diff --git a/.clang-format b/.clang-format index 915697a4a6bf5b2bb3bd74e0593e02915a31d450..60054387527c3cfa59e2dcfa13ebb2ae9a0b184a 100644 --- a/.clang-format +++ b/.clang-format @@ -50,7 +50,7 @@ BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon BreakAfterJavaFieldAnnotations: false BreakStringLiterals: true -ColumnLimit: 300 +ColumnLimit: 125 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false diff --git a/.clang-tidy b/.clang-tidy index e7d5a5e58c66b679eb607560b1c4073abb0f6d97..3ed9ebc5b5104aa82e28c90c1e6a1d3117b89d79 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -53,5 +53,5 @@ cppcoreguidelines-special-member-functions, -cppcoreguidelines-interfaces-global-init ' -HeaderFilterRegex: '\.h$' -... +HeaderFilterRegex: '.*/src/.*' +WarningsAsErrors: 'True' \ No newline at end of file diff --git a/.clangd b/.clangd new file mode 100644 index 0000000000000000000000000000000000000000..c6f7db4e4d1eb5d761fd66dab7ff582e640651dd --- /dev/null +++ b/.clangd @@ -0,0 +1,9 @@ +CompileFlags: + Add: + - -xc++ + - -std=c++17 + - --cuda-gpu-arch=sm_70 + - --cuda-path=/usr/local/cuda + - -L/usr/local/cuda/lib64 + - -I/usr/local/cuda/include + Remove: [-ccbin=*,-rdc=*,--generate-code*,--options-file,-forward*,--extended-lambda,-fopenmp] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e69b3794f5854cd6c9446b120eb6d64603f8d143..50c1263289d238837267f21e101afa190cb2f6ed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,24 @@ { "name": "virtual-fluids-environment", - "extensions": [ - "mhutchie.git-graph", - "donjayamanne.githistory", - "twxs.cmake", - "ms-vscode.cpptools", - "visualstudioexptteam.vscodeintellicode", - "xaver.clang-format", - "notskm.clang-tidy", - "streetsidesoftware.code-spell-checker" - ], + "customizations": { + "vscode": { + "extensions": [ + "mhutchie.git-graph", + "donjayamanne.githistory", + "ms-python.python", + "twxs.cmake", + //"ms-vscode.cpptools", + "usernamehw.errorlens", // show warnings in code + "streetsidesoftware.code-spell-checker", + "xaver.clang-format", + "msekoranja.clang-format-checker", // currently this extensions results in a lot of warnings + "llvm-vs-code-extensions.vscode-clangd" // code index based on clang using the compile_commannds.json + ] + } + }, "containerEnv": {"TZ": "${localEnv:TZ:Europe/Berlin}"}, "runArgs": ["--gpus","all", // remove this line in case you have no gpus available "--hostname=${localEnv:HOSTNAME}"], // HOSTNAME needs to be known by the vscode environment. It is probably necessary to add "export HOSTNAME=<hostname>" to the config file of your host machine's bash. - "image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.5" + "image": "git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.1" } diff --git a/.gitignore b/.gitignore index d3e29c184e8e90ec5899b7b7241bd9fb34385cc9..bb7d38f1349cff7e73d0a8881d1c9dbf3b90f757 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,10 @@ build/ bin/ cmake-build-debug/ run/ -buildGCC -buildWSL +buildGCC/ +buildWSL/ +buildCygwin/ +pybuild/ # Python _skbuild/ @@ -39,6 +41,9 @@ scripts/ # stl files stl/ +# test data for regression tests +test_data/ + # MacOS .DS_Store diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e12f8c5ae11456bc45fcf280a7601376805b25a9..3202c00addeaf7bf54e354e868175a06bfb94168 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ ############################################################################### ## VirtualFluids CI Pipeline ## ############################################################################### -image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.5 +image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.1 stages: - build @@ -13,6 +13,11 @@ stages: - deploy - release +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never # disable detached merge request pipelines + - when: always # add all jobs to normal pipeline. This can be overwritten by the rules of the jobs. ############################################################################### ## Builds ## @@ -51,7 +56,7 @@ stages: - cmake .. -LAH --preset=make_all -DBUILD_WARNINGS_AS_ERRORS=ON - -DCMAKE_CUDA_ARCHITECTURES=60 + -DCMAKE_CUDA_ARCHITECTURES=70 -DBUILD_VF_ALL_SAMPLES=ON - make -j4 - ccache --show-stats @@ -60,7 +65,7 @@ stages: BUILD_FOLDER: "build" ############################################################################### -gcc_9: +gcc_12: extends: .gnu_build_template before_script: @@ -68,7 +73,7 @@ gcc_9: - export CXX=g++ ############################################################################### -clang_10: +clang_15: extends: .gnu_build_template before_script: @@ -110,31 +115,27 @@ msvc_17: ############################################################################### -## Build Python ## -############################################################################### -gcc_9_python: - stage: build_python - - needs: ["gcc_9"] +gcc_12_python: + stage: build cache: - key: "gcc_9-$CI_COMMIT_REF_SLUG" + key: "gcc_12-$CI_COMMIT_REF_SLUG" paths: - - build + - pybuild/ artifacts: expire_in: 1 hrs paths: - - build/ - - dist/ - - _skbuild/ + - pybuild/ # build in separate folder to avoid conflicts with c++ build before_script: - export CCACHE_BASEDIR=$CI_PROJECT_DIR - export CCACHE_DIR=$CI_PROJECT_DIR/cache script: - - python3 setup.py bdist_wheel build_ext --build-temp=_skbuild -- -DBUILD_VF_CPU=ON -DBUILD_VF_DOUBLE_ACCURACY=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + - export SKBUILD_BUILD_DIR="pybuild" + - export SKBUILD_CMAKE_ARGS="-DBUILD_VF_CPU=ON;-DBUILD_VF_GPU=ON;-DCMAKE_CUDA_ARCHITECTURES=70;-DBUILD_VF_DOUBLE_ACCURACY=ON;-DCMAKE_CXX_COMPILER_LAUNCHER=ccache;-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache;-DCMAKE_C_COMPILER_LAUNCHER=ccache;-G=Ninja" + - pip install . -v ############################################################################### ## Container Upload ## @@ -149,8 +150,6 @@ build_poiseuille_test_container: rules: - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -169,10 +168,10 @@ build_poiseuille_test_container: ############################################################################### ## Tests ## ############################################################################### -gcc_9_unit_tests: +gcc_12_unit_tests: stage: test - needs: ["gcc_9"] + needs: ["gcc_12"] before_script: - cd $CI_PROJECT_DIR/build @@ -199,22 +198,19 @@ msvc_17_unit_tests: - ctest --output-on-failure -C Release ############################################################################### -gcc_9_python_bindings_test: +gcc_12_python_bindings_test: stage: test - needs: ["gcc_9_python"] + needs: ["gcc_12_python"] before_script: - - export PYTHONPATH="Python" - - export VF_WHEEL=$(find dist/*.whl) - - pip3 install $VF_WHEEL - pip3 install -r Python/requirements.txt script: - python3 -m unittest discover -s Python -v ############################################################################### -gcc_9_python_hpc_test: +gcc_12_python_hpc_test: image: python:latest stage: test @@ -223,8 +219,6 @@ gcc_9_python_hpc_test: rules: - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -253,8 +247,6 @@ build-regression-tests-ci: rules: - if: $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -276,12 +268,11 @@ trigger-regression-tests: regression_test_4gpu: image: python:latest stage: test + needs: [] rules: - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -290,7 +281,10 @@ regression_test_4gpu: - pip install "fieldcompare[all]" script: - - hpc-rocket launch --watch regression-tests/multigpu_test/rocket4GPU.yml + - hpc-rocket launch regression-tests/multigpu_test/rocket4GPU.yml |& tee hpcrocket4GPU.log + - hpc-rocket watch regression-tests/multigpu_test/rocket4GPU.yml $(python regression-tests/multigpu_test/utilities/parsejobid.py hpcrocket4GPU.log) + - hpc-rocket finalize regression-tests/multigpu_test/rocket4GPU.yml + - cat output/4GPU/slurm4GPU.out - git clone --depth 1 --filter=blob:none --sparse https://github.com/irmb/test_data - cd test_data - git sparse-checkout set regression_tests/gpu/DrivenCavity_4GPU_2Levels regression_tests/gpu/SphereScaling_4GPU_2Levels @@ -298,16 +292,23 @@ regression_test_4gpu: - fieldcompare dir output/4GPU test_data/regression_tests/gpu/DrivenCavity_4GPU_2Levels --include-files "DrivenCavityMultiGPU*.vtu" - fieldcompare dir output/4GPU test_data/regression_tests/gpu/SphereScaling_4GPU_2Levels --include-files "SphereScaling*.vtu" + after_script: + - hpc-rocket cancel regression-tests/multigpu_test/rocket4GPU.yml $(python regression-tests/multigpu_test/utilities/parsejobid.py hpcrocket4GPU.log) + + artifacts: + when: always + paths: + - output/4GPU/slurm4GPU.out + expire_in: 1 week ############################################################################### regression_test_8gpu: image: python:latest stage: test + needs: [] rules: - if: $REMOTE_USER && $REMOTE_HOST && $PRIVATE_KEY && $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -316,21 +317,32 @@ regression_test_8gpu: - pip install "fieldcompare[all]" script: - - hpc-rocket launch --watch regression-tests/multigpu_test/rocket8GPU.yml + - hpc-rocket launch regression-tests/multigpu_test/rocket8GPU.yml |& tee hpcrocket8GPU.log + - hpc-rocket watch regression-tests/multigpu_test/rocket8GPU.yml $(python regression-tests/multigpu_test/utilities/parsejobid.py hpcrocket8GPU.log) + - hpc-rocket finalize regression-tests/multigpu_test/rocket8GPU.yml + - cat output/8GPU/slurm8GPU.out - git clone --depth 1 --filter=blob:none --sparse https://github.com/irmb/test_data - cd test_data - git sparse-checkout set regression_tests/gpu/DrivenCavity_8GPU_2Levels regression_tests/gpu/SphereScaling_8GPU_2Levels - cd .. - fieldcompare dir output/8GPU test_data/regression_tests/gpu/DrivenCavity_8GPU_2Levels --include-files "DrivenCavityMultiGPU*.vtu" - fieldcompare dir output/8GPU test_data/regression_tests/gpu/SphereScaling_8GPU_2Levels --include-files "SphereScaling*.vtu" + + after_script: + - hpc-rocket cancel regression-tests/multigpu_test/rocket8GPU.yml $(python regression-tests/multigpu_test/utilities/parsejobid.py hpcrocket8GPU.log) + artifacts: + when: always + paths: + - output/8GPU/slurm8GPU.out + expire_in: 1 week ############################################################################### ## Benchmark ## ############################################################################### nvidia_test: stage: benchmark - image: nvidia/cuda:11.1.1-devel-ubuntu20.04 + image: nvidia/cuda:12.1.1-devel-ubuntu22.04 needs: [] @@ -349,8 +361,6 @@ gpu_numerical_tests: rules: - if: $CI_PIPELINE_SOURCE == "schedule" when: always - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - when: manual allow_failure: true @@ -386,20 +396,32 @@ gpu_numerical_tests: - $CI_PROJECT_DIR/cache artifacts: - expire_in: 1 hrs paths: - $CI_PROJECT_DIR/numerical_tests_gpu_results.txt ############################################################################### ## Code analysis ## ############################################################################### -clang_build_analyzer_clang_10: +.analyze_template: stage: analyze - only: ["schedules"] - needs: [] + tags: + - gpu + - linux + + rules: + - if: '$CI_PROJECT_NAMESPACE == "irmb" && $CI_COMMIT_BRANCH == "develop"' + when: always + - if: '$CI_PROJECT_NAMESPACE != "irmb"' + when: manual + allow_failure: true + + +clang_build_analyzer: + extends: .analyze_template + before_script: - export CC=clang - export CXX=clang++ @@ -424,22 +446,19 @@ clang_build_analyzer_clang_10: - ClangBuildAnalyzer --analyze CBA ############################################################################### -include_what_you_use_clang_10: - stage: analyze - - only: ["schedules"] - - needs: [] +include_what_you_use_clang_15: + extends: .analyze_template before_script: + - apt-get update && apt-get install -y libclang-15-dev llvm-15-dev - export CC=clang - export CXX=clang++ - $CXX --version - cd /tmp - git clone https://github.com/include-what-you-use/include-what-you-use.git - cd include-what-you-use - - git checkout clang_10 - - cmake . -DCMAKE_PREFIX_PATH=/usr/lib/llvm-10 + - git checkout clang_15 + - cmake . -DCMAKE_PREFIX_PATH=/usr/lib/llvm-15 - make - export PATH+=:$(pwd)/bin @@ -453,24 +472,13 @@ include_what_you_use_clang_10: - make ############################################################################### -.analyze_template: - - rules: # dont create MR pipeline, run always on irmb/develop and manual in all other cases - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never - - if: '$CI_PROJECT_NAMESPACE == "irmb" && $CI_COMMIT_BRANCH == "develop"' - when: always - - when: manual - allow_failure: true - cppcheck: - stage: analyze - extends: .analyze_template - needs: [] - before_script: + - apt-get update && apt-get install -y libpcre3-dev + - chmod +x utilities/install-cppcheck.sh + - ./utilities/install-cppcheck.sh - cppcheck --version script: @@ -486,17 +494,9 @@ cppcheck: # lizard - Cyclomatic Complexity Analyzer # Ignore warnings is manually set to 191. This job will fail when new warnings are added. lizard: - stage: analyze - extends: .analyze_template - needs: [] - before_script: - - cd /tmp - - git clone https://github.com/terryyin/lizard.git - - cd lizard - - python3 setup.py install - lizard --version script: @@ -510,25 +510,25 @@ lizard: ############################################################################### # code coverage -gcov_gcc_9: +gcov_gcc: stage: analyze extends: .analyze_template - needs: [] - before_script: - gcovr --version + - export CC=/usr/bin/gcc-11 + - export CXX=/usr/bin/g++-11 script: - mkdir -p $CI_PROJECT_DIR/build - cd $CI_PROJECT_DIR/build - cmake .. --preset=make_all - -DCMAKE_CUDA_ARCHITECTURES=60 - -DBUILD_VF_COVERAGE=ON + -DCMAKE_BUILD_TYPE=PROFILE + -DCMAKE_CUDA_ARCHITECTURES=70 - make -j4 - - ./bin/basicsTests + - ctest --output-on-failure - cd .. - mkdir coverage - gcovr -r $CI_PROJECT_DIR -k build -f "src" --print-summary --html coverage/coverage.html --html-details --xml coverage/coverage.xml @@ -551,16 +551,10 @@ gcov_gcc_9: ############################################################################### # this job also produces a compile commands json file. clang-tidy: - stage: analyze - extends: .analyze_template - needs: [] - - allow_failure: true - before_script: - - run-clang-tidy -h + - run-clang-tidy-15 -h script: - mkdir -p $CI_PROJECT_DIR/build @@ -570,7 +564,7 @@ clang-tidy: -DBUILD_VF_DOUBLE_ACCURACY=ON -DBUILD_VF_GPU=OFF - python3 ../utilities/filterCompileCommands.py compile_commands.json - - run-clang-tidy -quiet > clangtidy.txt + - run-clang-tidy-15 -quiet > clangtidy.txt artifacts: when: always @@ -580,6 +574,33 @@ clang-tidy: - build/compile_commands.json +############################################################################### +## Sanitizer ## +############################################################################### +sanitizer-address-leak-ub: + extends: .analyze_template + script: + - mkdir -p build && cd build + - cmake .. + --preset=make_all + -DCMAKE_CUDA_ARCHITECTURES=70 + -DENABLE_SANITIZER_ADDRESS=ON + -DENABLE_SANITIZER_LEAK=ON + -DENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON + - make -j8 + - ctest --output-on-failure + +sanitizer-memory: + extends: .analyze_template + script: + - mkdir -p build && cd build + - cmake .. + --preset=make_all + -DCMAKE_CUDA_ARCHITECTURES=70 + -DENABLE_SANITIZER_MEMORY=ON + - make -j8 + - ctest --output-on-failure + ############################################################################### # doxgen pages: @@ -628,7 +649,7 @@ pages: vf_to_phoenix: extends: .deploy_template stage: deploy - needs: ["gcc_9_python", "gcc_9_unit_tests", "gcc_9_python_bindings_test"] + needs: ["gcc_12_python", "gcc_12_unit_tests", "gcc_12_python_bindings_test"] when: manual @@ -652,7 +673,7 @@ vf_wheel_to_jupyterhub: only: ["manual"] - needs: ["gcc_9_python", "gcc_9_unit_tests", "gcc_9_python_bindings_test"] + needs: ["gcc_12_python", "gcc_12_unit_tests", "gcc_12_python_bindings_test"] variables: HOST: "gitlab-runner01.irmb.bau.tu-bs.de" @@ -665,8 +686,8 @@ vf_wheel_to_jupyterhub: ############################################################################### # sonar-scanner runs sonar-project.properties -# the reports in this file needs to match the artifacts. -# This job only run on the development branch of the parent repository, not on forks! +# the reports in this file need to match the artifacts. +# This job only runs on the development branch of the parent repository, not on forks! sonar-scanner: stage: deploy @@ -680,7 +701,7 @@ sonar-scanner: variables: SONAR_HOST_URL: "http://gitlab-runner01.irmb.bau.tu-bs.de/sonarqube/" - needs: ["cppcheck","clang-tidy","gcov_gcc_9"] + needs: ["cppcheck","clang-tidy","gcov_gcc"] before_script: - cd /tmp diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..10e3386392e89fab16bac43ffaeb281f522e334b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "c-cpp-flylint.flexelint.enable": false, + "c-cpp-flylint.flawfinder.enable": false, + "files.associations": { + "__mutex_base": "cpp", + "memory": "cpp", + "mutex": "cpp" + } +} \ No newline at end of file diff --git a/3rdParty/cuda_samples/helper_functions.h b/3rdParty/cuda_samples/helper_functions.h index 3fc2ea47ba7d39a4bf6a882f65b16779de6de0ac..058aee7aac750787307a385d7e27b30c381c0ced 100644 --- a/3rdParty/cuda_samples/helper_functions.h +++ b/3rdParty/cuda_samples/helper_functions.h @@ -48,7 +48,7 @@ #include <vector> // includes, timer, string parsing, image helpers -#include <helper_image.h> // helper functions for image compare, dump, data comparisons +// #include <helper_image.h> // helper functions for image compare, dump, data comparisons #include <helper_string.h> // helper functions for string parsing #include <helper_timer.h> // helper functions for timers diff --git a/CMake/Sanitizers.cmake b/CMake/Sanitizers.cmake index 6f16207fefbc2f9ca72f065950b242a4333d442e..ea37a66a1ed7d4416a5fbe54afc2390e168d848b 100644 --- a/CMake/Sanitizers.cmake +++ b/CMake/Sanitizers.cmake @@ -52,6 +52,7 @@ function(enable_sanitizers project_name) "${LIST_OF_SANITIZERS}" STREQUAL "") + message(STATUS "Enabling sanitizers: ${LIST_OF_SANITIZERS}") target_compile_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) target_link_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) endif() diff --git a/CMake/cmake_config_files/ARAGORN.config.cmake b/CMake/cmake_config_files/ARAGORN.config.cmake index 9f33c9977924ab60a1300763f53d04bb842b2f00..7643d267aabce7914000face6553fb38135b7a63 100644 --- a/CMake/cmake_config_files/ARAGORN.config.cmake +++ b/CMake/cmake_config_files/ARAGORN.config.cmake @@ -7,7 +7,7 @@ set(CMAKE_CUDA_ARCHITECTURES 86) # Nvidia GeForce RTX 3060 # add invidual apps here -set(GPU_APP "apps/gpu/LBM/") +set(GPU_APP "apps/gpu/") list(APPEND USER_APPS "${GPU_APP}DrivenCavityMultiGPU" "${GPU_APP}SphereScaling" diff --git a/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake index 3259e13acaade9b896e5e4a82dec90d3f4eb5e89..25224f9a8e6f25cad0b1d90c4d3035ebff3a75c4 100644 --- a/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake +++ b/CMake/cmake_config_files/ARAGORNUBUNTU.config.cmake @@ -9,7 +9,7 @@ set(CMAKE_CUDA_ARCHITECTURES 86) # Nvidia GeForce RTX 3060 set(PATH_NUMERICAL_TESTS "D:/out/numericalTests/") list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") -set(GPU_APP "apps/gpu/LBM/") +set(GPU_APP "apps/gpu/") list(APPEND USER_APPS "${GPU_APP}DrivenCavityMultiGPU" "${GPU_APP}SphereScaling" diff --git a/CMake/cmake_config_files/ELDARION.config.cmake b/CMake/cmake_config_files/ELDARION.config.cmake index 53dc97e213a7445e153157ec76937ea0fec1f678..13abc819e862f9275fa2cd77ee6bb1f2d31375bf 100644 --- a/CMake/cmake_config_files/ELDARION.config.cmake +++ b/CMake/cmake_config_files/ELDARION.config.cmake @@ -10,7 +10,7 @@ SET(CMAKE_CUDA_ARCHITECTURES 61) # GeForce 1080 Ti set(PATH_NUMERICAL_TESTS "~/output/numericalTests/") list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") -set(GPU_APP "apps/gpu/LBM/") +set(GPU_APP "apps/gpu/") list(APPEND USER_APPS # "${GPU_APP}DrivenCavityMultiGPU" # "${GPU_APP}SphereScaling" diff --git a/CMake/cmake_config_files/KI4ALLGPU.config.cmake b/CMake/cmake_config_files/KI4ALLGPU.config.cmake index 111a3b3881d7a07eada02fb1e826e88b64b3591e..7e55f21f5549d10b2f5e93daf51a2b0bcb7f8bc1 100644 --- a/CMake/cmake_config_files/KI4ALLGPU.config.cmake +++ b/CMake/cmake_config_files/KI4ALLGPU.config.cmake @@ -6,7 +6,7 @@ set(CMAKE_CUDA_ARCHITECTURES 80) # Nvidia Tesla A100 -set(GPU_APP "apps/gpu/LBM/") +set(GPU_APP "apps/gpu/") list(APPEND USER_APPS "${GPU_APP}ChannelFlow" "${GPU_APP}SphereScaling" diff --git a/CMake/cmake_config_files/MOLLOK.config.cmake b/CMake/cmake_config_files/MOLLOK.config.cmake index 72470da1bc52a242cb8e3c341e0e7f87bb06ab26..fac7be0cffc5ff09b8f0b46dbb21af7afb938a66 100644 --- a/CMake/cmake_config_files/MOLLOK.config.cmake +++ b/CMake/cmake_config_files/MOLLOK.config.cmake @@ -1,7 +1,7 @@ ################################################################################# # VirtualFluids MACHINE FILE # Responsible: Martin Schoenherr -# OS: Windows 10 +# OS: Windows 11 ################################################################################# # cuda compute capability @@ -12,5 +12,6 @@ set(PATH_NUMERICAL_TESTS "D:/out/numericalTests/") list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") # add invidual apps here -list(APPEND USER_APPS "apps/gpu/LBM/WTG_RUB") -list(APPEND USER_APPS "apps/gpu/LBM/TGV_3D_GridRef") +list(APPEND USER_APPS "apps/gpu/WTG_RUB") +list(APPEND USER_APPS "apps/gpu/TGV_3D_GridRef") +list(APPEND USER_APPS "apps/gpu/SphereRefined") diff --git a/CMake/cmake_config_files/MULE.config.cmake b/CMake/cmake_config_files/MULE.config.cmake index 2afbce6cc257fa0b8ff4dd7de580cb50c01369f1..abe277026891774030c9bb6338b94616f54f6f4c 100644 --- a/CMake/cmake_config_files/MULE.config.cmake +++ b/CMake/cmake_config_files/MULE.config.cmake @@ -1,4 +1,4 @@ SET(CMAKE_CUDA_ARCHITECTURES "75") -list(APPEND USER_APPS "apps/gpu/LBM/ActuatorLine") -list(APPEND USER_APPS "apps/gpu/LBM/SphereScaling") +list(APPEND USER_APPS "apps/gpu/ActuatorLine") +list(APPEND USER_APPS "apps/gpu/SphereScaling") diff --git a/CMake/cmake_config_files/PHOENIX.config.cmake b/CMake/cmake_config_files/PHOENIX.config.cmake index 2112bd6aa50e9335bc6b23bda0f0e9fda3ef7533..7d0e1d6b6ba2790a2ab24e20d4ab6199ee75d0cf 100644 --- a/CMake/cmake_config_files/PHOENIX.config.cmake +++ b/CMake/cmake_config_files/PHOENIX.config.cmake @@ -8,7 +8,7 @@ ## nvidia set(CMAKE_CUDA_ARCHITECTURES 60) # NVIDIA Tesla P100 -set(GPU_APP "apps/gpu/LBM/") +set(GPU_APP "apps/gpu/") list(APPEND USER_APPS # "${GPU_APP}DrivenCavityMultiGPU" # "${GPU_APP}SphereScaling" diff --git a/CMake/cmake_config_files/TESLA03.config.cmake b/CMake/cmake_config_files/TESLA03.config.cmake index e29c7306c5448b97eefed9d7a41871a5e4d3b589..dc0f1253c668dd6fba92c5d1ee33c387af67ee5a 100644 --- a/CMake/cmake_config_files/TESLA03.config.cmake +++ b/CMake/cmake_config_files/TESLA03.config.cmake @@ -12,4 +12,4 @@ SET(PATH_NUMERICAL_TESTS "E:/temp/numericalTests/") list(APPEND VF_COMPILER_DEFINITION "PATH_NUMERICAL_TESTS=${PATH_NUMERICAL_TESTS}") # add invidual apps here -list(APPEND USER_APPS "apps/gpu/LBM/MusselOyster") +list(APPEND USER_APPS "apps/gpu/MusselOyster") diff --git a/CMake/compilerflags/GNU.cmake b/CMake/compilerflags/GNU.cmake index 8d54b52a434719a1e99aa705b121593973f3375a..cf77b2228e1ac470f064db71c8f8e87f33902f04 100644 --- a/CMake/compilerflags/GNU.cmake +++ b/CMake/compilerflags/GNU.cmake @@ -17,10 +17,10 @@ if(NOT BUILD_VF_INCLUDE_WHAT_YOU_USE) # optimization flag '-funroll-all-loops' i endif() # gcov -if (BUILD_VF_COVERAGE) - list(APPEND CS_COMPILER_FLAGS_CXX "--coverage") - set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage") -endif() +# According to https://gcovr.com/en/stable/cookbook.html#out-of-source-builds-with-cmake +# This flags are used if cmake is called with -DCMAKE_BUILD_TYPE=PROFILE +set(CMAKE_C_FLAGS_PROFILE --coverage) +set(CMAKE_CXX_FLAGS_PROFILE --coverage) ############################################################################################################# # warnings diff --git a/CMakeLists.txt b/CMakeLists.txt index e7f62a5ba3308a7e382e1802a8cc42a1bb043b25..34edea623975db57b6b3a23b0a1b49721367d67b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,6 @@ option(BUILD_VF_UNIT_TESTS "Build VirtualFluids unit tests" OFF) option(BUILD_VF_CLANG_TIDY "Add the clang tidy checks to the targets" OFF) option(BUILD_VF_INCLUDE_WHAT_YOU_USE "Add IWYU to the targets" OFF) option(BUILD_VF_CPPCHECK "Add cppcheck to the targets" OFF) -option(BUILD_VF_COVERAGE "Add the -coverage compiler flag." OFF) option(BUILD_CUDA_LTO "Enables the cuda link optimization." OFF) @@ -92,9 +91,12 @@ include(${VF_CMAKE_DIR}/Cache.cmake) include(CMakePrintHelpers) include(${VF_CMAKE_DIR}/VirtualFluidsMacros.cmake) -IF( BUILD_VF_DOUBLE_ACCURACY ) +if(BUILD_VF_DOUBLE_ACCURACY) list(APPEND VF_COMPILER_DEFINITION VF_DOUBLE_ACCURACY) -ENDIF() + message(STATUS "Configure VirtualFluids with double precision") +else() + message(STATUS "Configure VirtualFluids with single precision") +endif() # set gpu features if(BUILD_VF_GPU) @@ -136,6 +138,11 @@ if(BUILD_VF_GPU) set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_CUDA_ARCHITECTURES}" CACHE STRING "Cuda Architecture (compute capabilitiy)") set(CMAKE_CUDA_FLAGS_DEBUG " -G" CACHE STRING "" FORCE) + + # we disable the usage of cuda response files here + # usually CUDA_INCLUDES.rsp is genereated by cmake containing all include paths and is passed in compile_commands.json via the --options-file flag + # this .rsp file can not be parsed by clangd and therefore we disable it + set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0) endif() @@ -203,7 +210,7 @@ ENDIF() add_subdirectory(src/logger) add_subdirectory(src/basics) -add_subdirectory(src/mpi) +add_subdirectory(src/parallel) add_subdirectory(src/lbm) @@ -214,7 +221,7 @@ if (BUILD_VF_CPU) include(cpu.cmake) endif() if(BUILD_VF_GPU) - add_subdirectory(src/cuda) + add_subdirectory(src/gpu/cuda_helper) include(gpu.cmake) endif() diff --git a/Containers/Ubuntu22_04.Dockerfile b/Containers/Ubuntu22_04.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8eb107bc5d9ac43c1bcda5b1f638d9f49bcc2c91 --- /dev/null +++ b/Containers/Ubuntu22_04.Dockerfile @@ -0,0 +1,49 @@ +# VirtualFluids Development Image: +# Ubuntu 22.04 + +FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 + +# timezone +ARG TZ +ENV TZ="$TZ" + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install -y \ + git wget unzip software-properties-common \ + build-essential g++-12 gcc-12 gdb \ + ccache \ + ninja-build \ + openmpi-bin \ + libopenmpi-dev \ + libomp-15-dev \ + clang-15 \ + clang-format-15 \ + clang-tidy-15 \ + clang-tools-15 \ + python3.11 \ + python3-pip \ + python3.11-dev \ + cppcheck \ + && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \ + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \ + && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100 \ + && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100 \ + && ln -s clang-tidy-15 /usr/bin/clang-tidy \ + && ln -s clang-format-15 /usr/bin/clang-format \ + && wget https://github.com/clangd/clangd/releases/download/16.0.2/clangd-linux-16.0.2.zip && unzip clangd-linux-16.0.2.zip \ + && mv clangd_16.0.2/bin/clangd /usr/bin/clangd-16 && mv clangd_16.0.2/lib/clang/16 /usr/lib/clang/ \ + && update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-16 100 \ + && pip3 install \ + cmake==3.26.3 \ + setuptools \ + wheel \ + scikit-build \ + pyvista \ + numpy \ + ansible \ + 'jinja2<3.1' \ + gcovr==6.0 \ + lizard==1.17.10 + diff --git a/Containers/Ubuntu22_04_wiFI.Dockerfile b/Containers/Ubuntu22_04_wiFI.Dockerfile new file mode 100755 index 0000000000000000000000000000000000000000..105fe9dce0116eb4ad459982a008ba36ed620839 --- /dev/null +++ b/Containers/Ubuntu22_04_wiFI.Dockerfile @@ -0,0 +1,14 @@ +# VirtualFluids Development Image: +# Ubuntu 22.04 + +FROM git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.1 as build + +# For wiFI https://source.coderefinery.org/Hkorb/wifi.git +RUN pip3 install \ + pandas \ + cupy-cuda12x \ + mpi4py \ + && git clone --recurse-submodules https://source.coderefinery.org/Hkorb/wifi.git \ + && cd wifi \ + && git checkout develop \ + && pip3 install -e . >> log_wifi_install.txt diff --git a/MANIFEST.in b/MANIFEST.in index adafcf99560acd9da79aa060194df8263b6e77e0..196bdc09019d6028792a565d0776e2c267d3c15a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -include pythonbindings/*/bindings* \ No newline at end of file +include pythonbindings/*/*.cpython* \ No newline at end of file diff --git a/Python/SlurmTests/poiseuille/result_collector.py b/Python/SlurmTests/poiseuille/result_collector.py index 06efa481c8c010647531426f2af2bec2c2d7eaee..ed374b7d6dc8a32c46716c4648fc8ba35cbb9b4c 100644 --- a/Python/SlurmTests/poiseuille/result_collector.py +++ b/Python/SlurmTests/poiseuille/result_collector.py @@ -1,73 +1,73 @@ -from typing import Collection, List +# from typing import Collection, List -import pyvista as pv -from poiseuille.analytical import PoiseuilleSettings, poiseuille_at_heights -from vtk_utilities import vertical_column_from_mesh, get_values_from_indices -from SlurmTests.poiseuille.settings import Scaling +# import pyvista as pv +# from poiseuille.analytical import PoiseuilleSettings, poiseuille_at_heights +# from vtk_utilities import vertical_column_from_mesh, get_values_from_indices +# from SlurmTests.poiseuille.settings import Scaling -def get_output_file_name(output_folder, runtime_params): - timesteps = runtime_params.number_of_timesteps - file_name = f"{output_folder}/mq/mq{timesteps}/mq0_{timesteps}.bin.vtu" +# def get_output_file_name(output_folder, runtime_params): +# timesteps = runtime_params.number_of_timesteps +# file_name = f"{output_folder}/mq/mq{timesteps}/mq0_{timesteps}.bin.vtu" - return file_name +# return file_name -def get_mesh_for_last_timestep(output_folder, runtime_params): - file_name_of_last_timestep = get_output_file_name(output_folder, runtime_params) - mesh_of_last_timestep = pv.read(file_name_of_last_timestep) - return mesh_of_last_timestep +# def get_mesh_for_last_timestep(output_folder, runtime_params): +# file_name_of_last_timestep = get_output_file_name(output_folder, runtime_params) +# mesh_of_last_timestep = pv.read(file_name_of_last_timestep) +# return mesh_of_last_timestep -def get_heights_from_indices(mesh, indices): - return [mesh.points[index][2] for index in indices] +# def get_heights_from_indices(mesh, indices): +# return [mesh.points[index][2] for index in indices] -def get_heights(output_folder, runtime_params): - mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) - column_indices = vertical_column_from_mesh(mesh_of_last_timestep) - heights = get_heights_from_indices(mesh_of_last_timestep, column_indices) - return heights +# def get_heights(output_folder, runtime_params): +# mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) +# column_indices = vertical_column_from_mesh(mesh_of_last_timestep) +# heights = get_heights_from_indices(mesh_of_last_timestep, column_indices) +# return heights -def get_numerical_results(runtime_params, output_folder): - mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) - velocities_in_x_direction = mesh_of_last_timestep.get_array("Vx") - column_indices = vertical_column_from_mesh(mesh_of_last_timestep) - numerical_results = get_values_from_indices(velocities_in_x_direction, column_indices) +# def get_numerical_results(runtime_params, output_folder): +# mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) +# velocities_in_x_direction = mesh_of_last_timestep.get_array("Vx") +# column_indices = vertical_column_from_mesh(mesh_of_last_timestep) +# numerical_results = get_values_from_indices(velocities_in_x_direction, column_indices) - return numerical_results +# return numerical_results -def get_analytical_results(grid_params, physical_params, kernel, height_values): - channel_height = grid_params.number_of_nodes_per_direction[2] - settings = get_analytical_poiseuille_settings(channel_height, physical_params, kernel) - max_grid_height = channel_height * grid_params.node_distance - adjusted_height_values = [value / max_grid_height * channel_height for value in height_values] - analytical_results = poiseuille_at_heights(settings, adjusted_height_values) - return analytical_results +# def get_analytical_results(grid_params, physical_params, kernel, height_values): +# channel_height = grid_params.number_of_nodes_per_direction[2] +# settings = get_analytical_poiseuille_settings(channel_height, physical_params, kernel) +# max_grid_height = channel_height * grid_params.node_distance +# adjusted_height_values = [value / max_grid_height * channel_height for value in height_values] +# analytical_results = poiseuille_at_heights(settings, adjusted_height_values) +# return analytical_results -def get_analytical_poiseuille_settings(height, physical_params, kernel): - settings = PoiseuilleSettings() - settings.height = height - settings.viscosity = physical_params.lattice_viscosity - settings.density = 1 - settings.force = kernel.forcing_in_x1 +# def get_analytical_poiseuille_settings(height, physical_params, kernel): +# settings = PoiseuilleSettings() +# settings.height = height +# settings.viscosity = physical_params.lattice_viscosity +# settings.density = 1 +# settings.force = kernel.forcing_in_x1 - return settings +# return settings -def collect_results() -> (List[List[float]], List[List[float]]): - analytical_results = [] - numerical_results = [] +# def collect_results() -> (List[List[float]], List[List[float]]): +# analytical_results = [] +# numerical_results = [] - for simulation_run in range(0, 3): - output_folder = f"output-{simulation_run}" - grid_params, physical_params, runtime_params, kernel = Scaling.configuration_for_scale_level(simulation_run) - heights = get_heights(output_folder, runtime_params) - analytical_results.append( - get_analytical_results(grid_params, physical_params, kernel, heights)) - numerical_results.append(get_numerical_results(runtime_params, output_folder)) +# for simulation_run in range(0, 3): +# output_folder = f"output-{simulation_run}" +# grid_params, physical_params, runtime_params, kernel = Scaling.configuration_for_scale_level(simulation_run) +# heights = get_heights(output_folder, runtime_params) +# analytical_results.append( +# get_analytical_results(grid_params, physical_params, kernel, heights)) +# numerical_results.append(get_numerical_results(runtime_params, output_folder)) - return analytical_results, numerical_results +# return analytical_results, numerical_results diff --git a/Python/actuator_line/actuator_line.py b/Python/actuator_line/actuator_line.py index d0589f402456e8ffe8320ce7f780738aef22fbe4..00fa21baeae9d075f4ebeb49baa9d13394ae4b94 100644 --- a/Python/actuator_line/actuator_line.py +++ b/Python/actuator_line/actuator_line.py @@ -36,7 +36,7 @@ r""" import numpy as np from pathlib import Path from mpi4py import MPI -from pyfluids.bindings import basics, gpu, logger +from pyfluids import basics, gpu, logger, communicator #%% sim_name = "ABL" config_file = Path(__file__).parent/"configActuatorLine.txt" @@ -47,15 +47,13 @@ output_path.mkdir(exist_ok=True) #%% logger.Logger.initialize_logger() -#%% -grid_factory = gpu.grid_generator.GridFactory.make() -grid_builder = gpu.grid_generator.MultipleGridBuilder.make_shared(grid_factory) -communicator = gpu.Communicator.get_instance() +grid_builder = gpu.grid_generator.MultipleGridBuilder() +communicator = communicator.Communicator.get_instance() config = basics.ConfigurationFile() config.load(str(config_file)) -para = gpu.Parameter(communicator.get_number_of_process(), communicator.get_pid(), config) +para = gpu.Parameter(communicator.get_number_of_processes(), communicator.get_number_of_processes(), config) bc_factory = gpu.BoundaryConditionFactory() #%% @@ -104,8 +102,8 @@ length = np.array([6,4,1])*boundary_layer_height dx = boundary_layer_height/nodes_per_height dt = dx * mach / (np.sqrt(3) * velocity) velocity_ratio = dx/dt -velocity_LB = velocity / velocity_ratio # LB units -viscosity_LB = viscosity / (velocity_ratio * dx) # LB units +velocity_LB = velocity / velocity_ratio # LB units +viscosity_LB = viscosity / (velocity_ratio * dx) # LB units pressure_gradient = u_star * u_star / boundary_layer_height pressure_gradient_LB = pressure_gradient * (dt*dt)/dx @@ -142,7 +140,7 @@ tm_factory.read_config_file(config) grid_scaling_factory = gpu.GridScalingFactory() grid_scaling_factory.set_scaling_factory(gpu.GridScaling.ScaleCompressible) -grid_builder.add_coarse_grid(0.0, 0.0, 0.0, *length, dx) +grid_builder.add_coarse_grid(0.0, 0.0, 0.0, length[0], length[1], length[2], dx) grid_builder.set_periodic_boundary_condition(not read_precursor, True, False) grid_builder.build_grids(False) @@ -162,7 +160,7 @@ bc_factory.set_slip_boundary_condition(gpu.SlipBC.SlipBounceBack) bc_factory.set_pressure_boundary_condition(gpu.PressureBC.OutflowNonReflective) if read_precursor: bc_factory.set_precursor_boundary_condition(gpu.PrecursorBC.DistributionsPrecursor if use_distributions else gpu.PrecursorBC.VelocityPrecursor) -para.set_outflow_pressure_correction_factor(0.0); +para.set_outflow_pressure_correction_factor(0.0) #%% # don't use python init functions, they are very slow! Just kept as an example. # Define lambda in bindings and set it here. @@ -176,7 +174,7 @@ para.set_outflow_pressure_correction_factor(0.0); para.set_initial_condition_perturbed_log_law(u_star, z0, length[0], length[2], boundary_layer_height, velocity_ratio) #%% -turb_pos = np.array([3,3,3])*turbine_diameter +turb_pos = np.array([3, 3, 3])*turbine_diameter epsilon = 1.5*dx density = 1.225 level = 0 @@ -185,7 +183,7 @@ n_blade_nodes = 32 omega = 1 blade_radii = np.arange(n_blade_nodes, dtype=np.float32)/(0.5*turbine_diameter) alm = gpu.ActuatorFarm(n_blades, density, n_blade_nodes, epsilon, level, dt, dx, True) -alm.add_turbine(turb_pos[0],turb_pos[1],turb_pos[2], turbine_diameter, omega, 0, 0, blade_radii) +alm.add_turbine(turb_pos[0], turb_pos[1], turb_pos[2], turbine_diameter, omega, 0, 0, blade_radii) para.add_actuator(alm) #%% planar_average_probe = gpu.probes.PlanarAverageProbe("horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z') diff --git a/Python/boundary_layer/boundary_layer.py b/Python/boundary_layer/boundary_layer.py index 25b3cd895f8a3a80f9fd6438e00d3e924fc13779..d2efffeaca521f23f07fe24a0ad9edfeab675488 100644 --- a/Python/boundary_layer/boundary_layer.py +++ b/Python/boundary_layer/boundary_layer.py @@ -36,7 +36,7 @@ r""" import numpy as np from pathlib import Path from mpi4py import MPI -from pyfluids import basics, gpu, logger +from pyfluids import basics, gpu, logger, communicator #%% sim_name = "ABL" config_file = Path(__file__).parent/"configBoundaryLayer.txt" @@ -48,14 +48,13 @@ output_path.mkdir(exist_ok=True) logger.Logger.initialize_logger() #%% -grid_factory = gpu.grid_generator.GridFactory.make() -grid_builder = gpu.grid_generator.MultipleGridBuilder.make_shared(grid_factory) -communicator = gpu.Communicator.get_instance() +grid_builder = gpu.grid_generator.MultipleGridBuilder() +communicator = communicator.Communicator.get_instance() config = basics.ConfigurationFile() config.load(str(config_file)) -para = gpu.Parameter(communicator.get_number_of_process(), communicator.get_pid(), config) +para = gpu.Parameter(communicator.get_number_of_processes(), communicator.get_process_id(), config) bc_factory = gpu.BoundaryConditionFactory() #%% @@ -116,7 +115,7 @@ logger.vf_log_info(f"viscosity [10^8 dx^2/dt] = {viscosity_LB*1e8}") logger.vf_log_info(f"u* /(dx/dt) = {u_star*dt/dx}") logger.vf_log_info(f"dpdx = {pressure_gradient}") logger.vf_log_info(f"dpdx /(dx/dt^2) = {pressure_gradient_LB}") - + #%% #%% @@ -136,6 +135,8 @@ para.set_timestep_start_out(int(t_start_out/dt)) para.set_timestep_out(int(t_out/dt)) para.set_timestep_end(int(t_end/dt)) para.set_is_body_force(config.get_bool_value("bodyForce")) +para.set_devices(np.arange(10)) +para.set_max_dev(communicator.get_number_of_process()) #%% tm_factory = gpu.TurbulenceModelFactory(para) tm_factory.read_config_file(config) @@ -161,13 +162,7 @@ bc_factory.set_pressure_boundary_condition(gpu.PressureBC.OutflowNonReflective) bc_factory.set_precursor_boundary_condition(gpu.PrecursorBC.DistributionsPrecursor if use_distributions else gpu.PrecursorBC.VelocityPrecursor) para.set_outflow_pressure_correction_factor(0.0); #%% -def init_func(coord_x, coord_y, coord_z): - return [ - 0.0, - (u_star/0.4 * np.log(np.maximum(coord_z,z0)/z0) + 2.0*np.sin(np.pi*16*coord_x/length[0])*np.sin(np.pi*8*coord_z/boundary_layer_height)/(np.square(coord_z/boundary_layer_height)+1)) * dt / dx, - 2.0*np.sin(np.pi*16.*coord_x/length[0])*np.sin(np.pi*8.*coord_z/boundary_layer_height)/(np.square(coord_z/boundary_layer_height)+1.) * dt / dx, - 8.0*u_star/0.4*(np.sin(np.pi*8.0*coord_y/boundary_layer_height)*np.sin(np.pi*8.0*coord_z/boundary_layer_height)+np.sin(np.pi*8.0*coord_x/length[0]))/(np.square(length[2]/2.0-coord_z)+1.) * dt / dx] -para.set_initial_condition(init_func) +para.set_initial_condition_perturbed_log_law(u_star, z0, length[0], length[2], boundary_layer_height, dx/dx) #%% planar_average_probe = gpu.probes.PlanarAverageProbe("horizontalPlanes", para.get_output_path(), 0, int(t_start_tmp_averaging/dt), int(t_averaging/dt) , int(t_start_out_probe/dt), int(t_out_probe/dt), 'z') diff --git a/Python/poiseuille/test_poiseuille_l2.py b/Python/poiseuille/test_poiseuille_l2.py index 818cba40e115945c60e4fa2ac96b3b6b5ab0bba8..f863991364974ffd9a02e9ebb212c83e1182be42 100644 --- a/Python/poiseuille/test_poiseuille_l2.py +++ b/Python/poiseuille/test_poiseuille_l2.py @@ -32,153 +32,154 @@ r""" ! \author Sven Marcus, Henry Korb ======================================================================================= """ -import os -import shutil -import unittest -import matplotlib.pyplot as plt -import numpy as np -import pyvista as pv -from pyfluids import cpu -from scipy import stats +# import os +# import shutil +# import unittest -from errors import normalized_l2_error -from poiseuille.analytical import poiseuille_at_heights, PoiseuilleSettings -from poiseuille.simulation import run_simulation -from vtk_utilities import vertical_column_from_mesh, get_values_from_indices +# import matplotlib.pyplot as plt +# import numpy as np +# import pyvista as pv +# from pyfluids import cpu +# from scipy import stats +# from errors import normalized_l2_error +# from poiseuille.analytical import poiseuille_at_heights, PoiseuilleSettings +# from poiseuille.simulation import run_simulation +# from vtk_utilities import vertical_column_from_mesh, get_values_from_indices -class TestPoiseuilleFlow(unittest.TestCase): - node_distances = [1, 0.5, 0.25] - number_of_nodes = [16, 32, 64] - number_of_timesteps = [2_500_000, 5_000_000, 10_000_000] - forcings = [1e-9, 5e-10, 2.5e-10] - viscosities = [1e-3, 2e-3, 4e-3] - def zipped_settings(self): - return zip(self.node_distances, - self.number_of_nodes, - self.number_of_timesteps, - self.forcings, - self.viscosities) +# class TestPoiseuilleFlow(unittest.TestCase): +# node_distances = [1, 0.5, 0.25] +# number_of_nodes = [16, 32, 64] +# number_of_timesteps = [2_500_000, 5_000_000, 10_000_000] +# forcings = [1e-9, 5e-10, 2.5e-10] +# viscosities = [1e-3, 2e-3, 4e-3] - def test_poiseuille_flow(self): - self.skipTest("This test is not implemented correctly yet") - plt.ion() +# def zipped_settings(self): +# return zip(self.node_distances, +# self.number_of_nodes, +# self.number_of_timesteps, +# self.forcings, +# self.viscosities) - physical_params = cpu.parameters.PhysicalParameters() +# def test_poiseuille_flow(self): +# self.skipTest("This test is not implemented correctly yet") +# plt.ion() - runtime_params = cpu.parameters.RuntimeParameters() - runtime_params.number_of_threads = os.cpu_count() - runtime_params.timestep_log_interval = 10000 +# physical_params = cpu.parameters.PhysicalParameters() - kernel = cpu.kernel.LBMKernel(cpu.kernel.KernelType.CompressibleCumulantFourthOrderViscosity) - kernel.use_forcing = True +# runtime_params = cpu.parameters.RuntimeParameters() +# runtime_params.number_of_threads = os.cpu_count() +# runtime_params.timestep_log_interval = 10000 - normalized_l2_errors = [] - for delta_x, nodes, timesteps, forcing, viscosity in self.zipped_settings(): - physical_params.lattice_viscosity = viscosity - runtime_params.number_of_timesteps = timesteps - kernel.forcing_in_x1 = forcing +# kernel = cpu.kernel.LBMKernel(cpu.kernel.KernelType.CompressibleCumulantFourthOrderViscosity) +# kernel.use_forcing = True - grid_params = create_grid_params_with_nodes_in_column(nodes, delta_x) - l2_error = get_l2_error_for_simulation(grid_params, physical_params, runtime_params, kernel) - normalized_l2_errors.append(l2_error) +# normalized_l2_errors = [] +# for delta_x, nodes, timesteps, forcing, viscosity in self.zipped_settings(): +# physical_params.lattice_viscosity = viscosity +# runtime_params.number_of_timesteps = timesteps +# kernel.forcing_in_x1 = forcing - nodes_as_log = [np.log10(node) for node in self.number_of_nodes] - l2_norms_as_log = [np.log10(l2) for l2 in normalized_l2_errors] - res = stats.linregress(nodes_as_log, l2_norms_as_log) +# grid_params = create_grid_params_with_nodes_in_column(nodes, delta_x) +# l2_error = get_l2_error_for_simulation(grid_params, physical_params, runtime_params, kernel) +# normalized_l2_errors.append(l2_error) - plt.xscale("log") - plt.yscale("log") - plt.plot(self.number_of_nodes, [np.power(10, res.intercept + res.slope * node) for node in nodes_as_log], 'r-') - plt.plot(self.number_of_nodes, normalized_l2_errors, "x:") - plt.show() +# nodes_as_log = [np.log10(node) for node in self.number_of_nodes] +# l2_norms_as_log = [np.log10(l2) for l2 in normalized_l2_errors] +# res = stats.linregress(nodes_as_log, l2_norms_as_log) - print(normalized_l2_errors) - self.assertAlmostEqual(res.slope, -2, places=2) +# plt.xscale("log") +# plt.yscale("log") +# plt.plot(self.number_of_nodes, [np.power(10, res.intercept + res.slope * node) for node in nodes_as_log], 'r-') +# plt.plot(self.number_of_nodes, normalized_l2_errors, "x:") +# plt.show() +# print(normalized_l2_errors) +# self.assertAlmostEqual(res.slope, -2, places=2) -def get_l2_error_for_simulation(grid_params, physical_params, runtime_params, kernel): - output_folder = "./output" - run_simulation_with_settings(grid_params, physical_params, runtime_params, kernel, output_folder) - heights = get_heights(output_folder, runtime_params) - numerical_results = get_numerical_results(runtime_params, output_folder) - analytical_results = get_analytical_results(grid_params, physical_params, kernel, heights) +# def get_l2_error_for_simulation(grid_params, physical_params, runtime_params, kernel): +# output_folder = "./output" +# run_simulation_with_settings(grid_params, physical_params, runtime_params, kernel, output_folder) +# heights = get_heights(output_folder, runtime_params) - plt.plot(heights, numerical_results) - plt.plot(heights, analytical_results) - plt.legend(["numerical", "analytical"]) - plt.show() +# numerical_results = get_numerical_results(runtime_params, output_folder) +# analytical_results = get_analytical_results(grid_params, physical_params, kernel, heights) - return normalized_l2_error(analytical_results, numerical_results) +# plt.plot(heights, numerical_results) +# plt.plot(heights, analytical_results) +# plt.legend(["numerical", "analytical"]) +# plt.show() +# return normalized_l2_error(analytical_results, numerical_results) -def run_simulation_with_settings(grid_params, physical_params, runtime_params, kernel, output_folder): - shutil.rmtree(output_folder, ignore_errors=True) - run_simulation(physical_params, grid_params, runtime_params, kernel) +# def run_simulation_with_settings(grid_params, physical_params, runtime_params, kernel, output_folder): +# shutil.rmtree(output_folder, ignore_errors=True) +# run_simulation(physical_params, grid_params, runtime_params, kernel) -def get_heights(output_folder, runtime_params): - mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) - column_indices = vertical_column_from_mesh(mesh_of_last_timestep) - heights = get_heights_from_indices(mesh_of_last_timestep, column_indices) - return heights +# def get_heights(output_folder, runtime_params): +# mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) +# column_indices = vertical_column_from_mesh(mesh_of_last_timestep) +# heights = get_heights_from_indices(mesh_of_last_timestep, column_indices) +# return heights -def get_numerical_results(runtime_params, output_folder): - mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) - velocities_in_x_direction = mesh_of_last_timestep.get_array("Vx") - column_indices = vertical_column_from_mesh(mesh_of_last_timestep) - numerical_results = get_values_from_indices(velocities_in_x_direction, column_indices) - return numerical_results +# def get_numerical_results(runtime_params, output_folder): +# mesh_of_last_timestep = get_mesh_for_last_timestep(output_folder, runtime_params) +# velocities_in_x_direction = mesh_of_last_timestep.get_array("Vx") +# column_indices = vertical_column_from_mesh(mesh_of_last_timestep) +# numerical_results = get_values_from_indices(velocities_in_x_direction, column_indices) +# return numerical_results -def get_analytical_results(grid_params, physical_params, kernel, height_values): - channel_height = grid_params.number_of_nodes_per_direction[2] - settings = get_analytical_poiseuille_settings(channel_height, physical_params, kernel) - max_grid_height = channel_height * grid_params.node_distance - adjusted_height_values = [value / max_grid_height * channel_height for value in height_values] - analytical_results = poiseuille_at_heights(settings, adjusted_height_values) - return analytical_results +# def get_analytical_results(grid_params, physical_params, kernel, height_values): +# channel_height = grid_params.number_of_nodes_per_direction[2] +# settings = get_analytical_poiseuille_settings(channel_height, physical_params, kernel) +# max_grid_height = channel_height * grid_params.node_distance +# adjusted_height_values = [value / max_grid_height * channel_height for value in height_values] +# analytical_results = poiseuille_at_heights(settings, adjusted_height_values) +# return analytical_results -def get_mesh_for_last_timestep(output_folder, runtime_params): - file_name_of_last_timestep = get_output_file_name(output_folder, runtime_params) - mesh_of_last_timestep = pv.read(file_name_of_last_timestep) - return mesh_of_last_timestep +# def get_mesh_for_last_timestep(output_folder, runtime_params): +# file_name_of_last_timestep = get_output_file_name(output_folder, runtime_params) +# mesh_of_last_timestep = pv.read(file_name_of_last_timestep) +# return mesh_of_last_timestep -def get_analytical_poiseuille_settings(height, physical_params, kernel): - settings = PoiseuilleSettings() - settings.height = height - settings.viscosity = physical_params.lattice_viscosity - settings.density = 1 - settings.force = kernel.forcing_in_x1 - return settings +# def get_analytical_poiseuille_settings(height, physical_params, kernel): +# settings = PoiseuilleSettings() +# settings.height = height +# settings.viscosity = physical_params.lattice_viscosity +# settings.density = 1 +# settings.force = kernel.forcing_in_x1 +# return settings -def get_output_file_name(output_folder, runtime_params): - timesteps = runtime_params.number_of_timesteps - file_name = f"{output_folder}/mq/mq{timesteps}/mq0_{timesteps}.bin.vtu" - return file_name +# def get_output_file_name(output_folder, runtime_params): +# timesteps = runtime_params.number_of_timesteps +# file_name = f"{output_folder}/mq/mq{timesteps}/mq0_{timesteps}.bin.vtu" +# return file_name -def get_heights_from_indices(mesh, indices): - return [mesh.points[index][2] for index in indices] +# def get_heights_from_indices(mesh, indices): +# return [mesh.points[index][2] for index in indices] -def create_grid_params_with_nodes_in_column(nodes_in_column, delta_x): - grid_params = cpu.parameters.GridParameters() - grid_params.node_distance = delta_x - grid_params.number_of_nodes_per_direction = [1, 1, nodes_in_column] - grid_params.blocks_per_direction = [1, 1, 8] - grid_params.periodic_boundary_in_x1 = True - grid_params.periodic_boundary_in_x2 = True - grid_params.periodic_boundary_in_x3 = False - return grid_params +# def create_grid_params_with_nodes_in_column(nodes_in_column, delta_x): +# grid_params = cpu.parameters.GridParameters() +# grid_params.node_distance = delta_x +# grid_params.number_of_nodes_per_direction = [1, 1, nodes_in_column] +# grid_params.blocks_per_direction = [1, 1, 8] +# grid_params.periodic_boundary_in_x1 = True +# grid_params.periodic_boundary_in_x2 = True +# grid_params.periodic_boundary_in_x3 = False + +# return grid_params diff --git a/Python/requirements.txt b/Python/requirements.txt index 8628634d1b85ebc0b07328d563d479f35641be97..355bb47d748f0b593ed07da186d956d4a5cf48a1 100644 --- a/Python/requirements.txt +++ b/Python/requirements.txt @@ -4,20 +4,19 @@ cycler==0.10.0 imageio==2.9.0 iniconfig==1.1.1 kiwisolver==1.3.1 -matplotlib==3.3.3 +matplotlib==3.7.1 meshio==4.3.8 -numpy==1.19.5 +numpy==1.24.0 packaging==20.8 -Pillow==8.1.0 +Pillow==9.5.0 pluggy==0.13.1 py==1.10.0 pyparsing==2.4.7 pytest==6.2.1 python-dateutil==2.8.1 -pyvista==0.28.1 -scipy==1.6.1 +pyvista==0.39.1 +scipy==1.10 scooby==0.5.6 six==1.15.0 toml==0.10.2 -transforms3d==0.3.1 -vtk==9.0.1 +transforms3d==0.4.1 diff --git a/apps/cpu/AcousticPulse/ap.cpp b/apps/cpu/AcousticPulse/ap.cpp index 77ddfbf626e25b8c5d17d438255e37b4977dbddd..a04952a35cdb9ba5b55b4ed4dc9fb6225e26f5b7 100644 --- a/apps/cpu/AcousticPulse/ap.cpp +++ b/apps/cpu/AcousticPulse/ap.cpp @@ -10,7 +10,7 @@ void run() { try { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int numOfThreads = 4; @@ -179,9 +179,9 @@ void run() } //set connectors - //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); + //SPtr<Interpolator> iProcessor(new CompressibleOffsetInterpolator()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + //dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); diff --git a/apps/cpu/Applications.cmake b/apps/cpu/Applications.cmake index f0ccf3a5796013f92fd85bd7fd77890ad899e1b5..399ea713523aade56ebf3bff38cf4be31320d59c 100644 --- a/apps/cpu/Applications.cmake +++ b/apps/cpu/Applications.cmake @@ -8,7 +8,6 @@ add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex) IF(${VFCPU_ENABLE_LiggghtsCoupling}) add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp) add_subdirectory(${APPS_ROOT_CPU}/FallingSphere) - add_subdirectory(${APPS_ROOT_CPU}/Nozzle) ENDIF() IF(${VFCPU_ENABLE_NonNewtonianFluids}) @@ -23,8 +22,15 @@ IF(${VFCPU_ENABLE_MultiphaseFlow}) add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest) add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D) add_subdirectory(${APPS_ROOT_CPU}/JetBreakup) + add_subdirectory(${APPS_ROOT_CPU}/ShotcreteJet) + add_subdirectory(${APPS_ROOT_CPU}/ConcreteExtrusion) + add_subdirectory(${APPS_ROOT_CPU}/MultiphaseSymmetryTest) ENDIF() +IF(${VFCPU_ENABLE_LiggghtsCoupling} AND ${VFCPU_ENABLE_MultiphaseFlow}) + add_subdirectory(${APPS_ROOT_CPU}/Nozzle) + add_subdirectory(${APPS_ROOT_CPU}/NozzleMultiphase) +ENDIF() #add_subdirectory(tests) #add_subdirectory(Applications/gridRf) diff --git a/apps/cpu/BeadPack/beadpack.cpp b/apps/cpu/BeadPack/beadpack.cpp index d683fc445359e6e2d19a7d6f72c59158d6bf7f98..3da3030bb618812bc4e37db49683b9b6ce22fd84 100644 --- a/apps/cpu/BeadPack/beadpack.cpp +++ b/apps/cpu/BeadPack/beadpack.cpp @@ -23,7 +23,7 @@ void sbonepd(const char *configname) throw exceptionText; } - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (machine == "BOMBADIL") diff --git a/apps/cpu/BoxBenchmark/bb.cpp b/apps/cpu/BoxBenchmark/bb.cpp index 7d5c0ec2f4fdf4627b87a32727925f62a3bc89e9..3915f90627d7202c65a797960974b5c6f22ac1e2 100644 --- a/apps/cpu/BoxBenchmark/bb.cpp +++ b/apps/cpu/BoxBenchmark/bb.cpp @@ -37,7 +37,7 @@ void run(string configname) //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG3"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -130,7 +130,7 @@ void run(string configname) ppblocks.reset(); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //grid->accept(setConnsVisitor); @@ -192,7 +192,7 @@ void run(string configname) rcp.restart((int)restartStep); grid->setTimeStep(restartStep); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/CheckpointConverter/cpc.cpp b/apps/cpu/CheckpointConverter/cpc.cpp index 4eb526cc75be39153f61cbc4d599a21bcc5394b4..a34e758db522fb3cc72a7bedd6eef6c8cc20a49c 100644 --- a/apps/cpu/CheckpointConverter/cpc.cpp +++ b/apps/cpu/CheckpointConverter/cpc.cpp @@ -17,7 +17,7 @@ void run(string configname) int step = config.getValue<int>("step"); int numberOfProcesses = config.getValue<int>("numberOfProcesses"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); SPtr<Grid3D> grid(new Grid3D(comm)); diff --git a/apps/cpu/ConcreteExtrusion/CMakeLists.txt b/apps/cpu/ConcreteExtrusion/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c56d8430b841bda1c538244243c866bdb4b299c1 --- /dev/null +++ b/apps/cpu/ConcreteExtrusion/CMakeLists.txt @@ -0,0 +1,6 @@ +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(ConcreteExtrusion) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES ConcreteExtrusion.cpp ) \ No newline at end of file diff --git a/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cfg b/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cfg new file mode 100644 index 0000000000000000000000000000000000000000..abc2436d34371e663eca09ce83c3052cd2e71c37 --- /dev/null +++ b/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cfg @@ -0,0 +1,37 @@ +pathname = D:/temp/JetBreakupSharpInterfaceShortTest3 +pathGeo = d:/Projects/TRR277/Project/WP2/JetBreakup + +numOfThreads = 18 +availMem = 10e9 + +#Grid +blocknx = 25 25 25 + +factorLx = 2.0 +factorLy = 2.5 +factorLz = 2.5 + +#Simulation +case = 3 +U_LB = 0.003 #inlet velocity +interfaceWidth = 3 +D = 10 #0.0001 # m +D_LB = 50 + +contactAngle = 110.0 +phi_L = 0.0 +phi_H = 1.0 +Phase-field Relaxation = 0.6 +Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1 + + +logToFile = false + +newStart = true +restartStep = 10000 + +cpStart = 10000 +cpStep = 10000 + +outTime = 100 +endTime = 100000#36000 \ No newline at end of file diff --git a/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cpp b/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e73ff544b59991bf95874e058e3df3b7113370a0 --- /dev/null +++ b/apps/cpu/ConcreteExtrusion/ConcreteExtrusion.cpp @@ -0,0 +1,657 @@ +#include <iostream> +#include <memory> +#include <string> + +#include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" +#include "VirtualFluids.h" + +using namespace std; + +void setInflowBC(real x1, real x2, real x3, real radius, int dir) +{ +} + +void run(string configname) +{ + using namespace vf::lbm::dir; + + try { + + // Sleep(30000); + + vf::basics::ConfigurationFile config; + config.load(configname); + + string pathname = config.getValue<string>("pathname"); + string pathGeo = config.getValue<string>("pathGeo"); + int numOfThreads = config.getValue<int>("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); + real U_LB = config.getValue<real>("U_LB"); + int interfaceWidth = config.getValue<int>("interfaceWidth"); + real theta = config.getValue<real>("contactAngle"); + real D_LB = config.getValue<real>("D_LB"); + real phiL = config.getValue<real>("phi_L"); + real phiH = config.getValue<real>("phi_H"); + real tauH = config.getValue<real>("Phase-field Relaxation"); + real mob = config.getValue<real>("Mobility"); + + real endTime = config.getValue<real>("endTime"); + real outTime = config.getValue<real>("outTime"); + real availMem = config.getValue<real>("availMem"); + + bool logToFile = config.getValue<bool>("logToFile"); + real restartStep = config.getValue<real>("restartStep"); + real cpStart = config.getValue<real>("cpStart"); + real cpStep = config.getValue<real>("cpStep"); + bool newStart = config.getValue<bool>("newStart"); + + int caseN = config.getValue<int>("case"); + + real factorLx = config.getValue<real>("factorLx"); + real factorLy = config.getValue<real>("factorLy"); + real factorLz = config.getValue<real>("factorLz"); + + + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (myid == 0) UBLOG(logINFO, "Jet Breakup: Start!"); + + if (logToFile) { +#if defined(__unix__) + if (myid == 0) { + const char *str = pathname.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) { + stringstream logFilename; + logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + // Sleep(30000); + + real rho_h = 0, rho_l = 0, r_rho = 0, mu_h = 0, /*mu_l,*/ Uo = 0, D = 0, sigma = 0; + real Dg = 10; + + switch (caseN) { + case 1: + // density of heavy fluid (kg/m^3) + rho_h = 848; + // density of light fluid (kg/m^3) + rho_l = 34.5; + // density ratio + r_rho = rho_h / rho_l; + // dynamic viscosity of heavy fluid (Pa � s) + mu_h = 2.87e-3; + // dynamic viscosity of light fluid (Pa � s) + // mu_l = 1.97e-5; + // velocity (m/s) + Uo = 100; + // diameter of jet (m) + D = 0.0001; + // surface tension (N/m) + sigma = 0.03; + break; + case 2: + // density of heavy fluid (kg/m^3) + rho_h = 848; + // density of light fluid (kg/m^3) + rho_l = 1.205; + // density ratio + r_rho = rho_h / rho_l; + // dynamic viscosity of heavy fluid (Pa � s) + mu_h = 2.87e-3; + // dynamic viscosity of light fluid (Pa � s) + // mu_l = 1.84e-5; + // velocity (m/s) + Uo = 200; + // diameter of jet (m) + D = 0.0001; + // surface tension (N/m) + sigma = 0.03; + break; + case 3: + // density of heavy fluid (kg/m^3) + rho_h = 1000; + // density of light fluid (kg/m^3) + rho_l = 1.0; + // density ratio + r_rho = rho_h / rho_l; + // dynamic viscosity of heavy fluid (Pa � s) + mu_h = 2.87e-3; + // dynamic viscosity of light fluid (Pa � s) + // mu_l = 1.84e-5; + // velocity (m/s) + Uo = 200; + // diameter of jet (m) + D = 0.0001; + Dg = 10; + // surface tension (N/m) + sigma = 0.03; + break; + } + + real Re = rho_h * Uo * D / mu_h; + real We = rho_h * Uo * Uo * D / sigma; + + real dx = Dg / D_LB; + real nu_h = U_LB * D_LB / Re; + real nu_l = nu_h; + nu_h *= 0.1; + + //real rho_h_LB = 1; + // surface tension + real sigma_LB = 0.0; //rho_h_LB *U_LB *U_LB *D_LB / We; + + // LBMReal dLB = 0; // = length[1] / dx; + real rhoLB = 0.0; + // LBMReal nuLB = nu_l; //(uLB*dLB) / Re; + + real beta = 12.0 * sigma_LB / interfaceWidth; + real kappa = 1.5 * interfaceWidth * sigma_LB; + + //double tau0 = 715.218181094648*1000.; // Pa + //double muConcrete = 2.1133054011798826; // [Pa s] + //real u = Uo; //[m/s] + + + //double Bm = (tau0 * D) / (muConcrete * u); + double tau0_LB = 0.02; + //Bm *nu_h *U_LB / (D / dx); + + SPtr<Rheology> rheo = Rheology::getInstance(); + rheo->setYieldStress(tau0_LB); + + + if (myid == 0) { + UBLOG(logINFO, "Parameters:"); + UBLOG(logINFO, "U_LB = " << U_LB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nu_l = " << nu_l); + UBLOG(logINFO, "nu_h = " << nu_h); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "We = " << We); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "sigma = " << sigma); + UBLOG(logINFO, "sigma_LB = " << sigma_LB); + UBLOG(logINFO, "tau0_LB = " << tau0_LB); + UBLOG(logINFO, "density ratio = " << r_rho); + // UBLOG(logINFO, "number of levels = " << refineLevel + 1); + UBLOG(logINFO, "numOfThreads = " << numOfThreads); + UBLOG(logINFO, "path = " << pathname); + } + + // bounding box + + real Lx = factorLx * Dg; + real Ly = factorLy * Dg; + real Lz = factorLz * Dg; + + real g_minX1 = 0; + real g_minX2 = -0.5 * Ly; + real g_minX3 = -0.5 * Lz; + + // double g_maxX1 = 8.0*D; + // double g_maxX2 = 2.5*D; + // double g_maxX3 = 2.5*D; + + real g_maxX1 = Lx; + real g_maxX2 = 0.5 * Ly; + real g_maxX3 = 0.5 * Lz; + + SPtr<LBMUnitConverter> conv(new LBMUnitConverter()); + + // const int baseLevel = 0; + + SPtr<LBMKernel> kernel; + + // kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel()); + kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + //kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + + kernel->setWithForcing(false); + kernel->setForcingX1(0.0); + kernel->setForcingX2(0.0); + kernel->setForcingX3(0.0); + + kernel->setPhiL(phiL); + kernel->setPhiH(phiH); + kernel->setPhaseFieldRelaxation(tauH); + kernel->setMobility(mob); + + // nuL, nuG, densityRatio, beta, kappa, theta, + + kernel->setCollisionFactorMultiphase(nu_h, nu_l); + kernel->setDensityRatio(r_rho); + kernel->setMultiphaseModelParameters(beta, kappa); + kernel->setContactAngle(theta); + kernel->setInterfaceWidth(interfaceWidth); + // dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0); + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc(new BCSet()); + // BCSetPtr bcProc(new ThinWallBCSet()); + + kernel->setBCSet(bcProc); + + SPtr<Grid3D> grid(new Grid3D(comm)); + //grid->setPeriodicX1(true); + grid->setPeriodicX2(true); + grid->setPeriodicX3(true); + grid->setGhostLayerWidth(2); + + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_MMM, MetisPartitioner::RECURSIVE)); + + ////////////////////////////////////////////////////////////////////////// + // restart + SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart)); + // SPtr<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + // SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); + // rcp->setNu(nuLB); + // rcp->setNuLG(nuL, nuG); + // rcp->setDensityRatio(densityRatio); + + rcp->setLBMKernel(kernel); + rcp->setBCSet(bcProc); + ////////////////////////////////////////////////////////////////////////// + // BC Adapter + ////////////////////////////////////////////////////////////////////////////// + mu::Parser fctF1; + //u_actual(r) = U_max * (4 / (D^2) * (R^2 - r^2)) + //fctF1.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))"); + //fctF1.SetExpr("vx1*(1-(sqrt((x2-y0)^2+(x3-z0)^2))/(R))"); + //fctF1.SetExpr("vy1*(1-(sqrt((x2-x0)^2+(x3-z0)^2)/R))^0.1"); + fctF1.SetExpr("vx1"); + //fctF1.DefineConst("vx1", 0); + fctF1.DefineConst("vx1", U_LB); + fctF1.DefineConst("R", 0.5*Dg); + fctF1.DefineConst("y0", (g_minX2+g_maxX2)/2); + fctF1.DefineConst("z0", (g_minX3+g_maxX3)/2); + SPtr<BC> velBCF1(new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, BCFunction::INFCONST)); + + mu::Parser fctF2; + fctF2.SetExpr("vx1"); + fctF2.DefineConst("vx1", U_LB); + fctF2.SetExpr("vx1"); + fctF2.DefineConst("vx1", U_LB); + + // real startTime = 1; + // SPtr<BC> velBCF1(new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, startTime)); + //SPtr<BC> velBCF2(new MultiphaseVelocityBC(true, false, false, fctF2, phiH, startTime, endTime)); + SPtr<BC> velBCF2(new MultiphaseVelocityBC(false, true, false, fctF2, phiH, 0.0, BCFunction::INFCONST)); + + + + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + SPtr<BC> denBC(new DensityBC(rhoLB)); + denBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> slipBC(new SlipBC()); + slipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseSlipBCStrategy())); + + mu::Parser fctPhi_F1; + fctPhi_F1.SetExpr("phiH"); + fctPhi_F1.DefineConst("phiH", phiH); + + mu::Parser fctPhi_F2; + fctPhi_F2.SetExpr("phiL"); + fctPhi_F2.DefineConst("phiL", phiL); + + mu::Parser fctvel_F2_init; + fctvel_F2_init.SetExpr("U"); + fctvel_F2_init.DefineConst("U", 0); + + velBCF1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + velBCF2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + //bcVisitor.addBC(slipBC); + bcVisitor.addBC(denBC); + bcVisitor.addBC(velBCF1); + bcVisitor.addBC(velBCF2); + + // SPtr<D3Q27Interactor> inflowF1Int; + // SPtr<D3Q27Interactor> cylInt; + + SPtr<D3Q27Interactor> inflowInt; + + //if (newStart) { + + // if (newStart) { + + real inflowLength = 10; + + // geometry + SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + // if (myid == 0) + // UBLOG(logINFO, "Read geoFile:start"); + // SPtr<GbTriFaceMesh3D> cylinder = make_shared<GbTriFaceMesh3D>(); + // cylinder->readMeshFromSTLFileBinary(pathGeo + "/" + geoFile, false); + // GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance()); + // if (myid == 0) + // UBLOG(logINFO, "Read geoFile:stop"); + // inflow + // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2 - 0.5 * dx, g_minX3, g_maxX1, g_minX2 - 1.0 * + // dx, g_maxX3)); + // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1 * 0.5 - dx, g_minX2 - dx, g_minX3 * 0.5 - dx, + // g_maxX1 * 0.5 + dx, g_minX2, g_maxX3 * 0.5 + dx)); + // if (myid == 0) + // GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1", + // WbWriterVtkXmlASCII::getInstance()); + + //GbCylinder3DPtr geoInflow(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_minX1, 0.0, 0.0, Dg / 2.0)); + + GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 + inflowLength, g_minX3 + (g_maxX3 - g_minX3) / 3.0, g_minX1 + 2.0 * dx, 3 * inflowLength + g_minX2, g_maxX3 - (g_maxX3 - g_minX3) / 3.0)); + + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance()); + + GbCylinder3DPtr geoSolid(new GbCylinder3D(g_minX1 - 2.0 * dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1+2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, 1.5*D / 2.0)); + if (myid == 0) GbSystem3D::writeGeoObject(geoSolid.get(), pathname + "/geo/geoSolid", WbWriterVtkXmlASCII::getInstance()); + + SPtr<GbTriFaceMesh3D> meshInflowPipe = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshInflowPipe:start"); + meshInflowPipe->readMeshFromSTLFileBinary(pathGeo + "/JetTube4.stl", false); + //meshInflowPipe->readMeshFromSTLFileASCII(pathGeo + "/JetTubeScaled5.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshInflowPipe:end"); + //meshInflowPipe->scale(1e-04, 1e-04, 1e-04); + if (myid == 0) GbSystem3D::writeGeoObject(meshInflowPipe.get(), pathname + "/geo/meshInflowPipe", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrInflowPipe = std::make_shared<D3Q27TriFaceMeshInteractor>(meshInflowPipe, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + + // GbCylinder3DPtr cylinder2( + // new GbCylinder3D(0.0, g_minX2 - 2.0 * dx / 2.0, 0.0, 0.0, g_minX2 + 4.0 * dx, 0.0, 8.0+2.0*dx)); + // if (myid == 0) + // GbSystem3D::writeGeoObject(cylinder2.get(), pathname + "/geo/cylinder2", + // WbWriterVtkXmlASCII::getInstance()); + // outflow + // GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original) + // GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2 - 40 * dx, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); + + // double blockLength = blocknx[0] * dx; + + if (myid == 0) { + UBLOG(logINFO, "Preprocess - start"); + } + + grid->setDeltaX(dx); + grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + + //grid->setPeriodicX1(false); + //grid->setPeriodicX2(false); + //grid->setPeriodicX3(false); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + + // SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBC, + // Interactor3D::SOLID, Interactor3D::POINTS)); + + // inflowF1Int = + // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBC, Interactor3D::SOLID)); + // inflowF1Int->addBC(velBCF2); + + SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); + + // Create boundary conditions geometry + GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallZmin(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_minX3)); + GbSystem3D::writeGeoObject(wallZmin.get(), pathname + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallZmax(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_maxX3, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3 + 2.0*dx)); + GbSystem3D::writeGeoObject(wallZmax.get(), pathname + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_minX2, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - 2.0 * dx, g_maxX2, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance()); + + // Add boundary conditions to grid generator + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, velBCF2, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); + + +////////////////////////// + + GbCuboid3DPtr wallInfZmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, (g_maxX3 + g_minX3) / 2.0 - inflowLength)); + GbSystem3D::writeGeoObject(wallInfZmin.get(), pathname + "/geo/wallInfZmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfZmax(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, (g_maxX3 + g_minX3) / 2.0 + inflowLength, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallInfZmax.get(), pathname + "/geo/wallInfZmax", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfYmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_minX2 + inflowLength, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallInfYmin.get(), pathname + "/geo/wallInfYmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfYmax(new GbCuboid3D(g_minX1 - 2.0 * dx, 3* inflowLength+g_minX2, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, g_maxX3)); + GbSystem3D::writeGeoObject(wallInfYmax.get(), pathname + "/geo/wallInfYmax", WbWriterVtkXmlASCII::getInstance()); + + // Add boundary conditions to grid generator + SPtr<D3Q27Interactor> wallInfZminInt(new D3Q27Interactor(wallInfZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfZmaxInt(new D3Q27Interactor(wallInfZmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfYminInt(new D3Q27Interactor(wallInfYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfYmaxInt(new D3Q27Interactor(wallInfYmax, grid, noSlipBC, Interactor3D::SOLID)); +////////////////////////////////////// + + + + + + // cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCF1, Interactor3D::SOLID)); + // cylInt->addBC(velBCF2); + // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBC, + // Interactor3D::SOLID)); + + inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCF1, Interactor3D::SOLID)); + //inflowInt->addBC(velBCF2); + + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1, g_maxX2 / 2.0, g_maxX3 / 2.0, D * 0.9 / 2.0)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), pathname + "/geo/geoAirInflow", WbWriterVtkXmlASCII::getInstance()); + SPtr<D3Q27Interactor> inflowAirInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoAirInflow, grid, velBCF2, Interactor3D::SOLID)); + + SPtr<D3Q27Interactor> solidInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBC, Interactor3D::SOLID)); + + + InteractorsHelper intHelper(grid, metisVisitor, true); + //intHelper.addInteractor(cylInt); + //intHelper.addInteractor(tubes); + //intHelper.addInteractor(outflowInt); + // intHelper.addInteractor(cyl2Int); + //intHelper.addInteractor(intrInflowPipe); + intHelper.addInteractor(wallXminInt); + intHelper.addInteractor(wallXmaxInt); + //intHelper.addInteractor(wallZminInt); + //intHelper.addInteractor(wallZmaxInt); + //intHelper.addInteractor(wallYminInt); + //intHelper.addInteractor(wallYmaxInt); + + intHelper.addInteractor(wallInfZminInt); + intHelper.addInteractor(wallInfZmaxInt); + intHelper.addInteractor(wallInfYminInt); + intHelper.addInteractor(wallInfYmaxInt); + + intHelper.addInteractor(inflowInt); + //intHelper.addInteractor(outflowInt); + //intHelper.addInteractor(inflowAirInt); + + intHelper.selectBlocks(); + + ppblocks->update(0); + ppblocks.reset(); + + unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); + int ghostLayer = 3; + unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]); + unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock; + unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + real needMemAll = real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); + real needMem = needMemAll / real(comm->getNumberOfProcesses()); + + if (myid == 0) { + UBLOG(logINFO, "Number of blocks = " << numberOfBlocks); + UBLOG(logINFO, "Number of nodes = " << numberOfNodes); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for (int level = minInitLevel; level <= maxInitLevel; level++) { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl); + UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock); + } + UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); + } + + MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h, nu_l, availMem, needMem); + + grid->accept(kernelVisitor); + + //if (!newStart) { + // rcp->readBlocks((int)restartStep); + // grid->accept(metisVisitor); + // rcp->readDataSet((int)restartStep); + // grid->setTimeStep(restartStep); + //} + + intHelper.setBC(); + + if (newStart) { + + // initialization of distributions + // mu::Parser fct1; + // fct1.SetExpr("phiL"); + // fct1.DefineConst("phiL", phiL); + real x1c = g_minX1 - Dg*5; // (g_maxX1 - g_minX1-1)/2; // + real x2c = (g_minX2 + g_maxX2) / 2; + real x3c = (g_minX3 + g_maxX3) / 2; + + mu::Parser fct1; + fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + //fct1.SetExpr("(0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness))-(0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius2)/interfaceThickness))"); + // fct1.SetExpr("x1 < 4*dx ? (0.5-0.5*tanh(2*(1-4*dx)*(sqrt((x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)) : 0"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("dx", dx); + fct1.DefineConst("radius", 5.0*Dg + (inflowLength-1)*dx /* + 2. * dx*/); + fct1.DefineConst("radius2", Dg / 4.); + fct1.DefineConst("interfaceThickness", interfaceWidth * dx); + + mu::Parser fct2; + // fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + fct2.SetExpr("x1 < 4*dx ? (0.5-0.5*tanh(2*(1-4*dx)*(sqrt((x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)) : 0"); + fct2.DefineConst("x1c", x1c); + fct2.DefineConst("x2c", x2c); + fct2.DefineConst("x3c", x3c); + fct2.DefineConst("dx", dx); + fct2.DefineConst("radius", 0.5 * D /* + 2. * dx*/); + fct2.DefineConst("interfaceThickness", interfaceWidth * dx); + + MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + //initVisitor.setPhi(fct1); + grid->accept(initVisitor); + } + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + //} else { + if (!newStart) { + rcp->restart((int)restartStep); + grid->setTimeStep(restartStep); + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(10000); + if (myid == 0) UBLOG(logINFO, "Restart - end"); + } + + // TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); + // grid->accept(setConnsVisitor); + + // ThreeDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); + + grid->accept(bcVisitor); + + //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + SPtr<UbScheduler> visSch(new UbScheduler(outTime)); + real t_ast, t; + t_ast = 7.19; + t = (int)(t_ast/(U_LB/(D_LB))); + visSch->addSchedule(t,t,t); //t=7.19 + // SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( + // grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> pp(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + pp->update(0); + + SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); + + // SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); + // auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); + // timeDepBC->addInteractor(inflowInt); + +#ifdef _OPENMP + omp_set_num_threads(numOfThreads); +#endif + + SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + // simulation->addSimulationObserver(timeDepBC); + // simulation->addSimulationObserver(timeDepBC); + simulation->addSimulationObserver(rcp); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + } catch (std::exception &e) { + cerr << e.what() << endl << flush; + } catch (std::string &s) { + cerr << s << endl; + } catch (...) { + cerr << "unknown exception" << endl; + } +} +int main(int argc, char *argv[]) +{ + // Sleep(30000); + if (argv != NULL) { + if (argv[1] != NULL) { + run(string(argv[1])); + } else { + cout << "Configuration file is missing!" << endl; + } + } +} diff --git a/apps/cpu/ConvectionOfVortex/cov.cpp b/apps/cpu/ConvectionOfVortex/cov.cpp index baa136d6a3a96e1e4ce86ce187f116e2c560530c..102a1ad7d16fa7cd343449fd27fab73aae70c92f 100644 --- a/apps/cpu/ConvectionOfVortex/cov.cpp +++ b/apps/cpu/ConvectionOfVortex/cov.cpp @@ -12,7 +12,7 @@ void run() try { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int numOfThreads = 4; @@ -164,15 +164,15 @@ void run() ppblocks.reset(); //set connectors - //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); - //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkOmegaToOmega(true); - //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetSquarePressureInterpolationProcessor()); + //SPtr<Interpolator> iProcessor(new CompressibleOffsetInterpolator()); + //SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + //dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkOmegaToOmega(true); + //SPtr<Interpolator> iProcessor(new CompressibleOffsetSquarePressureInterpolator()); OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor); grid->accept(setInterConnsVisitor); diff --git a/apps/cpu/CouetteFlow/cflow.cpp b/apps/cpu/CouetteFlow/cflow.cpp index e81c3bb008948814d79577311498dbfd5f1a76f2..6c7e28f5abba629a7ad9c59204b70fb3d7e03574 100644 --- a/apps/cpu/CouetteFlow/cflow.cpp +++ b/apps/cpu/CouetteFlow/cflow.cpp @@ -40,7 +40,7 @@ void bflow(string configname) // double Re = config.getValue<double>("Re"); // double Bn = config.getValue<double>("Bn"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -243,7 +243,7 @@ void bflow(string configname) //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); //grid->accept(setConnsVisitor); diff --git a/apps/cpu/DHIT/dhit.cpp b/apps/cpu/DHIT/dhit.cpp index 850a531a9ac490ed195ad17ce298ca5cf027151a..3143aa1c8f79ceb4c69aca04bac193025a604392 100644 --- a/apps/cpu/DHIT/dhit.cpp +++ b/apps/cpu/DHIT/dhit.cpp @@ -29,7 +29,7 @@ void run(string configname) double lambda = config.getDouble("lambda"); double initTime = config.getDouble("initTime"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -117,7 +117,7 @@ void run(string configname) ppblocks.reset(); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/DLR-F16-Porous/f16.cpp b/apps/cpu/DLR-F16-Porous/f16.cpp index 7ddd135b2996c794e2802e235fdedc2a3013cdf3..08bafaf3df6cdb3c32a3592ea950bd3bc2c42474 100644 --- a/apps/cpu/DLR-F16-Porous/f16.cpp +++ b/apps/cpu/DLR-F16-Porous/f16.cpp @@ -95,7 +95,7 @@ void run(string configname) - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -656,8 +656,8 @@ void run(string configname) //////////////////////////////////////////////////////////////////////////// } ////set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/DLR-F16-Solid/f16.cpp b/apps/cpu/DLR-F16-Solid/f16.cpp index 328da5dc54b5a2db751eb71ad1ce8810cb471470..cf08ef73aac0d8279aa84e62b717700017163a7f 100644 --- a/apps/cpu/DLR-F16-Solid/f16.cpp +++ b/apps/cpu/DLR-F16-Solid/f16.cpp @@ -47,7 +47,7 @@ void run(string configname) double timeAvStart = config.getValue<double>("timeAvStart"); double timeAvStop = config.getValue<double>("timeAvStop"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -634,8 +634,8 @@ void run(string configname) } ////set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/DLR-F16/f16.cpp b/apps/cpu/DLR-F16/f16.cpp index 2bbc1b8ed63be110d4b6ccc98cdcdb88337d4760..639a73c3863d6e725ad048e44e0f9be12faf3909 100644 --- a/apps/cpu/DLR-F16/f16.cpp +++ b/apps/cpu/DLR-F16/f16.cpp @@ -13,7 +13,7 @@ double rangeRandom1() void setBC(SPtr<Grid3D> grid, string pathGeo, string fngFileWhole, string zigZagTape, vector<double> boundingBox, double uLB, double rhoLB, double blockLength, SPtr<BCProcessor> bcProcessor) { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); std::vector<std::vector<SPtr<Block3D>> > blockVector; @@ -205,7 +205,7 @@ void run(string configname) int chunk = config.getValue<int>("chunk"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -978,8 +978,8 @@ void run(string configname) ////set connectors - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -1101,7 +1101,7 @@ void run(string configname) //////////////////////////////////////////////////////////////////////////// - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/FallingSphere/FallingSphere.cpp b/apps/cpu/FallingSphere/FallingSphere.cpp index ba837fcf15b32a65983b633c768aea6250a976a7..f41524a5f6f5b163c6eaefeb386b9a76b892d196 100644 --- a/apps/cpu/FallingSphere/FallingSphere.cpp +++ b/apps/cpu/FallingSphere/FallingSphere.cpp @@ -11,7 +11,7 @@ using namespace std; int main(int argc, char *argv[]) { - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) double g_maxX2 = 1; double g_maxX3 = 10; - int blockNX[3] = { 16, 16, 16 }; + int blockNX[3] = { 32, 32, 32 }; double dx = 1./32.; double d_part = 0.25; @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) grid->setDeltaX(dx); grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]); - string outputPath = "f:/temp/FallingSpheresTest"; + string outputPath = "f:/temp/FallingSpheresTestMPI"; UbSystem::makeDirectory(outputPath); UbSystem::makeDirectory(outputPath + "/liggghts"); @@ -68,12 +68,6 @@ int main(int argc, char *argv[]) GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<SimulationObserver> ppblocks = - make_shared <WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, - WbWriterVtkXmlBinary::getInstance(), comm); - ppblocks->update(0); - ppblocks.reset(); - double dx2 = 2.0 * dx; GbCuboid3DPtr wallZmin( new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_minX3)); @@ -85,47 +79,39 @@ int main(int argc, char *argv[]) SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); - InteractorsHelper intHelper(grid, metisVisitor, true); - intHelper.addInteractor(wallZminInt); - intHelper.addInteractor(wallZmaxInt); - intHelper.selectBlocks(); - - SetKernelBlockVisitor kernelVisitor(kernel, nuLB, 1e9, 1e9); - grid->accept(kernelVisitor); - intHelper.setBC(); - - InitDistributionsBlockVisitor initVisitor; - grid->accept(initVisitor); + SPtr<SimulationObserver> ppblocks = make_shared<WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks->update(0); + MPI_Comm mpi_comm = *(MPI_Comm *)(comm->getNativeCommunicator()); + LiggghtsCouplingWrapper wrapper(argv, mpi_comm); SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); string inFile1 = "d:/Projects/VirtualFluids_Develop/apps/cpu/FallingSphere/in.lbdem"; string inFile2 = "d:/Projects/VirtualFluids_Develop/apps/cpu/FallingSphere/in2.lbdem"; - MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator()); - LiggghtsCouplingWrapper wrapper(argv, mpi_comm); - - // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx); - //SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx); SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 0.1, 1000, r_p / dx, 0.01); std::cout << units->toString() << std::endl; double v_frac = 0.1; - double dt_phys = units->getFactorTimeLbToW(); + double dt_phys = units->getFactorTimeLbToW(); int demSubsteps = 10; - double dt_dem = dt_phys / (double)demSubsteps; - int vtkSteps = 100; - string demOutDir = outputPath; + double dt_dem = dt_phys / (double)demSubsteps; + int vtkSteps = 100; + string demOutDir = outputPath; wrapper.execCommand("echo none"); wrapper.setVariable("d_part", d_part); - //wrapper.setVariable("r_part", d_part/2.); - //wrapper.setVariable("v_frac", v_frac); + // wrapper.setVariable("r_part", d_part/2.); + // wrapper.setVariable("v_frac", v_frac); + + wrapper.execFile((char *)inFile1.c_str()); + + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); + SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>((g_maxX1 - g_minX1) / dx, (g_maxX2 - g_minX2) / dx, (g_maxX3 - g_minX3) / dx, wrapper.lmp); - wrapper.execFile((char*)inFile1.c_str()); - //// set timestep and output directory wrapper.setVariable("t_step", dt_dem); wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); @@ -133,9 +119,22 @@ int main(int argc, char *argv[]) wrapper.execFile((char *)inFile2.c_str()); wrapper.runUpto(demSubsteps - 1); - - SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = - make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); + + InteractorsHelper intHelper(grid, partVisitor, false); + intHelper.addInteractor(wallZminInt); + intHelper.addInteractor(wallZmaxInt); + intHelper.selectBlocks(); + + ppblocks->update(1); + ppblocks.reset(); + + SetKernelBlockVisitor kernelVisitor(kernel, nuLB, 1e9, 1e9); + grid->accept(kernelVisitor); + + intHelper.setBC(); + + InitDistributionsBlockVisitor initVisitor; + grid->accept(initVisitor); // boundary conditions grid { @@ -158,6 +157,9 @@ int main(int argc, char *argv[]) new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + int numOfThreads = 1; + omp_set_num_threads(numOfThreads); + int endTime = 3000; //20; SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); simulation->addSimulationObserver(lcSimulationObserver); diff --git a/apps/cpu/FallingSphere/in.lbdem b/apps/cpu/FallingSphere/in.lbdem index b47a85c997fce75ba082490b305bbe9b55caeb25..5d0cfb511774c5270918f4e7007224d36080232c 100644 --- a/apps/cpu/FallingSphere/in.lbdem +++ b/apps/cpu/FallingSphere/in.lbdem @@ -11,7 +11,7 @@ communicate single vel yes boundary f f f newton off -processors * * 1 +processors 1 1 * region box block 0. 1. 0. 1. 0. 10. units box create_box 1 box @@ -42,7 +42,7 @@ fix xwalls2 all wall/gran model hertz tangential history primitive type 1 xplane fix ywalls1 all wall/gran model hertz tangential history primitive type 1 yplane 0. fix ywalls2 all wall/gran model hertz tangential history primitive type 1 yplane 1. fix zwalls1 all wall/gran model hertz tangential history primitive type 1 zplane 0. -fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 2. +fix zwalls2 all wall/gran model hertz tangential history primitive type 1 zplane 10. create_atoms 1 single 0.5 0.5 9.75 #create_atoms 1 single 0.38 0.05 0.05 diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cfg b/apps/cpu/FlowAroundCylinder/cylinder.cfg index 97ece40e65d4ffe47a75e5377db49bd0018bbff6..1869a668ad6a8a456a5b131234c082b05d9b17be 100644 --- a/apps/cpu/FlowAroundCylinder/cylinder.cfg +++ b/apps/cpu/FlowAroundCylinder/cylinder.cfg @@ -1,8 +1,8 @@ -pathOut = d:/temp/cylinder_test_naming +pathOut = ./output/FlowAroundCylinder numOfThreads = 8 availMem = 15e9 -refineLevel = 0 +refineLevel = 1 blockNx = 25 41 41 uLB = 0.001 #dx = 0.005 diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp b/apps/cpu/FlowAroundCylinder/cylinder.cpp index f8c2ac4674a7bfa98d42c0be4ebf20365f579695..3e5be5e080a5702e9608bf037d492b8cbc809dfc 100644 --- a/apps/cpu/FlowAroundCylinder/cylinder.cpp +++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp @@ -35,7 +35,7 @@ void run(string configname) vector<int> blockNx = config.getVector<int>("blockNx"); real dx = config.getValue<real>("dx"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -291,12 +291,13 @@ void run(string configname) } //set connectors - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + // SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor_old()); SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nueLB, iProcessor); grid->accept(setInterConnsVisitor); diff --git a/apps/cpu/FlowAroundCylinder/cylinder.cpp.old b/apps/cpu/FlowAroundCylinder/cylinder.cpp.old index f251ee63514c67cca6df0e998cc196d3cc5a9ec8..774ed812b5fab63538a56744ddd41a2611eadc72 100644 --- a/apps/cpu/FlowAroundCylinder/cylinder.cpp.old +++ b/apps/cpu/FlowAroundCylinder/cylinder.cpp.old @@ -15,7 +15,7 @@ void run(const char *cstr) int numOfThreads = 1; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "BOMBADIL") @@ -385,7 +385,7 @@ void run2(const char *cstr) int numOfThreads = 1; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "BOMBADIL") diff --git a/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp b/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp index 074e8c3aa9b338fa00db0718862d20c7e99f5e55..e7f7bb84a4dece690ea0e93cc2d07b6cdd8932d2 100644 --- a/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp +++ b/apps/cpu/Hagen_Poiseuille_flow/pflow.cpp @@ -29,7 +29,7 @@ using namespace std; // double deltax = config.getDouble("deltax"); // // -// SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); +// SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); // int myid = comm->getProcessID(); // // if (logToFile) @@ -322,7 +322,7 @@ void pflowdp(string configname) double cpStepStart = config.getValue<double>("cpStepStart"); bool newStart = config.getValue<bool>("newStart"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); LBMReal rhoLB = 0.0; @@ -553,8 +553,8 @@ void pflowdp(string configname) ////////////////////////////////////// //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -657,7 +657,7 @@ void pflowdp(string configname) grid->setTimeStep(restartStep); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp b/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp index 40bf20ecabe23637b6271edd6ac6c4fd951f4760..e278fcb78fddc4f5606256a6805dbda4e344a19d 100644 --- a/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp +++ b/apps/cpu/Hagen_Poiseuille_flow2/pflow2.cpp @@ -29,7 +29,7 @@ void pflowdp(string configname) double deltax = config.getValue<double>("deltax"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); LBMReal rhoLB = 0.0; @@ -194,7 +194,7 @@ void pflowdp(string configname) ////////////////////////////////////// //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -280,7 +280,7 @@ void pflowdp(string configname) grid->accept(bcVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/HerschelBulkleyModel/hbflow.cpp b/apps/cpu/HerschelBulkleyModel/hbflow.cpp index 83686a88495ef5fc2a3ce8529453f2d59d30dab7..67ed5404eebc1eeffe1e385ff42dc806c1588301 100644 --- a/apps/cpu/HerschelBulkleyModel/hbflow.cpp +++ b/apps/cpu/HerschelBulkleyModel/hbflow.cpp @@ -41,7 +41,7 @@ void bflow(string configname) // double Bn = config.getValue<double>("Bn"); real scaleFactor = config.getValue<real>("scaleFactor"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -290,7 +290,7 @@ void bflow(string configname) //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor); //grid->accept(setConnsVisitor); diff --git a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp index 221b106123b5fadffcf60427481800ef0d673b76..90ae44b62f18e412c4f3e0bd8ba88de56b01650a 100644 --- a/apps/cpu/HerschelBulkleySphere/hbsphere.cpp +++ b/apps/cpu/HerschelBulkleySphere/hbsphere.cpp @@ -38,7 +38,7 @@ void bflow(string configname) real Bn = config.getValue<real>("Bn"); vector<real> sphereCenter = config.getVector<real>("sphereCenter"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) diff --git a/apps/cpu/InterfaceTest/itest.cpp b/apps/cpu/InterfaceTest/itest.cpp index face949bd7d68c8d4fe94d7e32dc728b7818f42f..e8c93d4e5b3698b75964d63de0c18780a4566552 100644 --- a/apps/cpu/InterfaceTest/itest.cpp +++ b/apps/cpu/InterfaceTest/itest.cpp @@ -11,7 +11,7 @@ void run() { try { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int numOfThreads = 4; @@ -94,9 +94,9 @@ void run() ppblocks.reset(); //set connectors - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkOmegaToOmega(true); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetMomentsInterpolator()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkOmegaToOmega(true); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); diff --git a/apps/cpu/JetBreakup/CMakeLists.txt b/apps/cpu/JetBreakup/CMakeLists.txt index b5bb536cf0c0b4820953ade37b1b5ccca265d7f2..162e9c959fc27171e3f0d7e1df5e62eb6ff7ef87 100644 --- a/apps/cpu/JetBreakup/CMakeLists.txt +++ b/apps/cpu/JetBreakup/CMakeLists.txt @@ -3,4 +3,4 @@ ######################################################## PROJECT(JetBreakup) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow FILES JetBreakup.cpp ) \ No newline at end of file +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES JetBreakup.cpp ) \ No newline at end of file diff --git a/apps/cpu/JetBreakup/JetBreakup.cfg b/apps/cpu/JetBreakup/JetBreakup.cfg index eef35c305065efe01befab99f96f385a32d932bc..0900bcc997331ecdb4993e35e96d48aa888709cc 100644 --- a/apps/cpu/JetBreakup/JetBreakup.cfg +++ b/apps/cpu/JetBreakup/JetBreakup.cfg @@ -1,28 +1,21 @@ -pathname = f:/Multiphase/JetBreakupCaseCSThreeNonConservativePressShortCorrPhaseOutflow1 -#pathGeo = d:/Projects/VirtualFluids-Multiphase/source/Applications/Multiphase/backup -pathGeo = d:/Projects/VirtualFluidsCombined/apps/cpu/Multiphase/backup -#geoFile = JetBreakupR.ASCII.stl -#geoFile = inlet1.stl -geoFile = tubeTransformed.stl - -numOfThreads = 16 +pathname = D:/temp/JetBreakupSharpInterfaceShortTest3 +pathGeo = d:/Projects/TRR277/Project/WP2/JetBreakup + +numOfThreads = 18 availMem = 10e9 #Grid blocknx = 25 25 25 +factorLx = 16 +factorLy = 5 +factorLz = 5 + #Simulation case = 3 -U_LB = 0.01 #inlet velocity -#uF2 = 0.0001 -#Re = 10 -#nuL =0.00016922169811320757# 1.0e-5 #!1e-2 -#nuG =0.00016922169811320757# 1.16e-4 #!1e-2 -#densityRatio = 24.579710144927535 -#sigma = 1.7688679245283022e-07 -interfaceWidth = 5 - -D = 0.0001 # m +U_LB = 0.003 #inlet velocity +interfaceWidth = 3 +D = 10 #0.0001 # m D_LB = 50 contactAngle = 110.0 @@ -35,10 +28,10 @@ Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation param logToFile = false newStart = true -restartStep = 100000 +restartStep = 10000 -cpStart = 100000 -cpStep = 100000 +cpStart = 10000 +cpStep = 10000 -outTime = 1 #205 +outTime = 100 endTime = 100000#36000 \ No newline at end of file diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp b/apps/cpu/JetBreakup/JetBreakup.cpp index f4b74ca379edaf8840cb6875ca0ff9fc7f296509..de2f5b95035f8a2b786848941a897ad65cb9cf61 100644 --- a/apps/cpu/JetBreakup/JetBreakup.cpp +++ b/apps/cpu/JetBreakup/JetBreakup.cpp @@ -2,14 +2,14 @@ #include <memory> #include <string> -#include "VirtualFluids.h" #include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" +#include "VirtualFluids.h" using namespace std; void setInflowBC(real x1, real x2, real x3, real radius, int dir) { - } void run(string configname) @@ -24,20 +24,11 @@ void run(string configname) config.load(configname); string pathname = config.getValue<string>("pathname"); - //string pathGeo = config.getValue<string>("pathGeo"); - //string geoFile = config.getValue<string>("geoFile"); + string pathGeo = config.getValue<string>("pathGeo"); int numOfThreads = config.getValue<int>("numOfThreads"); vector<int> blocknx = config.getVector<int>("blocknx"); - //vector<double> boundingBox = config.getVector<double>("boundingBox"); - // vector<double> length = config.getVector<double>("length"); real U_LB = config.getValue<real>("U_LB"); - // double uF2 = config.getValue<double>("uF2"); - //double nuL = config.getValue<double>("nuL"); - //double nuG = config.getValue<double>("nuG"); - //double densityRatio = config.getValue<double>("densityRatio"); - //double sigma = config.getValue<double>("sigma"); int interfaceWidth = config.getValue<int>("interfaceWidth"); - //double D = config.getValue<double>("D"); real theta = config.getValue<real>("contactAngle"); real D_LB = config.getValue<real>("D_LB"); real phiL = config.getValue<real>("phi_L"); @@ -48,24 +39,26 @@ void run(string configname) real endTime = config.getValue<real>("endTime"); real outTime = config.getValue<real>("outTime"); real availMem = config.getValue<real>("availMem"); - //int refineLevel = config.getValue<int>("refineLevel"); - //double Re = config.getValue<double>("Re"); - + bool logToFile = config.getValue<bool>("logToFile"); real restartStep = config.getValue<real>("restartStep"); real cpStart = config.getValue<real>("cpStart"); real cpStep = config.getValue<real>("cpStep"); bool newStart = config.getValue<bool>("newStart"); + int caseN = config.getValue<int>("case"); + real factorLx = config.getValue<real>("factorLx"); + real factorLy = config.getValue<real>("factorLy"); + real factorLz = config.getValue<real>("factorLz"); + + //real dx = config.getValue<real>("dx"); - int caseN = config.getValue<int>("case"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); - if (myid == 0) - UBLOG(logINFO, "Jet Breakup: Start!"); + if (myid == 0) UBLOG(logINFO, "Jet Breakup: Start!"); if (logToFile) { #if defined(__unix__) @@ -84,25 +77,26 @@ void run(string configname) // Sleep(30000); - real rho_h=0, rho_l=0, r_rho=0, mu_h=0, /*mu_l,*/ Uo=0, D=0, sigma=0; + real rho_h = 0, rho_l = 0, r_rho = 0, mu_h = 0, /*mu_l,*/ Uo = 0, D = 0, sigma = 0; + real Dg = 10; switch (caseN) { - case 1: - //density of heavy fluid (kg/m^3) - rho_h = 848; - //density of light fluid (kg/m^3) + case 1: + // density of heavy fluid (kg/m^3) + rho_h = 848; + // density of light fluid (kg/m^3) rho_l = 34.5; - //density ratio + // density ratio r_rho = rho_h / rho_l; - //dynamic viscosity of heavy fluid (Pa � s) + // dynamic viscosity of heavy fluid (Pa � s) mu_h = 2.87e-3; - //dynamic viscosity of light fluid (Pa � s) - //mu_l = 1.97e-5; - //velocity (m/s) + // dynamic viscosity of light fluid (Pa � s) + // mu_l = 1.97e-5; + // velocity (m/s) Uo = 100; - //diameter of jet (m) + // diameter of jet (m) D = 0.0001; - //surface tension (N/m) + // surface tension (N/m) sigma = 0.03; break; case 2: @@ -115,7 +109,7 @@ void run(string configname) // dynamic viscosity of heavy fluid (Pa � s) mu_h = 2.87e-3; // dynamic viscosity of light fluid (Pa � s) - //mu_l = 1.84e-5; + // mu_l = 1.84e-5; // velocity (m/s) Uo = 200; // diameter of jet (m) @@ -133,34 +127,51 @@ void run(string configname) // dynamic viscosity of heavy fluid (Pa � s) mu_h = 2.87e-3; // dynamic viscosity of light fluid (Pa � s) - //mu_l = 1.84e-5; + // mu_l = 1.84e-5; // velocity (m/s) Uo = 200; // diameter of jet (m) D = 0.0001; + Dg = 100; // surface tension (N/m) sigma = 0.03; - break; + break; } real Re = rho_h * Uo * D / mu_h; real We = rho_h * Uo * Uo * D / sigma; - real dx = D / D_LB; + real dx = Dg / D_LB; + //real D_LB = Dg / dx; real nu_h = U_LB * D_LB / Re; real nu_l = nu_h; + nu_h *= 0.1; - real rho_h_LB = 1; - //surface tension - real sigma_LB = rho_h_LB * U_LB * U_LB * D_LB / We; + //real rho_h_LB = 1; + // surface tension + real sigma_LB = 0.0; //rho_h_LB *U_LB *U_LB *D_LB / We; // LBMReal dLB = 0; // = length[1] / dx; real rhoLB = 0.0; - //LBMReal nuLB = nu_l; //(uLB*dLB) / Re; + // LBMReal nuLB = nu_l; //(uLB*dLB) / Re; real beta = 12.0 * sigma_LB / interfaceWidth; real kappa = 1.5 * interfaceWidth * sigma_LB; + //double tau0 = 715.218181094648*1000.; // Pa + //double muConcrete = 2.1133054011798826; // [Pa s] + //real u = Uo; //[m/s] + + + //double Bm = (tau0 * D) / (muConcrete * u); + double tau0_LB = 0; + //0.02; + //Bm *nu_h *U_LB / (D / dx); + + SPtr<Rheology> rheo = Rheology::getInstance(); + rheo->setYieldStress(tau0_LB); + + if (myid == 0) { UBLOG(logINFO, "Parameters:"); UBLOG(logINFO, "U_LB = " << U_LB); @@ -171,12 +182,49 @@ void run(string configname) UBLOG(logINFO, "We = " << We); UBLOG(logINFO, "dx = " << dx); UBLOG(logINFO, "sigma = " << sigma); + UBLOG(logINFO, "sigma_LB = " << sigma_LB); + UBLOG(logINFO, "tau0_LB = " << tau0_LB); UBLOG(logINFO, "density ratio = " << r_rho); // UBLOG(logINFO, "number of levels = " << refineLevel + 1); UBLOG(logINFO, "numOfThreads = " << numOfThreads); UBLOG(logINFO, "path = " << pathname); } + // bounding box + + real Lx = factorLx * Dg; + real Ly = factorLy * Dg; + real Lz = factorLz * Dg; + + real g_minX1 = 0; + real g_minX2 = -0.5 * Ly; + real g_minX3 = -0.5 * Lz; + + real g_maxX1 = Lx; + real g_maxX2 = 0.5 * Ly; + real g_maxX3 = 0.5 * Lz; + + //real g_minX1 = -0.5 * Lx; + //real g_minX2 = 0; + //real g_minX3 = -0.5 * Lz; + + //real g_maxX1 = 0.5 * Lx; + //real g_maxX2 = Ly; + //real g_maxX3 = 0.5 * Lz; + + //real g_minX1 = -0.5 * Lx; + //real g_minX2 = -0.5 * Ly; + //real g_minX3 = 0; + + //real g_maxX1 = 0.5 * Lx; + //real g_maxX2 = 0.5 * Ly; + //real g_maxX3 = Lz; + + + // double g_maxX1 = 8.0*D; + // double g_maxX2 = 2.5*D; + // double g_maxX3 = 2.5*D; + SPtr<LBMUnitConverter> conv(new LBMUnitConverter()); // const int baseLevel = 0; @@ -188,10 +236,12 @@ void run(string configname) // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsCumulantLBMKernel()); // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsVelocityCumulantLBMKernel()); // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); - //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); - kernel = SPtr<LBMKernel>(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseSimpleVelocityBaseExternalPressureLBMKernel()); + kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + //kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); - kernel->setWithForcing(true); + kernel->setWithForcing(false); kernel->setForcingX1(0.0); kernel->setForcingX2(0.0); kernel->setForcingX3(0.0); @@ -208,7 +258,8 @@ void run(string configname) kernel->setMultiphaseModelParameters(beta, kappa); kernel->setContactAngle(theta); kernel->setInterfaceWidth(interfaceWidth); - //dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0); + // dynamicPointerCast<MultiphasePressureFilterLBMKernel>(kernel)->setPhaseFieldBC(0.0); + kernel->setSigma(sigma_LB); SPtr<BCSet> bcProc(new BCSet()); // BCSetPtr bcProc(new ThinWallBCSet()); @@ -221,8 +272,7 @@ void run(string configname) // grid->setPeriodicX3(true); grid->setGhostLayerWidth(2); - SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor( - comm, MetisPartitioningGridVisitor::LevelBased, DIR_MMM, MetisPartitioner::RECURSIVE)); + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_MMM, MetisPartitioner::RECURSIVE)); ////////////////////////////////////////////////////////////////////////// // restart @@ -240,31 +290,37 @@ void run(string configname) // BC Adapter ////////////////////////////////////////////////////////////////////////////// mu::Parser fctF1; - // fctF1.SetExpr("vy1*(1-((x1-x0)^2+(x3-z0)^2)/(R^2))"); - // fctF1.SetExpr("vy1*(1-(sqrt((x1-x0)^2+(x3-z0)^2)/R))^0.1"); - fctF1.SetExpr("vy1"); - fctF1.DefineConst("vy1", 0.0); - fctF1.DefineConst("R", 8.0); - fctF1.DefineConst("x0", 0.0); - fctF1.DefineConst("z0", 0.0); - // SPtr<BC> velBCF1( - // new MultiphaseVelocityBC(false, true, false, fctF1, phiH, 0.0, BCFunction::INFCONST)); + //u_actual(r) = U_max * (4 / (D^2) * (R^2 - r^2)) + //fctF1.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))"); + //fctF1.SetExpr("vx1*(1-(sqrt((x2-y0)^2+(x3-z0)^2))/(R))"); + //fctF1.SetExpr("vy1*(1-(sqrt((x2-x0)^2+(x3-z0)^2)/R))^0.1"); + fctF1.SetExpr("vx1"); + //fctF1.DefineConst("vx1", 0); + fctF1.DefineConst("vx1", U_LB); + fctF1.DefineConst("R", 0.5*Dg); + fctF1.DefineConst("y0", (g_minX2+g_maxX2)/2); + fctF1.DefineConst("z0", (g_minX3+g_maxX3)/2); + SPtr<BC> velBCF1(new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, BCFunction::INFCONST)); mu::Parser fctF2; - fctF2.SetExpr("vy1"); - fctF2.DefineConst("vy1", U_LB); + fctF2.SetExpr("vx1"); + fctF2.DefineConst("vx1", U_LB); + fctF2.SetExpr("vx1"); + fctF2.DefineConst("vx1", U_LB); - real startTime = 1; - SPtr<BC> velBCF1( - new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, startTime)); - SPtr<BC> velBCF2( - new MultiphaseVelocityBC(true, false, false, fctF2, phiH, startTime, endTime)); + // real startTime = 1; + // SPtr<BC> velBCF1(new MultiphaseVelocityBC(true, false, false, fctF1, phiH, 0.0, startTime)); + //SPtr<BC> velBCF2(new MultiphaseVelocityBC(true, false, false, fctF2, phiH, startTime, endTime)); + SPtr<BC> velBCF2(new MultiphaseVelocityBC(true, false, false, fctF2, phiL, 0.0, BCFunction::INFCONST)); SPtr<BC> noSlipBC(new NoSlipBC()); noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); SPtr<BC> denBC(new DensityBC(rhoLB)); - denBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + denBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> slipBC(new SlipBC()); + slipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseSlipBCStrategy())); mu::Parser fctPhi_F1; fctPhi_F1.SetExpr("phiH"); @@ -279,70 +335,69 @@ void run(string configname) fctvel_F2_init.DefineConst("U", 0); velBCF1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + velBCF2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; bcVisitor.addBC(noSlipBC); - bcVisitor.addBC(denBC); // Ohne das BB? + //bcVisitor.addBC(slipBC); + bcVisitor.addBC(denBC); bcVisitor.addBC(velBCF1); + //bcVisitor.addBC(velBCF2); - //SPtr<D3Q27Interactor> inflowF1Int; - //SPtr<D3Q27Interactor> cylInt; + // SPtr<D3Q27Interactor> inflowF1Int; + // SPtr<D3Q27Interactor> cylInt; SPtr<D3Q27Interactor> inflowInt; - if (newStart) { + //if (newStart) { // if (newStart) { - // bounding box - real g_minX1 = 0; - real g_minX2 = 0; - real g_minX3 = 0; - //double g_maxX1 = 8.0*D; - //double g_maxX2 = 2.5*D; - //double g_maxX3 = 2.5*D; - - real g_maxX1 = 1.0 * D; // 8.0 * D; - real g_maxX2 = 2.0 * D; - real g_maxX3 = 2.0 * D; // geometry SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); - if (myid == 0) - GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", - WbWriterVtkXmlBinary::getInstance()); - - //if (myid == 0) - // UBLOG(logINFO, "Read geoFile:start"); - //SPtr<GbTriFaceMesh3D> cylinder = make_shared<GbTriFaceMesh3D>(); - //cylinder->readMeshFromSTLFileBinary(pathGeo + "/" + geoFile, false); - //GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance()); - //if (myid == 0) - // UBLOG(logINFO, "Read geoFile:stop"); - // inflow - // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2 - 0.5 * dx, g_minX3, g_maxX1, g_minX2 - 1.0 * - // dx, g_maxX3)); - //GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1 * 0.5 - dx, g_minX2 - dx, g_minX3 * 0.5 - dx, - // g_maxX1 * 0.5 + dx, g_minX2, g_maxX3 * 0.5 + dx)); - //if (myid == 0) - // GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1", - // WbWriterVtkXmlASCII::getInstance()); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + // if (myid == 0) + // UBLOG(logINFO, "Read geoFile:start"); + // SPtr<GbTriFaceMesh3D> cylinder = make_shared<GbTriFaceMesh3D>(); + // cylinder->readMeshFromSTLFileBinary(pathGeo + "/" + geoFile, false); + // GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/Stlgeo", WbWriterVtkXmlBinary::getInstance()); + // if (myid == 0) + // UBLOG(logINFO, "Read geoFile:stop"); + // inflow + // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1, g_minX2 - 0.5 * dx, g_minX3, g_maxX1, g_minX2 - 1.0 * + // dx, g_maxX3)); + // GbCuboid3DPtr geoInflowF1(new GbCuboid3D(g_minX1 * 0.5 - dx, g_minX2 - dx, g_minX3 * 0.5 - dx, + // g_maxX1 * 0.5 + dx, g_minX2, g_maxX3 * 0.5 + dx)); + // if (myid == 0) + // GbSystem3D::writeGeoObject(geoInflowF1.get(), pathname + "/geo/geoInflowF1", + // WbWriterVtkXmlASCII::getInstance()); + + GbCylinder3DPtr geoInflow(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_minX1, 0.0, 0.0, Dg / 2.0)); + + //GbCylinder3DPtr geoInflow(new GbCylinder3D(0.0, g_minX2 - 2.0 * dx, 0.0, 0.0, g_minX2, 0.0, Dg / 2.0)); + + //GbCylinder3DPtr geoInflow(new GbCylinder3D(0.0, 0.0, g_minX3 - 2.0 * dx, 0.0, 0.0, g_minX3, Dg / 2.0)); - GbCylinder3DPtr geoInflow(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1, - g_maxX2 / 2.0, - g_maxX3 / 2.0, D / 2.0)); - if (myid == 0) - GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", - WbWriterVtkXmlASCII::getInstance()); - GbCylinder3DPtr geoSolid(new GbCylinder3D(g_minX1 - 2.0 * dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1-dx, - g_maxX2 / 2.0, g_maxX3 / 2.0, 1.5*D / 2.0)); - if (myid == 0) - GbSystem3D::writeGeoObject(geoSolid.get(), pathname + "/geo/geoSolid", - WbWriterVtkXmlASCII::getInstance()); + //GbCylinder3DPtr geoSolid(new GbCylinder3D(g_minX1 - 2.0 * dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1+2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, 1.5*D / 2.0)); + //if (myid == 0) GbSystem3D::writeGeoObject(geoSolid.get(), pathname + "/geo/geoSolid", WbWriterVtkXmlASCII::getInstance()); + + SPtr<GbTriFaceMesh3D> meshInflowPipe = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshInflowPipe:start"); + //meshInflowPipe->readMeshFromSTLFileBinary(pathGeo + "/JetTube4.stl", false); + meshInflowPipe->readMeshFromSTLFileBinary(pathGeo + "/JetTubeX50.stl", false); + //meshInflowPipe->readMeshFromSTLFileASCII(pathGeo + "/JetTubeScaled5.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshInflowPipe:end"); + //meshInflowPipe->scale(1e-04, 1e-04, 1e-04); + if (myid == 0) GbSystem3D::writeGeoObject(meshInflowPipe.get(), pathname + "/geo/meshInflowPipe", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrInflowPipe = std::make_shared<D3Q27TriFaceMeshInteractor>(meshInflowPipe, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); // GbCylinder3DPtr cylinder2( // new GbCylinder3D(0.0, g_minX2 - 2.0 * dx / 2.0, 0.0, 0.0, g_minX2 + 4.0 * dx, 0.0, 8.0+2.0*dx)); @@ -352,8 +407,8 @@ void run(string configname) // outflow // GbCuboid3DPtr geoOutflow(new GbCuboid3D(-1.0, -1, -1.0, 121.0, 1.0, 121.0)); // For JetBreakup (Original) // GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1, g_maxX2 - 40 * dx, g_minX3, g_maxX1, g_maxX2, g_maxX3)); - GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3)); - if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); // double blockLength = blocknx[0] * dx; @@ -364,18 +419,17 @@ void run(string configname) grid->setDeltaX(dx); grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); - grid->setPeriodicX1(false); - grid->setPeriodicX2(false); - grid->setPeriodicX3(false); + //grid->setPeriodicX1(false); + //grid->setPeriodicX2(false); + //grid->setPeriodicX3(false); GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); - SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver( - grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); - //SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBC, - // Interactor3D::SOLID, Interactor3D::POINTS)); + // SPtr<Interactor3D> tubes(new D3Q27TriFaceMeshInteractor(cylinder, grid, noSlipBC, + // Interactor3D::SOLID, Interactor3D::POINTS)); // inflowF1Int = // SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, noSlipBC, Interactor3D::SOLID)); @@ -384,64 +438,94 @@ void run(string configname) SPtr<D3Q27Interactor> outflowInt(new D3Q27Interactor(geoOutflow, grid, denBC, Interactor3D::SOLID)); // Create boundary conditions geometry - GbCuboid3DPtr wallXmin( - new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_minX1, g_maxX2 + 2.0*dx, g_maxX3)); + GbCuboid3DPtr wallXmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); GbSystem3D::writeGeoObject(wallXmin.get(), pathname + "/geo/wallXmin", WbWriterVtkXmlASCII::getInstance()); - GbCuboid3DPtr wallXmax( - new GbCuboid3D(g_maxX1, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3)); + GbCuboid3DPtr wallXmax(new GbCuboid3D(g_maxX1, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); GbSystem3D::writeGeoObject(wallXmax.get(), pathname + "/geo/wallXmax", WbWriterVtkXmlASCII::getInstance()); - GbCuboid3DPtr wallZmin( - new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_minX3)); + GbCuboid3DPtr wallZmin(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_minX3)); GbSystem3D::writeGeoObject(wallZmin.get(), pathname + "/geo/wallZmin", WbWriterVtkXmlASCII::getInstance()); - GbCuboid3DPtr wallZmax( - new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_maxX3, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3 + 2.0*dx)); + GbCuboid3DPtr wallZmax(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_maxX3, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3 + 2.0*dx)); GbSystem3D::writeGeoObject(wallZmax.get(), pathname + "/geo/wallZmax", WbWriterVtkXmlASCII::getInstance()); - GbCuboid3DPtr wallYmin( - new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - 2.0*dx, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_minX2, g_maxX3)); + GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_minX2, g_maxX3 + 2.0 * dx)); GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance()); - GbCuboid3DPtr wallYmax( - new GbCuboid3D(g_minX1 - 2.0*dx, g_maxX2, g_minX3 - 2.0*dx, g_maxX1 + 2.0*dx, g_maxX2 + 2.0*dx, g_maxX3)); + GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - 2.0 * dx, g_maxX2, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance()); // Add boundary conditions to grid generator - SPtr<D3Q27Interactor> wallXminInt( - new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallXmaxInt( - new D3Q27Interactor(wallXmax, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallZminInt( - new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallZmaxInt( - new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallYminInt( - new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> wallYmaxInt( - new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); - - //cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCF1, Interactor3D::SOLID)); - //cylInt->addBC(velBCF2); - // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBC, - // Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXminInt(new D3Q27Interactor(wallXmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallXmaxInt(new D3Q27Interactor(wallXmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZminInt(new D3Q27Interactor(wallZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallZmaxInt(new D3Q27Interactor(wallZmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); + + +////////////////////////// + real inflowLength = 10; + real difX2 = (g_maxX2 - g_minX2) / 2.0 - 0.5*Dg; + real difX3 = (g_maxX3 - g_minX3) / 2.0 - 0.5 * Dg; + GbCuboid3DPtr wallInfZmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, g_minX3 + difX3)); + GbSystem3D::writeGeoObject(wallInfZmin.get(), pathname + "/geo/wallInfZmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfZmax(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_maxX3 - difX3, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx)); + GbSystem3D::writeGeoObject(wallInfZmax.get(), pathname + "/geo/wallInfZmax", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfYmin(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_minX2 + difX2, g_maxX3)); + GbSystem3D::writeGeoObject(wallInfYmin.get(), pathname + "/geo/wallInfYmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallInfYmax(new GbCuboid3D(g_minX1 - 2.0 * dx, g_maxX2 - difX2, g_minX3 - 2.0 * dx, g_minX1 + inflowLength * dx, g_maxX2 + 2.0 * dx, g_maxX3)); + GbSystem3D::writeGeoObject(wallInfYmax.get(), pathname + "/geo/wallInfYmax", WbWriterVtkXmlASCII::getInstance()); + + // Add boundary conditions to grid generator + SPtr<D3Q27Interactor> wallInfZminInt(new D3Q27Interactor(wallInfZmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfZmaxInt(new D3Q27Interactor(wallInfZmax, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfYminInt(new D3Q27Interactor(wallInfYmin, grid, noSlipBC, Interactor3D::SOLID)); + SPtr<D3Q27Interactor> wallInfYmaxInt(new D3Q27Interactor(wallInfYmax, grid, noSlipBC, Interactor3D::SOLID)); + + + + //GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0 * dx, g_minX2 + difX2, g_minX3 + difX3, g_minX1 + 2.0 * dx, g_maxX2 - difX2, g_maxX3 - difX3)); + + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance()); + ////////////////////////////////////// + + + + + + // cylInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(cylinder1, grid, velBCF1, Interactor3D::SOLID)); + // cylInt->addBC(velBCF2); + // SPtr<D3Q27Interactor> cyl2Int(new D3Q27Interactor(cylinder2, grid, noSlipBC, + // Interactor3D::SOLID)); inflowInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, velBCF1, Interactor3D::SOLID)); - inflowInt->addBC(velBCF2); + //inflowInt->addBC(velBCF2); + + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(g_minX1 - 2.0*dx, g_maxX2 / 2.0, g_maxX3 / 2.0, g_minX1, g_maxX2 / 2.0, g_maxX3 / 2.0, D * 0.9 / 2.0)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), pathname + "/geo/geoAirInflow", WbWriterVtkXmlASCII::getInstance()); + SPtr<D3Q27Interactor> inflowAirInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoAirInflow, grid, velBCF2, Interactor3D::SOLID)); + + //SPtr<D3Q27Interactor> solidInt = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBC, Interactor3D::SOLID)); - SPtr<D3Q27Interactor> solidInt = - SPtr<D3Q27Interactor>(new D3Q27Interactor(geoSolid, grid, noSlipBC, Interactor3D::SOLID)); - InteractorsHelper intHelper(grid, metisVisitor, true); + InteractorsHelper intHelper(grid, metisVisitor, false); //intHelper.addInteractor(cylInt); //intHelper.addInteractor(tubes); - intHelper.addInteractor(outflowInt); + //intHelper.addInteractor(outflowInt); // intHelper.addInteractor(cyl2Int); - + intHelper.addInteractor(intrInflowPipe); intHelper.addInteractor(wallXminInt); - //intHelper.addInteractor(wallXmaxInt); + intHelper.addInteractor(wallXmaxInt); intHelper.addInteractor(wallZminInt); intHelper.addInteractor(wallZmaxInt); intHelper.addInteractor(wallYminInt); intHelper.addInteractor(wallYmaxInt); + + //intHelper.addInteractor(wallInfZminInt); + //intHelper.addInteractor(wallInfZmaxInt); + //intHelper.addInteractor(wallInfYminInt); + //intHelper.addInteractor(wallInfYmaxInt); + intHelper.addInteractor(inflowInt); - //intHelper.addInteractor(solidInt); + //intHelper.addInteractor(outflowInt); + //intHelper.addInteractor(inflowAirInt); intHelper.selectBlocks(); @@ -450,13 +534,10 @@ void run(string configname) unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); int ghostLayer = 3; - unsigned long long numberOfNodesPerBlock = - (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]); + unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]); unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock; - unsigned long long numberOfNodesPerBlockWithGhostLayer = - numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); - real needMemAll = - real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); + unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + real needMemAll = real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); real needMem = needMemAll / real(comm->getNumberOfProcesses()); if (myid == 0) { @@ -478,93 +559,70 @@ void run(string configname) grid->accept(kernelVisitor); - //if (refineLevel > 0) { - // SetUndefinedNodesBlockVisitor undefNodesVisitor; - // grid->accept(undefNodesVisitor); + //if (!newStart) { + // rcp->readBlocks((int)restartStep); + // grid->accept(metisVisitor); + // rcp->readDataSet((int)restartStep); + // grid->setTimeStep(restartStep); //} intHelper.setBC(); - // initialization of distributions - //mu::Parser fct1; - //fct1.SetExpr("phiL"); - //fct1.DefineConst("phiL", phiL); - real x1c = 0; // (g_maxX1 - g_minX1-1)/2; // - real x2c = (g_maxX2 - g_minX2)/2; - real x3c = (g_maxX3 - g_minX3)/2; - - mu::Parser fct1; - fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); - fct1.DefineConst("x1c", x1c); - fct1.DefineConst("x2c", x2c); - fct1.DefineConst("x3c", x3c); - fct1.DefineConst("radius", 0.5*D); - fct1.DefineConst("interfaceThickness", interfaceWidth*dx); - - MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; - initVisitor.setPhi(fct1); - grid->accept(initVisitor); - /////////////////////////////////////////////////////////////////////////////////////////// - //{ - // std::vector<std::vector<SPtr<Block3D>>> blockVector; - // int gridRank = comm->getProcessID(); - // int minInitLevel = grid->getCoarsestInitializedLevel(); - // int maxInitLevel = grid->getFinestInitializedLevel(); - // blockVector.resize(maxInitLevel + 1); - // for (int level = minInitLevel; level <= maxInitLevel; level++) { - // grid->getBlocks(level, gridRank, true, blockVector[level]); - //} - // for (int level = minInitLevel; level <= maxInitLevel; level++) { - // for (SPtr<Block3D> block : blockVector[level]) { - // if (block) { - // int ix1 = block->getX1(); - // int ix2 = block->getX2(); - // int ix3 = block->getX3(); - // int level = block->getLevel(); - - // for (int dir = 0; dir < D3Q27System::ENDDIR; dir++) { - // SPtr<Block3D> neighBlock = grid->getNeighborBlock(dir, ix1, ix2, ix3, level); - - // if (!neighBlock) { - - // } - // } - // } - // } - //} - // SPtr<Block3D> block = grid->getBlock(0, 0, 0, 0); - // SPtr<LBMKernel> kernel = dynamicPointerCast<LBMKernel>(block->getKernel()); - // SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); - - // for (int ix3 = 0; ix3 <= 13; ix3++) { - // for (int ix2 = 0; ix2 <= 13; ix2++) { - // for (int ix1 = 0; ix1 <= 13; ix1++) { - // if (ix1 == 0 || ix2 == 0 || ix3 == 0 || ix1 == 13 || ix2 == 13 || ix3 == 13) - // bcArray->setUndefined(ix1, ix2, ix3); - // } - // } - // } - //} - //////////////////////////////////////////////////////////////////////////////////////////// + if (newStart) { + + // initialization of distributions + // mu::Parser fct1; + // fct1.SetExpr("phiL"); + // fct1.DefineConst("phiL", phiL); + real x1c = g_minX1 - Dg*5; // (g_maxX1 - g_minX1-1)/2; // + real x2c = (g_minX2 + g_maxX2) / 2; + real x3c = (g_minX3 + g_maxX3) / 2; + + mu::Parser fct1; + fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + //fct1.SetExpr("(0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness))-(0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius2)/interfaceThickness))"); + // fct1.SetExpr("x1 < 4*dx ? (0.5-0.5*tanh(2*(1-4*dx)*(sqrt((x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)) : 0"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("dx", dx); + fct1.DefineConst("radius", 5.0*Dg + (inflowLength-1)*dx /* + 2. * dx*/); + fct1.DefineConst("radius2", Dg / 4.); + fct1.DefineConst("interfaceThickness", interfaceWidth * dx); + + mu::Parser fct2; + // fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1/radius-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + fct2.SetExpr("x1 < 4*dx ? (0.5-0.5*tanh(2*(1-4*dx)*(sqrt((x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)) : 0"); + fct2.DefineConst("x1c", x1c); + fct2.DefineConst("x2c", x2c); + fct2.DefineConst("x3c", x3c); + fct2.DefineConst("dx", dx); + fct2.DefineConst("radius", 0.5 * D /* + 2. * dx*/); + fct2.DefineConst("interfaceThickness", interfaceWidth * dx); + + MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + //initVisitor.setPhi(fct1); + grid->accept(initVisitor); + } + // boundary conditions grid { SPtr<UbScheduler> geoSch(new UbScheduler(1)); - SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( - grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); ppgeo->update(0); ppgeo.reset(); } - if (myid == 0) - UBLOG(logINFO, "Preprocess - end"); - } else { + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + //} else { + if (!newStart) { rcp->restart((int)restartStep); grid->setTimeStep(restartStep); - - if (myid == 0) - UBLOG(logINFO, "Restart - end"); + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppblocks->update(10000); + if (myid == 0) UBLOG(logINFO, "Restart - end"); } - + // TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); // grid->accept(setConnsVisitor); @@ -572,8 +630,8 @@ void run(string configname) grid->accept(bcVisitor); - ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); - //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); SPtr<UbScheduler> visSch(new UbScheduler(outTime)); @@ -581,16 +639,17 @@ void run(string configname) t_ast = 7.19; t = (int)(t_ast/(U_LB/(D_LB))); visSch->addSchedule(t,t,t); //t=7.19 - SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( - grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + // SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( + // grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> pp(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); pp->update(0); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); - SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); - auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); - timeDepBC->addInteractor(inflowInt); + // SPtr<UbScheduler> timeBCSch(new UbScheduler(1, startTime, startTime)); + // auto timeDepBC = make_shared<TimeDependentBCSimulationObserver>(TimeDependentBCSimulationObserver(grid, timeBCSch)); + // timeDepBC->addInteractor(inflowInt); #ifdef _OPENMP omp_set_num_threads(numOfThreads); @@ -600,14 +659,13 @@ void run(string configname) SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); simulation->addSimulationObserver(npr); simulation->addSimulationObserver(pp); - simulation->addSimulationObserver(timeDepBC); + // simulation->addSimulationObserver(timeDepBC); + // simulation->addSimulationObserver(timeDepBC); simulation->addSimulationObserver(rcp); - if (myid == 0) - UBLOG(logINFO, "Simulation-start"); + if (myid == 0) UBLOG(logINFO, "Simulation-start"); simulation->run(); - if (myid == 0) - UBLOG(logINFO, "Simulation-end"); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); } catch (std::exception &e) { cerr << e.what() << endl << flush; } catch (std::string &s) { diff --git a/apps/cpu/JetBreakup/JetBreakup.cpp.new b/apps/cpu/JetBreakup/JetBreakup.cpp.new index 953a8dee8caf0e7972b79138c8480f1883ebdfec..1c03deebdc1c6bfa195735c2cdf1dbb4ba0a8212 100644 --- a/apps/cpu/JetBreakup/JetBreakup.cpp.new +++ b/apps/cpu/JetBreakup/JetBreakup.cpp.new @@ -58,7 +58,7 @@ void run(string configname) int caseN = config.getValue<int>("case"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (myid == 0) diff --git a/apps/cpu/LaminarTubeFlow/ltf.cpp b/apps/cpu/LaminarTubeFlow/ltf.cpp index c70c2c19e7a02129ff00f8ca3bd0d7e53894831c..53927b7378db9bfca0693c1808610e0d6b532d66 100644 --- a/apps/cpu/LaminarTubeFlow/ltf.cpp +++ b/apps/cpu/LaminarTubeFlow/ltf.cpp @@ -33,7 +33,7 @@ void run(string configname) real cpStep = config.getValue<real>("cpStep"); bool newStart = config.getValue<bool>("newStart"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -311,7 +311,7 @@ void run(string configname) OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor); grid->accept(setInterConnsVisitor); diff --git a/apps/cpu/LaminarTubeFlowConv/ltf.cpp b/apps/cpu/LaminarTubeFlowConv/ltf.cpp index 53cd7c1ac7900118f47e483f867d22de2e3e7974..d7515d44bfd135d95a103aa758f38e376421b01c 100644 --- a/apps/cpu/LaminarTubeFlowConv/ltf.cpp +++ b/apps/cpu/LaminarTubeFlowConv/ltf.cpp @@ -30,7 +30,7 @@ void run(int tn) int numOfThreads = 1; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "BOMBADIL") diff --git a/apps/cpu/LidDrivenCavity/LidDrivenCavity.cpp b/apps/cpu/LidDrivenCavity/LidDrivenCavity.cpp index 1819ee0f6fe00191f28ddfcab8cce93466047289..01d6262c299f8f49e1e3cfd62ba1d9c39b127080 100644 --- a/apps/cpu/LidDrivenCavity/LidDrivenCavity.cpp +++ b/apps/cpu/LidDrivenCavity/LidDrivenCavity.cpp @@ -80,7 +80,7 @@ int main(int /*argc*/, char* /*argv*/[]) double g_maxX3 = 0.5; // NullCommunicator is a place-holder for interprocess communication - SPtr<vf::mpi::Communicator> comm = NullCommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = NullCommunicator::getInstance(); // new grid object SPtr<Grid3D> grid(new Grid3D(comm)); // set grid spacing diff --git a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp index 969243a0516871033c9c4d001d92468dc0164e8c..5b3f27d2ef7f64fc692750d8480dafea4a69a030 100644 --- a/apps/cpu/LiggghtsApp/LiggghtsApp.cpp +++ b/apps/cpu/LiggghtsApp/LiggghtsApp.cpp @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { //Sleep(30000); - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); diff --git a/apps/cpu/Multiphase/Multiphase (Droplet Test).cpp.backup b/apps/cpu/Multiphase/Multiphase (Droplet Test).cpp.backup index 533fb619c2bb82783b99110894079594b5ddba47..c0ca32e5ce1980af048c769e01aca95c1df9f0dd 100644 --- a/apps/cpu/Multiphase/Multiphase (Droplet Test).cpp.backup +++ b/apps/cpu/Multiphase/Multiphase (Droplet Test).cpp.backup @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -370,8 +370,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -420,8 +420,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/Multiphase (Jet breakup on Phoenix).cpp.backup b/apps/cpu/Multiphase/Multiphase (Jet breakup on Phoenix).cpp.backup index 954d4b539411adb36ea47724ab612fcd8d70be87..d43a61d6767b4193f443bcb1fede89cf3f37bc5f 100644 --- a/apps/cpu/Multiphase/Multiphase (Jet breakup on Phoenix).cpp.backup +++ b/apps/cpu/Multiphase/Multiphase (Jet breakup on Phoenix).cpp.backup @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -396,8 +396,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -446,8 +446,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/Multiphase.cpp b/apps/cpu/Multiphase/Multiphase.cpp index 79d969dd93c5bd87b0d327f5275d2c6b9a8a1448..07b5a661f2c6ead2c57d09b2c05869f86058d1ad 100644 --- a/apps/cpu/Multiphase/Multiphase.cpp +++ b/apps/cpu/Multiphase/Multiphase.cpp @@ -55,7 +55,7 @@ void run(string configname) real beta = 12 * sigma / interfaceWidth; real kappa = 1.5 * interfaceWidth * sigma; - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (myid == 0) diff --git a/apps/cpu/Multiphase/backup/CumulantKernel-Before Cumulant modifications.cpp b/apps/cpu/Multiphase/backup/CumulantKernel-Before Cumulant modifications.cpp index 860a1f1128fb161ee502bf8e1989748722a7941b..a667643c51186f3494d4e80018c482494ed8af30 100644 --- a/apps/cpu/Multiphase/backup/CumulantKernel-Before Cumulant modifications.cpp +++ b/apps/cpu/Multiphase/backup/CumulantKernel-Before Cumulant modifications.cpp @@ -1,6 +1,6 @@ #include "MultiphaseCumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include <omp.h> diff --git a/apps/cpu/Multiphase/backup/Multiphase (Droplet Test).cpp b/apps/cpu/Multiphase/backup/Multiphase (Droplet Test).cpp index 3362f66d5b07d1b94fd6c2623af58011ae425905..868b4abfa15b990cfdb418066efda3a7e3c8f91c 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Droplet Test).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Droplet Test).cpp @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -370,8 +370,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -420,8 +420,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (Final before automation).cpp b/apps/cpu/Multiphase/backup/Multiphase (Final before automation).cpp index 5ed66edace35c61fa3244c445fa479db13ccec8f..4b51783592d1ce6f89498313424d342b0766b289 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Final before automation).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Final before automation).cpp @@ -67,7 +67,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -474,8 +474,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -524,8 +524,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (Flow Focusing).cpp b/apps/cpu/Multiphase/backup/Multiphase (Flow Focusing).cpp index a6355a2aa56e0bd85d919250e750427df7662284..c79270b365d36b1b2a5c89f14ab9408592a1ecc4 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Flow Focusing).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Flow Focusing).cpp @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -448,8 +448,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -498,8 +498,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (Jet breakup on Phoenix).cpp b/apps/cpu/Multiphase/backup/Multiphase (Jet breakup on Phoenix).cpp index 954d4b539411adb36ea47724ab612fcd8d70be87..d43a61d6767b4193f443bcb1fede89cf3f37bc5f 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Jet breakup on Phoenix).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Jet breakup on Phoenix).cpp @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -396,8 +396,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -446,8 +446,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (T-Junction).cpp b/apps/cpu/Multiphase/backup/Multiphase (T-Junction).cpp index 1af6f9a19754035d1e4cc1466d80fa0d77de52c7..c213e6366119e8cbb8ca0db20e387b07a642c758 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (T-Junction).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (T-Junction).cpp @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -376,8 +376,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -426,8 +426,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (Thermal).cpp b/apps/cpu/Multiphase/backup/Multiphase (Thermal).cpp index 51ba4463a32740f8b2e07391d1ab174ccb9e7095..4f5417397da1fc043e466f1901ccd727b8831ca4 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Thermal).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Thermal).cpp @@ -51,7 +51,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -417,8 +417,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -467,8 +467,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase (Tube).cpp b/apps/cpu/Multiphase/backup/Multiphase (Tube).cpp index 7e6dfd24a1ba90420891de57a7ba399d5c860e7d..84de9055d3024be2409b12afed7540b38b057bc1 100644 --- a/apps/cpu/Multiphase/backup/Multiphase (Tube).cpp +++ b/apps/cpu/Multiphase/backup/Multiphase (Tube).cpp @@ -42,7 +42,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -305,8 +305,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -352,8 +352,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/Multiphase.cpp b/apps/cpu/Multiphase/backup/Multiphase.cpp index 8b09c15f4f5eb829ca37fce160bbb86ebb92f19d..8a7708c05f1af35028518aa0ca061fc81f3f3de6 100644 --- a/apps/cpu/Multiphase/backup/Multiphase.cpp +++ b/apps/cpu/Multiphase/backup/Multiphase.cpp @@ -78,7 +78,7 @@ void run(string configname) double beta = 12*sigma/interfaceThickness; double kappa = 1.5*interfaceThickness*sigma; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -643,8 +643,8 @@ void run(string configname) grid->accept(initVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); @@ -693,8 +693,8 @@ void run(string configname) //grid->accept(bcVisitor); //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (New VBased).cpp b/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (New VBased).cpp index 1cdf5905cbac12297fc3ab9c759cda726673c508..a0bfe97ba310a8858225b5c344f425121ddd2585 100644 --- a/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (New VBased).cpp +++ b/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (New VBased).cpp @@ -1,6 +1,6 @@ #include "MultiphaseCumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include <omp.h> diff --git a/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (Original Final).cpp b/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (Original Final).cpp index 498d91ff8fb8e0a7ae19000225d82a2d7e757387..c0dcd4d0cf26a41da3ff36195d7d6efeabfe016d 100644 --- a/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (Original Final).cpp +++ b/apps/cpu/Multiphase/backup/MultiphaseCumulantLBMKernel (Original Final).cpp @@ -1,6 +1,6 @@ #include "MultiphaseCumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include <omp.h> diff --git a/apps/cpu/MultiphaseDropletTest/CMakeLists.txt b/apps/cpu/MultiphaseDropletTest/CMakeLists.txt index b70fdf8fb1e93807e7812988374b28a4f9a969b4..c48e517aaad9ff75f6245101ae0a433a2bd49886 100644 --- a/apps/cpu/MultiphaseDropletTest/CMakeLists.txt +++ b/apps/cpu/MultiphaseDropletTest/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(MultiphaseDropletTest) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow FILES droplet.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES droplet.cpp ) diff --git a/apps/cpu/MultiphaseDropletTest/droplet.cpp b/apps/cpu/MultiphaseDropletTest/droplet.cpp index eaa3e550f873113bf2ffdeba4ed8a962ccae5046..1ae1d18996dfd0e3ae7854e349631ed141cbbc58 100644 --- a/apps/cpu/MultiphaseDropletTest/droplet.cpp +++ b/apps/cpu/MultiphaseDropletTest/droplet.cpp @@ -9,6 +9,7 @@ #include "VirtualFluids.h" #include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" using namespace std; @@ -51,7 +52,7 @@ void run(string configname) bool newStart = config.getValue<bool>("newStart"); //double rStep = config.getValue<double>("rStep"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (myid == 0) @@ -141,12 +142,19 @@ void run(string configname) //const int baseLevel = 0; + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(0); + SPtr<LBMKernel> kernel; //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel()); // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel()); //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); - kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + //kernel = make_shared< MultiphaseScaleDistributionLBMKernel>(); + //kernel = SPtr<LBMKernel>(new MultiphaseSharpInterfaceLBMKernel()); + kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); mu::Parser fgr; fgr.SetExpr("-(rho-rho_l)*g_y"); @@ -177,10 +185,15 @@ void run(string configname) SPtr<BC> noSlipBC(new NoSlipBC()); noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + ////////////////////////////////////////////////////////////////////////////////// // BC visitor MultiphaseBoundaryConditionsBlockVisitor bcVisitor; bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(outflowBC); SPtr<Grid3D> grid(new Grid3D(comm)); grid->setDeltaX(dx); @@ -287,12 +300,13 @@ void run(string configname) intHelper.setBC(); // initialization of distributions - real x1c = 2.5 * D; // (g_maxX1 - g_minX1-1)/2; // - real x2c = 12.5 * D; //(g_maxX2 - g_minX2-1)/2; - real x3c = 1.5; //2.5 * D; //(g_maxX3 - g_minX3-1)/2; + real x1c = (g_maxX1 + g_minX1)/2; // + real x2c = (g_maxX2 + g_minX2)/2; + real x3c = (g_maxX3 + g_minX3) / 2; + //1.5; // 2.5 * D; //(g_maxX3 - g_minX3-1)/2; //LBMReal x3c = 2.5 * D; mu::Parser fct1; - fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + fct1.SetExpr("0.5-0.5*tanh(2*(sqrt(0*(x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); fct1.DefineConst("x1c", x1c); fct1.DefineConst("x2c", x2c); fct1.DefineConst("x3c", x3c); @@ -300,7 +314,7 @@ void run(string configname) fct1.DefineConst("interfaceThickness", interfaceThickness); mu::Parser fct2; - fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt(0*(x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); //fct2.SetExpr("uLB"); fct2.DefineConst("uLB", uLB); fct2.DefineConst("x1c", x1c); @@ -312,7 +326,7 @@ void run(string configname) //MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio); MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; initVisitor.setPhi(fct1); - initVisitor.setVx1(fct2); + initVisitor.setVx2(fct2); grid->accept(initVisitor); // boundary conditions grid @@ -381,10 +395,10 @@ void run(string configname) t = (int)(t_ast/std::sqrt(g_y/D)); visSch->addSchedule(t,t,t); //t=9 - SPtr<WriteMultiphaseQuantitiesSimulationObserver> pp(new WriteMultiphaseQuantitiesSimulationObserver( + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> pp(new WriteSharpInterfaceQuantitiesSimulationObserver( grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); - if(grid->getTimeStep() == 0) - pp->update(0); + //if(grid->getTimeStep() == 0) + pp->update(restartStep); SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); diff --git a/apps/cpu/MultiphaseSymmetryTest/CMakeLists.txt b/apps/cpu/MultiphaseSymmetryTest/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f6193c782ed6736fb3398f2ea2b9fb5a674eeb38 --- /dev/null +++ b/apps/cpu/MultiphaseSymmetryTest/CMakeLists.txt @@ -0,0 +1,6 @@ +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(MultiphaseSymmetryTest) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES droplet.cpp ) \ No newline at end of file diff --git a/apps/cpu/MultiphaseSymmetryTest/SymmetryTest.cfg b/apps/cpu/MultiphaseSymmetryTest/SymmetryTest.cfg new file mode 100644 index 0000000000000000000000000000000000000000..18d0a4251c54754dabba2d41a4b93dec167d679f --- /dev/null +++ b/apps/cpu/MultiphaseSymmetryTest/SymmetryTest.cfg @@ -0,0 +1,61 @@ +pathname = d:/temp/SymmetryTest + +numOfThreads =18#6#8#8#8 +availMem = 10e9 + +#Grid + +#boundingBox = 0 256 512 768 0 3 #3 +#boundingBox = 0 32 512 768 0 3 #3 +#boundingBox = 0 256 0 768 0 3 +#boundingBox = 0 256 256 768 0 3 +#blocknx = 16 16 3 + +boundingBox = 0 63 16 63 0 63 + +#blocknx = 256 256 3 +blocknx = 8 8 8#3 + +dx = 1 +refineLevel = 0 + +#SimulationBenchmark +uLB = -0.1 #0.02#0.001#0.01#0.0000001#-0.01#0.01#0.005#0.005 +Re = 10#00#100 +nuL = 1e-2 #1e-2#1e-5 #1e-5# 1.0e-5 #!1e-2 +nuG = 1e-6#1.0e-3# 0.0000015811388300841892 #5e-2 #1e-4 # 1e-8 # 1.16e-4 #!1e-2 +densityRatio = 1000#200#00 +sigma = 1e-3 #1e-12 #1.0850694444444444e-06 #1e-10 #1e-6 # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5 +interfaceThickness = 3#2#2.5#5#4.096 +radius = 8#16 #25.6#51.2 #16 + +#Simulation +#uLB = 0 #0.001#0.005#0.005 +#Re = 15#00000 #3000 +#nuL =1.0e-2#0.000001# 0.0001#1e-4 #1e-5# 1.0e-5 #!1e-2 +#nuG =1.0e-9#1.0e-8# 1.0e-8#0.000001 #0.015811388300841892 #5e-2 #1e-4 # 1e-8 # 1.16e-4 #!1e-2 +#densityRatio = 2000 +#sigma = 1.0e-1#1.0e-4#1.0e-1#1.0850694444444444e-08 #1e-10 #1e-6 # 1e-5 #4.66e-3 #surface tension 1e-4 ./. 1e-5 +#interfaceThickness = 7#3.9#5 #4.096 +#radius = 25.6 +contactAngle = 110.0 +gravity = -0.0001 +#gravity = -1.0348028606838648e-08 #-5.04e-6 +phi_L = 0.0 +phi_H = 1.0 +Phase-field Relaxation = 0.6 +Mobility = 0.02#0.2#0.056 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1 + + +logToFile = false + +newStart = true +restartStep = 10 + +cpStart = 100000 +cpStep = 100000 + +outTime = 100#200#1201 +endTime = 200000#400000 + +rStep = 159990 #160000 \ No newline at end of file diff --git a/apps/cpu/MultiphaseSymmetryTest/droplet.cpp b/apps/cpu/MultiphaseSymmetryTest/droplet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7ae2c6224435c1f576a5f66d99759c9ffd6bd002 --- /dev/null +++ b/apps/cpu/MultiphaseSymmetryTest/droplet.cpp @@ -0,0 +1,464 @@ +#include <iostream> +#include <string> +#include <memory> + +#if defined(__unix__) +#include <stdio.h> +#include <stdlib.h> +#endif + +#include "VirtualFluids.h" +#include "MultiphaseFlow/MultiphaseFlow.h" +#include "NonNewtonianFluids/NonNewtonianFluids.h" + +using namespace std; + +void run(string configname) +{ + using namespace vf::lbm::dir; + + try { + vf::basics::ConfigurationFile config; + config.load(configname); + + string pathname = config.getValue<string>("pathname"); + int numOfThreads = config.getValue<int>("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); + vector<real> boundingBox = config.getVector<real>("boundingBox"); + real uLB = config.getValue<real>("uLB"); + real nuL = config.getValue<real>("nuL"); + real nuG = config.getValue<real>("nuG"); + real densityRatio = config.getValue<real>("densityRatio"); + real sigma = config.getValue<real>("sigma"); + int interfaceThickness = config.getValue<int>("interfaceThickness"); + real radius = config.getValue<real>("radius"); + real theta = config.getValue<real>("contactAngle"); + //double gr = config.getValue<double>("gravity"); + real phiL = config.getValue<real>("phi_L"); + real phiH = config.getValue<real>("phi_H"); + real tauH = config.getValue<real>("Phase-field Relaxation"); + real mob = config.getValue<real>("Mobility"); + + real endTime = config.getValue<real>("endTime"); + real outTime = config.getValue<real>("outTime"); + real availMem = config.getValue<real>("availMem"); + int refineLevel = config.getValue<int>("refineLevel"); + real Re = config.getValue<real>("Re"); + real dx = config.getValue<real>("dx"); + bool logToFile = config.getValue<bool>("logToFile"); + real restartStep = config.getValue<real>("restartStep"); + real cpStart = config.getValue<real>("cpStart"); + real cpStep = config.getValue<real>("cpStep"); + bool newStart = config.getValue<bool>("newStart"); + //double rStep = config.getValue<double>("rStep"); + + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (myid == 0) + UBLOG(logINFO, "Droplet Test: Start!"); + + if (logToFile) { +#if defined(__unix__) + if (myid == 0) { + const char *str = pathname.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) { + stringstream logFilename; + logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + std::string fileName = "./LastTimeStep" + std::to_string((int)boundingBox[1]) + ".txt"; + +//#if defined(__unix__) +// double lastTimeStep = 0; +// //if (!newStart) +// { +// std::ifstream ifstr(fileName); +// ifstr >> lastTimeStep; +// restartStep = lastTimeStep; +// if(endTime >= lastTimeStep) +// endTime = lastTimeStep + rStep; +// else +// return; +// } +//#endif + + //Sleep(30000); + + // LBMReal dLB = 0; // = length[1] / dx; + real rhoLB = 0.0; + real nuLB = nuL; //(uLB*dLB) / Re; + + //diameter of circular droplet + real D = 2.0*radius; + + //density retio + real r_rho = densityRatio; + + //density of heavy fluid + real rho_h = 1.0; + //density of light fluid + real rho_l = rho_h / r_rho; + + //kinimatic viscosity + real nu_h = nuL; + //LBMReal nu_l = nuG; + //#dynamic viscosity + real mu_h = rho_h * nu_h; + + //gravity + real g_y = Re* Re* mu_h* mu_h / (rho_h * (rho_h - rho_l) * D * D * D); + //Eotvos number + real Eo = 100; + //surface tension + sigma = rho_h* g_y* D* D / Eo; + + //g_y = 0; + + real beta = 12.0 * sigma / interfaceThickness; + real kappa = 1.5 * interfaceThickness * sigma; + + if (myid == 0) { + //UBLOG(logINFO, "uLb = " << uLB); + //UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "D = " << D); + UBLOG(logINFO, "nuL = " << nuL); + UBLOG(logINFO, "nuG = " << nuG); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "Eo = " << Eo); + UBLOG(logINFO, "g_y = " << g_y); + UBLOG(logINFO, "sigma = " << sigma); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "Preprocess - start"); + } + + SPtr<LBMUnitConverter> conv(new LBMUnitConverter()); + + //const int baseLevel = 0; + + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(0); + + SPtr<LBMKernel> kernel; + + //kernel = SPtr<LBMKernel>(new MultiphaseScratchCumulantLBMKernel()); + // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel()); + //kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); + //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); + kernel = make_shared< MultiphaseScaleDistributionLBMKernel>(); + //kernel = SPtr<LBMKernel>(new MultiphaseSharpInterfaceLBMKernel()); + //kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + + mu::Parser fgr; + fgr.SetExpr("-(rho-rho_l)*g_y"); + fgr.DefineConst("rho_l", rho_l); + fgr.DefineConst("g_y", g_y); + + //kernel->setWithForcing(true); + //kernel->setForcingX1(fgr); + //kernel->setForcingX2(fgr); + //kernel->setForcingX3(fgr); + + kernel->setPhiL(phiL); + kernel->setPhiH(phiH); + kernel->setPhaseFieldRelaxation(tauH); + kernel->setMobility(mob); + kernel->setInterfaceWidth(interfaceThickness); + + + kernel->setCollisionFactorMultiphase(nuL, nuG); + kernel->setDensityRatio(densityRatio); + kernel->setMultiphaseModelParameters(beta, kappa); + kernel->setContactAngle(theta); + + real sigma_LB = 1e-3; + + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc(new BCSet()); + // BCSetPtr bcProc(new ThinWallBCSet()); + + kernel->setBCSet(bcProc); + + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + + + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(outflowBC); + + SPtr<Grid3D> grid(new Grid3D(comm)); + grid->setDeltaX(dx); + grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + grid->setPeriodicX1(true); + grid->setPeriodicX2(false); + grid->setPeriodicX3(true); + grid->setGhostLayerWidth(2); + + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, DIR_MMM, MetisPartitioner::RECURSIVE)); + + ////////////////////////////////////////////////////////////////////////// + // restart + SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart)); + //SPtr<MPIIORestartSimulationObserver> rcp(new MPIIORestartSimulationObserver(grid, rSch, pathname, comm)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, pathname, comm)); + //SPtr<MPIIOMigrationBESimulationObserver> rcp(new MPIIOMigrationBESimulationObserver(grid, rSch, pathname, comm)); + // rcp->setNu(nuLB); + // rcp->setNuLG(nuL, nuG); + // rcp->setDensityRatio(densityRatio); + + rcp->setLBMKernel(kernel); + rcp->setBCSet(bcProc); + ////////////////////////////////////////////////////////////////////////// + + if (newStart) { + + // bounding box + real g_minX1 = boundingBox[0]; + real g_minX2 = boundingBox[2]; + real g_minX3 = boundingBox[4]; + + real g_maxX1 = boundingBox[1]; + real g_maxX2 = boundingBox[3]; + real g_maxX3 = boundingBox[5]; + + // geometry + SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) + GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", + WbWriterVtkXmlBinary::getInstance()); + + + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + real dx2 = 2.0 * dx; + GbCuboid3DPtr wallYmin(new GbCuboid3D(g_minX1 - dx2, g_minX2 - dx2, g_minX3 - dx2, g_maxX1 + dx2, g_minX2, g_maxX3 + dx2)); + GbSystem3D::writeGeoObject(wallYmin.get(), pathname + "/geo/wallYmin", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr wallYmax(new GbCuboid3D(g_minX1 - dx2, g_maxX2, g_minX3 - dx2, g_maxX1 + dx2, g_maxX2 + dx2, g_maxX3 + dx2)); + GbSystem3D::writeGeoObject(wallYmax.get(), pathname + "/geo/wallYmax", WbWriterVtkXmlASCII::getInstance()); + + SPtr<D3Q27Interactor> wallYminInt(new D3Q27Interactor(wallYmin, grid, outflowBC, Interactor3D::SOLID)); + //outflowBC + SPtr<D3Q27Interactor> wallYmaxInt(new D3Q27Interactor(wallYmax, grid, noSlipBC, Interactor3D::SOLID)); + + SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver( + grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + + InteractorsHelper intHelper(grid, metisVisitor, true); + intHelper.addInteractor(wallYminInt); + intHelper.addInteractor(wallYmaxInt); + intHelper.selectBlocks(); + + ppblocks->update(0); + ppblocks.reset(); + + unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); + int ghostLayer = 5; + unsigned long long numberOfNodesPerBlock = + (unsigned long long)(blocknx[0]) * (unsigned long long)(blocknx[1]) * (unsigned long long)(blocknx[2]); + unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock; + unsigned long long numberOfNodesPerBlockWithGhostLayer = + numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + real needMemAll = + real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); + real needMem = needMemAll / real(comm->getNumberOfProcesses()); + + if (myid == 0) { + UBLOG(logINFO, "Number of blocks = " << numberOfBlocks); + UBLOG(logINFO, "Number of nodes = " << numberOfNodes); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for (int level = minInitLevel; level <= maxInitLevel; level++) { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl); + UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * numberOfNodesPerBlock); + } + UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); + } + + MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nuL, nuG, availMem, needMem); + + grid->accept(kernelVisitor); + + if (refineLevel > 0) { + SetUndefinedNodesBlockVisitor undefNodesVisitor; + grid->accept(undefNodesVisitor); + } + + + intHelper.setBC(); + + // initialization of distributions + real x1c = (g_maxX1 + g_minX1) / 2; // + real x2c = (g_maxX2 + g_minX2) / 2; + real x3c = (g_maxX3 + g_minX3) / 2; + //1.5; // 2.5 * D; //(g_maxX3 - g_minX3-1)/2; + //LBMReal x3c = 2.5 * D; + mu::Parser fct1; + fct1.SetExpr("0.5-0.5*tanh(2*(sqrt((x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("radius", radius); + fct1.DefineConst("interfaceThickness", interfaceThickness); + + mu::Parser fct2; + fct2.SetExpr("0.5*uLB-uLB*0.5*tanh(2*(sqrt(0*(x1-x1c)^2+(x2-x2c)^2+(x3-x3c)^2)-radius)/interfaceThickness)"); + //fct2.SetExpr("uLB"); + fct2.DefineConst("uLB", uLB); + fct2.DefineConst("x1c", x1c); + fct2.DefineConst("x2c", x2c); + fct2.DefineConst("x3c", x3c); + fct2.DefineConst("radius", radius); + fct2.DefineConst("interfaceThickness", interfaceThickness); + + //MultiphaseInitDistributionsBlockVisitor initVisitor(densityRatio); + MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + initVisitor.setPhi(fct1); + initVisitor.setVx2(fct2); + grid->accept(initVisitor); + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver( + grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + if (myid == 0) + UBLOG(logINFO, "Preprocess - end"); + } else { + if (myid == 0) { + UBLOG(logINFO, "Parameters:"); + UBLOG(logINFO, "uLb = " << uLB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nuLb = " << nuLB); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "number of levels = " << refineLevel + 1); + UBLOG(logINFO, "numOfThreads = " << numOfThreads); + UBLOG(logINFO, "path = " << pathname); + } + + rcp->restart((int)restartStep); + grid->setTimeStep(restartStep); + + if (myid == 0) + UBLOG(logINFO, "Restart - end"); + } + + grid->accept(bcVisitor); + + //TwoDistributionsSetConnectorsBlockVisitor setConnsVisitor(comm); + //grid->accept(setConnsVisitor); + + //ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + //grid->accept(setConnsVisitor); + + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + SPtr<UbScheduler> visSch(new UbScheduler(outTime)); + real t_ast, t; + t_ast = 2; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=2 + t_ast = 3; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=3 + t_ast = 4; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=4 + t_ast = 5; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=5 + t_ast = 6; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=6 + t_ast = 7; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=7 + t_ast = 9; + t = (int)(t_ast/std::sqrt(g_y/D)); + visSch->addSchedule(t,t,t); //t=9 + + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> pp(new WriteSharpInterfaceQuantitiesSimulationObserver( + grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + if(grid->getTimeStep() == 0) + pp->update(0); + + SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); + SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); + + omp_set_num_threads(numOfThreads); + + SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); + SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); + simulation->addSimulationObserver(npr); + simulation->addSimulationObserver(pp); + simulation->addSimulationObserver(rcp); + + + if (myid == 0) + UBLOG(logINFO, "Simulation-start"); + simulation->run(); + if (myid == 0) + UBLOG(logINFO, "Simulation-end"); + +//#if defined(__unix__) +// //if (!newStart) +// //{ +// if (myid == 0) +// { +// std::ofstream ostr(fileName); +// ostr << endTime; +// cout << "start sbatch\n"; +// //system("./start.sh"); +// //system("echo test!"); +// std::string str = "sbatch startJob" + std::to_string((int)boundingBox[1]) + ".sh"; +// //system("sbatch startJob512.sh"); +// system(str.c_str()); +// } +// //MPI_Barrier((MPI_Comm)comm->getNativeCommunicator()); +// //} +//#endif + + } catch (std::exception &e) { + cerr << e.what() << endl << flush; + } catch (std::string &s) { + cerr << s << endl; + } catch (...) { + cerr << "unknown exception" << endl; + } +} +int main(int argc, char *argv[]) +{ + // Sleep(30000); + if (argv != NULL) { + if (argv[1] != NULL) { + run(string(argv[1])); + } else { + cout << "Configuration file is missing!" << endl; + } + } +} diff --git a/apps/cpu/Nozzle/CMakeLists.txt b/apps/cpu/Nozzle/CMakeLists.txt index f9e90c7e95115d4b4dfc436721a192100ad95e98..9764934d46b39abca2ceda133e3434a78980f294 100644 --- a/apps/cpu/Nozzle/CMakeLists.txt +++ b/apps/cpu/Nozzle/CMakeLists.txt @@ -1,3 +1,3 @@ PROJECT(Nozzle) -vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow NonNewtonianFluids FILES nozzle.cpp ) +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow NonNewtonianFluids FILES nozzleSinglePhase.cpp ) diff --git a/apps/cpu/Nozzle/nozzle.cpp b/apps/cpu/Nozzle/nozzle.cpp.1 similarity index 91% rename from apps/cpu/Nozzle/nozzle.cpp rename to apps/cpu/Nozzle/nozzle.cpp.1 index babee1900c0bd9bb10bca3bccd790e83d25d14b8..57bac14e13ce30981e2572d5570e869eab1f253f 100644 --- a/apps/cpu/Nozzle/nozzle.cpp +++ b/apps/cpu/Nozzle/nozzle.cpp.1 @@ -14,11 +14,11 @@ using namespace std; int main(int argc, char *argv[]) { - // Sleep(30000); + //Sleep(30000); try { - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); // bounding box @@ -42,11 +42,11 @@ int main(int argc, char *argv[]) double g_minX1 = -1.31431; double g_minX2 = 0.375582; - double g_minX3 = 0.1; //-210e-3 - 0.2 - 6e-3; //- 1e-3; + double g_minX3 = -0.21; //-210e-3 - 0.2 - 6e-3; //- 1e-3; double g_maxX1 = -1.28831; double g_maxX2 = 0.401582; - double g_maxX3 = 0.206; + double g_maxX3 = 0.175;//0.21; int blockNX[3] = { 26, 26, 35 }; @@ -126,8 +126,8 @@ int main(int argc, char *argv[]) if (myid == 0) VF_LOG_INFO("Yield stress = {} Pa", tau0); if (myid == 0) VF_LOG_INFO("Yield stress LB = {} ", tau0_LB); - // SPtr<BC> noSlipBC(new NoSlipBC()); - // noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + //SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); SPtr<BC> noSlipBC(new NoSlipBC()); noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); @@ -161,8 +161,8 @@ int main(int argc, char *argv[]) // fct.DefineConst("U", uLB_ref * ((N + 3) / (N + 1))); // fct.DefineConst("NplusOne", N + 1.0); - // SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); - // inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); + //inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); SPtr<BC> inflowConcreteBC(new MultiphaseVelocityBC(false, false, true, fct, phiH, 0, BCFunction::INFCONST)); inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); @@ -444,13 +444,15 @@ int main(int argc, char *argv[]) bcVisitor.addBC(noSlipBC); bcVisitor.addBC(inflowConcreteBC); bcVisitor.addBC(inflowAirBC1); - //bcVisitor.addBC(outflowBC); + bcVisitor.addBC(outflowBC); // SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); // SPtr<LBMKernel> kernel = make_shared<CumulantK17LBMKernel>(); // SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(); // SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(); - SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + SPtr<LBMKernel> kernel = make_shared<IBsharpInterfaceLBMKernel>(); kernel->setWithForcing(false); kernel->setForcingX1(0.0); @@ -482,7 +484,7 @@ int main(int argc, char *argv[]) string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo"; - string outputPath = "f:/temp/NozzleFlowTest_SharpInterface_OutflowPress"; + string outputPath = "d:/temp/NozzleFlowTest_SharpInterface_With_Part_fraction_0.23"; UbSystem::makeDirectory(outputPath); UbSystem::makeDirectory(outputPath + "/liggghts"); @@ -492,6 +494,44 @@ int main(int argc, char *argv[]) // UbLog::output_policy::setStream(logFilename.str()); // } + ///////////////////////////////////////////////////////////////////// + //LIGGGHTS things + ///////////////////////////////////////////////////////////////////// + string inFile1 = "d:/Projects/TRR277/Project/WP4/Config/in.nozzle"; + // string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem"; + MPI_Comm mpi_comm = *(MPI_Comm *)(comm->getNativeCommunicator()); + LiggghtsCouplingWrapper wrapper(argv, mpi_comm); + + double v_frac = 0.1; + double dt_phys = units->getFactorTimeLbToW(); + int demSubsteps = 10; + double dt_dem = dt_phys / (double)demSubsteps; + int vtkSteps = 1000; + string demOutDir = outputPath + "/liggghts"; + + // wrapper.execCommand("echo none"); + + // wrapper.execFile((char*)inFile1.c_str()); + + //// set timestep and output directory + wrapper.setVariable("t_step", dt_dem); + wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); + wrapper.setVariable("dmp_dir", demOutDir); + + wrapper.execFile((char *)inFile1.c_str()); + //wrapper.runUpto(demSubsteps - 1); + // wrapper.runUpto(1000); + + //LatticeDecomposition lDec((g_maxX1 - g_minX1) / dx, (g_maxX2 - g_minX2) / dx, (g_maxX3 - g_minX3) / dx, wrapper.lmp, grid); + + SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, unitsAir); + //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(std::ceil((g_maxX1 - g_minX1) / dx), std::ceil((g_maxX2 - g_minX2) / dx), std::ceil((g_maxX3 - g_minX3) / dx), wrapper.lmp); + SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(26,26,420, wrapper.lmp); + + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::DIR_MMM, MetisPartitioner::RECURSIVE)); SPtr<GbObject3D> gridCube = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3); @@ -557,7 +597,8 @@ int main(int argc, char *argv[]) SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBC, Interactor3D::INVERSESOLID)); /////////////////////////////////////////////////////////// // inflow - GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.20105, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.23, 0.013)); + //GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.20105, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.23, 0.013)); + GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.175, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.21, 0.013)); if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlBinary::getInstance()); SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, Interactor3D::SOLID)); /////////////////////////////////////////////////////////// @@ -628,7 +669,7 @@ int main(int argc, char *argv[]) SPtr<Interactor3D> intAirInlet6 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet6, grid, inflowAirBC6, Interactor3D::SOLID, Interactor3D::POINTS); /////////////////////////////////////////////////////////// - InteractorsHelper intHelper(grid, metisVisitor, true); + InteractorsHelper intHelper(grid, partVisitor, false); intHelper.addInteractor(intrFluidArea); intHelper.addInteractor(intrNozzleVolcanNozzle2); @@ -658,10 +699,11 @@ int main(int argc, char *argv[]) // if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses())); - // SetKernelBlockVisitor kernelVisitor(kernel, nuLB, comm->getNumberOfProcesses()); + //SetKernelBlockVisitor kernelVisitor(kernel, nu_l_LB, comm->getNumberOfProcesses()); MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1); grid->accept(kernelVisitor); + intHelper.setBC(); // InitDistributionsBlockVisitor initVisitor; @@ -669,9 +711,10 @@ int main(int argc, char *argv[]) double x1c = -1.31431 + R; double x2c = 0.375582 + R; - double x3c = 0.20105; + double Ri = 5; + double x3c = 0.136 + Ri; - R = 0.2 - 0.145; // 0.078-0.04; // 0.2; + //R = 0.2 - 0.145; // 0.078-0.04; // 0.2; mu::Parser fct1; // fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); @@ -679,40 +722,15 @@ int main(int argc, char *argv[]) fct1.DefineConst("x1c", x1c); fct1.DefineConst("x2c", x2c); fct1.DefineConst("x3c", x3c); - fct1.DefineConst("radius", R); + fct1.DefineConst("radius", Ri); fct1.DefineConst("interfaceThickness", interfaceThickness * dx); MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; initVisitor.setPhi(fct1); grid->accept(initVisitor); - string inFile1 = "d:/Projects/VirtualFluids_Develop/apps/cpu/Nozzle/in.nozzle"; - //string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem"; - MPI_Comm mpi_comm = *(MPI_Comm*)(comm->getNativeCommunicator()); - LiggghtsCouplingWrapper wrapper(argv, mpi_comm); - - double v_frac = 0.1; - double dt_phys = units->getFactorTimeLbToW(); - int demSubsteps = 10; - double dt_dem = dt_phys / (double)demSubsteps; - int vtkSteps = 100; - string demOutDir = outputPath + "/liggghts"; - - //wrapper.execCommand("echo none"); - - //wrapper.execFile((char*)inFile1.c_str()); - - //// set timestep and output directory - wrapper.setVariable("t_step", dt_dem); - wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); - wrapper.setVariable("dmp_dir", demOutDir); - - //wrapper.execFile((char *)inFile1.c_str()); - //wrapper.runUpto(demSubsteps - 1); - //wrapper.runUpto(1000); - - SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); - SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, units); + //InitDistributionsBlockVisitor initVisitor; + //grid->accept(initVisitor); // boundary conditions grid { @@ -724,12 +742,12 @@ int main(int argc, char *argv[]) grid->accept(bcVisitor); - // OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + //OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); - int numOfThreads = 18; + int numOfThreads = 1; omp_set_num_threads(numOfThreads); SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100); @@ -739,12 +757,16 @@ int main(int argc, char *argv[]) SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); // SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800)); // visSch->addSchedule(1, 8700, 8800); - SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); + + //SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); int endTime = 10000000; SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); simulation->addSimulationObserver(nupsSimulationObserver); - // Simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(lcSimulationObserver); simulation->addSimulationObserver(writeMQSimulationObserver); if (myid == 0) UBLOG(logINFO, "Simulation-start"); diff --git a/apps/cpu/Nozzle/nozzleSinglePhase.cpp b/apps/cpu/Nozzle/nozzleSinglePhase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe70ce94516a60ed17b559b3b8470b77341f7aaa --- /dev/null +++ b/apps/cpu/Nozzle/nozzleSinglePhase.cpp @@ -0,0 +1,799 @@ +#include <iostream> +#include <memory> +#include <string> + +#include "VirtualFluids.h" + +#include "LiggghtsCoupling/LiggghtsCoupling.h" + +#include "MultiphaseFlow/MultiphaseFlow.h" + +#include "NonNewtonianFluids/NonNewtonianFluids.h" + +using namespace std; + +int main(int argc, char *argv[]) +{ + //Sleep(30000); + + try { + + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + // bounding box + // double g_minX1 = -1341.81e-3; + // double g_minX2 = 348.087e-3; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3; + // double g_maxX2 = 429.087e-3; + // double g_maxX3 = 214.5e-3; + + // double g_minX1 = -1341.81e-3 + 10e-3; + // double g_minX2 = 0.360872; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3 - 10e-3; + // double g_maxX2 = 0.416302; + // double g_maxX3 = 210e-3; + + // int blockNX[3] = { 10, 10, 10 }; + + double g_minX1 = -1.31431; + double g_minX2 = 0.375582; + double g_minX3 = -0.21 + 0.035 * 8.0; //-0.21; //-210e-3 - 0.2 - 6e-3; //- 1e-3; + + double g_maxX1 = -1.28831; + double g_maxX2 = 0.401582; + double g_maxX3 = 0.175;//0.21; + + //int blockNX[3] = { 26, 26, 35 }; + int blockNX[3] = { 26, 26, 35/5 }; + + double dx = 1e-3; + + double uLB_ref = 0.0001; + // double rhoLB = 0.0; + + // concrete + double d_part = 1e-3; + double V = 0.4*10.; // flow rate [m^3/h] + double D = 0.026; // shotcrete inlet diameter [m] + double R = D / 2.0; // radius [m] + double A = UbMath::PI * R * R; + double u = V / 3600 / A; + double muConcrete = 2.1133054011798826; // [Pa s] + double rhoAir = 1.2041; // [kg/m^3] + double tau0 = 715.218181094648; // Pa + double rhoConcrete = 2400; // [kg/m^3] + double nu = muConcrete / rhoConcrete; + + // double Re_D = d_part * u / nu; + // if (myid == 0) UBLOG(logINFO, "Re_D = " << Re_D); + // + SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uLB_ref); + if (myid == 0) std::cout << units->toString() << std::endl; + + double interfaceThickness = 3; // 4.096; + double sigma = 0.3; //0.03; + double Re = rhoConcrete * u * d_part / muConcrete; + double We = rhoConcrete * u * u * d_part / sigma; + + double u_LB_con = u * units->getFactorVelocityWToLb(); + double nu_h_LB = nu * units->getFactorViscosityWToLb(); // uLB_ref * d_part * units->getFactorLentghWToLb() / Re; + double nu_l_LB = 0; // = nu_h_LB; + + double rho_h_LB = 1; + + // surface tension + double sigma_LB = rho_h_LB *u_LB_con *u_LB_con *d_part * units->getFactorLentghWToLb() / We; + + // LBMReal dLB = 0; // = length[1] / dx; + LBMReal rhoLB = 0.0; + // LBMReal nuLB = nu_l; //(uLB_ref*dLB) / Re; + + double beta = 12.0 * sigma_LB / interfaceThickness; + double kappa = 1.5 * interfaceThickness * sigma_LB; + + double phiL = 0.0; + double phiH = 1.0; + double tauH = 0.6; // Phase - field Relaxation + double mob = 0.02; // Mobility + // double nuL = 1e-2; + // double nuG = 0.015811388300841892; + double densityRatio = rhoConcrete / rhoAir; + // double sigma_old = 1.0850694444444444e-06; + // + // double beta_old = 12.0 * sigma / interfaceThickness; + // double kappa_old = 1.5 * interfaceThickness * sigma; + + double theta = 110; // contact angle + + // https://civilsir.com/density-of-cement-sand-and-aggregate-in-kg-m3-list-of-material-density/ + + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uRef); + + double Bm = (tau0 * d_part) / (muConcrete * u); + double tau0_LB = Bm * nu_h_LB * u_LB_con / (d_part * units->getFactorLentghWToLb()); + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(tau0_LB); + + if (myid == 0) VF_LOG_INFO("Yield stress = {} Pa", tau0); + if (myid == 0) VF_LOG_INFO("Yield stress LB = {} ", tau0_LB); + + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + //SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + // concrete inflow boundary condition + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", -u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} m/s", u); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} dx/dt", u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete Re = {}", Re); + + // // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // // Mechanics, 21(6), 371-379. + // double cx1 = -1.31431 + R; + // double cx2 = 0.375582 + R; + // //double cx3 = 0.20105 + R; + // double L = g_maxX1 - g_minX1; + // double p_concrete = 1e5; // Pa = 1 Bar + // double p1 = p_concrete * units->getFactorPressureWToLb(); + // double p2 = 0.0; + // double drhoLB = 1.0 + rhoLB; + // double muLB = drhoLB * nuLB; + // double N = R * R / 2 * muLB * uLB_ref * (p1 - p2) / L - 3; + + // // mu::Parser fct; + // fct.SetExpr("U*(1-(((((x2-y0)^2+(x1-x0)^2)^0.5)/R)^NplusOne))"); + // fct.DefineConst("x0", cx1); + // fct.DefineConst("y0", cx2); + // //fct.DefineConst("z0", cx3); + // fct.DefineConst("R", R); + // fct.DefineConst("U", uLB_ref * ((N + 3) / (N + 1))); + // fct.DefineConst("NplusOne", N + 1.0); + + SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); + inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowConcreteBC(new MultiphaseVelocityBC(false, false, true, fct, phiH, 0, BCFunction::INFCONST)); + //inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // air inflow boundary condition + // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // Mechanics, 21(6), 371-379. + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + // double V = 40; // flow rate [m^3/h] + // double D = 0.0166; // air inlet diameter [m] + // double R = D / 2.0; // radius [m] + // double A = UbMath::PI * R * R; + // double u = V / 3600 / A; + // double uLB_ref = u * unitsAir->getFactorVelocityWToLb(); + //// double cx1 = -1.2788 + R; + // double cx2 = 0.3803 + R; + // double cx3 = 0.1517 + R; + // double L = g_maxX1 - g_minX1; + // double p_air = 7e5; // Pa = 7 Bar + // double p1 = p_air; + // double p2 = 0.0; + // double mu = 17.2e-6; // Pa s, air 20° C + // double N = R * R / 2 * mu * u * (p1 - p2) / L - 3; + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u); + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_ref); + // + + // double nu = mu / rhoConcrete; + // double Re = d_part * u / nu; + // if (myid == 0) VF_LOG_INFO("Re_air = {}", Re); + + // double nuLB = d_part * unitsAir->getFactorLentghWToLb() * uLB_ref / Re; + // if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB); + // nu_l_LB = nuLB; + + SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + //SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + double V_air = 40./6.; // flow rate [m^3/h] //10. + double D_air = 0.00553; // air inlet diameter [m] + double R_air = D_air / 2.0; // radius [m] + double A_air = UbMath::PI * (R_air * R_air); + double u_air = V_air / 3600 / A_air; + double uLB_air = u_air * unitsAir->getFactorVelocityWToLb(); + // double cx1 = -1.2788 + R; + double cx2 = 0.385822 + R_air; + double cx3 = 0.135562 + R_air; + double L_air = 0.00747; + double p_air = 7e5; // Pa = 7 Bar + double p1 = p_air; + double p2 = 1e5; + double mu_air = 17.2e-6; // Pa s, air 20° C + double rho_air = 1.2041; // [kg/m^3] + double Re_inlet = D_air * u_air * rho_air / mu_air; + double lambda = 0.3164 / pow(Re_inlet, 0.25); + double deltaP = (lambda / (2. * R_air)) * (rho_air * pow(u_air, 2) / 2.); // Darcy friction factor (Rohrreibungszahl) + double N = pow(R_air, 2) / (2. * mu_air * u_air) * deltaP - 3.; + // double N = R_air * R_air / 2 * mu_air * u_air * (p1 - p2) / L_air - 3; + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u_air); + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_air); + + double nu_air = mu_air / rho_air; + double Re_air = d_part * u_air / nu_air; + if (myid == 0) VF_LOG_INFO("Air Re = {}", Re_air); + + double nuLB_air = nu_air * unitsAir->getFactorViscosityWToLb(); // d_part * unitsAir->getFactorLentghWToLb() * uLB_air / Re_air; + if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB_air); + nu_l_LB = nuLB_air; + + if (myid == 0) VF_LOG_INFO("nu_h = {}", nu_h_LB); + if (myid == 0) VF_LOG_INFO("nu_l = {}", nu_l_LB); + if (myid == 0) VF_LOG_INFO("sigma_LB = {}", sigma_LB); + + double p_air_LB = p_air * unitsAir->getFactorPressureWToLb(); + if (myid == 0) VF_LOG_INFO("p_air_LB = {}", p_air_LB); + + // mu::Parser fctVx1; + ////fctVx1.SetExpr("U"); + ////fctVx1.DefineConst("U", uLB_air); + // mu::Parser fctVx2; + // fctVx2.SetExpr("U"); + // fctVx2.DefineConst("U", 0); + // mu::Parser fctVx3; + ////fctVx3.SetExpr("U"); + ////fctVx3.DefineConst("U", -uLB_air); + + double cx1 = 0; + double alpha = 0; + double gamma = 0; + double U = uLB_air;// * ((N + 3.) / (N + 1.)); + + mu::Parser fctVx1; + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + // fctVx1.SetExpr("(((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5/R)^NplusOne"); + fctVx1.SetExpr("U*cos(alpha*_pi/180)"); + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("R", R_air); + fctVx1.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx1.DefineConst("NplusOne", N + 1.0); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + + mu::Parser fctVx2; + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx2.SetExpr("U*sin(alpha*_pi/180)"); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("R", R_air); + fctVx2.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx2.DefineConst("NplusOne", N + 1.0); + fctVx2.DefineConst("alpha", alpha); + + mu::Parser fctVx3; + //fctVx3.SetExpr("U*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx3.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx3.SetExpr("U"); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("R", R_air); + fctVx3.DefineConst("U", -U); //* ((N + 3.) / (N + 1.))); + fctVx3.DefineConst("NplusOne", N + 1.0); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + // SPtr<BC> inflowAirBC1(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + // t = U * sin(alpha * _pi / 180) * (1 - (((((x1 - x0) ^ 2 + (x2 - y0) ^ 2 + (x3 - z0) ^ 2) ^ 0.5) / R) ^ NplusOne)); + cx1 = -1.31416; + cx2 = 0.388684; + cx3 = 0.138177; + alpha = 0; + gamma = 225; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx2.DefineConst("gamma", gamma); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + SPtr<BC> inflowAirBC1(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC1(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + fctVx1.DefineVar("x1", &cx1); + fctVx1.DefineVar("x2", &cx2); + fctVx1.DefineVar("x3", &cx3); + fctVx2.DefineVar("x1", &cx1); + fctVx2.DefineVar("x2", &cx2); + fctVx2.DefineVar("x3", &cx3); + fctVx3.DefineVar("x1", &cx1); + fctVx3.DefineVar("x2", &cx2); + fctVx3.DefineVar("x3", &cx3); + + if (myid == 0) { + + VF_LOG_INFO("fctVx1 = {}", fctVx1.Eval()); + VF_LOG_INFO("fctVx2 = {}", fctVx2.Eval()); + VF_LOG_INFO("fctVx3 = {}", fctVx3.Eval()); + VF_LOG_INFO("N = {}", N); + VF_LOG_INFO("NplusOne = {}", N + 1.0); + // return 0; + } + cx1 = -1.31303; + cx2 = 0.377234; + cx3 = 0.138174; + alpha = 60; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC2(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC2(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.2948374155694822; + cx2 = 0.37733728717266285; + cx3 = 0.13840460401111598; + alpha = 120; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC3(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC3(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.28847; + cx2 = 0.3885; + cx3 = 0.1385; + alpha = 180; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC4(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC4(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.294771417778694; + cx2 = 0.399787947463142; + cx3 = 0.1383429692754194; + alpha = 240; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC5(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC5(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.3077338898450492; + cx2 = 0.3998516560596088; + cx3 = 0.13843501416896437; + alpha = 300; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + SPtr<BC> inflowAirBC6(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + //SPtr<BC> inflowAirBC6(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + //inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // Pressure BC for air inlet + // SPtr<BC> inflowAirBC1(new DensityBC(p_air_LB)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + // SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + BoundaryConditionsBlockVisitor bcVisitor; + //MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + //bcVisitor.addBC(inflowConcreteBC); + bcVisitor.addBC(inflowAirBC1); + bcVisitor.addBC(outflowBC); + + // SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<CumulantK17LBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBsharpInterfaceLBMKernel>(); + + kernel->setWithForcing(false); + kernel->setForcingX1(0.0); + kernel->setForcingX2(0.0); + kernel->setForcingX3(0.0); + + kernel->setPhiL(phiL); + kernel->setPhiH(phiH); + kernel->setPhaseFieldRelaxation(tauH); + kernel->setMobility(mob); + kernel->setInterfaceWidth(interfaceThickness); + + kernel->setCollisionFactorMultiphase(nu_h_LB, nu_l_LB); + kernel->setDensityRatio(densityRatio); + kernel->setMultiphaseModelParameters(beta, kappa); + kernel->setContactAngle(theta); + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); + + SPtr<Grid3D> grid = make_shared<Grid3D>(comm); + grid->setPeriodicX1(false); + grid->setPeriodicX2(false); + grid->setPeriodicX3(false); + grid->setDeltaX(dx); + grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]); + grid->setGhostLayerWidth(1); + + string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo"; + + string outputPath = "d:/temp/NozzleFlowTest_SinglePhase_SmallTest_Blocks"; + UbSystem::makeDirectory(outputPath); + UbSystem::makeDirectory(outputPath + "/liggghts"); + + // if (myid == 0) { + // stringstream logFilename; + // logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + // UbLog::output_policy::setStream(logFilename.str()); + // } + + ///////////////////////////////////////////////////////////////////// + //LIGGGHTS things + ///////////////////////////////////////////////////////////////////// + string inFile1 = "d:/Projects/TRR277/Project/WP4/Config/in.nozzle"; + // string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem"; + MPI_Comm mpi_comm = *(MPI_Comm *)(comm->getNativeCommunicator()); + LiggghtsCouplingWrapper wrapper(argv, mpi_comm); + + double v_frac = 0.1; + double dt_phys = units->getFactorTimeLbToW(); + int demSubsteps = 10; + double dt_dem = dt_phys / (double)demSubsteps; + int vtkSteps = 1000; + string demOutDir = outputPath + "/liggghts"; + + // wrapper.execCommand("echo none"); + + // wrapper.execFile((char*)inFile1.c_str()); + + //// set timestep and output directory + wrapper.setVariable("t_step", dt_dem); + wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); + wrapper.setVariable("dmp_dir", demOutDir); + + wrapper.execFile((char *)inFile1.c_str()); + //wrapper.runUpto(demSubsteps - 1); + // wrapper.runUpto(1000); + + //LatticeDecomposition lDec((g_maxX1 - g_minX1) / dx, (g_maxX2 - g_minX2) / dx, (g_maxX3 - g_minX3) / dx, wrapper.lmp, grid); + + SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, unitsAir); + //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(std::ceil((g_maxX1 - g_minX1) / dx), std::ceil((g_maxX2 - g_minX2) / dx), std::ceil((g_maxX3 - g_minX3) / dx), wrapper.lmp); + SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(26,26,420, wrapper.lmp); + + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::DIR_MMM, MetisPartitioner::RECURSIVE)); + + SPtr<GbObject3D> gridCube = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + // geo + ////////////////////////////////////////////////////////// + int accuracy = Interactor3D::EDGES; + /////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAirDistributor = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:start"); + meshNozzleAirDistributor->readMeshFromSTLFileASCII(geoPath + "/01_Nozzle_Air_Distributor.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirDistributor.get(), outputPath + "/geo/meshNozzleAirDistributor", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAirDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirDistributor, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAirInlet = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:start"); + meshNozzleAirInlet->readMeshFromSTLFileASCII(geoPath + "/02_Nozzle_Air_Inlet.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirInlet.get(), outputPath + "/geo/meshNozzleAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleSpacer = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:start"); + meshNozzleSpacer->readMeshFromSTLFileASCII(geoPath + "/03_Nozzle_Spacer.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleSpacer.get(), outputPath + "/geo/meshNozzleSpacer", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleSpacer = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleSpacer, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAccDistributor = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:start"); + meshNozzleAccDistributor->readMeshFromSTLFileASCII(geoPath + "/04_Nozzle_Acc_Distributor.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccDistributor.get(), outputPath + "/geo/meshNozzleAccDistributor", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAccDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccDistributor, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAccInlet = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:start"); + meshNozzleAccInlet->readMeshFromSTLFileASCII(geoPath + "/05_Nozzle_Acc_Inlet.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccInlet.get(), outputPath + "/geo/meshNozzleAccInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAccInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:start"); + meshNozzleVolcanNozzle1->readMeshFromSTLFileBinary(geoPath + "/06_1_Nozzle_Volcan_Nozzle.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle1.get(), outputPath + "/geo/meshNozzleVolcanNozzle1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleVolcanNozzle1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle1, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:start"); + meshNozzleVolcanNozzle2->readMeshFromSTLFileBinary(geoPath + "/06_2_Nozzle_Volcan_Nozzle.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle2.get(), outputPath + "/geo/meshNozzleVolcanNozzle2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleVolcanNozzle2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle2, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + // box + SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + // inflow + //GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.20105, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.23, 0.013)); + GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3 - 2.0 * dx, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // outflow + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.22, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.21, 0.013)); + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.426, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.415, 0.013)); + GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3+2.*dx, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // SPtr<GbTriFaceMesh3D> geoAirInlet = std::make_shared<GbTriFaceMesh3D>(); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:start"); + // geoAirInlet->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet.stl", true); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:end"); + // if (myid == 0) GbSystem3D::writeGeoObject(geoAirInlet.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + // SPtr<Interactor3D> intrAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(geoAirInlet, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + ///////////////////////////////////////////////////////////// + // Fluid area + GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoFluidArea.get(), outputPath + "/geo/geoFluidArea", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrFluidArea = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoFluidArea, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(-1.31431 - 0.0005, 0.388587, 0.1383275, -1.31431, 0.388587, 0.1383275, 0.002765)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrAirInflow = std::make_shared<D3Q27Interactor>(geoAirInflow, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:start"); + meshAirInlet1->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_1.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet1.get(), outputPath + "/geo/meshAirInlet1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet1, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:start"); + meshAirInlet2->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_2.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet2.get(), outputPath + "/geo/meshAirInlet2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet2, grid, inflowAirBC2, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet3 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:start"); + meshAirInlet3->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_3.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet3.get(), outputPath + "/geo/meshAirInlet3", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet3 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet3, grid, inflowAirBC3, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet4 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:start"); + meshAirInlet4->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_4.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet4.get(), outputPath + "/geo/meshAirInlet4", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet4 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet4, grid, inflowAirBC4, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet5 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:start"); + meshAirInlet5->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_5.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet5.get(), outputPath + "/geo/meshAirInlet5", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet5 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet5, grid, inflowAirBC5, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet6 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:start"); + meshAirInlet6->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_6.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet6.get(), outputPath + "/geo/meshAirInlet6", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet6 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet6, grid, inflowAirBC6, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + + InteractorsHelper intHelper(grid, partVisitor, false); + + intHelper.addInteractor(intrFluidArea); + //intHelper.addInteractor(intrNozzleVolcanNozzle2); + // intHelper.addInteractor(intrBox); + //intHelper.addInteractor(intrInflow); + // intHelper.addInteractor(intrAirInflow); + intHelper.addInteractor(intAirInlet1); + intHelper.addInteractor(intAirInlet2); + intHelper.addInteractor(intAirInlet3); + intHelper.addInteractor(intAirInlet4); + intHelper.addInteractor(intAirInlet5); + intHelper.addInteractor(intAirInlet6); + intHelper.addInteractor(intrOutflow); + + // intHelper.addInteractor(intrNozzleAirDistributor); + // intHelper.addInteractor(intrNozzleAirInlet); + // intHelper.addInteractor(intrNozzleSpacer); + // intHelper.addInteractor(intrNozzleAccDistributor); + // intHelper.addInteractor(intrNozzleAccInlet); + // intHelper.addInteractor(intrNozzleVolcanNozzle1); + + intHelper.selectBlocks(); + + SPtr<SimulationObserver> ppblocks = make_shared<WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks->update(0); + ppblocks.reset(); + + // if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses())); + + SetKernelBlockVisitor kernelVisitor(kernel, nu_l_LB, comm->getNumberOfProcesses()); + //MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1); + grid->accept(kernelVisitor); + + + intHelper.setBC(); + + // InitDistributionsBlockVisitor initVisitor; + // grid->accept(initVisitor); + + double x1c = -1.31431 + R; + double x2c = 0.375582 + R; + double Ri = 5; + double x3c = 0.136 + Ri; + + //R = 0.2 - 0.145; // 0.078-0.04; // 0.2; + + mu::Parser fct1; + // fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("radius", Ri); + fct1.DefineConst("interfaceThickness", interfaceThickness * dx); + + //MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + //initVisitor.setPhi(fct1); + //grid->accept(initVisitor); + + InitDistributionsBlockVisitor initVisitor; + grid->accept(initVisitor); + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + grid->accept(bcVisitor); + + OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + //TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + int numOfThreads = 1; + omp_set_num_threads(numOfThreads); + + SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100); + SPtr<NUPSCounterSimulationObserver> nupsSimulationObserver = make_shared<NUPSCounterSimulationObserver>(grid, nupsSch, numOfThreads, comm); + + //// write data for visualization of macroscopic quantities + SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); + // SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800)); + // visSch->addSchedule(1, 8700, 8800); + //SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); + + SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); + + int endTime = 10000000; + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + + } catch (std::exception &e) { + cerr << e.what() << endl << flush; + } catch (std::string &s) { + cerr << s << endl; + } catch (...) { + cerr << "unknown exception" << endl; + } + return 0; +} diff --git a/apps/cpu/NozzleMultiphase/CMakeLists.txt b/apps/cpu/NozzleMultiphase/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f92a4267e94c3899565812181fa0fd6af45fc1ca --- /dev/null +++ b/apps/cpu/NozzleMultiphase/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(NozzleMultiphase) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} LiggghtsCoupling MultiphaseFlow NonNewtonianFluids FILES nozzleMultiPhase.cpp ) diff --git a/apps/cpu/NozzleMultiphase/nozzleMultiPhase.cpp b/apps/cpu/NozzleMultiphase/nozzleMultiPhase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ced2724ee6e8dddd3102428696a8647fee322326 --- /dev/null +++ b/apps/cpu/NozzleMultiphase/nozzleMultiPhase.cpp @@ -0,0 +1,802 @@ +#include <iostream> +#include <memory> +#include <string> + +#include "VirtualFluids.h" + +#include "LiggghtsCoupling/LiggghtsCoupling.h" + +#include "MultiphaseFlow/MultiphaseFlow.h" + +#include "NonNewtonianFluids/NonNewtonianFluids.h" + +using namespace std; + +int main(int argc, char *argv[]) +{ + //Sleep(30000); + + try { + + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + // bounding box + // double g_minX1 = -1341.81e-3; + // double g_minX2 = 348.087e-3; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3; + // double g_maxX2 = 429.087e-3; + // double g_maxX3 = 214.5e-3; + + // double g_minX1 = -1341.81e-3 + 10e-3; + // double g_minX2 = 0.360872; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3 - 10e-3; + // double g_maxX2 = 0.416302; + // double g_maxX3 = 210e-3; + + // int blockNX[3] = { 10, 10, 10 }; + + int gridNZ = 3; + + double g_minX1 = -1.31431; + double g_minX2 = 0.375582; + double g_minX3 = -0.21 + 0.035 * 8.0; //-0.21; //-210e-3 - 0.2 - 6e-3; //- 1e-3; + + double g_maxX1 = -1.28831; + double g_maxX2 = 0.401582; + double g_maxX3 = 0.175;//0.21; + + //int blockNX[3] = { 26, 26, 35 }; + int blockNX[3] = { 26, 26, 35 * gridNZ }; + + double dx = 1e-3; + + double uLB_ref = 0.0001; + // double rhoLB = 0.0; + + // concrete + double d_part = 1e-3; + double V = 0.4*10.; // flow rate [m^3/h] + double D = 0.026; // shotcrete inlet diameter [m] + double R = D / 2.0; // radius [m] + double A = UbMath::PI * R * R; + double u = V / 3600 / A; + double muConcrete = 2.1133054011798826; // [Pa s] + double rhoAir = 1.2041; // [kg/m^3] + double tau0 = 715.218181094648; // Pa + double rhoConcrete = 2400; // [kg/m^3] + double nu = muConcrete / rhoConcrete; + + // double Re_D = d_part * u / nu; + // if (myid == 0) UBLOG(logINFO, "Re_D = " << Re_D); + // + SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uLB_ref); + if (myid == 0) std::cout << units->toString() << std::endl; + + double interfaceThickness = 3; // 4.096; + double sigma = 0.3; //0.03; + double Re = rhoConcrete * u * d_part / muConcrete; + double We = rhoConcrete * u * u * d_part / sigma; + + double u_LB_con = u * units->getFactorVelocityWToLb(); + double nu_h_LB = nu * units->getFactorViscosityWToLb(); // uLB_ref * d_part * units->getFactorLentghWToLb() / Re; + double nu_l_LB = 0; // = nu_h_LB; + + double rho_h_LB = 1; + + // surface tension + double sigma_LB = rho_h_LB *u_LB_con *u_LB_con *d_part * units->getFactorLentghWToLb() / We; + + // LBMReal dLB = 0; // = length[1] / dx; + LBMReal rhoLB = 0.0; + // LBMReal nuLB = nu_l; //(uLB_ref*dLB) / Re; + + double beta = 12.0 * sigma_LB / interfaceThickness; + double kappa = 1.5 * interfaceThickness * sigma_LB; + + double phiL = 0.0; + double phiH = 1.0; + double tauH = 0.6; // Phase - field Relaxation + double mob = 0.02; // Mobility + // double nuL = 1e-2; + // double nuG = 0.015811388300841892; + double densityRatio = rhoConcrete / rhoAir; + // double sigma_old = 1.0850694444444444e-06; + // + // double beta_old = 12.0 * sigma / interfaceThickness; + // double kappa_old = 1.5 * interfaceThickness * sigma; + + double theta = 110; // contact angle + + // https://civilsir.com/density-of-cement-sand-and-aggregate-in-kg-m3-list-of-material-density/ + + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uRef); + + double Bm = (tau0 * d_part) / (muConcrete * u); + double tau0_LB = Bm * nu_h_LB * u_LB_con / (d_part * units->getFactorLentghWToLb()); + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(tau0_LB); + + if (myid == 0) VF_LOG_INFO("Yield stress = {} Pa", tau0); + if (myid == 0) VF_LOG_INFO("Yield stress LB = {} ", tau0_LB); + + //SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + // concrete inflow boundary condition + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", -u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} m/s", u); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} dx/dt", u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete Re = {}", Re); + + // // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // // Mechanics, 21(6), 371-379. + // double cx1 = -1.31431 + R; + // double cx2 = 0.375582 + R; + // //double cx3 = 0.20105 + R; + // double L = g_maxX1 - g_minX1; + // double p_concrete = 1e5; // Pa = 1 Bar + // double p1 = p_concrete * units->getFactorPressureWToLb(); + // double p2 = 0.0; + // double drhoLB = 1.0 + rhoLB; + // double muLB = drhoLB * nuLB; + // double N = R * R / 2 * muLB * uLB_ref * (p1 - p2) / L - 3; + + // // mu::Parser fct; + // fct.SetExpr("U*(1-(((((x2-y0)^2+(x1-x0)^2)^0.5)/R)^NplusOne))"); + // fct.DefineConst("x0", cx1); + // fct.DefineConst("y0", cx2); + // //fct.DefineConst("z0", cx3); + // fct.DefineConst("R", R); + // fct.DefineConst("U", uLB_ref * ((N + 3) / (N + 1))); + // fct.DefineConst("NplusOne", N + 1.0); + + //SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); + //inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowConcreteBC(new MultiphaseVelocityBC(false, false, true, fct, phiH, 0, BCFunction::INFCONST)); + inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // air inflow boundary condition + // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // Mechanics, 21(6), 371-379. + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + // double V = 40; // flow rate [m^3/h] + // double D = 0.0166; // air inlet diameter [m] + // double R = D / 2.0; // radius [m] + // double A = UbMath::PI * R * R; + // double u = V / 3600 / A; + // double uLB_ref = u * unitsAir->getFactorVelocityWToLb(); + //// double cx1 = -1.2788 + R; + // double cx2 = 0.3803 + R; + // double cx3 = 0.1517 + R; + // double L = g_maxX1 - g_minX1; + // double p_air = 7e5; // Pa = 7 Bar + // double p1 = p_air; + // double p2 = 0.0; + // double mu = 17.2e-6; // Pa s, air 20° C + // double N = R * R / 2 * mu * u * (p1 - p2) / L - 3; + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u); + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_ref); + // + + // double nu = mu / rhoConcrete; + // double Re = d_part * u / nu; + // if (myid == 0) VF_LOG_INFO("Re_air = {}", Re); + + // double nuLB = d_part * unitsAir->getFactorLentghWToLb() * uLB_ref / Re; + // if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB); + // nu_l_LB = nuLB; + + SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + //SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + double V_air = 40./6.; // flow rate [m^3/h] //10. + double D_air = 0.00553; // air inlet diameter [m] + double R_air = D_air / 2.0; // radius [m] + double A_air = UbMath::PI * (R_air * R_air); + double u_air = V_air / 3600 / A_air; + double uLB_air = u_air * unitsAir->getFactorVelocityWToLb(); + // double cx1 = -1.2788 + R; + double cx2 = 0.385822 + R_air; + double cx3 = 0.135562 + R_air; + double L_air = 0.00747; + double p_air = 7e5; // Pa = 7 Bar + double p1 = p_air; + double p2 = 1e5; + double mu_air = 17.2e-6; // Pa s, air 20° C + double rho_air = 1.2041; // [kg/m^3] + double Re_inlet = D_air * u_air * rho_air / mu_air; + double lambda = 0.3164 / pow(Re_inlet, 0.25); + double deltaP = (lambda / (2. * R_air)) * (rho_air * pow(u_air, 2) / 2.); // Darcy friction factor (Rohrreibungszahl) + double N = pow(R_air, 2) / (2. * mu_air * u_air) * deltaP - 3.; + // double N = R_air * R_air / 2 * mu_air * u_air * (p1 - p2) / L_air - 3; + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u_air); + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_air); + + double nu_air = mu_air / rho_air; + double Re_air = d_part * u_air / nu_air; + if (myid == 0) VF_LOG_INFO("Air Re = {}", Re_air); + + double nuLB_air = nu_air * unitsAir->getFactorViscosityWToLb(); // d_part * unitsAir->getFactorLentghWToLb() * uLB_air / Re_air; + if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB_air); + nu_l_LB = nuLB_air; + + if (myid == 0) VF_LOG_INFO("nu_h = {}", nu_h_LB); + if (myid == 0) VF_LOG_INFO("nu_l = {}", nu_l_LB); + if (myid == 0) VF_LOG_INFO("sigma_LB = {}", sigma_LB); + + double p_air_LB = p_air * unitsAir->getFactorPressureWToLb(); + if (myid == 0) VF_LOG_INFO("p_air_LB = {}", p_air_LB); + + // mu::Parser fctVx1; + ////fctVx1.SetExpr("U"); + ////fctVx1.DefineConst("U", uLB_air); + // mu::Parser fctVx2; + // fctVx2.SetExpr("U"); + // fctVx2.DefineConst("U", 0); + // mu::Parser fctVx3; + ////fctVx3.SetExpr("U"); + ////fctVx3.DefineConst("U", -uLB_air); + + double cx1 = 0; + double alpha = 0; + double gamma = 0; + double U = uLB_air;// * ((N + 3.) / (N + 1.)); + + mu::Parser fctVx1; + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + // fctVx1.SetExpr("(((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5/R)^NplusOne"); + fctVx1.SetExpr("U*cos(alpha*_pi/180)"); + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("R", R_air); + fctVx1.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx1.DefineConst("NplusOne", N + 1.0); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + + mu::Parser fctVx2; + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx2.SetExpr("U*sin(alpha*_pi/180)"); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("R", R_air); + fctVx2.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx2.DefineConst("NplusOne", N + 1.0); + fctVx2.DefineConst("alpha", alpha); + + mu::Parser fctVx3; + //fctVx3.SetExpr("U*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx3.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx3.SetExpr("U"); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("R", R_air); + fctVx3.DefineConst("U", -U); //* ((N + 3.) / (N + 1.))); + fctVx3.DefineConst("NplusOne", N + 1.0); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + // SPtr<BC> inflowAirBC1(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + // t = U * sin(alpha * _pi / 180) * (1 - (((((x1 - x0) ^ 2 + (x2 - y0) ^ 2 + (x3 - z0) ^ 2) ^ 0.5) / R) ^ NplusOne)); + cx1 = -1.31416; + cx2 = 0.388684; + cx3 = 0.138177; + alpha = 0; + gamma = 225; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx2.DefineConst("gamma", gamma); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + //SPtr<BC> inflowAirBC1(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC1(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + fctVx1.DefineVar("x1", &cx1); + fctVx1.DefineVar("x2", &cx2); + fctVx1.DefineVar("x3", &cx3); + fctVx2.DefineVar("x1", &cx1); + fctVx2.DefineVar("x2", &cx2); + fctVx2.DefineVar("x3", &cx3); + fctVx3.DefineVar("x1", &cx1); + fctVx3.DefineVar("x2", &cx2); + fctVx3.DefineVar("x3", &cx3); + + if (myid == 0) { + + VF_LOG_INFO("fctVx1 = {}", fctVx1.Eval()); + VF_LOG_INFO("fctVx2 = {}", fctVx2.Eval()); + VF_LOG_INFO("fctVx3 = {}", fctVx3.Eval()); + VF_LOG_INFO("N = {}", N); + VF_LOG_INFO("NplusOne = {}", N + 1.0); + // return 0; + } + cx1 = -1.31303; + cx2 = 0.377234; + cx3 = 0.138174; + alpha = 60; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC2(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC2(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.2948374155694822; + cx2 = 0.37733728717266285; + cx3 = 0.13840460401111598; + alpha = 120; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC3(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC3(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.28847; + cx2 = 0.3885; + cx3 = 0.1385; + alpha = 180; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC4(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC4(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.294771417778694; + cx2 = 0.399787947463142; + cx3 = 0.1383429692754194; + alpha = 240; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC5(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC5(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.3077338898450492; + cx2 = 0.3998516560596088; + cx3 = 0.13843501416896437; + alpha = 300; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC6(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC6(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // Pressure BC for air inlet + // SPtr<BC> inflowAirBC1(new DensityBC(p_air_LB)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + // SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + //BoundaryConditionsBlockVisitor bcVisitor; + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(inflowConcreteBC); + bcVisitor.addBC(inflowAirBC1); + bcVisitor.addBC(outflowBC); + + // SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<CumulantK17LBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + SPtr<LBMKernel> kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBsharpInterfaceLBMKernel>(); + + kernel->setWithForcing(false); + kernel->setForcingX1(0.0); + kernel->setForcingX2(0.0); + kernel->setForcingX3(0.0); + + kernel->setPhiL(phiL); + kernel->setPhiH(phiH); + kernel->setPhaseFieldRelaxation(tauH); + kernel->setMobility(mob); + kernel->setInterfaceWidth(interfaceThickness); + + kernel->setCollisionFactorMultiphase(nu_h_LB, nu_l_LB); + kernel->setDensityRatio(densityRatio); + kernel->setMultiphaseModelParameters(beta, kappa); + kernel->setContactAngle(theta); + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); + + SPtr<Grid3D> grid = make_shared<Grid3D>(comm); + grid->setPeriodicX1(false); + grid->setPeriodicX2(false); + grid->setPeriodicX3(false); + grid->setDeltaX(dx); + grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]); + grid->setGhostLayerWidth(2); + + string geoPath = "d:/Projects/TRR277/Project/WP4/NozzleGeo"; + + string outputPath = "d:/temp/NozzleFlowTest_MultiPhase_SmallTest_OneBlock"; + UbSystem::makeDirectory(outputPath); + UbSystem::makeDirectory(outputPath + "/liggghts"); + + // if (myid == 0) { + // stringstream logFilename; + // logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + // UbLog::output_policy::setStream(logFilename.str()); + // } + + ///////////////////////////////////////////////////////////////////// + //LIGGGHTS things + ///////////////////////////////////////////////////////////////////// + string inFile1 = "d:/Projects/TRR277/Project/WP4/Config/in.nozzle"; + // string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem"; + MPI_Comm mpi_comm = *(MPI_Comm *)(comm->getNativeCommunicator()); + LiggghtsCouplingWrapper wrapper(argv, mpi_comm); + + double v_frac = 0.1; + double dt_phys = units->getFactorTimeLbToW(); + int demSubsteps = 10; + double dt_dem = dt_phys / (double)demSubsteps; + int vtkSteps = 1000; + string demOutDir = outputPath + "/liggghts"; + + // wrapper.execCommand("echo none"); + + // wrapper.execFile((char*)inFile1.c_str()); + + //// set timestep and output directory + wrapper.setVariable("t_step", dt_dem); + wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); + wrapper.setVariable("dmp_dir", demOutDir); + + //!!!!//wrapper.execFile((char *)inFile1.c_str()); + //wrapper.runUpto(demSubsteps - 1); + // wrapper.runUpto(1000); + + //LatticeDecomposition lDec((g_maxX1 - g_minX1) / dx, (g_maxX2 - g_minX2) / dx, (g_maxX3 - g_minX3) / dx, wrapper.lmp, grid); + + SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); + SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, unitsAir); + //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(std::ceil((g_maxX1 - g_minX1) / dx), std::ceil((g_maxX2 - g_minX2) / dx), std::ceil((g_maxX3 - g_minX3) / dx), wrapper.lmp); + //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(blockNX[0], blockNX[1], blockNX[2] * gridNZ, wrapper.lmp); + + ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::DIR_MMM, MetisPartitioner::RECURSIVE)); + + SPtr<GbObject3D> gridCube = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + // geo + ////////////////////////////////////////////////////////// + int accuracy = Interactor3D::EDGES; + /////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAirDistributor = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:start"); + meshNozzleAirDistributor->readMeshFromSTLFileASCII(geoPath + "/01_Nozzle_Air_Distributor.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirDistributor.get(), outputPath + "/geo/meshNozzleAirDistributor", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAirDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirDistributor, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAirInlet = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:start"); + meshNozzleAirInlet->readMeshFromSTLFileASCII(geoPath + "/02_Nozzle_Air_Inlet.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirInlet.get(), outputPath + "/geo/meshNozzleAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleSpacer = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:start"); + meshNozzleSpacer->readMeshFromSTLFileASCII(geoPath + "/03_Nozzle_Spacer.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleSpacer.get(), outputPath + "/geo/meshNozzleSpacer", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleSpacer = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleSpacer, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAccDistributor = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:start"); + meshNozzleAccDistributor->readMeshFromSTLFileASCII(geoPath + "/04_Nozzle_Acc_Distributor.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccDistributor.get(), outputPath + "/geo/meshNozzleAccDistributor", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAccDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccDistributor, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAccInlet = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:start"); + meshNozzleAccInlet->readMeshFromSTLFileASCII(geoPath + "/05_Nozzle_Acc_Inlet.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccInlet.get(), outputPath + "/geo/meshNozzleAccInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAccInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:start"); + meshNozzleVolcanNozzle1->readMeshFromSTLFileBinary(geoPath + "/06_1_Nozzle_Volcan_Nozzle.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle1.get(), outputPath + "/geo/meshNozzleVolcanNozzle1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleVolcanNozzle1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle1, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:start"); + meshNozzleVolcanNozzle2->readMeshFromSTLFileBinary(geoPath + "/06_2_Nozzle_Volcan_Nozzle.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle2.get(), outputPath + "/geo/meshNozzleVolcanNozzle2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleVolcanNozzle2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle2, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + // box + SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + // inflow + //GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.20105, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.23, 0.013)); + GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3 - 2.0 * dx, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // outflow + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.22, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.21, 0.013)); + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.426, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.415, 0.013)); + GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3+2.*dx, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // SPtr<GbTriFaceMesh3D> geoAirInlet = std::make_shared<GbTriFaceMesh3D>(); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:start"); + // geoAirInlet->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet.stl", true); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:end"); + // if (myid == 0) GbSystem3D::writeGeoObject(geoAirInlet.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + // SPtr<Interactor3D> intrAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(geoAirInlet, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + ///////////////////////////////////////////////////////////// + // Fluid area + GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + if (myid == 0) GbSystem3D::writeGeoObject(geoFluidArea.get(), outputPath + "/geo/geoFluidArea", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrFluidArea = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoFluidArea, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(-1.31431 - 0.0005, 0.388587, 0.1383275, -1.31431, 0.388587, 0.1383275, 0.002765)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrAirInflow = std::make_shared<D3Q27Interactor>(geoAirInflow, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:start"); + meshAirInlet1->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_1.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet1.get(), outputPath + "/geo/meshAirInlet1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet1, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:start"); + meshAirInlet2->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_2.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet2.get(), outputPath + "/geo/meshAirInlet2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet2, grid, inflowAirBC2, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet3 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:start"); + meshAirInlet3->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_3.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet3.get(), outputPath + "/geo/meshAirInlet3", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet3 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet3, grid, inflowAirBC3, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet4 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:start"); + meshAirInlet4->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_4.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet4.get(), outputPath + "/geo/meshAirInlet4", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet4 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet4, grid, inflowAirBC4, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet5 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:start"); + meshAirInlet5->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_5.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet5.get(), outputPath + "/geo/meshAirInlet5", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet5 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet5, grid, inflowAirBC5, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet6 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:start"); + meshAirInlet6->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet_6.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet6.get(), outputPath + "/geo/meshAirInlet6", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet6 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet6, grid, inflowAirBC6, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + + InteractorsHelper intHelper(grid, metisVisitor, false); + + intHelper.addInteractor(intrFluidArea); + //intHelper.addInteractor(intrNozzleVolcanNozzle2); + // intHelper.addInteractor(intrBox); + intHelper.addInteractor(intrInflow); + // intHelper.addInteractor(intrAirInflow); + intHelper.addInteractor(intAirInlet1); + intHelper.addInteractor(intAirInlet2); + intHelper.addInteractor(intAirInlet3); + intHelper.addInteractor(intAirInlet4); + intHelper.addInteractor(intAirInlet5); + intHelper.addInteractor(intAirInlet6); + intHelper.addInteractor(intrOutflow); + + // intHelper.addInteractor(intrNozzleAirDistributor); + // intHelper.addInteractor(intrNozzleAirInlet); + // intHelper.addInteractor(intrNozzleSpacer); + // intHelper.addInteractor(intrNozzleAccDistributor); + // intHelper.addInteractor(intrNozzleAccInlet); + // intHelper.addInteractor(intrNozzleVolcanNozzle1); + + intHelper.selectBlocks(); + + SPtr<SimulationObserver> ppblocks = make_shared<WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks->update(0); + ppblocks.reset(); + + // if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses())); + + //SetKernelBlockVisitor kernelVisitor(kernel, nu_l_LB, comm->getNumberOfProcesses()); + MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1); + grid->accept(kernelVisitor); + + + intHelper.setBC(); + + // InitDistributionsBlockVisitor initVisitor; + // grid->accept(initVisitor); + + double x1c = -1.31431 + R; + double x2c = 0.375582 + R; + double Ri = 5; + double x3c = 0.136 + Ri; + + //R = 0.2 - 0.145; // 0.078-0.04; // 0.2; + + mu::Parser fct1; + // fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("radius", Ri); + fct1.DefineConst("interfaceThickness", interfaceThickness * dx); + + MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + initVisitor.setPhi(fct1); + //grid->accept(initVisitor); + + //InitDistributionsBlockVisitor initVisitor; + grid->accept(initVisitor); + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + grid->accept(bcVisitor); + + //OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + int numOfThreads = 1; + omp_set_num_threads(numOfThreads); + + SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100); + SPtr<NUPSCounterSimulationObserver> nupsSimulationObserver = make_shared<NUPSCounterSimulationObserver>(grid, nupsSch, numOfThreads, comm); + + //// write data for visualization of macroscopic quantities + SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); + // SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800)); + // visSch->addSchedule(1, 8700, 8800); + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + writeMQSimulationObserver->update(0); + + //SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); + + int endTime = 10000000; + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + //!!!//simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + + } catch (std::exception &e) { + cerr << e.what() << endl << flush; + } catch (std::string &s) { + cerr << s << endl; + } catch (...) { + cerr << "unknown exception" << endl; + } + return 0; +} diff --git a/apps/cpu/OrganPipe/OrganPipe.cpp b/apps/cpu/OrganPipe/OrganPipe.cpp index ad6ec5a1d0892b60f699b74ee4101a9f4ad047e3..98b8c25050ba459c795ea22b3005686755e69077 100644 --- a/apps/cpu/OrganPipe/OrganPipe.cpp +++ b/apps/cpu/OrganPipe/OrganPipe.cpp @@ -8,7 +8,7 @@ void run(string configname) { try { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (myid == 0) UBLOG(logINFO, "Testcase organ pipe"); @@ -389,9 +389,9 @@ void run(string configname) grid->setTimeStep(restartStep); } ////set connectors - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nu_LB, bulckViscosity); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolator>(iProcessor)->setBulkViscosity(nu_LB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/PlateWithPorousInlay/plate.cpp b/apps/cpu/PlateWithPorousInlay/plate.cpp index 315bacfa954640c8963ef46c3a7c840280a69e06..0334da7c3410cba9f92a2c2396c9702db429c510 100644 --- a/apps/cpu/PlateWithPorousInlay/plate.cpp +++ b/apps/cpu/PlateWithPorousInlay/plate.cpp @@ -52,7 +52,7 @@ void run(const char *cstr) stringstream logFilename; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/PoiseuilleFlow/pf1.cpp b/apps/cpu/PoiseuilleFlow/pf1.cpp index 0e21dea4d252dc141fa5fd75feebe24c0b80042d..dffd5fde6c71dfd0ab647cee2c3e6ee1a81455d0 100644 --- a/apps/cpu/PoiseuilleFlow/pf1.cpp +++ b/apps/cpu/PoiseuilleFlow/pf1.cpp @@ -9,7 +9,7 @@ void pf1() { using namespace vf::lbm::dir; - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); //parameters diff --git a/apps/cpu/PoiseuilleFlow/pf2.cpp b/apps/cpu/PoiseuilleFlow/pf2.cpp index f312bc37dacc3caadd9935f450cdcf808c945b4f..7990d19690f048f444ff234a00557b22f9f5e86f 100644 --- a/apps/cpu/PoiseuilleFlow/pf2.cpp +++ b/apps/cpu/PoiseuilleFlow/pf2.cpp @@ -6,7 +6,7 @@ ////pipe flow with pressure drop //void pf2() //{ -// SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); +// SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); // int myid = comm->getProcessID(); // // //parameters @@ -149,7 +149,7 @@ // grid->accept(initVisitor); // // //set connectors -// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); +// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); // SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); // grid->accept(setConnsVisitor); // diff --git a/apps/cpu/PoiseuilleFlow/pf3.cpp b/apps/cpu/PoiseuilleFlow/pf3.cpp index a2eca67d593fd9e21641e99bd3910e4c775f00a9..0442b1c67663f91abb39350cc4287a62efa95e74 100644 --- a/apps/cpu/PoiseuilleFlow/pf3.cpp +++ b/apps/cpu/PoiseuilleFlow/pf3.cpp @@ -6,7 +6,7 @@ ////two plates flow with forcing //void pf3() //{ -// SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); +// SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); // int myid = comm->getProcessID(); // // //parameters @@ -141,7 +141,7 @@ // grid->accept(initVisitor); // // //set connectors -// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); +// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); // SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); // grid->accept(setConnsVisitor); // diff --git a/apps/cpu/PoiseuilleFlow/pf4.cpp b/apps/cpu/PoiseuilleFlow/pf4.cpp index 9b249f94e19fd6c53b6410702406c498c101ed42..9568cdd619dec4a6585de167ca2234894962ef10 100644 --- a/apps/cpu/PoiseuilleFlow/pf4.cpp +++ b/apps/cpu/PoiseuilleFlow/pf4.cpp @@ -6,7 +6,7 @@ ////two plates flow with pressure drop //void pf4() //{ -// SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); +// SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); // int myid = comm->getProcessID(); // // //parameters @@ -154,7 +154,7 @@ // grid->accept(initVisitor); // // //set connectors -// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); +// InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); // SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); // grid->accept(setConnsVisitor); // diff --git a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp index c9a28efc4033ceb0be8cbabc4976055f994c1932..90c912152f7e3cfbc8cf27a8d7170ca74ae71919 100644 --- a/apps/cpu/RisingBubble2D/RisingBubble2D.cpp +++ b/apps/cpu/RisingBubble2D/RisingBubble2D.cpp @@ -52,20 +52,21 @@ void run(string configname) bool newStart = config.getValue<bool>("newStart"); // double rStep = config.getValue<double>("rStep"); - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (myid == 0) UBLOG(logINFO, "2D Rising Bubble: Start!"); if (logToFile) { -#if defined(__unix__) - if (myid == 0) { - const char *str = pathname.c_str(); - mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); - } -#endif +// #if defined(__unix__) +// if (myid == 0) { +// const char *str = pathname.c_str(); +// mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +// } +// #endif if (myid == 0) { + UbSystem::makeDirectory(pathname); stringstream logFilename; logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; UbLog::output_policy::setStream(logFilename.str()); @@ -147,8 +148,8 @@ void run(string configname) // kernel = SPtr<LBMKernel>(new MultiphaseCumulantLBMKernel()); // kernel = SPtr<LBMKernel>(new MultiphaseTwoPhaseFieldsPressureFilterLBMKernel()); //kernel = SPtr<LBMKernel>(new MultiphasePressureFilterLBMKernel()); - //kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); - kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + //kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); mu::Parser fgr; fgr.SetExpr("-rho*g_y"); fgr.DefineConst("g_y", g_y); @@ -187,7 +188,7 @@ void run(string configname) SPtr<Grid3D> grid(new Grid3D(comm)); grid->setDeltaX(dx); grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); - grid->setPeriodicX1(false); + grid->setPeriodicX1(true); grid->setPeriodicX2(false); grid->setPeriodicX3(true); grid->setGhostLayerWidth(2); @@ -246,8 +247,8 @@ void run(string configname) SPtr<WriteBlocksSimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); InteractorsHelper intHelper(grid, metisVisitor, true); - intHelper.addInteractor(wallXminInt); - intHelper.addInteractor(wallXmaxInt); + //intHelper.addInteractor(wallXminInt); + //intHelper.addInteractor(wallXmaxInt); intHelper.addInteractor(wallYminInt); intHelper.addInteractor(wallYmaxInt); intHelper.selectBlocks(); @@ -360,13 +361,24 @@ void run(string configname) SPtr<UbScheduler> visSch(new UbScheduler(outTime)); // visSch->addSchedule(307200,307200,307200); //t=2 // visSch->addSchedule(1228185,1228185,1228185); - double t_ast, t; - t_ast = 2; - t = (int)(t_ast / std::sqrt(g_y / D)); + + //Tlb = (np.sqrt(2 * dLB / gLB)) / (np.sqrt(2 * dLT / gLT)) + double gLT = 0.98; + double dLT = 0.5; + double Tlb = (sqrt(2 * D / g_y)) / (sqrt(2. * dLT / gLT)); + UBLOG(logINFO, "Tlb = " << Tlb); + double t = Tlb * 3.; visSch->addSchedule(t, t, t); // t=2 - t_ast = 3; - t = (int)(t_ast / std::sqrt(g_y / D)); - visSch->addSchedule(t, t, t); // t=3 + UBLOG(logINFO, "T3 = " << t); + + + // double t_ast, t; + // t_ast = 2; + // t = (int)(t_ast / std::sqrt(g_y / D)); + // visSch->addSchedule(t, t, t); // t=2 + // t_ast = 3; + // t = (int)(t_ast / std::sqrt(g_y / D)); + // visSch->addSchedule(t, t, t); // t=3 // t_ast = 4; // t = (int)(t_ast/std::sqrt(g_y/D)); // visSch->addSchedule(t,t,t); //t=4 @@ -391,7 +403,10 @@ void run(string configname) SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100)); SPtr<NUPSCounterSimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm)); - // omp_set_num_threads(numOfThreads); + omp_set_num_threads(numOfThreads); + + endTime = t + 1000; + UBLOG(logINFO, "endTime = " << endTime); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime)); diff --git a/apps/cpu/ShotcreteJet/CMakeLists.txt b/apps/cpu/ShotcreteJet/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c82d37e10ac965dff939740f28b2200b0aec239 --- /dev/null +++ b/apps/cpu/ShotcreteJet/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(ShotcreteJet) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK VirtualFluidsCore basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES jet.cpp ) diff --git a/apps/cpu/ShotcreteJet/ShotcreteJet.cfg b/apps/cpu/ShotcreteJet/ShotcreteJet.cfg new file mode 100644 index 0000000000000000000000000000000000000000..2d4507811d568974f9a338d5c3fa32c33b7989b4 --- /dev/null +++ b/apps/cpu/ShotcreteJet/ShotcreteJet.cfg @@ -0,0 +1,10 @@ + outputPath = /scratch/projects/nii00154/ShotcreteJet2 + geoPath = /home/niikonst/NozzleGeo + logToFile = false + vtkSteps = 1000 + newStart = false + cpStep = 450000 + cpStart = 450000 + restartStep = 300000 + endTime = 450000 + diff --git a/apps/cpu/ShotcreteJet/jet.cpp b/apps/cpu/ShotcreteJet/jet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87ea7ab473acb19396a66709bdb437593151f927 --- /dev/null +++ b/apps/cpu/ShotcreteJet/jet.cpp @@ -0,0 +1,1078 @@ +#include <iostream> +#include <memory> +#include <string> + +#include "VirtualFluids.h" + +//#include "LiggghtsCoupling/LiggghtsCoupling.h" + +#include "MultiphaseFlow/MultiphaseFlow.h" + +#include "NonNewtonianFluids/NonNewtonianFluids.h" + +using namespace std; + +int main(int argc, char *argv[]) +{ + //Sleep(30000); + string configname; + if (argv != NULL) { + if (argv[1] != NULL) { + configname = string(argv[1]); + } else { + cout << "Configuration file is missing!" << endl; + return 0; + } + } + + + try { + + vf::basics::ConfigurationFile config; + config.load(configname); + + string outputPath = config.getValue<string>("outputPath"); + string geoPath = config.getValue<string>("geoPath"); + bool logToFile = config.getValue<bool>("logToFile"); + int vtkSteps = config.getValue<int>("vtkSteps"); + bool newStart = config.getValue<bool>("newStart"); + double cpStep = config.getValue<double>("cpStep"); + double cpStart = config.getValue<double>("cpStart"); + double restartStep = config.getValue<int>("restartStep"); + int endTime = config.getValue<int>("endTime"); + int numOfThreads = config.getValue<int>("numOfThreads"); + + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (myid == 0) UBLOG(logINFO, "Jet Breakup: Start!"); + + if (logToFile) { +#if defined(__unix__) + if (myid == 0) { + const char *str = outputPath.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) { + stringstream logFilename; + logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + //bool newStart = false; + // bounding box + // double g_minX1 = -1341.81e-3; + // double g_minX2 = 348.087e-3; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3; + // double g_maxX2 = 429.087e-3; + // double g_maxX3 = 214.5e-3; + + // double g_minX1 = -1341.81e-3 + 10e-3; + // double g_minX2 = 0.360872; + // double g_minX3 = -210e-3; + + // double g_maxX1 = -1260.81e-3 - 10e-3; + // double g_maxX2 = 0.416302; + // double g_maxX3 = 210e-3; + + // int blockNX[3] = { 10, 10, 10 }; + + //int gridNZ = 3; + + //double g_minX1 = -1.31431; + //double g_minX2 = 0.375582; + //double g_minX3 = -0.21 + 0.035 * 8.0; //-0.21; //-210e-3 - 0.2 - 6e-3; //- 1e-3; + + //double g_maxX1 = -1.28831; + //double g_maxX2 = 0.401582; + //double g_maxX3 = 0.175;//0.21; + + double dx = 1; + + double g_maxX3_box = -0.065e3; + + double g_minX1 = -1.49631e3; + double g_minX2 = 0.193582e3; + double g_minX3 = g_maxX3_box - 0.39e3;//-0.095; //-0.215; + + double g_maxX1 = -1.10631e3; + double g_maxX2 = 0.583582e3; + double g_maxX3 = 0.175e3; + + + + //int blockNX[3] = { 26, 26, 35 }; + int blockNX[3] = { 15, 15, 15 }; + + + double uLB_ref = 0.0001; + // double rhoLB = 0.0; + + // concrete + double d_part = 1e-3; + double V = 0.4*7.0; // flow rate [m^3/h] + double D = 0.026; // shotcrete inlet diameter [m] + double R = D / 2.0; // radius [m] + double A = UbMath::PI * R * R; + double u = V / 3600 / A; + double muConcrete = 2.1133054011798826; // [Pa s] + double rhoAir = 1.2041; // [kg/m^3] + double tau0 = 715.218181094648; // Pa + double rhoConcrete = 2400; // [kg/m^3] + double nu = muConcrete / rhoConcrete; + + // double Re_D = d_part * u / nu; + // if (myid == 0) UBLOG(logINFO, "Re_D = " << Re_D); + // + SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uLB_ref); + if (myid == 0) std::cout << units->toString() << std::endl; + + double interfaceThickness = 3; // 4.096; + double sigma = 0.3; //0.03; + double Re = rhoConcrete * u * d_part / muConcrete; + double We = rhoConcrete * u * u * d_part / sigma; + + double u_LB_con = u * units->getFactorVelocityWToLb(); + double nu_h_LB = nu * units->getFactorViscosityWToLb(); // uLB_ref * d_part * units->getFactorLentghWToLb() / Re; + double nu_l_LB = 0; // = nu_h_LB; + + double rho_h_LB = 1; + + // surface tension + double sigma_LB = rho_h_LB *u_LB_con *u_LB_con *d_part * units->getFactorLentghWToLb() / We; + + // LBMReal dLB = 0; // = length[1] / dx; + LBMReal rhoLB = 0.0; + // LBMReal nuLB = nu_l; //(uLB_ref*dLB) / Re; + + double beta = 12.0 * sigma_LB / interfaceThickness; + double kappa = 1.5 * interfaceThickness * sigma_LB; + + double phiL = 0.0; + double phiH = 1.0; + double tauH = 0.6; // Phase - field Relaxation + double mob = 0.02; // Mobility + // double nuL = 1e-2; + // double nuG = 0.015811388300841892; + double densityRatio = rhoConcrete / rhoAir; + // double sigma_old = 1.0850694444444444e-06; + // + // double beta_old = 12.0 * sigma / interfaceThickness; + // double kappa_old = 1.5 * interfaceThickness * sigma; + + double theta = 110; // contact angle + + // https://civilsir.com/density-of-cement-sand-and-aggregate-in-kg-m3-list-of-material-density/ + + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, 1.480, 2060, r_p/dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(r_p, LBMUnitConverter::AIR_20C, r_p / dx); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 1000, d_part / dx, std::abs(uLB_ref)); + // SPtr<LBMUnitConverter> units = std::make_shared<LBMUnitConverter>(d_part, 1., 2400, d_part / dx, uRef); + + double Bm = (tau0 * d_part) / (muConcrete * u); + double tau0_LB = Bm * nu_h_LB * u_LB_con / (d_part * units->getFactorLentghWToLb()); + + SPtr<Rheology> thix = Rheology::getInstance(); + thix->setYieldStress(tau0_LB); + + if (myid == 0) VF_LOG_INFO("Yield stress = {} Pa", tau0); + if (myid == 0) VF_LOG_INFO("Yield stress LB = {} ", tau0_LB); + + //SPtr<BC> noSlipBC(new NoSlipBC()); + //noSlipBC->setBCStrategy(SPtr<BCStrategy>(new NoSlipBCStrategy())); + SPtr<BC> noSlipBC(new NoSlipBC()); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + SPtr<BC> unwettingNoSlipBC(new NoSlipBC(1)); + noSlipBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNoSlipBCStrategy())); + + // concrete inflow boundary condition + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", -u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} m/s", u); + if (myid == 0) VF_LOG_INFO("Concrete inflow velocity = {} dx/dt", u_LB_con); + if (myid == 0) VF_LOG_INFO("Concrete Re = {}", Re); + + // // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // // Mechanics, 21(6), 371-379. + // double cx1 = -1.31431 + R; + // double cx2 = 0.375582 + R; + // //double cx3 = 0.20105 + R; + // double L = g_maxX1 - g_minX1; + // double p_concrete = 1e5; // Pa = 1 Bar + // double p1 = p_concrete * units->getFactorPressureWToLb(); + // double p2 = 0.0; + // double drhoLB = 1.0 + rhoLB; + // double muLB = drhoLB * nuLB; + // double N = R * R / 2 * muLB * uLB_ref * (p1 - p2) / L - 3; + + // // mu::Parser fct; + // fct.SetExpr("U*(1-(((((x2-y0)^2+(x1-x0)^2)^0.5)/R)^NplusOne))"); + // fct.DefineConst("x0", cx1); + // fct.DefineConst("y0", cx2); + // //fct.DefineConst("z0", cx3); + // fct.DefineConst("R", R); + // fct.DefineConst("U", uLB_ref * ((N + 3) / (N + 1))); + // fct.DefineConst("NplusOne", N + 1.0); + + //SPtr<BC> inflowConcreteBC(new VelocityBC(false, false, true, fct, 0, BCFunction::INFCONST)); + //inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowConcreteBC(new MultiphaseVelocityBC(false, false, true, fct, phiH, 0, BCFunction::INFCONST)); + inflowConcreteBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // air inflow boundary condition + // Ã… tigler, J. (2014). Analytical velocity profile in tube for laminar and turbulent flow. Engineering + // Mechanics, 21(6), 371-379. + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + // SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + // double V = 40; // flow rate [m^3/h] + // double D = 0.0166; // air inlet diameter [m] + // double R = D / 2.0; // radius [m] + // double A = UbMath::PI * R * R; + // double u = V / 3600 / A; + // double uLB_ref = u * unitsAir->getFactorVelocityWToLb(); + //// double cx1 = -1.2788 + R; + // double cx2 = 0.3803 + R; + // double cx3 = 0.1517 + R; + // double L = g_maxX1 - g_minX1; + // double p_air = 7e5; // Pa = 7 Bar + // double p1 = p_air; + // double p2 = 0.0; + // double mu = 17.2e-6; // Pa s, air 20° C + // double N = R * R / 2 * mu * u * (p1 - p2) / L - 3; + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u); + // if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_ref); + // + + // double nu = mu / rhoConcrete; + // double Re = d_part * u / nu; + // if (myid == 0) VF_LOG_INFO("Re_air = {}", Re); + + // double nuLB = d_part * unitsAir->getFactorLentghWToLb() * uLB_ref / Re; + // if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB); + // nu_l_LB = nuLB; + + SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, 1., 1.2041, d_part / dx, uLB_ref); + //SPtr<LBMUnitConverter> unitsAir = std::make_shared<LBMUnitConverter>(d_part, LBMUnitConverter::AIR_20C, d_part / dx); + double V_air = 40./6.; // flow rate [m^3/h] //10. + double D_air = 0.00553; // air inlet diameter [m] + double R_air = D_air / 2.0; // radius [m] + double A_air = UbMath::PI * (R_air * R_air); + double u_air = V_air / 3600 / A_air; + double uLB_air = u_air * unitsAir->getFactorVelocityWToLb(); + // double cx1 = -1.2788 + R; + double cx2 = 0.385822 + R_air; + double cx3 = 0.135562 + R_air; + //double L_air = 0.00747; + double p_air = 7e5; // Pa = 7 Bar + //double p1 = p_air; + //double p2 = 1e5; + double mu_air = 17.2e-6; // Pa s, air 20° C + double rho_air = 1.2041; // [kg/m^3] + double Re_inlet = D_air * u_air * rho_air / mu_air; + double lambda = 0.3164 / pow(Re_inlet, 0.25); + double deltaP = (lambda / (2. * R_air)) * (rho_air * pow(u_air, 2) / 2.); // Darcy friction factor (Rohrreibungszahl) + double N = pow(R_air, 2) / (2. * mu_air * u_air) * deltaP - 3.; + // double N = R_air * R_air / 2 * mu_air * u_air * (p1 - p2) / L_air - 3; + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} m/s", u_air); + if (myid == 0) VF_LOG_INFO("Air inflow velocity = {} dx/dt", uLB_air); + + double nu_air = mu_air / rho_air; + double Re_air = d_part * u_air / nu_air; + if (myid == 0) VF_LOG_INFO("Air Re = {}", Re_air); + + double nuLB_air = nu_air * unitsAir->getFactorViscosityWToLb(); // d_part * unitsAir->getFactorLentghWToLb() * uLB_air / Re_air; + if (myid == 0) VF_LOG_INFO("nuLB_air = {}", nuLB_air); + nu_l_LB = nuLB_air; + + if (myid == 0) VF_LOG_INFO("nu_h = {}", nu_h_LB); + if (myid == 0) VF_LOG_INFO("nu_l = {}", nu_l_LB); + if (myid == 0) VF_LOG_INFO("sigma_LB = {}", sigma_LB); + + double p_air_LB = p_air * unitsAir->getFactorPressureWToLb(); + if (myid == 0) VF_LOG_INFO("p_air_LB = {}", p_air_LB); + + // mu::Parser fctVx1; + ////fctVx1.SetExpr("U"); + ////fctVx1.DefineConst("U", uLB_air); + // mu::Parser fctVx2; + // fctVx2.SetExpr("U"); + // fctVx2.DefineConst("U", 0); + // mu::Parser fctVx3; + ////fctVx3.SetExpr("U"); + ////fctVx3.DefineConst("U", -uLB_air); + + double cx1 = 0; + double alpha = 0; + double gamma = 0; + double U = uLB_air;// * ((N + 3.) / (N + 1.)); + + mu::Parser fctVx1; + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx1.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + // fctVx1.SetExpr("(((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5/R)^NplusOne"); + fctVx1.SetExpr("U*cos(alpha*_pi/180)"); + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("R", R_air); + fctVx1.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx1.DefineConst("NplusOne", N + 1.0); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + + mu::Parser fctVx2; + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx2.SetExpr("U*sin(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx2.SetExpr("U*sin(alpha*_pi/180)"); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("R", R_air); + fctVx2.DefineConst("U", U); //* ((N + 3.) / (N + 1.))); + fctVx2.DefineConst("NplusOne", N + 1.0); + fctVx2.DefineConst("alpha", alpha); + + mu::Parser fctVx3; + //fctVx3.SetExpr("U*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)^NplusOne))"); + //fctVx3.SetExpr("U*cos(alpha*_pi/180)*(1-(((((x1-x0)^2+(x2-y0)^2+(x3-z0)^2)^0.5)/R)))"); + fctVx3.SetExpr("U"); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("R", R_air); + fctVx3.DefineConst("U", -U); //* ((N + 3.) / (N + 1.))); + fctVx3.DefineConst("NplusOne", N + 1.0); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + // SPtr<BC> inflowAirBC1(new VelocityBC(true, false, false, fct, 0, BCFunction::INFCONST)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + // t = U * sin(alpha * _pi / 180) * (1 - (((((x1 - x0) ^ 2 + (x2 - y0) ^ 2 + (x3 - z0) ^ 2) ^ 0.5) / R) ^ NplusOne)); + cx1 = -1.31416e3; + cx2 = 0.388684e3; + cx3 = 0.138177e3; + alpha = 0; + gamma = 225; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx1.DefineConst("gamma", gamma); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx2.DefineConst("gamma", gamma); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + fctVx3.DefineConst("alpha", alpha); + fctVx3.DefineConst("gamma", gamma); + + //SPtr<BC> inflowAirBC1(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC1(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + fctVx1.DefineVar("x1", &cx1); + fctVx1.DefineVar("x2", &cx2); + fctVx1.DefineVar("x3", &cx3); + fctVx2.DefineVar("x1", &cx1); + fctVx2.DefineVar("x2", &cx2); + fctVx2.DefineVar("x3", &cx3); + fctVx3.DefineVar("x1", &cx1); + fctVx3.DefineVar("x2", &cx2); + fctVx3.DefineVar("x3", &cx3); + + if (myid == 0) { + + VF_LOG_INFO("fctVx1 = {}", fctVx1.Eval()); + VF_LOG_INFO("fctVx2 = {}", fctVx2.Eval()); + VF_LOG_INFO("fctVx3 = {}", fctVx3.Eval()); + VF_LOG_INFO("N = {}", N); + VF_LOG_INFO("NplusOne = {}", N + 1.0); + // return 0; + } + cx1 = -1.31303e3; + cx2 = 0.377234e3; + cx3 = 0.138174e3; + alpha = 60; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC2(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC2(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC2->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.2948374155694822e3; + cx2 = 0.37733728717266285e3; + cx3 = 0.13840460401111598e3; + alpha = 120; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC3(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC3(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC3->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.28847e3; + cx2 = 0.3885e3; + cx3 = 0.1385e3; + alpha = 180; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC4(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC4(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC4->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.294771417778694e3; + cx2 = 0.399787947463142e3; + cx3 = 0.1383429692754194e3; + alpha = 240; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC5(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC5(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC5->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + cx1 = -1.3077338898450492e3; + cx2 = 0.3998516560596088e3; + cx3 = 0.13843501416896437e3; + alpha = 300; + fctVx1.DefineConst("x0", cx1); + fctVx1.DefineConst("y0", cx2); + fctVx1.DefineConst("z0", cx3); + fctVx1.DefineConst("alpha", alpha); + fctVx2.DefineConst("x0", cx1); + fctVx2.DefineConst("y0", cx2); + fctVx2.DefineConst("z0", cx3); + fctVx2.DefineConst("alpha", alpha); + fctVx3.DefineConst("x0", cx1); + fctVx3.DefineConst("y0", cx2); + fctVx3.DefineConst("z0", cx3); + //SPtr<BC> inflowAirBC6(new VelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, 0, BCFunction::INFCONST)); + //inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new VelocityBCStrategy())); + SPtr<BC> inflowAirBC6(new MultiphaseVelocityBC(true, true, true, fctVx1, fctVx2, fctVx3, phiL, 0, BCFunction::INFCONST)); + inflowAirBC6->setBCStrategy(SPtr<BCStrategy>(new MultiphaseVelocityBCStrategy())); + + // Pressure BC for air inlet + // SPtr<BC> inflowAirBC1(new DensityBC(p_air_LB)); + // inflowAirBC1->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonEqDensityBCStrategy())); + outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphasePressureBCStrategy())); + + // SPtr<BC> outflowBC(new DensityBC(rhoLB)); + //outflowBC->setBCStrategy(SPtr<BCStrategy>(new MultiphaseNonReflectingOutflowBCStrategy())); + ////////////////////////////////////////////////////////////////////////////////// + // BC visitor + //BoundaryConditionsBlockVisitor bcVisitor; + MultiphaseBoundaryConditionsBlockVisitor bcVisitor; + bcVisitor.addBC(noSlipBC); + bcVisitor.addBC(inflowConcreteBC); + bcVisitor.addBC(inflowAirBC1); + bcVisitor.addBC(outflowBC); + + // SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<CumulantK17LBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseTwoPhaseFieldsPressureFilterLBMKernel>(); + // SPtr<LBMKernel> kernel = make_shared<MultiphaseSimpleVelocityBaseExternalPressureLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<MultiphaseSharpInterfaceLBMKernel>(); + SPtr<LBMKernel> kernel = make_shared<MultiphaseScaleDistributionLBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBcumulantK17LBMKernel>(); + //SPtr<LBMKernel> kernel = make_shared<IBsharpInterfaceLBMKernel>(); + + kernel->setWithForcing(false); + kernel->setForcingX1(0.0); + kernel->setForcingX2(0.0); + kernel->setForcingX3(0.0); + + kernel->setPhiL(phiL); + kernel->setPhiH(phiH); + kernel->setPhaseFieldRelaxation(tauH); + kernel->setMobility(mob); + kernel->setInterfaceWidth(interfaceThickness); + + kernel->setCollisionFactorMultiphase(nu_h_LB, nu_l_LB); + kernel->setDensityRatio(densityRatio); + kernel->setMultiphaseModelParameters(beta, kappa); + kernel->setContactAngle(theta); + kernel->setSigma(sigma_LB); + + SPtr<BCSet> bcProc = make_shared<BCSet>(); + kernel->setBCSet(bcProc); + + SPtr<Grid3D> grid = make_shared<Grid3D>(comm); + grid->setPeriodicX1(false); + grid->setPeriodicX2(false); + grid->setPeriodicX3(false); + grid->setDeltaX(dx); + grid->setBlockNX(blockNX[0], blockNX[1], blockNX[2]); + grid->setGhostLayerWidth(2); + + //string geoPath = "/home/niikonst/NozzleGeo"; + + //string outputPath = "/scratch/projects/nii00154/ShotcreteJet2"; + UbSystem::makeDirectory(outputPath); + UbSystem::makeDirectory(outputPath + "/liggghts"); + + // if (myid == 0) { + // stringstream logFilename; + // logFilename << outputPath + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + // UbLog::output_policy::setStream(logFilename.str()); + // } + + ///////////////////////////////////////////////////////////////////// + //LIGGGHTS things + ///////////////////////////////////////////////////////////////////// + // string inFile1 = "d:/Projects/TRR277/Project/WP4/Config/in.nozzle"; + // // string inFile2 = "d:/Projects/VirtualFluids_LIGGGHTS_coupling/apps/cpu/LiggghtsApp/in2.lbdem"; + // MPI_Comm mpi_comm = *(MPI_Comm *)(comm->getNativeCommunicator()); + // LiggghtsCouplingWrapper wrapper(argv, mpi_comm); + + // double v_frac = 0.1; + // double dt_phys = units->getFactorTimeLbToW(); + // int demSubsteps = 10; + // double dt_dem = dt_phys / (double)demSubsteps; + //int vtkSteps = 1000; + // string demOutDir = outputPath + "/liggghts"; + + // // wrapper.execCommand("echo none"); + + // // wrapper.execFile((char*)inFile1.c_str()); + + // //// set timestep and output directory + // //////wrapper.setVariable("t_step", dt_dem); + // //////wrapper.setVariable("dmp_stp", vtkSteps * demSubsteps); + // //////wrapper.setVariable("dmp_dir", demOutDir); + + // //!!!!//wrapper.execFile((char *)inFile1.c_str()); + // //wrapper.runUpto(demSubsteps - 1); + // // wrapper.runUpto(1000); + + // //LatticeDecomposition lDec((g_maxX1 - g_minX1) / dx, (g_maxX2 - g_minX2) / dx, (g_maxX3 - g_minX3) / dx, wrapper.lmp, grid); + + SPtr<UbScheduler> lScheduler = make_shared<UbScheduler>(1); + // SPtr<LiggghtsCouplingSimulationObserver> lcSimulationObserver = make_shared<LiggghtsCouplingSimulationObserver>(grid, lScheduler, comm, wrapper, demSubsteps, unitsAir); + // //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(std::ceil((g_maxX1 - g_minX1) / dx), std::ceil((g_maxX2 - g_minX2) / dx), std::ceil((g_maxX3 - g_minX3) / dx), wrapper.lmp); + // //SPtr<Grid3DVisitor> partVisitor = make_shared<LiggghtsPartitioningGridVisitor>(blockNX[0], blockNX[1], blockNX[2] * gridNZ, wrapper.lmp); + + // ///////////////////////////////////////////////////////////////////// + // ///////////////////////////////////////////////////////////////////// + + SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, vf::lbm::dir::DIR_MMM, MetisPartitioner::KWAY)); + + ////////////////////////////////////////////////////////////////////////// + // restart + //double cpStep = 15000; + //double cpStart = 10; + SPtr<UbScheduler> rSch(new UbScheduler(cpStep, cpStart)); + SPtr<MPIIOMigrationSimulationObserver> rcp(new MPIIOMigrationSimulationObserver(grid, rSch, metisVisitor, outputPath, comm)); + rcp->setLBMKernel(kernel); + rcp->setBCSet(bcProc); + ////////////////////////////////////////////////////////////////////////// + +//if (newStart) { + SPtr<GbObject3D> gridCube = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), outputPath + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + // geo + ////////////////////////////////////////////////////////// + //int accuracy = Interactor3D::EDGES; + /////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleAirDistributor = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:start"); + meshNozzleAirDistributor->readMeshFromSTLFileBinary(geoPath + "/01_Nozzle_Air_Distributor.stl", false); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirDistributor:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirDistributor.get(), outputPath + "/geo/meshNozzleAirDistributor", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleAirDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirDistributor, grid, unwettingNoSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + ///////////////////////////////////////////////////////////// + //SPtr<GbTriFaceMesh3D> meshNozzleAirInlet = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:start"); + //meshNozzleAirInlet->readMeshFromSTLFileASCII(geoPath + "/02_Nozzle_Air_Inlet.stl", false); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAirInlet:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAirInlet.get(), outputPath + "/geo/meshNozzleAirInlet", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrNozzleAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAirInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + ///////////////////////////////////////////////////////////// + //SPtr<GbTriFaceMesh3D> meshNozzleSpacer = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:start"); + //meshNozzleSpacer->readMeshFromSTLFileASCII(geoPath + "/03_Nozzle_Spacer.stl", true); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleSpacer:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleSpacer.get(), outputPath + "/geo/meshNozzleSpacer", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrNozzleSpacer = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleSpacer, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + ///////////////////////////////////////////////////////////// + //SPtr<GbTriFaceMesh3D> meshNozzleAccDistributor = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:start"); + //meshNozzleAccDistributor->readMeshFromSTLFileASCII(geoPath + "/04_Nozzle_Acc_Distributor.stl", false); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccDistributor:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccDistributor.get(), outputPath + "/geo/meshNozzleAccDistributor", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrNozzleAccDistributor = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccDistributor, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + ///////////////////////////////////////////////////////////// + //SPtr<GbTriFaceMesh3D> meshNozzleAccInlet = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:start"); + //meshNozzleAccInlet->readMeshFromSTLFileASCII(geoPath + "/05_Nozzle_Acc_Inlet.stl", false); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleAccInlet:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleAccInlet.get(), outputPath + "/geo/meshNozzleAccInlet", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrNozzleAccInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleAccInlet, grid, noSlipBC, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy); + ///////////////////////////////////////////////////////////// + //SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle1 = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:start"); + //meshNozzleVolcanNozzle1->readMeshFromSTLFileBinary(geoPath + "/06_1_Nozzle_Volcan_Nozzle.stl", true); + //if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle1:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle1.get(), outputPath + "/geo/meshNozzleVolcanNozzle1", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrNozzleVolcanNozzle1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle1, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshNozzleVolcanNozzle2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:start"); + //meshNozzleVolcanNozzle2->readMeshFromSTLFileBinary(geoPath + "/06_2_Nozzle_Volcan_Nozzle.stl", true); + meshNozzleVolcanNozzle2->readMeshFromSTLFileBinary(geoPath + "/Nozzle_Volcan_Nozzle_Shift.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshNozzleVolcanNozzle2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshNozzleVolcanNozzle2.get(), outputPath + "/geo/meshNozzleVolcanNozzle2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrNozzleVolcanNozzle2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshNozzleVolcanNozzle2, grid, unwettingNoSlipBC, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + // box + SPtr<D3Q27Interactor> intrBox = SPtr<D3Q27Interactor>(new D3Q27Interactor(gridCube, grid, noSlipBC, Interactor3D::INVERSESOLID)); + /////////////////////////////////////////////////////////// + // inflow + //GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, 0.20105, -1.30181 + 0.0005, 0.390872 - 0.00229, 0.23, 0.013)); + GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_maxX3 - 2.0 * dx, -1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_maxX3+2.0*dx, 0.013e3)); + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // outflow + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.22, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.21, 0.013)); + //GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, -0.426, -1.30181 + 0.0005, 0.390872 - 0.00229, -0.415, 0.013)); + GbCylinder3DPtr geoOutflow(new GbCylinder3D(-1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_minX3, -1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_minX3+2.*dx, 0.013e3)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), outputPath + "/geo/geoOutflow", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow, grid, outflowBC, Interactor3D::SOLID)); + /////////////////////////////////////////////////////////// + // SPtr<GbTriFaceMesh3D> geoAirInlet = std::make_shared<GbTriFaceMesh3D>(); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:start"); + // geoAirInlet->readMeshFromSTLFileASCII(geoPath + "/Air_Inlet.stl", true); + // if (myid == 0) UBLOG(logINFO, "Read Air_Inlet:end"); + // if (myid == 0) GbSystem3D::writeGeoObject(geoAirInlet.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + // SPtr<Interactor3D> intrAirInlet = std::make_shared<D3Q27TriFaceMeshInteractor>(geoAirInlet, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + ///////////////////////////////////////////////////////////// + // Fluid area + //GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_minX3, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3, 0.013)); + GbCylinder3DPtr geoFluidArea(new GbCylinder3D(-1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_maxX3_box, -1.30181e3 + 0.0005e3, 0.390872e3 - 0.00229e3, g_maxX3, 0.013e3)); + if (myid == 0) GbSystem3D::writeGeoObject(geoFluidArea.get(), outputPath + "/geo/geoFluidArea", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrFluidArea = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoFluidArea, grid, noSlipBC, Interactor3D::INVERSESOLID)); + + //SPtr<GbTriFaceMesh3D> meshFluidArea = std::make_shared<GbTriFaceMesh3D>(); + //if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:start"); + //meshFluidArea->readMeshFromSTLFileBinary(geoPath + "/FluidArea.stl", true); + //if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:end"); + //if (myid == 0) GbSystem3D::writeGeoObject(meshFluidArea.get(), outputPath + "/geo/meshFluidArea", WbWriterVtkXmlBinary::getInstance()); + //SPtr<Interactor3D> intrFluidArea = std::make_shared<D3Q27TriFaceMeshInteractor>(meshFluidArea, grid, noSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshInflowPipe = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:start"); + meshInflowPipe->readMeshFromSTLFileBinary(geoPath + "/InflowPipe.stl", true); + if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshInflowPipe.get(), outputPath + "/geo/meshInflowPipe", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrInflowPipe = std::make_shared<D3Q27TriFaceMeshInteractor>(meshInflowPipe, grid, unwettingNoSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshInflowPipe2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:start"); + meshInflowPipe2->readMeshFromSTLFileBinary(geoPath + "/LongTube2.stl", true); + if (myid == 0) UBLOG(logINFO, "Read geoFluidArea:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshInflowPipe2.get(), outputPath + "/geo/LongTube", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrInflowPipe2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshInflowPipe2, grid, unwettingNoSlipBC, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////// + //outflows + ////////////////////////////////////////////////////////// + SPtr<GbObject3D> geoOutflow1 = make_shared<GbCuboid3D>(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_minX3); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow1.get(), outputPath + "/geo/geoOutflow1", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow1, grid, noSlipBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoOutflow2 = make_shared<GbCuboid3D>(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_minX1, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow2.get(), outputPath + "/geo/geoOutflow2", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow2, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoOutflow3 = make_shared<GbCuboid3D>(g_maxX1, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow3.get(), outputPath + "/geo/geoOutflow3", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow3 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow3, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoOutflow4 = make_shared<GbCuboid3D>(g_minX1 - 2.0 * dx, g_minX2 - 2.0 * dx, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_minX2, g_maxX3 + 2.0 * dx); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow4.get(), outputPath + "/geo/geoOutflow4", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow4 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow4, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoOutflow5 = make_shared<GbCuboid3D>(g_minX1 - 2.0 * dx, g_maxX2, g_minX3 - 2.0 * dx, g_maxX1 + 2.0 * dx, g_maxX2 + 2.0 * dx, g_maxX3 + 2.0 * dx); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow5.get(), outputPath + "/geo/geoOutflow5", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrOutflow5 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow5, grid, outflowBC, Interactor3D::SOLID)); + + //SPtr<GbObject3D> geoOutflow6 = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_maxX3_box, g_maxX1, g_maxX2, g_maxX3_box + 2.0 * dx); + //if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow6.get(), outputPath + "/geo/geoOutflow6", WbWriterVtkXmlBinary::getInstance()); + //SPtr<D3Q27Interactor> intrOutflow6 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow6, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbTriFaceMesh3D> geoOutflow6 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read geoOutflow6:start"); + geoOutflow6->readMeshFromSTLFileBinary(geoPath + "/OutflowTop.stl", true); + if (myid == 0) UBLOG(logINFO, "Read geoOutflow6:end"); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow6.get(), outputPath + "/geo/geoOutflow6", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrOutflow6 = std::make_shared<D3Q27TriFaceMeshInteractor>(geoOutflow6, grid, outflowBC, Interactor3D::SOLID, Interactor3D::POINTS); + + /////////////////////////////////////////////////////////// + GbCylinder3DPtr geoAirInflow(new GbCylinder3D(-1.31431 - 0.0005, 0.388587, 0.1383275, -1.31431, 0.388587, 0.1383275, 0.002765)); + if (myid == 0) GbSystem3D::writeGeoObject(geoAirInflow.get(), outputPath + "/geo/geoAirInlet", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intrAirInflow = std::make_shared<D3Q27Interactor>(geoAirInflow, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::EDGES); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet1 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:start"); + meshAirInlet1->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_1.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet1:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet1.get(), outputPath + "/geo/meshAirInlet1", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet1 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet1, grid, inflowAirBC1, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet2 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:start"); + meshAirInlet2->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_2.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet2:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet2.get(), outputPath + "/geo/meshAirInlet2", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet2 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet2, grid, inflowAirBC2, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet3 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:start"); + meshAirInlet3->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_3.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet3:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet3.get(), outputPath + "/geo/meshAirInlet3", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet3 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet3, grid, inflowAirBC3, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet4 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:start"); + meshAirInlet4->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_4.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet4:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet4.get(), outputPath + "/geo/meshAirInlet4", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet4 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet4, grid, inflowAirBC4, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet5 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:start"); + meshAirInlet5->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_5.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet5:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet5.get(), outputPath + "/geo/meshAirInlet5", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet5 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet5, grid, inflowAirBC5, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + SPtr<GbTriFaceMesh3D> meshAirInlet6 = std::make_shared<GbTriFaceMesh3D>(); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:start"); + meshAirInlet6->readMeshFromSTLFileBinary(geoPath + "/Air_Inlet_6.stl", true); + if (myid == 0) UBLOG(logINFO, "Read meshAirInlet6:end"); + if (myid == 0) GbSystem3D::writeGeoObject(meshAirInlet6.get(), outputPath + "/geo/meshAirInlet6", WbWriterVtkXmlBinary::getInstance()); + SPtr<Interactor3D> intAirInlet6 = std::make_shared<D3Q27TriFaceMeshInteractor>(meshAirInlet6, grid, inflowAirBC6, Interactor3D::SOLID, Interactor3D::POINTS); + /////////////////////////////////////////////////////////// + + SPtr<GbObject3D> geoBox1 = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_maxX3_box, g_minX1+12.0*blockNX[0]*dx, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(geoBox1.get(), outputPath + "/geo/geoBox1", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrGeoBox1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoBox1, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoBox2 = make_shared<GbCuboid3D>(g_minX1 + 14.0 * blockNX[0] * dx, g_minX2, g_maxX3_box, g_maxX1, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(geoBox2.get(), outputPath + "/geo/geoBox2", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrGeoBox2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoBox2, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoBox3 = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_maxX3_box, g_maxX1, g_minX2 + 12.0 * blockNX[0] * dx, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(geoBox3.get(), outputPath + "/geo/geoBox3", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrGeoBox3 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoBox3, grid, outflowBC, Interactor3D::SOLID)); + + SPtr<GbObject3D> geoBox4 = make_shared<GbCuboid3D>(g_minX1, g_minX2 + 14.0 * blockNX[0] * dx, g_maxX3_box, g_maxX1, g_maxX2, g_maxX3); + if (myid == 0) GbSystem3D::writeGeoObject(geoBox4.get(), outputPath + "/geo/geoBox4", WbWriterVtkXmlBinary::getInstance()); + SPtr<D3Q27Interactor> intrGeoBox4 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoBox4, grid, outflowBC, Interactor3D::SOLID)); + + InteractorsHelper intHelper1(grid, metisVisitor, true); + //intHelper1.addInteractor(intrFluidArea); + intHelper1.addInteractor(intrGeoBox1); + intHelper1.addInteractor(intrGeoBox2); + intHelper1.addInteractor(intrGeoBox3); + intHelper1.addInteractor(intrGeoBox4); + intHelper1.selectBlocks(); + + //MultiphaseSetKernelBlockVisitor kernelVisitor(kernel, nu_h_LB, nu_l_LB, 1e9, 1); + //grid->accept(kernelVisitor); + + //intHelper1.setBC(); + + //SPtr<GbObject3D> gridCube2 = make_shared<GbCuboid3D>(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3_box); + //if (myid == 0) GbSystem3D::writeGeoObject(gridCube2.get(), outputPath + "/geo/gridCube2", WbWriterVtkXmlBinary::getInstance()); + //GenBlocksGridVisitor genBlocks2(gridCube2); + //grid->accept(genBlocks2); + + MultiphaseSetKernelBlockVisitor kernelVisitor2(kernel, nu_h_LB, nu_l_LB, 1e9, 1 ); // ,MultiphaseSetKernelBlockVisitor::AddKernel); + grid->accept(kernelVisitor2); + + vector<SPtr<Block3D>> blocks; + grid->getBlocksByCuboid(0, g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3, blocks); + + for (auto block : blocks) { + if (block) { + block->setActive(true); + SPtr<BCArray3D> bcArray = block->getKernel()->getBCSet()->getBCArray(); + + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; + + int maxX1 = (int)(bcArray->getNX1()) - 1; + int maxX2 = (int)(bcArray->getNX2()) - 1; + int maxX3 = (int)(bcArray->getNX3()) - 1; + + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { + bcArray->setFluid(ix1, ix2, ix3); + } + } + } + } + } + + if (!newStart) + { + rcp->readBlocks((int)restartStep); + grid->accept(metisVisitor); + rcp->readDataSet((int)restartStep); + grid->setTimeStep(restartStep); + } + + InteractorsHelper intHelper2(grid, metisVisitor, false); + intHelper2.addInteractor(intrInflowPipe); + intHelper2.addInteractor(intrInflowPipe2); + intHelper2.addInteractor(intrNozzleAirDistributor); + //intHelper2.addInteractor(intrFluidArea); + intHelper2.addInteractor(intrNozzleVolcanNozzle2); + // intHelper.addInteractor(intrBox); + intHelper2.addInteractor(intrInflow); + //// intHelper.addInteractor(intrAirInflow); + intHelper2.addInteractor(intAirInlet1); + intHelper2.addInteractor(intAirInlet2); + intHelper2.addInteractor(intAirInlet3); + intHelper2.addInteractor(intAirInlet4); + intHelper2.addInteractor(intAirInlet5); + intHelper2.addInteractor(intAirInlet6); + intHelper2.addInteractor(intrOutflow1); + intHelper2.addInteractor(intrOutflow2); + intHelper2.addInteractor(intrOutflow3); + intHelper2.addInteractor(intrOutflow4); + intHelper2.addInteractor(intrOutflow5); + intHelper2.addInteractor(intrOutflow6); + + // intHelper.addInteractor(intrNozzleAirDistributor); + // intHelper.addInteractor(intrNozzleAirInlet); + // intHelper.addInteractor(intrNozzleSpacer); + // intHelper.addInteractor(intrNozzleAccDistributor); + // intHelper.addInteractor(intrNozzleAccInlet); + // intHelper.addInteractor(intrNozzleVolcanNozzle1); + + intHelper2.selectBlocks(); + + // if (myid == 0) UBLOG(logINFO, Utilities::toString(grid, comm->getNumberOfProcesses())); + + //SetKernelBlockVisitor kernelVisitor(kernel, nu_l_LB, comm->getNumberOfProcesses()); + + + intHelper2.setBC(); + + + + //GenBlocksGridVisitor genBlocks2(gridCube2); + //grid->accept(genBlocks2); + + //grid->accept(metisVisitor); + + //MultiphaseSetKernelBlockVisitor kernelVisitor2(kernel, nu_h_LB, nu_l_LB, 1e9, 1, MultiphaseSetKernelBlockVisitor::AddKernel); + //grid->accept(kernelVisitor2); + + //SetBcBlocksBlockVisitor v1(intrOutflow1); + //grid->accept(v1); + //intrOutflow1->initInteractor(); + + + //SetBcBlocksBlockVisitor v2(intrOutflow2); + //grid->accept(v2); + //intrOutflow2->initInteractor(); + + //SetBcBlocksBlockVisitor v3(intrOutflow3); + //grid->accept(v3); + //intrOutflow3->initInteractor(); + + //SetBcBlocksBlockVisitor v4(intrOutflow4); + //grid->accept(v4); + //intrOutflow4->initInteractor(); + + //SetBcBlocksBlockVisitor v5(intrOutflow5); + //grid->accept(v5); + //intrOutflow5->initInteractor(); + + //SetBcBlocksBlockVisitor v6(intrOutflow6); + //grid->accept(v6); + //intrOutflow6->initInteractor(); + + //SetBcBlocksBlockVisitor v7(intrNozzleVolcanNozzle2); + //grid->accept(v7); + //intrNozzleVolcanNozzle2->initInteractor(); + + + SPtr<SimulationObserver> ppblocks = make_shared<WriteBlocksSimulationObserver>(grid, SPtr<UbScheduler>(new UbScheduler(1)), outputPath, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks->update(0); + ppblocks.reset(); + + // boundary conditions grid + { + SPtr<UbScheduler> geoSch(new UbScheduler(1)); + SPtr<WriteBoundaryConditionsSimulationObserver> ppgeo(new WriteBoundaryConditionsSimulationObserver(grid, geoSch, outputPath, WbWriterVtkXmlBinary::getInstance(), comm)); + ppgeo->update(0); + ppgeo.reset(); + } + + + + if (newStart) + { + double x1c = -1.31431e3 + R; + double x2c = 0.375582e3 + R; + double Ri = 5e3; + //double x3c = 0.136e3 + Ri; + double x3c = -65 + Ri; + + mu::Parser fct1; + // fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.SetExpr(" 0.5 - 0.5 * tanh(2 * (sqrt((x1 - x1c) ^ 2 + (x2 - x2c) ^ 2 + (x3 - x3c) ^ 2) - radius) / interfaceThickness)"); + fct1.DefineConst("x1c", x1c); + fct1.DefineConst("x2c", x2c); + fct1.DefineConst("x3c", x3c); + fct1.DefineConst("radius", Ri); + fct1.DefineConst("interfaceThickness", interfaceThickness * dx); + + MultiphaseVelocityFormInitDistributionsBlockVisitor initVisitor; + initVisitor.setPhi(fct1); + grid->accept(initVisitor); + } + //else + //{ + // //rcp->restart((int)restartStep); + // rcp->readBlocks((int)restartStep); + // grid->accept(metisVisitor); + // rcp->readDataSet((int)restartStep); + // grid->setTimeStep(restartStep); + //} + + + + +//} +//else +//{ +// //double restartStep = 10; +// rcp->restart((int)restartStep); +// grid->setTimeStep(restartStep); +// +// //GbCylinder3DPtr geoInflow(new GbCylinder3D(-1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3 - 2.0 * dx, -1.30181 + 0.0005, 0.390872 - 0.00229, g_maxX3 + 2.0 * dx, 0.013)); +// //if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), outputPath + "/geo/geoInflow", WbWriterVtkXmlBinary::getInstance()); +// //SPtr<D3Q27Interactor> intrInflow = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoInflow, grid, inflowConcreteBC, Interactor3D::SOLID)); +// //SetBcBlocksBlockVisitor v1(intrInflow); +// //grid->accept(v1); +// //intrInflow->initInteractor(); +// +// if (myid == 0) UBLOG(logINFO, "Restart - end"); +//} + + + if (myid == 0) VF_LOG_INFO("{}", Utilities::toString(grid, comm->getNumberOfProcesses())); + + + grid->accept(bcVisitor); + //OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); + TwoDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + // ThreeDistributionsDoubleGhostLayerSetConnectorsBlockVisitor setConnsVisitor(comm); + grid->accept(setConnsVisitor); + + //int numOfThreads = 18; + omp_set_num_threads(numOfThreads); + + SPtr<UbScheduler> nupsSch = std::make_shared<UbScheduler>(10, 10, 100); + SPtr<NUPSCounterSimulationObserver> nupsSimulationObserver = make_shared<NUPSCounterSimulationObserver>(grid, nupsSch, numOfThreads, comm); + + //// write data for visualization of macroscopic quantities + SPtr<UbScheduler> visSch(new UbScheduler(vtkSteps)); + // SPtr<UbScheduler> visSch(new UbScheduler(1, 8700, 8800)); + // visSch->addSchedule(1, 8700, 8800); + SPtr<WriteSharpInterfaceQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteSharpInterfaceQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(10); + + //SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, outputPath, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm)); + //writeMQSimulationObserver->update(0); + + //int endTime = 20; + SPtr<Simulation> simulation(new Simulation(grid, lScheduler, endTime)); + simulation->addSimulationObserver(nupsSimulationObserver); + //!!!//simulation->addSimulationObserver(lcSimulationObserver); + simulation->addSimulationObserver(writeMQSimulationObserver); + simulation->addSimulationObserver(rcp); + + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + simulation->run(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + + } catch (std::exception &e) { + cerr << e.what() << endl << flush; + } catch (std::string &s) { + cerr << s << endl; + } catch (...) { + cerr << "unknown exception" << endl; + } + return 0; +} diff --git a/apps/cpu/TPMSRow/TPMSRow.cpp b/apps/cpu/TPMSRow/TPMSRow.cpp index 9adcaadde90454a64221d04e55712ff12c175e54..09be56c68ed6cc0db2d911b19a21feae2c890d80 100644 --- a/apps/cpu/TPMSRow/TPMSRow.cpp +++ b/apps/cpu/TPMSRow/TPMSRow.cpp @@ -47,7 +47,7 @@ void run(string configname) bool newStart = config.getValue<bool>("newStart"); //SPtr<Communicator> comm = MPICommunicator::getInstance(); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); //int numOfProcesses = comm->getNumberOfProcesses(); @@ -447,7 +447,7 @@ void run(string configname) UBLOG(logINFO, "Restart - end"); } // set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu, iProcessor); OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); diff --git a/apps/cpu/ViskomatXL/viskomat.cpp b/apps/cpu/ViskomatXL/viskomat.cpp index 327f25e599c80b059fe273cfd2a0c526ed4279f7..7db98670e2325825a76b60559d09d818838f9430 100644 --- a/apps/cpu/ViskomatXL/viskomat.cpp +++ b/apps/cpu/ViskomatXL/viskomat.cpp @@ -40,7 +40,7 @@ void bflow(string configname) vf::basics::ConfigurationFile viscosity; - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) diff --git a/apps/cpu/Wing/wing.cpp b/apps/cpu/Wing/wing.cpp index ff6cbcfcab3b60669aea19ca6a56077034f0e7dc..d7e4cd77057f3edb63432b25e50aecc285734a7e 100644 --- a/apps/cpu/Wing/wing.cpp +++ b/apps/cpu/Wing/wing.cpp @@ -30,7 +30,7 @@ void setup(const char *cstr1, const char *cstr2) int refineLevel = UbSystem::stringTo<int>(cf.getValue("refineLevel")); int blocknx = UbSystem::stringTo<int>(cf.getValue("blocknx")); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "Bombadil") int dumy=0; diff --git a/apps/cpu/aperm/aperm.cpp b/apps/cpu/aperm/aperm.cpp index ecff1a453276444b706e31729012dea10597ac61..44b48bb3cfd4038da8be18bfa1a0328edb7cb570 100644 --- a/apps/cpu/aperm/aperm.cpp +++ b/apps/cpu/aperm/aperm.cpp @@ -59,7 +59,7 @@ void run(string configname) double cpStepStart = config.getDouble("cpStepStart"); bool newStart = config.getValue<bool>("newStart"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -320,7 +320,7 @@ void run(string configname) ////////////////////////////////////// //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -467,7 +467,7 @@ void run(string configname) } //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/aperm/aperm.cpp.old b/apps/cpu/aperm/aperm.cpp.old index 54dfe45fd86ff791d3965632a21acac0a3284aea..3776c454f75d0510a6ec4f033d25f35aa82618d4 100644 --- a/apps/cpu/aperm/aperm.cpp.old +++ b/apps/cpu/aperm/aperm.cpp.old @@ -58,7 +58,7 @@ void run(string configname) bool yDir = config.getBool("yDir"); bool zDir = config.getBool("zDir"); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -285,7 +285,7 @@ void run(string configname) ////////////////////////////////////// //set connectors - D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -487,7 +487,7 @@ void run(string configname) } //set connectors - D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + D3Q27InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/aperm/aperm.cpp.old2 b/apps/cpu/aperm/aperm.cpp.old2 index bd49f895a277a34608393a7cb53c0b6466526a95..ece4410e92f4ac587391ed0921400c4110cfb921 100644 --- a/apps/cpu/aperm/aperm.cpp.old2 +++ b/apps/cpu/aperm/aperm.cpp.old2 @@ -55,7 +55,7 @@ void run(string configname) bool yDir = config.getBool("yDir"); bool zDir = config.getBool("zDir"); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -303,7 +303,7 @@ void run(string configname) ////////////////////////////////////// //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -450,7 +450,7 @@ void run(string configname) } //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/bChannelA/bChannelA.cpp b/apps/cpu/bChannelA/bChannelA.cpp index d50e87437b5fa17353b0f8adb298ec91ecc9d964..a59d829c35e6d1211d206439803c732f832831b2 100644 --- a/apps/cpu/bChannelA/bChannelA.cpp +++ b/apps/cpu/bChannelA/bChannelA.cpp @@ -111,7 +111,7 @@ void run(string configname) vector<double> nupsStep = config.getVector<double>("nupsStep"); vector<double> boundingBox = config.getVector<double>("boundingBox"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -385,8 +385,8 @@ void run(string configname) grid->accept(initVisitor); ////set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -409,7 +409,7 @@ void run(string configname) //migCoProcessor->restart((int)restartStep); grid->setTimeStep(restartStep); //////////////////////////////////////////////////////////////////////////// - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/bChannelVA/bChannelVA.cpp b/apps/cpu/bChannelVA/bChannelVA.cpp index 6cfe5dac2557f167864495599074cd3c94da6517..363d02697f0fde6ff18736b07e09e1ac3310bea7 100644 --- a/apps/cpu/bChannelVA/bChannelVA.cpp +++ b/apps/cpu/bChannelVA/bChannelVA.cpp @@ -13,7 +13,7 @@ int main(int argc, char* argv[]) try { //Sleep(20000); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); //Pheonix diff --git a/apps/cpu/bKanal/HLRNb/bKanal.cpp b/apps/cpu/bKanal/HLRNb/bKanal.cpp index 0c5c46a0cb78354563425685c8346ff81258ccd2..99b21eabf2a3c11b325fc3727e5acb795b394dfc 100644 --- a/apps/cpu/bKanal/HLRNb/bKanal.cpp +++ b/apps/cpu/bKanal/HLRNb/bKanal.cpp @@ -27,7 +27,7 @@ void run(const char *cstr) UbLog::reportingLevel() = logINFO; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); diff --git a/apps/cpu/bKanal/bKanal.cpp b/apps/cpu/bKanal/bKanal.cpp index 94af8f6aa46ddf5f398747805836ba95ce1dbbaf..33994ad706dc50ec1f1532f2b6b31fec84f4a520 100644 --- a/apps/cpu/bKanal/bKanal.cpp +++ b/apps/cpu/bKanal/bKanal.cpp @@ -24,7 +24,7 @@ void run(const char *cstr) UbLog::reportingLevel() = logINFO; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/bKanal/sKanal/bKanal.cpp b/apps/cpu/bKanal/sKanal/bKanal.cpp index 6a9d3c2c697b04c176bc9c11aa38f7f719e07785..1048554fb5ffc1e91abc97cf2bbf7f4133533063 100644 --- a/apps/cpu/bKanal/sKanal/bKanal.cpp +++ b/apps/cpu/bKanal/sKanal/bKanal.cpp @@ -27,7 +27,7 @@ void run(const char *cstr) UbLog::reportingLevel() = logINFO; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "PIPPINNEU") diff --git a/apps/cpu/bKanal2/bKanal2.cpp b/apps/cpu/bKanal2/bKanal2.cpp index 10e6f988085244e2028f28fca4129bc354c49699..ec632612596d14a747b48500d7436bbf4876f081 100644 --- a/apps/cpu/bKanal2/bKanal2.cpp +++ b/apps/cpu/bKanal2/bKanal2.cpp @@ -24,7 +24,7 @@ void run(const char *cstr) UbLog::reportingLevel() = logINFO; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/bKanalAv/bKanal.cpp b/apps/cpu/bKanalAv/bKanal.cpp index 71ca1ed0464afd67adf8db473ccdbf9487b8acda..27bf3c1a61f1d429e60a057a74479ad306098826 100644 --- a/apps/cpu/bKanalAv/bKanal.cpp +++ b/apps/cpu/bKanalAv/bKanal.cpp @@ -27,7 +27,7 @@ void run(const char *cstr) UbLog::reportingLevel() = logINFO; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); diff --git a/apps/cpu/band/band.cpp b/apps/cpu/band/band.cpp index 370e50341662d21f25407cec428b1c20ee543a37..b454ff1284bbb1d64d657e9c87a51be2cbf06d66 100644 --- a/apps/cpu/band/band.cpp +++ b/apps/cpu/band/band.cpp @@ -20,7 +20,7 @@ void run(const char *cstr) //UbLog::reportingLevel() = logDEBUG5; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/bbone/bbone.cpp b/apps/cpu/bbone/bbone.cpp index 3eb6c827c6157c4dc6810ffaab402e3e51337c93..558ff4c9848bac363e4e01ad94fcd450745ea3de 100644 --- a/apps/cpu/bbone/bbone.cpp +++ b/apps/cpu/bbone/bbone.cpp @@ -33,7 +33,7 @@ void sbonepd(string configname) bool logToFile = config.getBool("logToFile"); double deltaT = config.getDouble("deltaT"); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) diff --git a/apps/cpu/block_test/block_test_incompressible.hpp b/apps/cpu/block_test/block_test_incompressible.hpp index 2ce506c93f4611a3069140703e712dbcca7fe661..61b8d762bdf727816f07833c30e02e86e02c2c20 100644 --- a/apps/cpu/block_test/block_test_incompressible.hpp +++ b/apps/cpu/block_test/block_test_incompressible.hpp @@ -29,7 +29,7 @@ void block_test_incompressible(const char *cstr1, const char *cstr2) int numOfThreads = UbSystem::stringTo<int>(cf.getValue("numOfThreads")); double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "BOMBADIL") diff --git a/apps/cpu/bond_benchmark/bonb_b_chanel.cpp b/apps/cpu/bond_benchmark/bonb_b_chanel.cpp index b5e63c50d5a9ba91abb872319a7e68de9df28b97..7df5a016279b60337a5a24b4c3a5241d7f0555b9 100644 --- a/apps/cpu/bond_benchmark/bonb_b_chanel.cpp +++ b/apps/cpu/bond_benchmark/bonb_b_chanel.cpp @@ -29,7 +29,7 @@ void chanel(const char *cstr) string comm_type = cf.getValue("comm"); if(comm_type == "MPI") - comm = vf::mpi::MPICommunicator::getInstance(); + comm = vf::parallel::MPICommunicator::getInstance(); else if(comm_type == "BOND") comm = BondCommunicator::getInstance(); diff --git a/apps/cpu/bond_benchmark/bond_b.cpp b/apps/cpu/bond_benchmark/bond_b.cpp index 6d607811a21f4dc111f6b003bf9343c60973207c..e3924595d89afd1f81cd4dde159f42a569e0cd01 100644 --- a/apps/cpu/bond_benchmark/bond_b.cpp +++ b/apps/cpu/bond_benchmark/bond_b.cpp @@ -35,7 +35,7 @@ void periodic(const char *cstr1, const char *cstr2) string comm_type = cf.getValue("comm"); if(comm_type == "MPI") - comm = vf::mpi::MPICommunicator::getInstance(); + comm = vf::parallel::MPICommunicator::getInstance(); else if(comm_type == "BOND") comm = BondCommunicator::getInstance(); diff --git a/apps/cpu/bond_test/bond_test.cpp b/apps/cpu/bond_test/bond_test.cpp index b7091184ff789dd6ac56e8c085853e5a45c088a0..fd77c285f540034b8c1d432097c45d9d0c6e9a7c 100644 --- a/apps/cpu/bond_test/bond_test.cpp +++ b/apps/cpu/bond_test/bond_test.cpp @@ -153,7 +153,7 @@ void simulation(const char *cstr) CommunicatorPtr comm; string comm_type = cf.getValue("comm"); if(comm_type == "MPI") - comm = vf::mpi::MPICommunicator::getInstance(); + comm = vf::parallel::MPICommunicator::getInstance(); else if(comm_type == "BOND") comm = BondCommunicator::getInstance(); diff --git a/apps/cpu/bone/bone.cpp b/apps/cpu/bone/bone.cpp index 849241ba26fc515ca2ee4ac3bd127742c0c693e5..17d0eca37975fa2cee87aa87f815d7237673111d 100644 --- a/apps/cpu/bone/bone.cpp +++ b/apps/cpu/bone/bone.cpp @@ -18,7 +18,7 @@ void run(const char *cstr1, const char *cstr2) stringstream logFilename; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr1); diff --git a/apps/cpu/f16Test/f16test.cpp b/apps/cpu/f16Test/f16test.cpp index a73949c8cef45cfa1b576070cb004041f2ac7a0f..32f424bdbcd8c2fa9f9596147757dc63f2c0b684 100644 --- a/apps/cpu/f16Test/f16test.cpp +++ b/apps/cpu/f16Test/f16test.cpp @@ -42,7 +42,7 @@ void run(string configname) double refineDistance = config.getDouble("refineDistance"); vector<double> nupsStep = config.getVector<double>("nupsStep"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -571,8 +571,8 @@ void run(string configname) grid->accept(initVisitor); ////set connectors - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -591,7 +591,7 @@ void run(string configname) } else { - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/insitu_demo/insitu_demo.cpp b/apps/cpu/insitu_demo/insitu_demo.cpp index 42a1c6b4c636801bbaa50a1027751cd88301edfb..bd5f150191f2b9a63a1b7532d8f91b8f068d089a 100644 --- a/apps/cpu/insitu_demo/insitu_demo.cpp +++ b/apps/cpu/insitu_demo/insitu_demo.cpp @@ -15,7 +15,7 @@ void chanel(const char *cstr1) double availMem = 0; //CommunicatorPtr comm = FETOLCommunicator::getInstance(); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int mybundle = comm->getBundleID(); diff --git a/apps/cpu/levels/levels.cpp b/apps/cpu/levels/levels.cpp index 0fe328df129ea3f64a135f74f51e425c8d33bd52..10672abe42441f69e9536fb78e54efb01503264e 100644 --- a/apps/cpu/levels/levels.cpp +++ b/apps/cpu/levels/levels.cpp @@ -14,7 +14,7 @@ void run(string configname) string machine = QUOTEME(CAB_MACHINE); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int mybundle = comm->getBundleID(); @@ -208,7 +208,7 @@ void run(string configname) //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -290,7 +290,7 @@ void run(string configname) UBLOG(logINFO, "SetConnectors - start, id="<<myid); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); SPtr<ConnectorFactory> cFactory(new Block3DConnectorFactory()); ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, cFactory); diff --git a/apps/cpu/micropart/micropartTestQs3.hpp b/apps/cpu/micropart/micropartTestQs3.hpp index 14e9a84412a51548b91f668369029afd057241c5..d8c870269b42929d5844bb516c79d091d6ab40ad 100644 --- a/apps/cpu/micropart/micropartTestQs3.hpp +++ b/apps/cpu/micropart/micropartTestQs3.hpp @@ -9,7 +9,7 @@ void micropartTestQs3(const char *cstr) { try { - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); int numprocs = comm->getNumberOfProcesses(); diff --git a/apps/cpu/mirror/mirror.cpp b/apps/cpu/mirror/mirror.cpp index 68902fdb7d0dcb74d3eb59d884a0619c8bb0cf6b..99ba78ff170513b6b8e92681b203f74dbc44e7d8 100644 --- a/apps/cpu/mirror/mirror.cpp +++ b/apps/cpu/mirror/mirror.cpp @@ -49,7 +49,7 @@ void run(string configname) string VRES1100_Spiegel_fein = config.getValue<string>("VRES1100_Spiegel_fein"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -488,7 +488,7 @@ void run(string configname) grid->accept(initVisitor); ////set connectors - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -506,7 +506,7 @@ void run(string configname) } else { - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/mpi_benchmark/mpib.cpp b/apps/cpu/mpi_benchmark/mpib.cpp index 6c13de98b743ad251bb1000dafc609660ca4ba46..8ddf7bde30aaaf2f6707e3ac53e577919c546f40 100644 --- a/apps/cpu/mpi_benchmark/mpib.cpp +++ b/apps/cpu/mpi_benchmark/mpib.cpp @@ -8,7 +8,7 @@ using namespace std; void run(string configname) { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); // Get the name of the processor @@ -211,7 +211,7 @@ void run(string configname) //set connectors if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); grid->accept(setConnsVisitor); if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:end"); diff --git a/apps/cpu/pChannel/pChannel.cpp b/apps/cpu/pChannel/pChannel.cpp index c2b32108037389ddd18351ff7092cd3d680492ea..d30b28d262fa8d09c1658452eb11496b5c5c61f9 100644 --- a/apps/cpu/pChannel/pChannel.cpp +++ b/apps/cpu/pChannel/pChannel.cpp @@ -206,7 +206,7 @@ void run(string configname) vector<double> nupsStep = config.getVector<double>("nupsStep"); vector<double> boundingBox = config.getVector<double>("boundingBox"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -536,7 +536,7 @@ void run(string configname) grid->accept(initVisitor); ////set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -559,7 +559,7 @@ void run(string configname) migCoProcessor->restart((int)restartStep); grid->setTimeStep(restartStep); //////////////////////////////////////////////////////////////////////////// - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/pChannel/pChannel.cpp.hlrn b/apps/cpu/pChannel/pChannel.cpp.hlrn index f25a0c4c2e62d6b2b97ff338d567ef911bdc9d14..812566c96d046cf9da9b72bd388ce0696224df7b 100644 --- a/apps/cpu/pChannel/pChannel.cpp.hlrn +++ b/apps/cpu/pChannel/pChannel.cpp.hlrn @@ -52,7 +52,7 @@ void run(string configname) double timeLineTsStop = config.getDouble("timeLineTsStop"); - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) diff --git a/apps/cpu/pDisk/pdisk.cpp b/apps/cpu/pDisk/pdisk.cpp index f19e04ff81222e7eb448c1f0236669fb824fad23..fed4f38b64eb8fa8471fc9e0c389fe40f77ffd4a 100644 --- a/apps/cpu/pDisk/pdisk.cpp +++ b/apps/cpu/pDisk/pdisk.cpp @@ -39,7 +39,7 @@ void run(string configname) //UbLog::reportingLevel() = logDEBUG5; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); diff --git a/apps/cpu/perm/perm.cpp b/apps/cpu/perm/perm.cpp index 7fae63025a198a09af2a30da3776f940441dbcc2..4ea9ac93742da1bc65cd266d028bd09bcc195811 100644 --- a/apps/cpu/perm/perm.cpp +++ b/apps/cpu/perm/perm.cpp @@ -44,7 +44,7 @@ void perm(string configname) double deltax = config.getValue<double>("deltax"); bool writeSampleToFile = config.getValue<bool>("writeSampleToFile"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -415,7 +415,7 @@ void perm(string configname) } ////set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/perm/perm.cpp_s b/apps/cpu/perm/perm.cpp_s index 21db434d5290ee948665f45af8ae1c93a84d9336..e40c55fbf49d157433822462cfa5e0cfec9636a6 100644 --- a/apps/cpu/perm/perm.cpp_s +++ b/apps/cpu/perm/perm.cpp_s @@ -23,7 +23,7 @@ void perm(const char *configname) throw exceptionText; } - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (machine == "BOMBADIL") diff --git a/apps/cpu/plate/plate.cpp b/apps/cpu/plate/plate.cpp index 28db0262fa649ea93f8b44cf69821557ad53961e..e4c78c6044106280732f151f9610e3791ff502a4 100644 --- a/apps/cpu/plate/plate.cpp +++ b/apps/cpu/plate/plate.cpp @@ -25,7 +25,7 @@ void run(const char *cstr, double endTime) //UbLog::reportingLevel() = logDEBUG5; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/plate2/plate2.cpp b/apps/cpu/plate2/plate2.cpp index a908abf5b3652dcdd24c44202950f4962351c735..1fd5a281ebae6906ae7706735d32b4aedbbe8199 100644 --- a/apps/cpu/plate2/plate2.cpp +++ b/apps/cpu/plate2/plate2.cpp @@ -18,7 +18,7 @@ void run(const char *cstr1, const char *cstr2) stringstream logFilename; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr1); diff --git a/apps/cpu/poiseuille_example/poiseuille.cpp b/apps/cpu/poiseuille_example/poiseuille.cpp index d5de62d10edb0ddcfb7790febe494f937317f6e9..d2e2c178e247f69d1629374661da9746ad8542bc 100644 --- a/apps/cpu/poiseuille_example/poiseuille.cpp +++ b/apps/cpu/poiseuille_example/poiseuille.cpp @@ -25,7 +25,7 @@ int main() const auto lbmUnitConverter = std::make_shared<LBMUnitConverter>(); const auto writer = WbWriterVtkXmlBinary::getInstance(); - const auto communicator = vf::mpi::MPICommunicator::getInstance(); + const auto communicator = vf::parallel::MPICommunicator::getInstance(); const auto kernel = std::make_shared<CompressibleCumulant4thOrderViscosityLBMKernel>(); kernel->setBCProcessor(std::make_shared<BCProcessor>()); kernel->setForcingX1(1e-6 * lbmUnitConverter->getFactorForceWToLb()); @@ -79,7 +79,7 @@ int main() grid->accept(kernelVisitor); interactorsHelper.setBC(); - const auto interpolationProcessor(std::make_shared<CompressibleOffsetMomentsInterpolationProcessor>()); + const auto interpolationProcessor(std::make_shared<CompressibleOffsetMomentsInterpolator>()); interpolationProcessor->setBulkViscosity(latticeViscosity, latticeViscosity * bulkViscosityFactor); SetConnectorsBlockVisitor setConnsVisitor(communicator, diff --git a/apps/cpu/porplate2/porplate.cpp b/apps/cpu/porplate2/porplate.cpp index 2414e07732b18cac8a8c7c61b276f007c16826ef..fe93f8fa59d7e9befa63176b253f172ae09e1e87 100644 --- a/apps/cpu/porplate2/porplate.cpp +++ b/apps/cpu/porplate2/porplate.cpp @@ -316,7 +316,7 @@ void run(const char *cstr, bool firststart) stringstream logFilename; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr); diff --git a/apps/cpu/rheometer/rheometer.cpp b/apps/cpu/rheometer/rheometer.cpp index ca3378bd5d6a4322b66877b25fca89d5ae478aac..68db541bc922d3c269d3f626e19ddd6a1001d071 100644 --- a/apps/cpu/rheometer/rheometer.cpp +++ b/apps/cpu/rheometer/rheometer.cpp @@ -43,7 +43,7 @@ void bflow(string configname) //outputPath = outputPath + "/rheometerBingham_" + config.getValue<string>("resolution") + "_" + config.getValue<string>("OmegaLB"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) diff --git a/apps/cpu/sbone/sbone.cpp b/apps/cpu/sbone/sbone.cpp index 321396da68d290946c16b36955cc1be98c10cf84..b52aaa3ac6e40ec9550171125141edf28b3fd89d 100644 --- a/apps/cpu/sbone/sbone.cpp +++ b/apps/cpu/sbone/sbone.cpp @@ -23,7 +23,7 @@ void sbonepd(const char *configname) throw exceptionText; } - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if(machine == "BOMBADIL") diff --git a/apps/cpu/screw/screw.cpp b/apps/cpu/screw/screw.cpp index c1eea3f960cf6b4b64757843d08d126e4fac14b9..ad7c997743a0ad10b4301765aaf73392f61f4bcc 100644 --- a/apps/cpu/screw/screw.cpp +++ b/apps/cpu/screw/screw.cpp @@ -29,7 +29,7 @@ int main(int argc, char* argv[]) int restartStep = config.getValue<int>("restartStep"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter()); @@ -146,8 +146,8 @@ int main(int argc, char* argv[]) ////////////////////////////////////// //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -220,7 +220,7 @@ int main(int argc, char* argv[]) grid->accept(bcVisitor); //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/sphere/sphere.cpp b/apps/cpu/sphere/sphere.cpp index 8a5ef89b8bf09e765236153f37cb259e075bf15e..5411449c79fcbf0bece01517eb81c4b7f1d4d52f 100644 --- a/apps/cpu/sphere/sphere.cpp +++ b/apps/cpu/sphere/sphere.cpp @@ -11,7 +11,7 @@ void run(string configname) try { - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); @@ -267,14 +267,14 @@ void run(string configname) UBLOG(logINFO, "SetConnectors - start, id=" << myid); //set connectors - //SPtr<InterpolationProcessor> iProcessor(new IncompressibleOffsetInterpolationProcessor()); - //SPtr<CompressibleOffsetMomentsInterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + //SPtr<Interpolator> iProcessor(new IncompressibleOffsetInterpolator()); + //SPtr<CompressibleOffsetMomentsInterpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); //SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm); grid->accept(setConnsVisitor); - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + SPtr<Interpolator> iProcessor(new CompressibleOffsetMomentsInterpolator()); SetInterpolationConnectorsBlockVisitor setInterConnsVisitor(comm, nuLB, iProcessor); grid->accept(setInterConnsVisitor); diff --git a/apps/cpu/stick/stick.cpp b/apps/cpu/stick/stick.cpp index 62efec8098241d440a2b2292ca5018fea915fe4e..8bbc820001c2e5e5b87c268d95bfce4f5323df70 100644 --- a/apps/cpu/stick/stick.cpp +++ b/apps/cpu/stick/stick.cpp @@ -19,7 +19,7 @@ void main() int numOfThreads = 4; double availMem = 10e9; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); double dx = 1; diff --git a/apps/cpu/teperm/teperm.cpp b/apps/cpu/teperm/teperm.cpp index aecdb3745f3da37c03b07eb7b103374a99df4302..78e57d8ef8200c8b0552d7b2670ca43c973e9182 100644 --- a/apps/cpu/teperm/teperm.cpp +++ b/apps/cpu/teperm/teperm.cpp @@ -63,7 +63,7 @@ void run(string configname) int chunk = config.getValue<int>("chunk"); - SPtr<vf::mpi::Communicator> comm = vf::mpi::MPICommunicator::getInstance(); + SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); if (logToFile) @@ -356,7 +356,7 @@ void run(string configname) ////////////////////////////////////// //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -501,7 +501,7 @@ void run(string configname) } //set connectors - InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); diff --git a/apps/cpu/town/town.cpp b/apps/cpu/town/town.cpp index ccaf90f8d277df9e16a5e3592eafa649e142d235..7fcb83b314188d93a3778d06b439c5ff8e384d25 100644 --- a/apps/cpu/town/town.cpp +++ b/apps/cpu/town/town.cpp @@ -18,7 +18,7 @@ void run(const char *cstr1, const char *cstr2) stringstream logFilename; double availMem = 0; - CommunicatorPtr comm = vf::mpi::MPICommunicator::getInstance(); + CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance(); int myid = comm->getProcessID(); string machine = string(cstr1); diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/ActuatorLine/ActuatorLine.cpp similarity index 86% rename from apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp rename to apps/gpu/ActuatorLine/ActuatorLine.cpp index 368e80a726c1f6e75bd5300ad3de60fd840ba119..4598244a12c3abf7f9211c242877a198f7799922 100644 --- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp +++ b/apps/gpu/ActuatorLine/ActuatorLine.cpp @@ -31,28 +31,25 @@ //! \author Henry Korb, Henrik Asmuth //======================================================================================= #define _USE_MATH_DEFINES -#include <math.h> -#include <string> -#include <sstream> -#include <iostream> -#include <stdexcept> -#include <fstream> +#include <cmath> #include <exception> +#include <fstream> +#include <iostream> #include <memory> +#include <sstream> +#include <stdexcept> +#include <string> ////////////////////////////////////////////////////////////////////////// -#include "DataTypes.h" -#include "PointerDefinitions.h" - -#include "StringUtilities/StringUtil.h" - - - +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> +#include <basics/StringUtilities/StringUtil.h> #include <basics/config/ConfigurationFile.h> #include <logger/Logger.h> +#include <parallel/MPICommunicator.h> ////////////////////////////////////////////////////////////////////////// @@ -61,8 +58,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/BoundaryConditions/BoundaryCondition.h" -#include "GridGenerator/grid/GridFactory.h" - #include "GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" #include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" #include "GridGenerator/TransientBCSetter/TransientBCSetter.h" @@ -71,7 +66,6 @@ ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" @@ -107,10 +101,7 @@ std::string simulationName("ActuatorLine"); void multipleLevel(const std::string& configPath) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - - auto gridFactory = GridFactory::make(); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); vf::basics::ConfigurationFile config; config.load(configPath); @@ -139,7 +130,7 @@ void multipleLevel(const std::string& configPath) const float tStartOutProbe = config.getValue<real>("tStartOutProbe"); const float tOutProbe = config.getValue<real>("tOutProbe"); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); @@ -149,6 +140,8 @@ void multipleLevel(const std::string& configPath) real turbPos[3] = {3*reference_diameter, 3*reference_diameter, 3*reference_diameter}; + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); + gridBuilder->addCoarseGrid(0.0, 0.0, 0.0, L_x, L_y, L_z, dx); @@ -185,7 +178,7 @@ void multipleLevel(const std::string& configPath) para->setViscosityLB(viscosityLB); para->setVelocityRatio( dx / dt ); para->setViscosityRatio( dx*dx/dt ); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { rho = (real)0.0; @@ -236,21 +229,28 @@ void multipleLevel(const std::string& configPath) para->addActuator( actuator_farm ); - // SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>("pointProbe", para->getOutputPath(), 100, 1, 500, 100); - // std::vector<real> probeCoordsX = {reference_diameter,2*reference_diameter,5*reference_diameter}; - // std::vector<real> probeCoordsY = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; - // std::vector<real> probeCoordsZ = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; - // pointProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ); - // // pointProbe->addProbePointsFromXNormalPlane(2*D, 0.0, 0.0, L_y, L_z, (uint)L_y/dx, (uint)L_z/dx); + SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>("pointProbe", para->getOutputPath(), 100, 1, 500, 100, false); + std::vector<real> probeCoordsX = {reference_diameter,2*reference_diameter,5*reference_diameter}; + std::vector<real> probeCoordsY = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; + std::vector<real> probeCoordsZ = {3*reference_diameter,3*reference_diameter,3*reference_diameter}; + + pointProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ); + // pointProbe->addProbePointsFromXNormalPlane(2*D, 0.0, 0.0, L_y, L_z, (uint)L_y/dx, (uint)L_z/dx); + + pointProbe->addStatistic(Statistic::Means); + pointProbe->addStatistic(Statistic::Variances); + para->addProbe( pointProbe ); - // pointProbe->addStatistic(Statistic::Means); - // pointProbe->addStatistic(Statistic::Variances); - // para->addProbe( pointProbe ); + SPtr<PointProbe> timeseriesProbe = std::make_shared<PointProbe>("timeProbe", para->getOutputPath(), 100, 1, 500, 100, true); + timeseriesProbe->addProbePointsFromList(probeCoordsX, probeCoordsY, probeCoordsZ); + timeseriesProbe->addStatistic(Statistic::Instantaneous); + timeseriesProbe->addStatistic(Statistic::Means); + para->addProbe( timeseriesProbe ); - // SPtr<PlaneProbe> planeProbe = std::make_shared<PlaneProbe>("planeProbe", para->getOutputPath(), 100, 500, 100, 100); - // planeProbe->setProbePlane(5*reference_diameter, 0, 0, dx, L_y, L_z); - // planeProbe->addStatistic(Statistic::Means); - // para->addProbe( planeProbe ); + SPtr<PlaneProbe> planeProbe = std::make_shared<PlaneProbe>("planeProbe", para->getOutputPath(), 100, 500, 100, 100); + planeProbe->setProbePlane(5*reference_diameter, 0, 0, dx, L_y, L_z); + planeProbe->addStatistic(Statistic::Means); + para->addProbe( planeProbe ); auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); diff --git a/apps/gpu/LBM/ActuatorLine/CMakeLists.txt b/apps/gpu/ActuatorLine/CMakeLists.txt similarity index 81% rename from apps/gpu/LBM/ActuatorLine/CMakeLists.txt rename to apps/gpu/ActuatorLine/CMakeLists.txt index e0ff4e06e83a957be6966a7322ff06a0d068d18a..c437ac81a0e23fadd925ca81af596f81ff59f820 100644 --- a/apps/gpu/LBM/ActuatorLine/CMakeLists.txt +++ b/apps/gpu/ActuatorLine/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(ActuatorLine LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES ActuatorLine.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES ActuatorLine.cpp) set_source_files_properties(ActuatorLine.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/ActuatorLine/configActuatorLine.txt b/apps/gpu/ActuatorLine/configActuatorLine.txt similarity index 100% rename from apps/gpu/LBM/ActuatorLine/configActuatorLine.txt rename to apps/gpu/ActuatorLine/configActuatorLine.txt diff --git a/apps/gpu/LBM/Basel/3rdPartyLinking.cmake b/apps/gpu/Basel/3rdPartyLinking.cmake similarity index 100% rename from apps/gpu/LBM/Basel/3rdPartyLinking.cmake rename to apps/gpu/Basel/3rdPartyLinking.cmake diff --git a/apps/gpu/LBM/Basel/CMakeLists.txt b/apps/gpu/Basel/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/Basel/CMakeLists.txt rename to apps/gpu/Basel/CMakeLists.txt diff --git a/apps/gpu/LBM/Basel/CMakePackage.cmake b/apps/gpu/Basel/CMakePackage.cmake similarity index 100% rename from apps/gpu/LBM/Basel/CMakePackage.cmake rename to apps/gpu/Basel/CMakePackage.cmake diff --git a/apps/gpu/LBM/Basel/main.cpp b/apps/gpu/Basel/main.cpp similarity index 100% rename from apps/gpu/LBM/Basel/main.cpp rename to apps/gpu/Basel/main.cpp diff --git a/apps/gpu/LBM/Basel/resources/Junctions.txt b/apps/gpu/Basel/resources/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/Junctions.txt rename to apps/gpu/Basel/resources/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/Sinks.txt b/apps/gpu/Basel/resources/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/Sinks.txt rename to apps/gpu/Basel/resources/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/Sources.txt b/apps/gpu/Basel/resources/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/Sources.txt rename to apps/gpu/Basel/resources/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/Streets.txt b/apps/gpu/Basel/resources/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/Streets.txt rename to apps/gpu/Basel/resources/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreets/Junctions.txt b/apps/gpu/Basel/resources/allStreets/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreets/Junctions.txt rename to apps/gpu/Basel/resources/allStreets/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreets/Sinks.txt b/apps/gpu/Basel/resources/allStreets/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreets/Sinks.txt rename to apps/gpu/Basel/resources/allStreets/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreets/Sources.txt b/apps/gpu/Basel/resources/allStreets/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreets/Sources.txt rename to apps/gpu/Basel/resources/allStreets/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreets/Streets.txt b/apps/gpu/Basel/resources/allStreets/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreets/Streets.txt rename to apps/gpu/Basel/resources/allStreets/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsDouble/Junctions.txt b/apps/gpu/Basel/resources/allStreetsDouble/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsDouble/Junctions.txt rename to apps/gpu/Basel/resources/allStreetsDouble/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsDouble/Sinks.txt b/apps/gpu/Basel/resources/allStreetsDouble/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsDouble/Sinks.txt rename to apps/gpu/Basel/resources/allStreetsDouble/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsDouble/Sources.txt b/apps/gpu/Basel/resources/allStreetsDouble/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsDouble/Sources.txt rename to apps/gpu/Basel/resources/allStreetsDouble/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsDouble/Streets.txt b/apps/gpu/Basel/resources/allStreetsDouble/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsDouble/Streets.txt rename to apps/gpu/Basel/resources/allStreetsDouble/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Junctions.txt b/apps/gpu/Basel/resources/allStreetsOneClosed/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Junctions.txt rename to apps/gpu/Basel/resources/allStreetsOneClosed/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Sinks.txt b/apps/gpu/Basel/resources/allStreetsOneClosed/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Sinks.txt rename to apps/gpu/Basel/resources/allStreetsOneClosed/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Sources.txt b/apps/gpu/Basel/resources/allStreetsOneClosed/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Sources.txt rename to apps/gpu/Basel/resources/allStreetsOneClosed/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Streets.txt b/apps/gpu/Basel/resources/allStreetsOneClosed/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsOneClosed/Streets.txt rename to apps/gpu/Basel/resources/allStreetsOneClosed/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Junctions.txt b/apps/gpu/Basel/resources/allStreetsQuadruple/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Junctions.txt rename to apps/gpu/Basel/resources/allStreetsQuadruple/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Sinks.txt b/apps/gpu/Basel/resources/allStreetsQuadruple/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Sinks.txt rename to apps/gpu/Basel/resources/allStreetsQuadruple/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Sources.txt b/apps/gpu/Basel/resources/allStreetsQuadruple/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Sources.txt rename to apps/gpu/Basel/resources/allStreetsQuadruple/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Streets.txt b/apps/gpu/Basel/resources/allStreetsQuadruple/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/allStreetsQuadruple/Streets.txt rename to apps/gpu/Basel/resources/allStreetsQuadruple/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/fourStreets/Junctions.txt b/apps/gpu/Basel/resources/fourStreets/Junctions.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/fourStreets/Junctions.txt rename to apps/gpu/Basel/resources/fourStreets/Junctions.txt diff --git a/apps/gpu/LBM/Basel/resources/fourStreets/Sinks.txt b/apps/gpu/Basel/resources/fourStreets/Sinks.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/fourStreets/Sinks.txt rename to apps/gpu/Basel/resources/fourStreets/Sinks.txt diff --git a/apps/gpu/LBM/Basel/resources/fourStreets/Sources.txt b/apps/gpu/Basel/resources/fourStreets/Sources.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/fourStreets/Sources.txt rename to apps/gpu/Basel/resources/fourStreets/Sources.txt diff --git a/apps/gpu/LBM/Basel/resources/fourStreets/Streets.txt b/apps/gpu/Basel/resources/fourStreets/Streets.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/fourStreets/Streets.txt rename to apps/gpu/Basel/resources/fourStreets/Streets.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions1.txt b/apps/gpu/Basel/resources/testStreets/Junctions1.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions1.txt rename to apps/gpu/Basel/resources/testStreets/Junctions1.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions2.txt b/apps/gpu/Basel/resources/testStreets/Junctions2.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions2.txt rename to apps/gpu/Basel/resources/testStreets/Junctions2.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions3.txt b/apps/gpu/Basel/resources/testStreets/Junctions3.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions3.txt rename to apps/gpu/Basel/resources/testStreets/Junctions3.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions4.txt b/apps/gpu/Basel/resources/testStreets/Junctions4.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions4.txt rename to apps/gpu/Basel/resources/testStreets/Junctions4.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions5.txt b/apps/gpu/Basel/resources/testStreets/Junctions5.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions5.txt rename to apps/gpu/Basel/resources/testStreets/Junctions5.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Junctions6.txt b/apps/gpu/Basel/resources/testStreets/Junctions6.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Junctions6.txt rename to apps/gpu/Basel/resources/testStreets/Junctions6.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks1.txt b/apps/gpu/Basel/resources/testStreets/Sinks1.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks1.txt rename to apps/gpu/Basel/resources/testStreets/Sinks1.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks2.txt b/apps/gpu/Basel/resources/testStreets/Sinks2.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks2.txt rename to apps/gpu/Basel/resources/testStreets/Sinks2.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks3.txt b/apps/gpu/Basel/resources/testStreets/Sinks3.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks3.txt rename to apps/gpu/Basel/resources/testStreets/Sinks3.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks4.txt b/apps/gpu/Basel/resources/testStreets/Sinks4.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks4.txt rename to apps/gpu/Basel/resources/testStreets/Sinks4.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks5.txt b/apps/gpu/Basel/resources/testStreets/Sinks5.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks5.txt rename to apps/gpu/Basel/resources/testStreets/Sinks5.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sinks6.txt b/apps/gpu/Basel/resources/testStreets/Sinks6.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sinks6.txt rename to apps/gpu/Basel/resources/testStreets/Sinks6.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources1.txt b/apps/gpu/Basel/resources/testStreets/Sources1.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources1.txt rename to apps/gpu/Basel/resources/testStreets/Sources1.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources2.txt b/apps/gpu/Basel/resources/testStreets/Sources2.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources2.txt rename to apps/gpu/Basel/resources/testStreets/Sources2.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources3.txt b/apps/gpu/Basel/resources/testStreets/Sources3.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources3.txt rename to apps/gpu/Basel/resources/testStreets/Sources3.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources4.txt b/apps/gpu/Basel/resources/testStreets/Sources4.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources4.txt rename to apps/gpu/Basel/resources/testStreets/Sources4.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources5.txt b/apps/gpu/Basel/resources/testStreets/Sources5.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources5.txt rename to apps/gpu/Basel/resources/testStreets/Sources5.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Sources6.txt b/apps/gpu/Basel/resources/testStreets/Sources6.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Sources6.txt rename to apps/gpu/Basel/resources/testStreets/Sources6.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets1.txt b/apps/gpu/Basel/resources/testStreets/Streets1.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets1.txt rename to apps/gpu/Basel/resources/testStreets/Streets1.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets2.txt b/apps/gpu/Basel/resources/testStreets/Streets2.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets2.txt rename to apps/gpu/Basel/resources/testStreets/Streets2.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets3.txt b/apps/gpu/Basel/resources/testStreets/Streets3.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets3.txt rename to apps/gpu/Basel/resources/testStreets/Streets3.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets4.txt b/apps/gpu/Basel/resources/testStreets/Streets4.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets4.txt rename to apps/gpu/Basel/resources/testStreets/Streets4.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets5.txt b/apps/gpu/Basel/resources/testStreets/Streets5.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets5.txt rename to apps/gpu/Basel/resources/testStreets/Streets5.txt diff --git a/apps/gpu/LBM/Basel/resources/testStreets/Streets6.txt b/apps/gpu/Basel/resources/testStreets/Streets6.txt similarity index 100% rename from apps/gpu/LBM/Basel/resources/testStreets/Streets6.txt rename to apps/gpu/Basel/resources/testStreets/Streets6.txt diff --git a/apps/gpu/LBM/BaselMultiGPU/3rdPartyLinking.cmake b/apps/gpu/BaselMultiGPU/3rdPartyLinking.cmake similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/3rdPartyLinking.cmake rename to apps/gpu/BaselMultiGPU/3rdPartyLinking.cmake diff --git a/apps/gpu/LBM/BaselMultiGPU/CMakeLists.txt b/apps/gpu/BaselMultiGPU/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/CMakeLists.txt rename to apps/gpu/BaselMultiGPU/CMakeLists.txt diff --git a/apps/gpu/LBM/BaselMultiGPU/CMakePackage.cmake b/apps/gpu/BaselMultiGPU/CMakePackage.cmake similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/CMakePackage.cmake rename to apps/gpu/BaselMultiGPU/CMakePackage.cmake diff --git a/apps/gpu/LBM/BaselMultiGPU/main.cpp b/apps/gpu/BaselMultiGPU/main.cpp similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/main.cpp rename to apps/gpu/BaselMultiGPU/main.cpp diff --git a/apps/gpu/LBM/BaselMultiGPU/resources/ExampleStreets.txt b/apps/gpu/BaselMultiGPU/resources/ExampleStreets.txt similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/resources/ExampleStreets.txt rename to apps/gpu/BaselMultiGPU/resources/ExampleStreets.txt diff --git a/apps/gpu/LBM/BaselMultiGPU/resources/Junctions.txt b/apps/gpu/BaselMultiGPU/resources/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/resources/Junctions.txt rename to apps/gpu/BaselMultiGPU/resources/Junctions.txt diff --git a/apps/gpu/LBM/BaselMultiGPU/resources/Sinks.txt b/apps/gpu/BaselMultiGPU/resources/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/resources/Sinks.txt rename to apps/gpu/BaselMultiGPU/resources/Sinks.txt diff --git a/apps/gpu/LBM/BaselMultiGPU/resources/Sources.txt b/apps/gpu/BaselMultiGPU/resources/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselMultiGPU/resources/Sources.txt rename to apps/gpu/BaselMultiGPU/resources/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/3rdPartyLinking.cmake b/apps/gpu/BaselNU/3rdPartyLinking.cmake similarity index 100% rename from apps/gpu/LBM/BaselNU/3rdPartyLinking.cmake rename to apps/gpu/BaselNU/3rdPartyLinking.cmake diff --git a/apps/gpu/LBM/BaselNU/CMakeLists.txt b/apps/gpu/BaselNU/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/CMakeLists.txt rename to apps/gpu/BaselNU/CMakeLists.txt diff --git a/apps/gpu/LBM/BaselNU/CMakePackage.cmake b/apps/gpu/BaselNU/CMakePackage.cmake similarity index 100% rename from apps/gpu/LBM/BaselNU/CMakePackage.cmake rename to apps/gpu/BaselNU/CMakePackage.cmake diff --git a/apps/gpu/LBM/BaselNU/main.cpp b/apps/gpu/BaselNU/main.cpp similarity index 100% rename from apps/gpu/LBM/BaselNU/main.cpp rename to apps/gpu/BaselNU/main.cpp diff --git a/apps/gpu/LBM/BaselNU/resources/Junctions.txt b/apps/gpu/BaselNU/resources/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/Junctions.txt rename to apps/gpu/BaselNU/resources/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/Sinks.txt b/apps/gpu/BaselNU/resources/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/Sinks.txt rename to apps/gpu/BaselNU/resources/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/Sources.txt b/apps/gpu/BaselNU/resources/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/Sources.txt rename to apps/gpu/BaselNU/resources/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/Streets.txt b/apps/gpu/BaselNU/resources/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/Streets.txt rename to apps/gpu/BaselNU/resources/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreets/Junctions.txt b/apps/gpu/BaselNU/resources/allStreets/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreets/Junctions.txt rename to apps/gpu/BaselNU/resources/allStreets/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreets/Sinks.txt b/apps/gpu/BaselNU/resources/allStreets/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreets/Sinks.txt rename to apps/gpu/BaselNU/resources/allStreets/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreets/Sources.txt b/apps/gpu/BaselNU/resources/allStreets/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreets/Sources.txt rename to apps/gpu/BaselNU/resources/allStreets/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreets/Streets.txt b/apps/gpu/BaselNU/resources/allStreets/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreets/Streets.txt rename to apps/gpu/BaselNU/resources/allStreets/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Junctions.txt b/apps/gpu/BaselNU/resources/allStreetsDouble/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Junctions.txt rename to apps/gpu/BaselNU/resources/allStreetsDouble/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Sinks.txt b/apps/gpu/BaselNU/resources/allStreetsDouble/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Sinks.txt rename to apps/gpu/BaselNU/resources/allStreetsDouble/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Sources.txt b/apps/gpu/BaselNU/resources/allStreetsDouble/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Sources.txt rename to apps/gpu/BaselNU/resources/allStreetsDouble/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Streets.txt b/apps/gpu/BaselNU/resources/allStreetsDouble/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsDouble/Streets.txt rename to apps/gpu/BaselNU/resources/allStreetsDouble/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Junctions.txt b/apps/gpu/BaselNU/resources/allStreetsOneClosed/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Junctions.txt rename to apps/gpu/BaselNU/resources/allStreetsOneClosed/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Sinks.txt b/apps/gpu/BaselNU/resources/allStreetsOneClosed/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Sinks.txt rename to apps/gpu/BaselNU/resources/allStreetsOneClosed/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Sources.txt b/apps/gpu/BaselNU/resources/allStreetsOneClosed/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Sources.txt rename to apps/gpu/BaselNU/resources/allStreetsOneClosed/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Streets.txt b/apps/gpu/BaselNU/resources/allStreetsOneClosed/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsOneClosed/Streets.txt rename to apps/gpu/BaselNU/resources/allStreetsOneClosed/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Junctions.txt b/apps/gpu/BaselNU/resources/allStreetsQuadruple/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Junctions.txt rename to apps/gpu/BaselNU/resources/allStreetsQuadruple/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Sinks.txt b/apps/gpu/BaselNU/resources/allStreetsQuadruple/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Sinks.txt rename to apps/gpu/BaselNU/resources/allStreetsQuadruple/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Sources.txt b/apps/gpu/BaselNU/resources/allStreetsQuadruple/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Sources.txt rename to apps/gpu/BaselNU/resources/allStreetsQuadruple/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Streets.txt b/apps/gpu/BaselNU/resources/allStreetsQuadruple/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/allStreetsQuadruple/Streets.txt rename to apps/gpu/BaselNU/resources/allStreetsQuadruple/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/fourStreets/Junctions.txt b/apps/gpu/BaselNU/resources/fourStreets/Junctions.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/fourStreets/Junctions.txt rename to apps/gpu/BaselNU/resources/fourStreets/Junctions.txt diff --git a/apps/gpu/LBM/BaselNU/resources/fourStreets/Sinks.txt b/apps/gpu/BaselNU/resources/fourStreets/Sinks.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/fourStreets/Sinks.txt rename to apps/gpu/BaselNU/resources/fourStreets/Sinks.txt diff --git a/apps/gpu/LBM/BaselNU/resources/fourStreets/Sources.txt b/apps/gpu/BaselNU/resources/fourStreets/Sources.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/fourStreets/Sources.txt rename to apps/gpu/BaselNU/resources/fourStreets/Sources.txt diff --git a/apps/gpu/LBM/BaselNU/resources/fourStreets/Streets.txt b/apps/gpu/BaselNU/resources/fourStreets/Streets.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/fourStreets/Streets.txt rename to apps/gpu/BaselNU/resources/fourStreets/Streets.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions1.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions1.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions1.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions1.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions2.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions2.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions2.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions2.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions3.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions3.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions3.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions3.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions4.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions4.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions4.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions4.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions5.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions5.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions5.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions5.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Junctions6.txt b/apps/gpu/BaselNU/resources/testStreets/Junctions6.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Junctions6.txt rename to apps/gpu/BaselNU/resources/testStreets/Junctions6.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks1.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks1.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks1.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks1.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks2.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks2.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks2.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks2.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks3.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks3.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks3.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks3.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks4.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks4.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks4.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks4.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks5.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks5.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks5.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks5.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sinks6.txt b/apps/gpu/BaselNU/resources/testStreets/Sinks6.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sinks6.txt rename to apps/gpu/BaselNU/resources/testStreets/Sinks6.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources1.txt b/apps/gpu/BaselNU/resources/testStreets/Sources1.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources1.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources1.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources2.txt b/apps/gpu/BaselNU/resources/testStreets/Sources2.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources2.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources2.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources3.txt b/apps/gpu/BaselNU/resources/testStreets/Sources3.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources3.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources3.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources4.txt b/apps/gpu/BaselNU/resources/testStreets/Sources4.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources4.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources4.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources5.txt b/apps/gpu/BaselNU/resources/testStreets/Sources5.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources5.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources5.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Sources6.txt b/apps/gpu/BaselNU/resources/testStreets/Sources6.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Sources6.txt rename to apps/gpu/BaselNU/resources/testStreets/Sources6.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets1.txt b/apps/gpu/BaselNU/resources/testStreets/Streets1.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets1.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets1.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets2.txt b/apps/gpu/BaselNU/resources/testStreets/Streets2.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets2.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets2.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets3.txt b/apps/gpu/BaselNU/resources/testStreets/Streets3.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets3.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets3.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets4.txt b/apps/gpu/BaselNU/resources/testStreets/Streets4.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets4.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets4.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets5.txt b/apps/gpu/BaselNU/resources/testStreets/Streets5.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets5.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets5.txt diff --git a/apps/gpu/LBM/BaselNU/resources/testStreets/Streets6.txt b/apps/gpu/BaselNU/resources/testStreets/Streets6.txt similarity index 100% rename from apps/gpu/LBM/BaselNU/resources/testStreets/Streets6.txt rename to apps/gpu/BaselNU/resources/testStreets/Streets6.txt diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/BoundaryLayer/BoundaryLayer.cpp similarity index 96% rename from apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp rename to apps/gpu/BoundaryLayer/BoundaryLayer.cpp index 1c5f8ac0318f00a6bb819b016ff11925b2ff2da5..d8b3b54b22045214c70dde4c9c2ded711ab9cf73 100644 --- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp +++ b/apps/gpu/BoundaryLayer/BoundaryLayer.cpp @@ -31,28 +31,27 @@ //! \author Henry Korb, Henrik Asmuth //======================================================================================= #define _USE_MATH_DEFINES -#include <math.h> -#include <string> -#include <sstream> -#include <iostream> -#include <stdexcept> -#include <fstream> +#include <cmath> #include <exception> +#include <fstream> +#include <iostream> #include <memory> #include <numeric> +#include <sstream> +#include <stdexcept> +#include <string> ////////////////////////////////////////////////////////////////////////// -#include "DataTypes.h" -#include "PointerDefinitions.h" - -#include "StringUtilities/StringUtil.h" - +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> +#include <basics/StringUtilities/StringUtil.h> #include <basics/config/ConfigurationFile.h> -#include "basics/constants/NumericConstants.h" +#include <basics/constants/NumericConstants.h> #include <logger/Logger.h> +#include <parallel/MPICommunicator.h> ////////////////////////////////////////////////////////////////////////// @@ -61,8 +60,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/BoundaryConditions/BoundaryCondition.h" -#include "GridGenerator/grid/GridFactory.h" - #include "geometries/Cuboid/Cuboid.h" #include "geometries/TriangularMesh/TriangularMesh.h" @@ -73,7 +70,6 @@ ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" @@ -103,23 +99,19 @@ using namespace vf::basics::constant; void multipleLevel(const std::string& configPath) { - auto gridFactory = GridFactory::make(); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); vf::basics::ConfigurationFile config; config.load(configPath); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////^ - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - const int nProcs = communicator.getNumberOfProcess(); - const uint procID = vf::gpu::MpiCommunicator::getInstance().getPID(); + const int nProcs = communicator.getNumberOfProcesses(); + const uint procID = communicator.getProcessID(); std::vector<uint> devices(10); std::iota(devices.begin(), devices.end(), 0); para->setDevices(devices); @@ -221,7 +213,7 @@ void multipleLevel(const std::string& configPath) bool useStreams = (nProcs > 1 ? true: false); // useStreams=false; para->setUseStreams(useStreams); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); para->setIsBodyForce( config.getValue<bool>("bodyForce") ); para->setTimestepStartOut(uint(tStartOut/dt) ); @@ -266,6 +258,7 @@ void multipleLevel(const std::string& configPath) xGridMax += overlap; xGridMin -= overlap; } + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); gridBuilder->addCoarseGrid( xGridMin, 0.0, 0.0, xGridMax, L_y, L_z, dx); @@ -426,7 +419,6 @@ void multipleLevel(const std::string& configPath) SPtr<PrecursorWriter> precursorWriter = std::make_shared<PrecursorWriter>("precursor", para->getOutputPath()+precursorDirectory, posXPrecursor, 0, L_y, 0, L_z, tStartPrecursor/dt, nTWritePrecursor, useDistributions? OutputVariable::Distributions: OutputVariable::Velocities, 1000); para->addProbe(precursorWriter); } - auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); auto gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); diff --git a/apps/gpu/LBM/BoundaryLayer/CMakeLists.txt b/apps/gpu/BoundaryLayer/CMakeLists.txt similarity index 81% rename from apps/gpu/LBM/BoundaryLayer/CMakeLists.txt rename to apps/gpu/BoundaryLayer/CMakeLists.txt index 801b634803943d48abda690935df0867eb3418d2..248c7a1616610715d38bcbff129b226da2cfd1f2 100644 --- a/apps/gpu/LBM/BoundaryLayer/CMakeLists.txt +++ b/apps/gpu/BoundaryLayer/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(BoundaryLayer LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES BoundaryLayer.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES BoundaryLayer.cpp) set_source_files_properties(BoundaryLayer.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt b/apps/gpu/BoundaryLayer/configBoundaryLayer.txt similarity index 97% rename from apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt rename to apps/gpu/BoundaryLayer/configBoundaryLayer.txt index 83e7861a5fb85ea800d187699f1c6c1409422f0a..1b415aa6ce14109c2d93a17ae78463786a7b7608 100644 --- a/apps/gpu/LBM/BoundaryLayer/configBoundaryLayer.txt +++ b/apps/gpu/BoundaryLayer/configBoundaryLayer.txt @@ -23,8 +23,7 @@ Ma = 0.1 nz = 96 bodyForce = true -UseAMD = true -SGSconstant = 0.2 +TurbulenceModel = QR QuadricLimiterP = 100000.0 QuadricLimiterM = 100000.0 QuadricLimiterD = 100000.0 diff --git a/apps/gpu/LBM/ChannelFlow/CMakeLists.txt b/apps/gpu/ChannelFlow/CMakeLists.txt similarity index 81% rename from apps/gpu/LBM/ChannelFlow/CMakeLists.txt rename to apps/gpu/ChannelFlow/CMakeLists.txt index f5b1bfd40dc723a7c050091d6d1c82d5f9addbd5..3884074e05097b392d96a47287d5e5cad4c0d6f3 100644 --- a/apps/gpu/LBM/ChannelFlow/CMakeLists.txt +++ b/apps/gpu/ChannelFlow/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(ChannelFlow LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES ChannelFlow.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES ChannelFlow.cpp) set_source_files_properties(ChannelFlow.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp b/apps/gpu/ChannelFlow/ChannelFlow.cpp similarity index 87% rename from apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp rename to apps/gpu/ChannelFlow/ChannelFlow.cpp index 1482adf275da6dabae7bdde7647ac374a0d66bb1..c716729f88d2e9d07b7647749f09127e8acf252e 100644 --- a/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp +++ b/apps/gpu/ChannelFlow/ChannelFlow.cpp @@ -41,22 +41,18 @@ #include <stdexcept> #include <string> -#include "mpi.h" - ////////////////////////////////////////////////////////////////////////// -#include "DataTypes.h" - -#include "PointerDefinitions.h" -#include "config/ConfigurationFile.h" -#include <logger/Logger.h> +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> +#include <basics/StringUtilities/StringUtil.h> +#include <basics/config/ConfigurationFile.h> ////////////////////////////////////////////////////////////////////////// #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "GridGenerator/geometries/Sphere/Sphere.h" #include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h" @@ -65,7 +61,6 @@ ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/BoundaryConditions/BoundaryConditionFactory.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" @@ -76,6 +71,8 @@ ////////////////////////////////////////////////////////////////////////// +#include <parallel/MPICommunicator.h> + int main(int argc, char *argv[]) { try { @@ -95,31 +92,23 @@ int main(int argc, char *argv[]) // setup simulation parameters (without config file) ////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator &communicator = vf::gpu::MpiCommunicator::getInstance(); - const int numberOfProcesses = communicator.getNumberOfProcess(); - SPtr<Parameter> para = std::make_shared<Parameter>(numberOfProcesses, communicator.getPID()); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); + const int numberOfProcesses = communicator.getNumberOfProcesses(); + const auto processID = communicator.getProcessID(); + SPtr<Parameter> para = std::make_shared<Parameter>(numberOfProcesses, processId); std::vector<uint> devices(10); std::iota(devices.begin(), devices.end(), 0); para->setDevices(devices); - para->setMaxDev(communicator.getNumberOfProcess()); + para->setMaxDev(communicator.getNumberOfProcesses()); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); ////////////////////////////////////////////////////////////////////////// // setup logger ////////////////////////////////////////////////////////////////////////// - vf::logging::Logger::changeLogPath("output/vflog_process" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + ".txt"); + std::to_string(processId) + ".txt"); vf::logging::Logger::initializeLogger(); - ////////////////////////////////////////////////////////////////////////// - // setup gridGenerator - ////////////////////////////////////////////////////////////////////////// - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - ////////////////////////////////////////////////////////////////////////// // create grid ////////////////////////////////////////////////////////////////////////// @@ -157,9 +146,8 @@ int main(int argc, char *argv[]) para->setTimestepEnd(timeStepEnd); para->setOutputPrefix("ChannelFlow"); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); - const uint generatePart = vf::gpu::MpiCommunicator::getInstance().getPID(); real overlap = (real)8.0 * dx; if (numberOfProcesses > 1) { @@ -168,17 +156,19 @@ int main(int argc, char *argv[]) // add coarse grids ////////////////////////////////////////////////////////////////////////// - real subdomainMinX = channelWidth * generatePart; + real subdomainMinX = channelWidth * processId; real subdomainMinXoverlap = subdomainMinX; real subdomainMaxX = subdomainMinX + channelWidth; real subdomainMaxXoverlap = subdomainMaxX; - if (generatePart != 0) + if (processID != 0) subdomainMinXoverlap -= overlap; - if (generatePart != numberOfProcesses - 1) + if (processID != numberOfProcesses - 1) subdomainMaxXoverlap += overlap; + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); + gridBuilder->addCoarseGrid(subdomainMinXoverlap, yGridMin, zGridMin, subdomainMaxXoverlap, yGridMax, zGridMax, dx); @@ -199,14 +189,14 @@ int main(int argc, char *argv[]) // configure communication neighbors ////////////////////////////////////////////////////////////////////////// - if (generatePart != 0) { + if (processID != 0) { gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); - gridBuilder->setCommunicationProcess(CommunicationDirections::MX, generatePart - 1); + gridBuilder->setCommunicationProcess(CommunicationDirections::MX, processId - 1); } - if (generatePart != numberOfProcesses - 1) { + if (processID != numberOfProcesses - 1) { gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); - gridBuilder->setCommunicationProcess(CommunicationDirections::PX, generatePart + 1); + gridBuilder->setCommunicationProcess(CommunicationDirections::PX, processId + 1); } ////////////////////////////////////////////////////////////////////////// @@ -215,10 +205,10 @@ int main(int argc, char *argv[]) gridBuilder->setPeriodicBoundaryCondition(false, false, false); - if (generatePart == 0) { + if (processID == 0) { gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0); } - if (generatePart == numberOfProcesses - 1) { + if (processID == numberOfProcesses - 1) { gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure boundary condition last bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); diff --git a/apps/gpu/DrivenCavity/CMakeLists.txt b/apps/gpu/DrivenCavity/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8646f29c13d689eaabee4274418620636643c592 --- /dev/null +++ b/apps/gpu/DrivenCavity/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(DrivenCavity LANGUAGES CXX) + +#LIST(APPEND CS_COMPILER_FLAGS_CXX "-DOMPI_SKIP_MPICXX" ) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES DrivenCavity.cpp) diff --git a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp b/apps/gpu/DrivenCavity/DrivenCavity.cpp similarity index 91% rename from apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp rename to apps/gpu/DrivenCavity/DrivenCavity.cpp index 245d1c052c909cef7c1ab948ca55d104419fa8cd..6f36a74a61902135ae78d4cdea43f13540e243f0 100644 --- a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp +++ b/apps/gpu/DrivenCavity/DrivenCavity.cpp @@ -41,31 +41,30 @@ ////////////////////////////////////////////////////////////////////////// -#include "DataTypes.h" -#include "PointerDefinitions.h" +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> #include <logger/Logger.h> +#include <parallel/MPICommunicator.h> + ////////////////////////////////////////////////////////////////////////// #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "GridGenerator/geometries/Cuboid/Cuboid.h" ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/Factories/GridScalingFactory.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" #include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" ////////////////////////////////////////////////////////////////////////// @@ -89,14 +88,6 @@ int main() const uint timeStepOut = 1000; const uint timeStepEnd = 10000; - ////////////////////////////////////////////////////////////////////////// - // setup gridGenerator - ////////////////////////////////////////////////////////////////////////// - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - ////////////////////////////////////////////////////////////////////////// // compute parameters in lattice units ////////////////////////////////////////////////////////////////////////// @@ -112,6 +103,7 @@ int main() ////////////////////////////////////////////////////////////////////////// // create grid ////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, 0.5 * L, 0.5 * L, 0.5 * L, dx); @@ -142,7 +134,7 @@ int main() para->setTimestepOut(timeStepOut); para->setTimestepEnd(timeStepEnd); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); ////////////////////////////////////////////////////////////////////////// // set boundary conditions @@ -164,7 +156,7 @@ int main() // set copy mesh to simulation ////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator &communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); SPtr<GridProvider> gridGenerator = diff --git a/apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt b/apps/gpu/DrivenCavity/configDrivenCavity.txt similarity index 100% rename from apps/gpu/LBM/DrivenCavity/configDrivenCavity.txt rename to apps/gpu/DrivenCavity/configDrivenCavity.txt diff --git a/apps/gpu/DrivenCavityMultiGPU/CMakeLists.txt b/apps/gpu/DrivenCavityMultiGPU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6460abb1cb56b770cf91f57239eeb8262f34595a --- /dev/null +++ b/apps/gpu/DrivenCavityMultiGPU/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(DrivenCavityMultiGPU LANGUAGES CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES DrivenCavityMultiGPU.cpp) diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp b/apps/gpu/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp similarity index 96% rename from apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp rename to apps/gpu/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp index d7f6dace74a07ba8477085b94f2146cf4500d7d1..006f2b92335a3dd2f6c2cd97de2971cac0e61bf8 100755 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp +++ b/apps/gpu/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp @@ -1,14 +1,12 @@ #define _USE_MATH_DEFINES #include <exception> +#include <filesystem> #include <fstream> #include <iostream> #include <memory> #include <sstream> #include <stdexcept> #include <string> -#include <filesystem> - -#include "mpi.h" ////////////////////////////////////////////////////////////////////////// @@ -24,7 +22,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "geometries/Cuboid/Cuboid.h" #include "geometries/TriangularMesh/TriangularMesh.h" @@ -36,7 +33,6 @@ ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" @@ -53,7 +49,7 @@ #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" ////////////////////////////////////////////////////////////////////////// - +#include <parallel/MPICommunicator.h> #include "utilities/communication.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -62,13 +58,11 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); @@ -115,7 +109,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) para->setPrintFiles(true); std::cout << "Write result files to " << para->getFName() << std::endl; - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -145,7 +139,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) if (para->getNumprocs() > 1) { - const uint generatePart = vf::gpu::MpiCommunicator::getInstance().getPID(); + const uint generatePart = communicator.getProcessID(); real overlap = (real)8.0 * dxGrid; gridBuilder->setNumberOfLayers(10, 8); @@ -153,7 +147,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) const real ySplit = 0.0; const real zSplit = 0.0; - if (communicator.getNumberOfProcess() == 2) { + if (communicator.getNumberOfProcesses() == 2) { if (generatePart == 0) { gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xGridMax, yGridMax, zSplit + overlap, @@ -200,7 +194,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 4) { + } else if (communicator.getNumberOfProcesses() == 4) { if (generatePart == 0) { gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, yGridMax, @@ -284,7 +278,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) gridBuilder->setVelocityBoundaryCondition(SideType::PX, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 8) { + } else if (communicator.getNumberOfProcesses() == 8) { if (generatePart == 0) { gridBuilder->addCoarseGrid(xGridMin, yGridMin, zGridMin, xSplit + overlap, ySplit + overlap, @@ -517,7 +511,7 @@ int main(int argc, char *argv[]) try { VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); - vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt"); + vf::basics::ConfigurationFile config = vf::basics::loadConfig(argc, argv, "./apps/gpu/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt"); runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt b/apps/gpu/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt similarity index 95% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt rename to apps/gpu/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt index 69b6d099c97bd0bebeec71104ad484513f50c6e7..5e6c31efa177ef510ae8db66da5f4aafbe0da771 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt @@ -26,7 +26,7 @@ GridPath=/workspaces/VirtualFluids_dev/output/DrivenCavity_Results/grid/ # Arag ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt b/apps/gpu/DrivenCavityMultiGPU/configPhoenix1GPU.txt similarity index 95% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt rename to apps/gpu/DrivenCavityMultiGPU/configPhoenix1GPU.txt index e63db13b533d24ef44b2e4d472ffba481d79f828..64c083d726d88a6331d503ea4683020ed8212394 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix1GPU.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configPhoenix1GPU.txt @@ -25,7 +25,7 @@ GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/1GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt b/apps/gpu/DrivenCavityMultiGPU/configPhoenix2GPU.txt similarity index 96% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt rename to apps/gpu/DrivenCavityMultiGPU/configPhoenix2GPU.txt index 30b1882df34dcae63674b42ce6d65a47942ff87e..c88e125fbcc9e956b74094d8e608131c21369588 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix2GPU.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configPhoenix2GPU.txt @@ -25,7 +25,7 @@ GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/2GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt b/apps/gpu/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt similarity index 96% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt rename to apps/gpu/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt index c5789cdf96049b7c0a31ce693c29cd2db4952a58..9b8c6e42de49997cc218a2a0ee6f832b903d142b 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt @@ -1,7 +1,7 @@ ################################################## #GPU Mapping ################################################## -Devices="0 1 2 3" +Devices=0 1 2 3 NumberOfDevices=4 ################################################## diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt b/apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU.txt similarity index 96% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt rename to apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU.txt index 85684e7589dad91e53356c16bc2eae44081d7e96..78c95032a9c7a49d760a58e77112ee7fb774758d 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU.txt @@ -25,7 +25,7 @@ GridPath=/work/y0078217/Grids/GridDrivenCavityMultiGPU/8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_regressionTest.txt b/apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_regressionTest.txt rename to apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt index c5789cdf96049b7c0a31ce693c29cd2db4952a58..9b8c6e42de49997cc218a2a0ee6f832b903d142b 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_regressionTest.txt +++ b/apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt @@ -1,7 +1,7 @@ ################################################## #GPU Mapping ################################################## -Devices="0 1 2 3" +Devices=0 1 2 3 NumberOfDevices=4 ################################################## diff --git a/apps/gpu/DrivenCavityUniform/CMakeLists.txt b/apps/gpu/DrivenCavityUniform/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..78d6d693a54b251b8c3361ac908f6099f4d7ccf0 --- /dev/null +++ b/apps/gpu/DrivenCavityUniform/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(DrivenCavityUniform LANGUAGES CXX) + +#LIST(APPEND CS_COMPILER_FLAGS_CXX "-DOMPI_SKIP_MPICXX" ) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES DrivenCavity.cpp) diff --git a/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp b/apps/gpu/DrivenCavityUniform/DrivenCavity.cpp similarity index 91% rename from apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp rename to apps/gpu/DrivenCavityUniform/DrivenCavity.cpp index 05c164ea82790c4a26c5c65538d944f46d1c969c..10319c4c62ad2b1a3e5471be86e3f8fca41a49b2 100644 --- a/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp +++ b/apps/gpu/DrivenCavityUniform/DrivenCavity.cpp @@ -41,41 +41,39 @@ ////////////////////////////////////////////////////////////////////////// -#include "DataTypes.h" -#include <logger/Logger.h> - -#include "PointerDefinitions.h" +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> #include <logger/Logger.h> +#include <parallel/MPICommunicator.h> + ////////////////////////////////////////////////////////////////////////// #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "GridGenerator/geometries/Cuboid/Cuboid.h" ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "VirtualFluids_GPU/Factories/GridScalingFactory.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" #include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" + ////////////////////////////////////////////////////////////////////////// int main() { try { - vf::logging::Logger::initializeLogger(); + vf::logging::Logger::initializeLogger(); ////////////////////////////////////////////////////////////////////////// // Simulation parameters ////////////////////////////////////////////////////////////////////////// @@ -91,20 +89,14 @@ int main() const uint timeStepOut = 1000; const uint timeStepEnd = 10000; - ////////////////////////////////////////////////////////////////////////// - // setup gridGenerator - ////////////////////////////////////////////////////////////////////////// - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - ////////////////////////////////////////////////////////////////////////// // create grid ////////////////////////////////////////////////////////////////////////// real dx = L / real(nx); + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); + gridBuilder->addCoarseGrid(-0.5 * L, -0.5 * L, -0.5 * L, 0.5 * L, 0.5 * L, 0.5 * L, dx); // gridBuilder->addGrid(std::make_shared<Cuboid>(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25), 1); // add fine grid @@ -145,7 +137,7 @@ int main() para->setTimestepOut(timeStepOut); para->setTimestepEnd(timeStepEnd); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); ////////////////////////////////////////////////////////////////////////// // set boundary conditions @@ -167,13 +159,12 @@ int main() // set copy mesh to simulation ////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator &communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); - ////////////////////////////////////////////////////////////////////////// // run simulation ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/DrivenCavityUniform/configDrivenCavity.txt b/apps/gpu/DrivenCavityUniform/configDrivenCavity.txt similarity index 100% rename from apps/gpu/LBM/DrivenCavityUniform/configDrivenCavity.txt rename to apps/gpu/DrivenCavityUniform/configDrivenCavity.txt diff --git a/apps/gpu/LBM/DrivenCavity/CMakeLists.txt b/apps/gpu/LBM/DrivenCavity/CMakeLists.txt deleted file mode 100644 index 8384e1bc6fcfa3fd2514434b620b266e96b3626a..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/DrivenCavity/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -PROJECT(DrivenCavity LANGUAGES CUDA CXX) - -#LIST(APPEND CS_COMPILER_FLAGS_CXX "-DOMPI_SKIP_MPICXX" ) - -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES DrivenCavity.cpp) - -set_source_files_properties(DrivenCavity.cpp PROPERTIES LANGUAGE CUDA) - -set_target_properties(DrivenCavity PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt b/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt deleted file mode 100644 index 51b8db1edf126ebe7e2f3d5808496121270433c5..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -PROJECT(DrivenCavityMultiGPU LANGUAGES CUDA CXX) - -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES DrivenCavityMultiGPU.cpp) - -set_source_files_properties(DrivenCavityMultiGPU.cpp PROPERTIES LANGUAGE CUDA) - -set_target_properties(DrivenCavityMultiGPU PROPERTIES - CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/DrivenCavityUniform/CMakeLists.txt b/apps/gpu/LBM/DrivenCavityUniform/CMakeLists.txt deleted file mode 100644 index 40b4f08d7500c56efae7378df6398d065e4ecbfb..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/DrivenCavityUniform/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -PROJECT(DrivenCavityUniform LANGUAGES CUDA CXX) - -#LIST(APPEND CS_COMPILER_FLAGS_CXX "-DOMPI_SKIP_MPICXX" ) - -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES DrivenCavity.cpp) - -set_source_files_properties(DrivenCavity.cpp PROPERTIES LANGUAGE CUDA) - -set_target_properties(DrivenCavityUniform PROPERTIES CUDA_SEPARABLE_COMPILATION ON) - diff --git a/apps/gpu/LBM/MusselOyster/CMakeLists.txt b/apps/gpu/LBM/MusselOyster/CMakeLists.txt deleted file mode 100644 index 595d9ff7250d984f80e8d0d54dad0b11ae7e71e2..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/MusselOyster/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -PROJECT(MusselOyster LANGUAGES CUDA CXX) - -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES MusselOyster.cpp) - -set_source_files_properties(MusselOyster.cpp PROPERTIES LANGUAGE CUDA) - -set_target_properties(MusselOyster PROPERTIES - CUDA_SEPARABLE_COMPILATION ON) \ No newline at end of file diff --git a/apps/gpu/LBM/SphereGPU/CMakeLists.txt b/apps/gpu/LBM/SphereGPU/CMakeLists.txt deleted file mode 100644 index 6a8f3cb1b86b149852abf4365e15fd4df9e8c0cf..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/SphereGPU/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -PROJECT(SphereGPU LANGUAGES CUDA CXX) - -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES Sphere.cpp) - -set_source_files_properties(Sphere.cpp PROPERTIES LANGUAGE CUDA) - -set_target_properties(SphereGPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/LBM/lbmTest/3rdPartyLinking.cmake b/apps/gpu/LBM/lbmTest/3rdPartyLinking.cmake deleted file mode 100644 index 6dd6ba1bc73e73dfbf01a3cc36aaeb3664e1c04c..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/lbmTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,13 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "serialization") -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) -linkMetis(${targetName}) - -if(HULC.BUILD_JSONCPP) - include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/JsonCpp/Link.cmake) - linkJsonCpp(${targetName}) -endif() \ No newline at end of file diff --git a/apps/gpu/LBM/lbmTest/CMakeLists.txt b/apps/gpu/LBM/lbmTest/CMakeLists.txt deleted file mode 100644 index 6ef6241b52aa9b5dc73a19b82f2b9fd5248c77c5..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/lbmTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink VirtualFluids_GPU GridGenerator) -set(includeDirectories "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU" "${CMAKE_SOURCE_DIR}/src/GridGenerator" "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics") - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${lbmAppFolder}) - -# Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file diff --git a/apps/gpu/LBM/lbmTest/CMakePackage.cmake b/apps/gpu/LBM/lbmTest/CMakePackage.cmake deleted file mode 100644 index 5d39e3804dbd180790629111449a7dc918292430..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/lbmTest/CMakePackage.cmake +++ /dev/null @@ -1,9 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() -addFileEndingToCollect("*.cu") -addFileEndingToCollect("*.cuh") - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/apps/gpu/LBM/lbmTest/main.cpp b/apps/gpu/LBM/lbmTest/main.cpp deleted file mode 100644 index 90640a3813a25e8249c7668a6e6c7779b0f01e4d..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/lbmTest/main.cpp +++ /dev/null @@ -1,819 +0,0 @@ -//#define MPI_LOGGING - -//Martin Branch - -#include <mpi.h> -#if defined( MPI_LOGGING ) - #include <mpe.h> -#endif - -#include <string> -#include <iostream> -#include <stdexcept> -#include <fstream> -#define _USE_MATH_DEFINES -#include <math.h> - -#include "metis.h" - -#include "Input/Input.h" -#include "StringUtilities/StringUtil.h" - -#include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Output/FileWriter.h" -#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" - -#include "global.h" - -#include "geometries/Sphere/Sphere.h" -#include "geometries/VerticalCylinder/VerticalCylinder.h" -#include "geometries/Cuboid/Cuboid.h" -#include "geometries/TriangularMesh/TriangularMesh.h" -#include "geometries/Conglomerate/Conglomerate.h" -#include "geometries/TriangularMesh/TriangularMeshStrategy.h" - -#include "grid/GridBuilder/LevelGridBuilder.h" -#include "grid/GridBuilder/MultipleGridBuilder.h" -#include "grid/BoundaryConditions/Side.h" -#include "grid/BoundaryConditions/BoundaryCondition.h" -#include "grid/GridFactory.h" - -#include "io/SimulationFileWriter/SimulationFileWriter.h" -#include "io/GridVTKWriter/GridVTKWriter.h" -#include "io/STLReaderWriter/STLReader.h" -#include "io/STLReaderWriter/STLWriter.h" - -#include "utilities/math/Math.h" -#include "utilities/communication.h" -#include "utilities/transformator/TransformatorImp.h" - -std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath) -{ - if (para->getNumprocs() == 1) - return Gridpath + "/"; - - return Gridpath + "/" + StringUtil::toString(para->getMyID()) + "/"; -} - -void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input> &input) -{ - Communicator* comm = Communicator::getInstanz(); - - para->setMaxDev(StringUtil::toInt(input->getValue("NumberOfDevices"))); - para->setNumprocs(comm->getNumberOfProcess()); - para->setDevices(StringUtil::toUintVector(input->getValue("Devices"))); - para->setMyID(comm->getPID()); - - std::string _path = input->getValue("Path"); - std::string _prefix = input->getValue("Prefix"); - std::string _gridpath = input->getValue("GridPath"); - std::string gridPath = getGridPath(para, _gridpath); - para->setOutputPath(_path); - para->setOutputPrefix(_prefix); - para->setPathAndFilename(_path + "/" + _prefix); - para->setPrintFiles(false); - para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid"))); - para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); - para->setCalc2ndOrderMoments(StringUtil::toBool(input->getValue("calc2ndOrderMoments"))); - para->setCalc3rdOrderMoments(StringUtil::toBool(input->getValue("calc3rdOrderMoments"))); - para->setCalcHighOrderMoments(StringUtil::toBool(input->getValue("calcHigherOrderMoments"))); - para->setReadGeo(StringUtil::toBool(input->getValue("ReadGeometry"))); - para->setCalcMedian(StringUtil::toBool(input->getValue("calcMedian"))); - para->setConcFile(StringUtil::toBool(input->getValue("UseConcFile"))); - para->setUseMeasurePoints(StringUtil::toBool(input->getValue("UseMeasurePoints"))); - para->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); - para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); - para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - para->setTimestepEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - para->setTimestepOut(StringUtil::toInt(input->getValue("TimeOut"))); - para->setTimestepStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); - para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); - para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); - para->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); - para->setPressOutID(StringUtil::toInt(input->getValue("PressOutID"))); - para->setPressInZ(StringUtil::toInt(input->getValue("PressInZ"))); - para->setPressOutZ(StringUtil::toInt(input->getValue("PressOutZ"))); - ////////////////////////////////////////////////////////////////////////// - para->setDiffOn(StringUtil::toBool(input->getValue("DiffOn"))); - para->setDiffMod(StringUtil::toInt(input->getValue("DiffMod"))); - para->setDiffusivity(StringUtil::toFloat(input->getValue("Diffusivity"))); - para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); - para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); - ////////////////////////////////////////////////////////////////////////// - para->setViscosityLB(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - para->setVelocityLB(StringUtil::toFloat(input->getValue("Velocity_LB"))); - para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); - para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); - para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); - para->setPressRatio(StringUtil::toFloat(input->getValue("Delta_Press"))); - para->setRealX(StringUtil::toFloat(input->getValue("SliceRealX"))); - para->setRealY(StringUtil::toFloat(input->getValue("SliceRealY"))); - para->setFactorPressBC(StringUtil::toFloat(input->getValue("dfpbc"))); - para->setGeometryFileC(input->getValue("GeometryC")); - para->setGeometryFileM(input->getValue("GeometryM")); - para->setGeometryFileF(input->getValue("GeometryF")); - ////////////////////////////////////////////////////////////////////////// - para->setgeoVec(gridPath + input->getValue("geoVec")); - para->setcoordX(gridPath + input->getValue("coordX")); - para->setcoordY(gridPath + input->getValue("coordY")); - para->setcoordZ(gridPath + input->getValue("coordZ")); - para->setneighborX(gridPath + input->getValue("neighborX")); - para->setneighborY(gridPath + input->getValue("neighborY")); - para->setneighborZ(gridPath + input->getValue("neighborZ")); - para->setscaleCFC(gridPath + input->getValue("scaleCFC")); - para->setscaleCFF(gridPath + input->getValue("scaleCFF")); - para->setscaleFCC(gridPath + input->getValue("scaleFCC")); - para->setscaleFCF(gridPath + input->getValue("scaleFCF")); - para->setscaleOffsetCF(gridPath + input->getValue("scaleOffsetCF")); - para->setscaleOffsetFC(gridPath + input->getValue("scaleOffsetFC")); - para->setgeomBoundaryBcQs(gridPath + input->getValue("geomBoundaryBcQs")); - para->setgeomBoundaryBcValues(gridPath + input->getValue("geomBoundaryBcValues")); - para->setinletBcQs(gridPath + input->getValue("inletBcQs")); - para->setinletBcValues(gridPath + input->getValue("inletBcValues")); - para->setoutletBcQs(gridPath + input->getValue("outletBcQs")); - para->setoutletBcValues(gridPath + input->getValue("outletBcValues")); - para->settopBcQs(gridPath + input->getValue("topBcQs")); - para->settopBcValues(gridPath + input->getValue("topBcValues")); - para->setbottomBcQs(gridPath + input->getValue("bottomBcQs")); - para->setbottomBcValues(gridPath + input->getValue("bottomBcValues")); - para->setfrontBcQs(gridPath + input->getValue("frontBcQs")); - para->setfrontBcValues(gridPath + input->getValue("frontBcValues")); - para->setbackBcQs(gridPath + input->getValue("backBcQs")); - para->setbackBcValues(gridPath + input->getValue("backBcValues")); - para->setnumberNodes(gridPath + input->getValue("numberNodes")); - para->setLBMvsSI(gridPath + input->getValue("LBMvsSI")); - //////////////////////////////gridPath + //////////////////////////////////////////// - para->setmeasurePoints(gridPath + input->getValue("measurePoints")); - para->setpropellerValues(gridPath + input->getValue("propellerValues")); - para->setclockCycleForMP(StringUtil::toFloat(input->getValue("measureClockCycle"))); - para->settimestepForMP(StringUtil::toInt(input->getValue("measureTimestep"))); - para->setcpTop(gridPath + input->getValue("cpTop")); - para->setcpBottom(gridPath + input->getValue("cpBottom")); - para->setcpBottom2(gridPath + input->getValue("cpBottom2")); - para->setConcentration(gridPath + input->getValue("Concentration")); - ////////////////////////////////////////////////////////////////////////// - //Normals - Geometry - para->setgeomBoundaryNormalX(gridPath + input->getValue("geomBoundaryNormalX")); - para->setgeomBoundaryNormalY(gridPath + input->getValue("geomBoundaryNormalY")); - para->setgeomBoundaryNormalZ(gridPath + input->getValue("geomBoundaryNormalZ")); - //Normals - Inlet - para->setInflowBoundaryNormalX(gridPath + input->getValue("inletBoundaryNormalX")); - para->setInflowBoundaryNormalY(gridPath + input->getValue("inletBoundaryNormalY")); - para->setInflowBoundaryNormalZ(gridPath + input->getValue("inletBoundaryNormalZ")); - //Normals - Outlet - para->setOutflowBoundaryNormalX(gridPath + input->getValue("outletBoundaryNormalX")); - para->setOutflowBoundaryNormalY(gridPath + input->getValue("outletBoundaryNormalY")); - para->setOutflowBoundaryNormalZ(gridPath + input->getValue("outletBoundaryNormalZ")); - ////////////////////////////////////////////////////////////////////////// - //Forcing - para->setForcing(StringUtil::toFloat(input->getValue("ForcingX")), StringUtil::toFloat(input->getValue("ForcingY")), StringUtil::toFloat(input->getValue("ForcingZ"))); - ////////////////////////////////////////////////////////////////////////// - //Particles - para->setCalcParticles(StringUtil::toBool(input->getValue("calcParticles"))); - para->setParticleBasicLevel(StringUtil::toInt(input->getValue("baseLevel"))); - para->setParticleInitLevel(StringUtil::toInt(input->getValue("initLevel"))); - para->setNumberOfParticles(StringUtil::toInt(input->getValue("numberOfParticles"))); - para->setneighborWSB(gridPath + input->getValue("neighborWSB")); - para->setStartXHotWall(StringUtil::toDouble(input->getValue("startXHotWall"))); - para->setEndXHotWall(StringUtil::toDouble(input->getValue("endXHotWall"))); - ////////////////////////////////////////////////////////////////////////// - //for Multi GPU - if (para->getNumprocs() > 1) - { - //////////////////////////////////////////////////////////////////////////// - ////1D domain decomposition - //std::vector<std::string> sendProcNeighbors; - //std::vector<std::string> recvProcNeighbors; - //for (int i = 0; i<para->getNumprocs();i++) - //{ - // sendProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "s.dat"); - // recvProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "r.dat"); - //} - //para->setPossNeighborFiles(sendProcNeighbors, "send"); - //para->setPossNeighborFiles(recvProcNeighbors, "recv"); - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition - std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ; - std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ; - for (int i = 0; i < para->getNumprocs(); i++) - { - sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat"); - sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat"); - sendProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zs.dat"); - recvProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xr.dat"); - recvProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Yr.dat"); - recvProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zr.dat"); - } - para->setPossNeighborFilesX(sendProcNeighborsX, "send"); - para->setPossNeighborFilesY(sendProcNeighborsY, "send"); - para->setPossNeighborFilesZ(sendProcNeighborsZ, "send"); - para->setPossNeighborFilesX(recvProcNeighborsX, "recv"); - para->setPossNeighborFilesY(recvProcNeighborsY, "recv"); - para->setPossNeighborFilesZ(recvProcNeighborsZ, "recv"); - } - ////////////////////////////////////////////////////////////////////////// - //para->setkFull( input->getValue( "kFull" )); - //para->setgeoFull( input->getValue( "geoFull" )); - //para->setnoSlipBcPos( input->getValue( "noSlipBcPos" )); - //para->setnoSlipBcQs( input->getValue( "noSlipBcQs" )); - //para->setnoSlipBcValues( input->getValue( "noSlipBcValues" )); - //para->setnoSlipBcValue( input->getValue( "noSlipBcValue" )); - //para->setslipBcPos( input->getValue( "slipBcPos" )); - //para->setslipBcQs( input->getValue( "slipBcQs" )); - //para->setslipBcValue( input->getValue( "slipBcValue" )); - //para->setpressBcPos( input->getValue( "pressBcPos" )); - //para->setpressBcQs( input->getValue( "pressBcQs" )); - //para->setpressBcValues( input->getValue( "pressBcValues" )); - //para->setpressBcValue( input->getValue( "pressBcValue" )); - //para->setvelBcQs( input->getValue( "velBcQs" )); - //para->setvelBcValues( input->getValue( "velBcValues" )); - //para->setpropellerCylinder( input->getValue( "propellerCylinder" )); - //para->setpropellerQs( input->getValue( "propellerQs" )); - //para->setwallBcQs( input->getValue( "wallBcQs" )); - //para->setwallBcValues( input->getValue( "wallBcValues" )); - //para->setperiodicBcQs( input->getValue( "periodicBcQs" )); - //para->setperiodicBcValues( input->getValue( "periodicBcValues" )); - //cout << "Try this: " << para->getgeomBoundaryBcValues() << endl; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Restart - para->setTimeDoCheckPoint(StringUtil::toInt(input->getValue("TimeDoCheckPoint"))); - para->setTimeDoRestart(StringUtil::toInt(input->getValue("TimeDoRestart"))); - para->setDoCheckPoint(StringUtil::toBool(input->getValue("DoCheckPoint"))); - para->setDoRestart(StringUtil::toBool(input->getValue("DoRestart"))); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->setMaxLevel(StringUtil::toInt(input->getValue("NOGL"))); - para->setGridX(StringUtil::toIntVector(input->getValue("GridX"))); - para->setGridY(StringUtil::toIntVector(input->getValue("GridY"))); - para->setGridZ(StringUtil::toIntVector(input->getValue("GridZ"))); - para->setDistX(StringUtil::toIntVector(input->getValue("DistX"))); - para->setDistY(StringUtil::toIntVector(input->getValue("DistY"))); - para->setDistZ(StringUtil::toIntVector(input->getValue("DistZ"))); - - para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true}); -} - - - -void multipleLevel(const std::string& configPath) -{ - auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(Device::CPU); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - SPtr<Parameter> para = Parameter::make(); - BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); - SPtr<GridProvider> gridGenerator; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - bool useGridGenerator = true; - - if(useGridGenerator){ - - enum testCase{ - TGV, - TGV3D, - Sphere, - DrivAer, - DLC, - MultiGPU - }; - - int testcase = TGV3D; - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (testcase == TGV) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - real dx = 1.0; - real vx = 0.049; - ////////////////////////////////////////////////////////////////////////// - //32 - gridBuilder->addCoarseGrid(-24, -2, -16, - 24, 2, 16, dx); - ////////////////////////////////////////////////////////////////////////// - gridBuilder->setPeriodicBoundaryCondition(true, true, true); - ////////////////////////////////////////////////////////////////////////// - gridBuilder->buildGrids(true); - ////////////////////////////////////////////////////////////////////////// - SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); - ////////////////////////////////////////////////////////////////////////// - gridBuilder->writeGridsToVtk("E:/temp/TaylorGreenVortex/results/32/TGV32turned_Grid"); - gridBuilder->writeArrows("E:/temp/TaylorGreenVortex/results/32/TGV32turned_Grid_arrow"); - ////////////////////////////////////////////////////////////////////////// - SimulationFileWriter::write("E:/temp/TaylorGreenVortex/grids/turned/gridUni48x4x32/", gridBuilder, FILEFORMAT::BINARY); - ////////////////////////////////////////////////////////////////////////// - return; - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (testcase == TGV3D) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - const real PI = 3.141592653589793238462643383279; - - real dx = 2.0 * PI / 32.0; // 32^3 nodes - //real dx = 2.0 * PI / 64.0; // 64^3 nodes - //real dx = 2.0 * PI / 128.0; // 128^3 nodes - //real dx = 2.0 * PI / 256.0; // 128^3 nodes - real vx = 0.049; - - gridBuilder->addCoarseGrid(-PI, -PI, -PI, - PI, PI, PI, dx); - - gridBuilder->setPeriodicBoundaryCondition(true, true, true); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - ////////////////////////////////////////////////////////////////////////// - SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); - ////////////////////////////////////////////////////////////////////////// - //32 - gridBuilder->writeGridsToVtk("E:/temp/TaylorGreenVortex/results3D/32/TGV3D_Grid"); - gridBuilder->writeArrows("E:/temp/TaylorGreenVortex/results3D/32/TGV3D_Grid_arrow"); - SimulationFileWriter::write("E:/temp/TaylorGreenVortex/grids3D/gridTGV3D/32/", gridBuilder, FILEFORMAT::BINARY); //FILEFORMAT::ASCII - //256 - //gridBuilder->writeGridsToVtk("E:/temp/TaylorGreenVortex/results3D/256/TGV3D_Grid"); - //gridBuilder->writeArrows("E:/temp/TaylorGreenVortex/results3D/256/TGV3D_Grid_arrow"); - //SimulationFileWriter::write("E:/temp/TaylorGreenVortex/grids3D/gridTGV3D/256/", gridBuilder, FILEFORMAT::BINARY); //FILEFORMAT::ASCII - - //return; - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if( testcase == Sphere) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - real dx = 0.2; - real vx = 0.05; - - auto SphereSTL = std::make_shared<TriangularMesh>("E:/temp/GridSphere/2018/STL/SphereNotOptimal.stl"); - - gridBuilder->addCoarseGrid(- 5.0, -5.0, -5.0, - 10.0, 5.0, 5.0, dx); // DrivAer - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(SphereSTL, 2); - - gridBuilder->addGeometry(SphereSTL); - - gridBuilder->setPeriodicBoundaryCondition(false, false, false); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - ////////////////////////////////////////////////////////////////////////// - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); - - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - - gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); - bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); - bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); - ////////////////////////////////////////////////////////////////////////// - SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->writeGridsToVtk("E:/temp/GridSphere/2018/grids/outSphere/SphereBig3_Grid"); - gridBuilder->writeArrows ("E:/temp/GridSphere/2018/grids/outSphere/SphereBig3_Grid_arrow"); - - SimulationFileWriter::write("E:/temp/GridSphere/2018/grids/gridSphere/3lev_dxC_0_2/", gridBuilder, FILEFORMAT::BINARY); //FILEFORMAT::ASCII - - //return; - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if( testcase == DrivAer ) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - real dx = 0.2; - real vx = 0.05; - - auto DrivAerSTL = std::make_shared<TriangularMesh>("F:/Work/Computations/gridGenerator/stl/DrivAer_Fastback_Coarse.stl"); - //auto triangularMesh = std::make_shared<TriangularMesh>("M:/TestGridGeneration/STL/DrivAer_NoSTLGroups.stl"); - //auto triangularMesh = std::make_shared<TriangularMesh>("M:/TestGridGeneration/STL/DrivAer_Coarse.stl"); - //auto DrivAerSTL = std::make_shared<TriangularMesh>("stl/DrivAer_Fastback_Coarse.stl"); - - auto DrivAerRefBoxSTL = std::make_shared<TriangularMesh>("F:/Work/Computations/gridGenerator/stl/DrivAer_REF_BOX_Adrea.stl"); - //auto DrivAerRefBoxSTL = std::make_shared<TriangularMesh>("stl/DrivAer_REF_BOX_Adrea.stl"); - - real z0 = 0.318+0.5*dx; - - gridBuilder->addCoarseGrid(- 5.0, -5.0, 0.0 - z0, - 15.0, 5.0, 5.0 - z0, dx); // DrivAer - - //Object* floorBox = std::make_shared<Cuboid>( -0.3, -1, -1, 4.0, 1, 0.2 ); - //Object* wakeBox = std::make_shared<Cuboid>( 3.5, -1, -1, 5.5, 1, 0.8 ); - - //Conglomerate* refRegion = new Conglomerate(); - - //refRegion->add(floorBox); - //refRegion->add(wakeBox); - //refRegion->add(DrivAerRefBoxSTL); - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(DrivAerRefBoxSTL, 2); - - //gridBuilder->setNumberOfLayers(10,8); - //gridBuilder->addGrid(DrivAerSTL, 5); - - gridBuilder->addGeometry(DrivAerSTL); - - gridBuilder->setPeriodicBoundaryCondition(false, false, false); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); - - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - - gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); - bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); - bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); - - ////////////////////////////////////////////////////////////////////////// - - SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); - - gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, 4, 0.0075, -2.0, 0.0, - 0.0075, 2.0, 0.0, -vx, 0.318); - gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, 3, 2.793 , -2.0, 0.0, - 2.793 , 2.0, 0.0, -vx, 0.318); - - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/DrivAer_Grid"); - gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/DrivAer_Grid_arrow"); - - //SimulationFileWriter::write("D:/GRIDGENERATION/files/", gridBuilder, FILEFORMAT::ASCII); - //SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/", gridBuilder, FILEFORMAT::ASCII); - SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/", gridBuilder, FILEFORMAT::BINARY); - //SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); - - return; - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if( testcase == DLC ) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - real velocityRatio = 594.093427; - - real dx = 0.2; - real vx = 0.065272188; - - real z0 = 0.24395 + 0.5*dx; - - std::vector<uint> ignorePatches = { 152, 153, 154 }; - - //auto VW370_SERIE_STL = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/VW370_SERIE.stl", ignorePatches); - auto VW370_SERIE_STL = std::make_shared<TriangularMesh>("stl/VW370_SERIE.stl", ignorePatches); - - //auto DLC_RefBox = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC_RefBox.stl"); - - //auto DLC_RefBox_1 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC_RefBox_withWake/DLC_RefBox_withWake_4m.stl"); - //auto DLC_RefBox_2 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC_RefBox_withWake/DLC_RefBox_withWake_3m.stl"); - //auto DLC_RefBox_3 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC_RefBox_withWake/DLC_RefBox_withWake_2m.stl"); - //auto DLC_RefBox_4 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC_RefBox_withWake/DLC_RefBox_withWake_1m.stl"); - - //auto DLC_RefBox_Level_3 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC/DLC_RefBox_Level_3.stl"); - //auto DLC_RefBox_Level_4 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC/DLC_RefBox_Level_4.stl"); - //auto DLC_RefBox_Level_5 = std::make_shared<TriangularMesh>("C:/Users/lenz/Desktop/Work/gridGenerator/stl/DLC/DLC_RefBox_Level_5.stl"); - - auto DLC_RefBox_Level_3 = std::make_shared<TriangularMesh>("stl/DLC/DLC_RefBox_Level_3.stl"); - auto DLC_RefBox_Level_4 = std::make_shared<TriangularMesh>("stl/DLC/DLC_RefBox_Level_4.stl"); - auto DLC_RefBox_Level_5 = std::make_shared<TriangularMesh>("stl/DLC/DLC_RefBox_Level_5.stl"); - - //auto VW370_SERIE_STL = std::make_shared<TriangularMesh>("stl/VW370_SERIE.stl", ignorePatches); - //auto DLC_RefBox = std::make_shared<TriangularMesh>("stl/DLC_RefBox.lnx.stl"); - //auto DLC_RefBox_4 = std::make_shared<TriangularMesh>("stl/DLC_RefBox_withWake/DLC_RefBox_withWake_1m.lnx.stl"); - - gridBuilder->addCoarseGrid(-30.0, -20.0, 0.0 - z0, - 50.0, 20.0, 25.0 - z0, dx); - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid( std::make_shared<Cuboid>( - 6.6, -6, -0.7, 20.6 , 6, 5.3 ), 1 ); - gridBuilder->addGrid( std::make_shared<Cuboid>( -3.75, -3, -0.7, 11.75, 3, 2.65 ), 2 ); - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(DLC_RefBox_Level_3, 3); - gridBuilder->addGrid(DLC_RefBox_Level_4, 4); - - Conglomerate* refinement = new Conglomerate(); - refinement->add(DLC_RefBox_Level_5); - refinement->add(VW370_SERIE_STL); - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(refinement, 5); - - gridBuilder->addGeometry(VW370_SERIE_STL); - - gridBuilder->setPeriodicBoundaryCondition(false, false, false); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); - - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - - gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityAndPressureCompressible); - bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); - bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::OutflowNonReflective); - - ////////////////////////////////////////////////////////////////////////// - - SPtr<Grid> grid = gridBuilder->getGrid(gridBuilder->getNumberOfLevels() - 1); - - real wheelsFrontX = -0.081; - real wheelsRearX = 2.5486; - - real wheelsFrontZ = 0.0504; - real wheelsRearZ = 0.057; - - real wheelsRadius = 0.318; - - real wheelRotationFrequency = 1170.74376 / 60.0; - - real wheelTangentialVelocity = -2.0 * M_PI * wheelsRadius * wheelRotationFrequency / velocityRatio; - - std::vector<uint> frontWheelPatches = { 71, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 159 }; - std::vector<uint> rearWheelPatches = { 82, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 160 }; - - for( uint patch : frontWheelPatches ){ - gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, patch, wheelsFrontX, -2.0, wheelsFrontZ, - wheelsFrontX, 2.0, wheelsFrontZ, - wheelTangentialVelocity, wheelsRadius); - } - - for( uint patch : rearWheelPatches ){ - gridBuilder->getGeometryBoundaryCondition(gridBuilder->getNumberOfLevels() - 1)->setTangentialVelocityForPatch( grid, patch, wheelsRearX , -2.0, wheelsRearZ , - wheelsRearX , 2.0, wheelsRearZ , - wheelTangentialVelocity, wheelsRadius); - } - - ////////////////////////////////////////////////////////////////////////// - - //gridBuilder->writeGridsToVtk("C:/Users/lenz/Desktop/Work/gridGenerator/grid/DLC_Grid"); - //gridBuilder->writeArrows ("C:/Users/lenz/Desktop/Work/gridGenerator/grid/DLC_Grid_arrow"); - - gridBuilder->writeGridsToVtk("grid/DLC_Grid"); - gridBuilder->writeArrows ("grid/DLC_Grid_arrow"); - - //SimulationFileWriter::write("D:/GRIDGENERATION/files/", gridBuilder, FILEFORMAT::ASCII); - //SimulationFileWriter::write("C:/Users/lenz/Desktop/Work/gridGenerator/grid/", gridBuilder, FILEFORMAT::ASCII); - SimulationFileWriter::write("grid/", gridBuilder, FILEFORMAT::ASCII); - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if( testcase == MultiGPU ) - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - { - //const uint generatePart = 1; - const uint generatePart = Communicator::getInstanz()->getPID(); - - std::ofstream logFile2; - - if( generatePart == 0 ) - logFile2.open( "F:/Work/Computations/gridGenerator/grid/0/gridGeneratorLog.txt" ); - //logFile2.open( "grid/0/gridGeneratorLog.txt" ); - - if( generatePart == 1 ) - logFile2.open( "F:/Work/Computations/gridGenerator/grid/1/gridGeneratorLog.txt" ); - //logFile2.open( "grid/1/gridGeneratorLog.txt" ); - - real dx = 1.0 / 40.0; - real vx = 0.05; - - auto triangularMesh = std::make_shared<TriangularMesh>("F:/Work/Computations/gridGenerator/stl/ShpereNotOptimal.stl"); - //auto triangularMesh = std::make_shared<TriangularMesh>("stl/ShpereNotOptimal.lnx.stl"); - - // all - //gridBuilder->addCoarseGrid(-2, -2, -2, - // 4, 2, 2, dx); - - real overlap = 10.0 * dx; - - if( generatePart == 0 ) - gridBuilder->addCoarseGrid(-2.0 , -2.0, -2.0, - 0.5 + overlap, 2.0, 2.0, dx); - - if( generatePart == 1 ) - gridBuilder->addCoarseGrid( 0.5 - overlap, -2.0, -2.0, - 4.0 , 2.0, 2.0, dx); - - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(triangularMesh, 1); - - gridBuilder->addGeometry(triangularMesh); - - if( generatePart == 0 ) - gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( -2.0, 0.5, - -2.0, 2.0, - -2.0, 2.0 ) ); - - if( generatePart == 1 ) - gridBuilder->setSubDomainBox( std::make_shared<BoundingBox>( 0.5, 4.0, - -2.0, 2.0, - -2.0, 2.0 ) ); - - gridBuilder->setPeriodicBoundaryCondition(false, false, false); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - - if( generatePart == 0 ){ - gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); - gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 1); - } - - if( generatePart == 1 ){ - gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); - gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); - } - - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); - - if (generatePart == 0) { - gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - } - if (generatePart == 1) { - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - } - - gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); - bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); - bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); - ////////////////////////////////////////////////////////////////////////// - - if (generatePart == 0) { - //gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/0/Test_"); - //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/0/Test_Arrow"); - } - if (generatePart == 1) { - //gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/1/Test_"); - //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/1/Test_Arrow"); - } - - if (generatePart == 0) - SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/0/", gridBuilder, FILEFORMAT::ASCII); - //SimulationFileWriter::write("grid/0/", gridBuilder, FILEFORMAT::ASCII); - if (generatePart == 1) - SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/1/", gridBuilder, FILEFORMAT::ASCII); - //SimulationFileWriter::write("grid/1/", gridBuilder, FILEFORMAT::ASCII); - - //return; - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - - } - else - { - gridGenerator = GridReader::make(FileFormat::BINARY, para); - //gridGenerator = GridReader::make(FileFormat::ASCII, para); - } - - logFile.close(); - - //return; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - std::ifstream stream; - stream.open(configPath.c_str(), std::ios::in); - if (stream.fail()) - throw std::runtime_error("can not open config file!"); - - UPtr<input::Input> input = input::Input::makeInput(stream, "config"); - - setParameters(para, input); - - Simulation sim; - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - sim.init(para, gridGenerator, fileWriter); - sim.run(); -} - - -int main( int argc, char* argv[]) -{ - MPI_Init(&argc, &argv); - std::string str, str2; - if ( argv != NULL ) - { - str = static_cast<std::string>(argv[0]); - if (argc > 1) - { - str2 = static_cast<std::string>(argv[1]); - try - { - multipleLevel(str2); - } - catch (const std::exception& e) - { - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (...) - { - std::cout << "unknown exeption" << std::endl; - } - } - else - { - try - { - //multipleLevel("C:/Users/schoen/Desktop/bin/3D/VirtualFluidsGpuCodes/Sphere/configSphere.txt"); - multipleLevel("C:/Users/schoen/Desktop/bin/3D/VirtualFluidsGpuCodes/TGV3D/configTGV3D.txt"); - } - catch (const std::exception& e) - { - std::cout << e.what() << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (const std::bad_alloc e) - { - std::cout << e.what() << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (...) - { - std::cout << "unknown exeption" << std::endl; - } - - std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - } - - - /* - MPE_Init_log() & MPE_Finish_log() are NOT needed when - liblmpe.a is linked with this program. In that case, - MPI_Init() would have called MPE_Init_log() already. - */ -#if defined( MPI_LOGGING ) - MPE_Init_log(); -#endif - -#if defined( MPI_LOGGING ) - if ( argv != NULL ) - MPE_Finish_log( argv[0] ); - if ( str != "" ) - MPE_Finish_log( str.c_str() ); - else - MPE_Finish_log( "TestLog" ); -#endif - - MPI_Finalize(); - return 0; -} diff --git a/apps/gpu/LBM/metisTest/3rdPartyLinking.cmake b/apps/gpu/LBM/metisTest/3rdPartyLinking.cmake deleted file mode 100644 index 6dd6ba1bc73e73dfbf01a3cc36aaeb3664e1c04c..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/metisTest/3rdPartyLinking.cmake +++ /dev/null @@ -1,13 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "serialization") -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) -linkMetis(${targetName}) - -if(HULC.BUILD_JSONCPP) - include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/JsonCpp/Link.cmake) - linkJsonCpp(${targetName}) -endif() \ No newline at end of file diff --git a/apps/gpu/LBM/metisTest/CMakeLists.txt b/apps/gpu/LBM/metisTest/CMakeLists.txt deleted file mode 100644 index 6ef6241b52aa9b5dc73a19b82f2b9fd5248c77c5..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/metisTest/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) - -set(linkDirectories "") -set(libsToLink VirtualFluids_GPU GridGenerator) -set(includeDirectories "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU" "${CMAKE_SOURCE_DIR}/src/GridGenerator" "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics") - -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${lbmAppFolder}) - -# Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file diff --git a/apps/gpu/LBM/metisTest/CMakePackage.cmake b/apps/gpu/LBM/metisTest/CMakePackage.cmake deleted file mode 100644 index 5d39e3804dbd180790629111449a7dc918292430..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/metisTest/CMakePackage.cmake +++ /dev/null @@ -1,9 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() -addFileEndingToCollect("*.cu") -addFileEndingToCollect("*.cuh") - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/apps/gpu/LBM/metisTest/main.cpp b/apps/gpu/LBM/metisTest/main.cpp deleted file mode 100644 index 9edfb9e853f1c4fff6872b15e93d4de94bd35095..0000000000000000000000000000000000000000 --- a/apps/gpu/LBM/metisTest/main.cpp +++ /dev/null @@ -1,829 +0,0 @@ -//#define MPI_LOGGING - - -#include <mpi.h> -#if defined( MPI_LOGGING ) - #include <mpe.h> -#endif - -#include <string> -#include <iostream> -#include <stdexcept> -#include <fstream> -#define _USE_MATH_DEFINES -#include <math.h> - -#include "metis.h" - -#include "Input/Input.h" -#include "StringUtilities/StringUtil.h" - -#include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" -#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" -#include "VirtualFluids_GPU/Parameter/Parameter.h" -#include "VirtualFluids_GPU/Output/FileWriter.h" - -#include "global.h" - -#include "geometries/Sphere/Sphere.h" -#include "geometries/VerticalCylinder/VerticalCylinder.h" -#include "geometries/Cuboid/Cuboid.h" -#include "geometries/TriangularMesh/TriangularMesh.h" -#include "geometries/Conglomerate/Conglomerate.h" -#include "geometries/TriangularMesh/TriangularMeshStrategy.h" - -#include "grid/GridBuilder/LevelGridBuilder.h" -#include "grid/GridBuilder/MultipleGridBuilder.h" -#include "grid/BoundaryConditions/Side.h" -#include "grid/BoundaryConditions/BoundaryCondition.h" -#include "grid/GridFactory.h" - -#include "io/SimulationFileWriter/SimulationFileWriter.h" -#include "io/GridVTKWriter/GridVTKWriter.h" -#include "io/STLReaderWriter/STLReader.h" -#include "io/STLReaderWriter/STLWriter.h" - -#include "utilities/math/Math.h" -#include "utilities/communication.h" -#include "utilities/transformator/TransformatorImp.h" - -using namespace vf::gpu; - -std::string getGridPath(std::shared_ptr<Parameter> para, std::string Gridpath) -{ - if (para->getNumprocs() == 1) - return Gridpath + "/"; - - return Gridpath + "/" + StringUtil::toString(para->getMyID()) + "/"; -} - -void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input> &input) -{ - Communicator* comm = Communicator::getInstanz(); - - para->setMaxDev(StringUtil::toInt(input->getValue("NumberOfDevices"))); - para->setNumprocs(comm->getNumberOfProcess()); - para->setDevices(StringUtil::toUintVector(input->getValue("Devices"))); - para->setMyID(comm->getPID()); - - std::string _path = input->getValue("Path"); - std::string _prefix = input->getValue("Prefix"); - std::string _gridpath = input->getValue("GridPath"); - std::string gridPath = getGridPath(para, _gridpath); - para->setOutputPath(_path); - para->setOutputPrefix(_prefix); - para->setPathAndFilename(_path + "/" + _prefix); - para->setPrintFiles(false); - para->setPrintFiles(StringUtil::toBool(input->getValue("WriteGrid"))); - para->setGeometryValues(StringUtil::toBool(input->getValue("GeometryValues"))); - para->setCalc2ndOrderMoments(StringUtil::toBool(input->getValue("calc2ndOrderMoments"))); - para->setCalc3rdOrderMoments(StringUtil::toBool(input->getValue("calc3rdOrderMoments"))); - para->setCalcHighOrderMoments(StringUtil::toBool(input->getValue("calcHigherOrderMoments"))); - para->setReadGeo(StringUtil::toBool(input->getValue("ReadGeometry"))); - para->setCalcMedian(StringUtil::toBool(input->getValue("calcMedian"))); - para->setConcFile(StringUtil::toBool(input->getValue("UseConcFile"))); - para->setUseMeasurePoints(StringUtil::toBool(input->getValue("UseMeasurePoints"))); - para->setUseWale(StringUtil::toBool(input->getValue("UseWale"))); - para->setSimulatePorousMedia(StringUtil::toBool(input->getValue("SimulatePorousMedia"))); - para->setD3Qxx(StringUtil::toInt(input->getValue("D3Qxx"))); - para->setTimestepEnd(StringUtil::toInt(input->getValue("TimeEnd"))); - para->setTimestepOut(StringUtil::toInt(input->getValue("TimeOut"))); - para->setTimestepStartOut(StringUtil::toInt(input->getValue("TimeStartOut"))); - para->setTimeCalcMedStart(StringUtil::toInt(input->getValue("TimeStartCalcMedian"))); - para->setTimeCalcMedEnd(StringUtil::toInt(input->getValue("TimeEndCalcMedian"))); - para->setPressInID(StringUtil::toInt(input->getValue("PressInID"))); - para->setPressOutID(StringUtil::toInt(input->getValue("PressOutID"))); - para->setPressInZ(StringUtil::toInt(input->getValue("PressInZ"))); - para->setPressOutZ(StringUtil::toInt(input->getValue("PressOutZ"))); - ////////////////////////////////////////////////////////////////////////// - para->setDiffOn(StringUtil::toBool(input->getValue("DiffOn"))); - para->setDiffMod(StringUtil::toInt(input->getValue("DiffMod"))); - para->setDiffusivity(StringUtil::toFloat(input->getValue("Diffusivity"))); - para->setTemperatureInit(StringUtil::toFloat(input->getValue("Temp"))); - para->setTemperatureBC(StringUtil::toFloat(input->getValue("TempBC"))); - ////////////////////////////////////////////////////////////////////////// - para->setViscosityLB(StringUtil::toFloat(input->getValue("Viscosity_LB"))); - para->setVelocityLB(StringUtil::toFloat(input->getValue("Velocity_LB"))); - para->setViscosityRatio(StringUtil::toFloat(input->getValue("Viscosity_Ratio_World_to_LB"))); - para->setVelocityRatio(StringUtil::toFloat(input->getValue("Velocity_Ratio_World_to_LB"))); - para->setDensityRatio(StringUtil::toFloat(input->getValue("Density_Ratio_World_to_LB"))); - para->setPressRatio(StringUtil::toFloat(input->getValue("Delta_Press"))); - para->setRealX(StringUtil::toFloat(input->getValue("SliceRealX"))); - para->setRealY(StringUtil::toFloat(input->getValue("SliceRealY"))); - para->setFactorPressBC(StringUtil::toFloat(input->getValue("dfpbc"))); - para->setGeometryFileC(input->getValue("GeometryC")); - para->setGeometryFileM(input->getValue("GeometryM")); - para->setGeometryFileF(input->getValue("GeometryF")); - ////////////////////////////////////////////////////////////////////////// - para->setgeoVec(gridPath + input->getValue("geoVec")); - para->setcoordX(gridPath + input->getValue("coordX")); - para->setcoordY(gridPath + input->getValue("coordY")); - para->setcoordZ(gridPath + input->getValue("coordZ")); - para->setneighborX(gridPath + input->getValue("neighborX")); - para->setneighborY(gridPath + input->getValue("neighborY")); - para->setneighborZ(gridPath + input->getValue("neighborZ")); - para->setscaleCFC(gridPath + input->getValue("scaleCFC")); - para->setscaleCFF(gridPath + input->getValue("scaleCFF")); - para->setscaleFCC(gridPath + input->getValue("scaleFCC")); - para->setscaleFCF(gridPath + input->getValue("scaleFCF")); - para->setscaleOffsetCF(gridPath + input->getValue("scaleOffsetCF")); - para->setscaleOffsetFC(gridPath + input->getValue("scaleOffsetFC")); - para->setgeomBoundaryBcQs(gridPath + input->getValue("geomBoundaryBcQs")); - para->setgeomBoundaryBcValues(gridPath + input->getValue("geomBoundaryBcValues")); - para->setinletBcQs(gridPath + input->getValue("inletBcQs")); - para->setinletBcValues(gridPath + input->getValue("inletBcValues")); - para->setoutletBcQs(gridPath + input->getValue("outletBcQs")); - para->setoutletBcValues(gridPath + input->getValue("outletBcValues")); - para->settopBcQs(gridPath + input->getValue("topBcQs")); - para->settopBcValues(gridPath + input->getValue("topBcValues")); - para->setbottomBcQs(gridPath + input->getValue("bottomBcQs")); - para->setbottomBcValues(gridPath + input->getValue("bottomBcValues")); - para->setfrontBcQs(gridPath + input->getValue("frontBcQs")); - para->setfrontBcValues(gridPath + input->getValue("frontBcValues")); - para->setbackBcQs(gridPath + input->getValue("backBcQs")); - para->setbackBcValues(gridPath + input->getValue("backBcValues")); - para->setnumberNodes(gridPath + input->getValue("numberNodes")); - para->setLBMvsSI(gridPath + input->getValue("LBMvsSI")); - //////////////////////////////gridPath + //////////////////////////////////////////// - para->setmeasurePoints(gridPath + input->getValue("measurePoints")); - para->setpropellerValues(gridPath + input->getValue("propellerValues")); - para->setclockCycleForMP(StringUtil::toFloat(input->getValue("measureClockCycle"))); - para->settimestepForMP(StringUtil::toInt(input->getValue("measureTimestep"))); - para->setcpTop(gridPath + input->getValue("cpTop")); - para->setcpBottom(gridPath + input->getValue("cpBottom")); - para->setcpBottom2(gridPath + input->getValue("cpBottom2")); - para->setConcentration(gridPath + input->getValue("Concentration")); - ////////////////////////////////////////////////////////////////////////// - //Normals - Geometry - para->setgeomBoundaryNormalX(gridPath + input->getValue("geomBoundaryNormalX")); - para->setgeomBoundaryNormalY(gridPath + input->getValue("geomBoundaryNormalY")); - para->setgeomBoundaryNormalZ(gridPath + input->getValue("geomBoundaryNormalZ")); - //Normals - Inlet - para->setInflowBoundaryNormalX(gridPath + input->getValue("inletBoundaryNormalX")); - para->setInflowBoundaryNormalY(gridPath + input->getValue("inletBoundaryNormalY")); - para->setInflowBoundaryNormalZ(gridPath + input->getValue("inletBoundaryNormalZ")); - //Normals - Outlet - para->setOutflowBoundaryNormalX(gridPath + input->getValue("outletBoundaryNormalX")); - para->setOutflowBoundaryNormalY(gridPath + input->getValue("outletBoundaryNormalY")); - para->setOutflowBoundaryNormalZ(gridPath + input->getValue("outletBoundaryNormalZ")); - ////////////////////////////////////////////////////////////////////////// - //Forcing - para->setForcing(StringUtil::toFloat(input->getValue("ForcingX")), StringUtil::toFloat(input->getValue("ForcingY")), StringUtil::toFloat(input->getValue("ForcingZ"))); - ////////////////////////////////////////////////////////////////////////// - //Particles - para->setCalcParticles(StringUtil::toBool(input->getValue("calcParticles"))); - para->setParticleBasicLevel(StringUtil::toInt(input->getValue("baseLevel"))); - para->setParticleInitLevel(StringUtil::toInt(input->getValue("initLevel"))); - para->setNumberOfParticles(StringUtil::toInt(input->getValue("numberOfParticles"))); - para->setneighborWSB(gridPath + input->getValue("neighborWSB")); - para->setStartXHotWall(StringUtil::toDouble(input->getValue("startXHotWall"))); - para->setEndXHotWall(StringUtil::toDouble(input->getValue("endXHotWall"))); - ////////////////////////////////////////////////////////////////////////// - //for Multi GPU - if (para->getNumprocs() > 1) - { - //////////////////////////////////////////////////////////////////////////// - ////1D domain decomposition - //std::vector<std::string> sendProcNeighbors; - //std::vector<std::string> recvProcNeighbors; - //for (int i = 0; i<para->getNumprocs();i++) - //{ - // sendProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "s.dat"); - // recvProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "r.dat"); - //} - //para->setPossNeighborFiles(sendProcNeighbors, "send"); - //para->setPossNeighborFiles(recvProcNeighbors, "recv"); - ////////////////////////////////////////////////////////////////////////// - //3D domain decomposition - std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ; - std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ; - for (int i = 0; i < para->getNumprocs(); i++) - { - sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat"); - sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat"); - sendProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zs.dat"); - recvProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xr.dat"); - recvProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Yr.dat"); - recvProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zr.dat"); - } - para->setPossNeighborFilesX(sendProcNeighborsX, "send"); - para->setPossNeighborFilesY(sendProcNeighborsY, "send"); - para->setPossNeighborFilesZ(sendProcNeighborsZ, "send"); - para->setPossNeighborFilesX(recvProcNeighborsX, "recv"); - para->setPossNeighborFilesY(recvProcNeighborsY, "recv"); - para->setPossNeighborFilesZ(recvProcNeighborsZ, "recv"); - } - ////////////////////////////////////////////////////////////////////////// - //para->setkFull( input->getValue( "kFull" )); - //para->setgeoFull( input->getValue( "geoFull" )); - //para->setnoSlipBcPos( input->getValue( "noSlipBcPos" )); - //para->setnoSlipBcQs( input->getValue( "noSlipBcQs" )); - //para->setnoSlipBcValues( input->getValue( "noSlipBcValues" )); - //para->setnoSlipBcValue( input->getValue( "noSlipBcValue" )); - //para->setslipBcPos( input->getValue( "slipBcPos" )); - //para->setslipBcQs( input->getValue( "slipBcQs" )); - //para->setslipBcValue( input->getValue( "slipBcValue" )); - //para->setpressBcPos( input->getValue( "pressBcPos" )); - //para->setpressBcQs( input->getValue( "pressBcQs" )); - //para->setpressBcValues( input->getValue( "pressBcValues" )); - //para->setpressBcValue( input->getValue( "pressBcValue" )); - //para->setvelBcQs( input->getValue( "velBcQs" )); - //para->setvelBcValues( input->getValue( "velBcValues" )); - //para->setpropellerCylinder( input->getValue( "propellerCylinder" )); - //para->setpropellerQs( input->getValue( "propellerQs" )); - //para->setwallBcQs( input->getValue( "wallBcQs" )); - //para->setwallBcValues( input->getValue( "wallBcValues" )); - //para->setperiodicBcQs( input->getValue( "periodicBcQs" )); - //para->setperiodicBcValues( input->getValue( "periodicBcValues" )); - //cout << "Try this: " << para->getgeomBoundaryBcValues() << endl; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Restart - para->setTimeDoCheckPoint(StringUtil::toInt(input->getValue("TimeDoCheckPoint"))); - para->setTimeDoRestart(StringUtil::toInt(input->getValue("TimeDoRestart"))); - para->setDoCheckPoint(StringUtil::toBool(input->getValue("DoCheckPoint"))); - para->setDoRestart(StringUtil::toBool(input->getValue("DoRestart"))); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->setMaxLevel(StringUtil::toInt(input->getValue("NOGL"))); - para->setGridX(StringUtil::toIntVector(input->getValue("GridX"))); - para->setGridY(StringUtil::toIntVector(input->getValue("GridY"))); - para->setGridZ(StringUtil::toIntVector(input->getValue("GridZ"))); - para->setDistX(StringUtil::toIntVector(input->getValue("DistX"))); - para->setDistY(StringUtil::toIntVector(input->getValue("DistY"))); - para->setDistZ(StringUtil::toIntVector(input->getValue("DistZ"))); - - para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true}); -} - - - -void multipleLevel(const std::string& configPath) -{ - auto gridFactory = GridFactory::make(); - gridFactory->setGridStrategy(Device::CPU); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - SPtr<Parameter> para = Parameter::make(); - SPtr<GridProvider> gridGenerator; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - bool useGridGenerator = true; - - if(useGridGenerator){ - - //const uint generatePart = 1; - const uint generatePart = Communicator::getInstanz()->getPID(); - - real dx = 1.0 / 20.0; - real vx = 0.05; - - auto triangularMesh = std::make_shared<TriangularMesh>("F:/Work/Computations/gridGenerator/stl/ShpereNotOptimal.stl"); - //auto triangularMesh = std::make_shared<TriangularMesh>("stl/ShpereNotOptimal.lnx.stl"); - - // all - //gridBuilder->addCoarseGrid(-2, -2, -2, - // 4, 2, 2, dx); - - real overlap = 10.0 * dx; - - gridBuilder->addCoarseGrid(-2.0, -2.0, -2.0, - 4.0, 2.0, 2.0, dx); - - - gridBuilder->setNumberOfLayers(10,8); - gridBuilder->addGrid(triangularMesh, 1); - - gridBuilder->addGeometry(triangularMesh); - - gridBuilder->setPeriodicBoundaryCondition(false, false, false); - - gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! - - ////////////////////////////////////////////////////////////////////////// - - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); - - gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); - gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); - - gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); - - bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); - bcFactory.setGeometryBoundaryCondition(BoundaryConditionFactory::NoSlipBC::NoSlipCompressible); - bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); - - ////////////////////////////////////////////////////////////////////////// - gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/Test_"); - //gridBuilder->writeArrows ("F:/Work/Computations/gridGenerator/grid/Test_Arrow"); - - //SimulationFileWriter::write("F:/Work/Computations/gridGenerator/grid/", gridBuilder, FILEFORMAT::ASCII); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - if(false) - { - - auto getParentIndex = [&] (uint index, uint level) -> uint - { - SPtr<Grid> grid = gridBuilder->getGrid( level ); - - if( level != 0 ) - { - real x, y, z; - grid->transIndexToCoords(index, x, y, z); - - SPtr<Grid> coarseGrid = gridBuilder->getGrid(level - 1); - - for (const auto dir : DistributionHelper::getDistribution27()) - { - if (std::abs(dir[0]) < 0.5 || std::abs(dir[1]) < 0.5 || std::abs(dir[2]) < 0.5) continue; - - real coarseX = x + dir[0] * 0.5 * grid->getDelta(); - real coarseY = y + dir[1] * 0.5 * grid->getDelta(); - real coarseZ = z + dir[2] * 0.5 * grid->getDelta(); - - // check if close enough to coarse grid coordinates - if( 0.01 * grid->getDelta() < std::abs( (coarseGrid->getStartX() - coarseX) / grid->getDelta() - - lround( (coarseGrid->getStartX() - coarseX) / grid->getDelta() ) ) ) continue; - if( 0.01 * grid->getDelta() < std::abs( (coarseGrid->getStartY() - coarseY) / grid->getDelta() - - lround( (coarseGrid->getStartY() - coarseY) / grid->getDelta() ) ) ) continue; - if( 0.01 * grid->getDelta() < std::abs( (coarseGrid->getStartZ() - coarseZ) / grid->getDelta() - - lround( (coarseGrid->getStartZ() - coarseZ) / grid->getDelta() ) ) ) continue; - - uint parentIndex = coarseGrid->transCoordToIndex( coarseX, coarseY, coarseZ); - - return parentIndex; - } - } - - return INVALID_INDEX; - }; - - - std::vector<idx_t> xadj; - std::vector<idx_t> adjncy; - - std::vector<idx_t> vwgt; - std::vector<idx_t> adjwgt; - - idx_t vertexCounter = 0; - uint edgeCounter = 0; - - std::cout << "Checkpoint 1:" << std::endl; - - std::vector< std::vector<idx_t> > vertexIndex( gridBuilder->getNumberOfLevels() ); - - std::vector< uint > startVerticesPerLevel;; - - for( uint level = 0; level < gridBuilder->getNumberOfLevels(); level++ ) - { - SPtr<Grid> grid = gridBuilder->getGrid( level ); - - vertexIndex[level].resize( grid->getSize() ); - - startVerticesPerLevel.push_back(vertexCounter); - - for (uint index = 0; index < grid->getSize(); index++) - { - if (grid->getSparseIndex(index) == INVALID_INDEX) - { - vertexIndex[level][index] = INVALID_INDEX; - continue; - } - - uint parentIndex = getParentIndex(index, level); - - if( parentIndex != INVALID_INDEX ) - { - SPtr<Grid> coarseGrid = gridBuilder->getGrid(level - 1); - - if( coarseGrid->getFieldEntry(parentIndex) == FLUID_CFC || - coarseGrid->getFieldEntry(parentIndex) == FLUID_FCC || - coarseGrid->getFieldEntry(parentIndex) == STOPPER_COARSE_UNDER_FINE ) - { - //vertexIndex[level][index] = INVALID_INDEX; - vertexIndex[level][index] = vertexIndex[level - 1][parentIndex]; - continue; - } - } - - vertexIndex[level][index] = vertexCounter; - - vwgt.push_back( std::pow(2, level) ); - //vwgt.push_back( std::pow(2, 2*level) ); - vertexCounter++; - } - - } - - ////////////////////////////////////////////////////////////////////////// - //for( uint level = 0; level < gridBuilder->getNumberOfLevels(); level++ ) - //{ - // SPtr<Grid> grid = gridBuilder->getGrid( level ); - - // for (uint index = 0; index < grid->getSize(); index++) - // { - // grid->setFieldEntry(index, vertexIndex[level][index] >= startVerticesPerLevel[level] && vertexIndex[level][index] != INVALID_INDEX); - // } - //} - - //gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/VertexIndex_"); - - //return; - ////////////////////////////////////////////////////////////////////////// - - - std::cout << "Checkpoint 2:" << std::endl; - - for( uint level = 0; level < gridBuilder->getNumberOfLevels(); level++ ) - { - SPtr<Grid> grid = gridBuilder->getGrid( level ); - - for (uint index = 0; index < grid->getSize(); index++) - { - //if (grid->getSparseIndex(index) == INVALID_INDEX) continue; - - if( vertexIndex[level][index] == INVALID_INDEX ) continue; - - if( vertexIndex[level][index] < startVerticesPerLevel[level] ) continue; - - xadj.push_back(edgeCounter); - - real x, y, z; - grid->transIndexToCoords(index, x, y, z); - - for (const auto dir : DistributionHelper::getDistribution27()) - { - const uint neighborIndex = grid->transCoordToIndex(x + dir[0] * grid->getDelta(), - y + dir[1] * grid->getDelta(), - z + dir[2] * grid->getDelta()); - - if (neighborIndex == INVALID_INDEX) continue; - - if (neighborIndex == index) continue; - - if( vertexIndex[level][neighborIndex] == INVALID_INDEX ) continue; - - adjncy.push_back( vertexIndex[level][neighborIndex] ); - adjwgt.push_back( std::pow(2, level) ); - - edgeCounter++; - } - - if( grid->getFieldEntry(index) == FLUID_CFC || - grid->getFieldEntry(index) == FLUID_FCC || - grid->getFieldEntry(index) == STOPPER_COARSE_UNDER_FINE ) - - { - SPtr<Grid> fineGrid = gridBuilder->getGrid(level + 1); - - for (const auto dir : DistributionHelper::getDistribution27()) - { - if (std::abs(dir[0]) < 0.5 || std::abs(dir[1]) < 0.5 || std::abs(dir[2]) < 0.5) continue; - - real fineX = x + dir[0] * 0.25 * grid->getDelta(); - real fineY = y + dir[1] * 0.25 * grid->getDelta(); - real fineZ = z + dir[2] * 0.25 * grid->getDelta(); - - uint childIndex = fineGrid->transCoordToIndex(fineX, fineY, fineZ); - - if( fineGrid->getFieldEntry(childIndex) == INVALID_INDEX ) continue; - if( vertexIndex[level + 1][childIndex] == INVALID_INDEX ) continue; - - for (const auto dir : DistributionHelper::getDistribution27()) - { - const uint neighborIndex = fineGrid->transCoordToIndex( fineX + dir[0] * fineGrid->getDelta(), - fineY + dir[1] * fineGrid->getDelta(), - fineZ + dir[2] * fineGrid->getDelta() ); - - if(neighborIndex == INVALID_INDEX) continue; - - if (neighborIndex == childIndex) continue; - - if( vertexIndex[level + 1][neighborIndex] == INVALID_INDEX ) continue; - - adjncy.push_back( vertexIndex[level + 1][neighborIndex] ); - adjwgt.push_back( std::pow(2, level) ); - - edgeCounter++; - } - } - } - } - } - - xadj.push_back( edgeCounter ); - - std::cout << "Checkpoint 3:" << std::endl; - - idx_t nWeights = 1; - idx_t nParts = 4; - idx_t objval = 0; - - std::vector<idx_t> part( vertexCounter ); - - std::cout << vertexCounter << std::endl; - std::cout << edgeCounter << std::endl; - std::cout << xadj.size() << std::endl; - std::cout << adjncy.size() << std::endl; - - //int ret = METIS_PartGraphRecursive(&vertexCounter, &nWeights, xadj.data(), adjncy.data(), - // vwgt.data(), NULL, adjwgt.data(), &nParts, - // NULL, NULL, NULL, &objval, part.data()); - - int ret = METIS_PartGraphKway(&vertexCounter, &nWeights, xadj.data(), adjncy.data(), - vwgt.data(), NULL, NULL/*adjwgt.data()*/, &nParts, - NULL, NULL, NULL, &objval, part.data()); - - std::cout << "objval:" << objval << std::endl; - - std::cout << "Checkpoint 4:" << std::endl; - - //uint partCounter = 0; - - for( uint level = 0; level < gridBuilder->getNumberOfLevels(); level++ ) - { - SPtr<Grid> grid = gridBuilder->getGrid( level ); - - for (uint index = 0; index < grid->getSize(); index++) - { - if (grid->getSparseIndex(index) == INVALID_INDEX) continue; - - grid->setFieldEntry(index, part[vertexIndex[level][index]]); - - //partCounter++; - } - } - - std::cout << "Checkpoint 5:" << std::endl; - - gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/Partition_"); - - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - { - - for( int level = gridBuilder->getNumberOfLevels()-1; level >= 0 ; level-- ) - { - std::vector< std::vector<idx_t> > vertexIndex( gridBuilder->getNumberOfLevels() ); - - std::vector<idx_t> xadj; - std::vector<idx_t> adjncy; - - std::vector<idx_t> vwgt; - std::vector<idx_t> adjwgt; - - idx_t vertexCounter = 0; - uint edgeCounter = 0; - - SPtr<Grid> grid = gridBuilder->getGrid( level ); - - vertexIndex[level].resize( grid->getSize() ); - - for (uint index = 0; index < grid->getSize(); index++) - { - if (grid->getSparseIndex(index) == INVALID_INDEX) - { - vertexIndex[level][index] = INVALID_INDEX; - continue; - } - - vertexIndex[level][index] = vertexCounter; - - vwgt.push_back( std::pow(2, level) ); - //vwgt.push_back( std::pow(2, 2*level) ); - vertexCounter++; - } - - for (uint index = 0; index < grid->getSize(); index++) - { - //if (grid->getSparseIndex(index) == INVALID_INDEX) continue; - - if( vertexIndex[level][index] == INVALID_INDEX ) continue; - - xadj.push_back(edgeCounter); - - real x, y, z; - grid->transIndexToCoords(index, x, y, z); - - for (const auto dir : DistributionHelper::getDistribution27()) - { - const uint neighborIndex = grid->transCoordToIndex(x + dir[0] * grid->getDelta(), - y + dir[1] * grid->getDelta(), - z + dir[2] * grid->getDelta()); - - if (neighborIndex == INVALID_INDEX) continue; - - if (neighborIndex == index) continue; - - if( vertexIndex[level][neighborIndex] == INVALID_INDEX ) continue; - - adjncy.push_back( vertexIndex[level][neighborIndex] ); - adjwgt.push_back( std::pow(2, level) ); - - edgeCounter++; - } - } - - xadj.push_back( edgeCounter ); - - std::cout << "Checkpoint 3:" << std::endl; - - idx_t nWeights = 1; - idx_t nParts = 4; - idx_t objval = 0; - - std::vector<idx_t> part( vertexCounter ); - - std::cout << vertexCounter << std::endl; - std::cout << edgeCounter << std::endl; - std::cout << xadj.size() << std::endl; - std::cout << adjncy.size() << std::endl; - - int ret = METIS_PartGraphRecursive(&vertexCounter, &nWeights, xadj.data(), adjncy.data(), - NULL/*vwgt.data()*/, NULL, NULL/*adjwgt.data()*/, &nParts, - NULL, NULL, NULL, &objval, part.data()); - - //int ret = METIS_PartGraphKway(&vertexCounter, &nWeights, xadj.data(), adjncy.data(), - // NULL/*vwgt.data()*/, NULL, NULL/*adjwgt.data()*/, &nParts, - // NULL, NULL, NULL, &objval, part.data()); - - std::cout << "objval:" << objval << std::endl; - - std::cout << "Checkpoint 4:" << std::endl; - - for (uint index = 0; index < grid->getSize(); index++) - { - if (vertexIndex[level][index] == INVALID_INDEX) continue; - - if( grid->getFieldEntry(index) == FLUID_CFC || - grid->getFieldEntry(index) == FLUID_FCC || - grid->getFieldEntry(index) == STOPPER_COARSE_UNDER_FINE ) - { - SPtr<Grid> fineGrid = gridBuilder->getGrid(level+1); - - real x, y, z; - grid->transIndexToCoords(index, x, y, z); - - for (const auto dir : DistributionHelper::getDistribution27()) - { - if (std::abs(dir[0]) < 0.5 || std::abs(dir[1]) < 0.5 || std::abs(dir[2]) < 0.5) continue; - - real fineX = x + dir[0] * 0.25 * grid->getDelta(); - real fineY = y + dir[1] * 0.25 * grid->getDelta(); - real fineZ = z + dir[2] * 0.25 * grid->getDelta(); - - uint childIndex = fineGrid->transCoordToIndex(fineX, fineY, fineZ); - - if( childIndex == INVALID_INDEX ) continue; - - fineGrid->setFieldEntry(childIndex, part[vertexIndex[level][index]]); - //fineGrid->setFieldEntry(childIndex, grid->getFieldEntry(index)); - } - } - - grid->setFieldEntry(index, part[vertexIndex[level][index]]); - } - } - - gridBuilder->writeGridsToVtk("F:/Work/Computations/gridGenerator/grid/Partition_"); - - } - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - return; - - gridGenerator = GridGenerator::make(gridBuilder, para); - } - else - { - gridGenerator = GridReader::make(FileFormat::BINARY, para); - //gridGenerator = GridReader::make(FileFormat::ASCII, para); - } - - logFile.close(); - - //return; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - std::ifstream stream; - stream.open(configPath.c_str(), std::ios::in); - if (stream.fail()) - throw std::runtime_error("can not open config file!"); - - UPtr<input::Input> input = input::Input::makeInput(stream, "config"); - - setParameters(para, input); - - Simulation sim; - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); - sim.init(para, gridGenerator, fileWriter); - sim.run(); -} - - -int main( int argc, char* argv[]) -{ - MPI_Init(&argc, &argv); - std::string str, str2; - if ( argv != NULL ) - { - str = static_cast<std::string>(argv[0]); - if (argc > 1) - { - str2 = static_cast<std::string>(argv[1]); - try - { - multipleLevel(str2); - } - catch (const std::exception& e) - { - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (...) - { - std::cout << "unknown exeption" << std::endl; - } - } - else - { - try - { - multipleLevel("F:/Work/Computations/gridGenerator/inp/configTest.txt"); - } - catch (const std::exception& e) - { - std::cout << e.what() << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (const std::bad_alloc e) - { - std::cout << e.what() << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - catch (...) - { - std::cout << "unknown exeption" << std::endl; - } - - std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; - //MPI_Abort(MPI_COMM_WORLD, -1); - } - } - - - /* - MPE_Init_log() & MPE_Finish_log() are NOT needed when - liblmpe.a is linked with this program. In that case, - MPI_Init() would have called MPE_Init_log() already. - */ -#if defined( MPI_LOGGING ) - MPE_Init_log(); -#endif - -#if defined( MPI_LOGGING ) - if ( argv != NULL ) - MPE_Finish_log( argv[0] ); - if ( str != "" ) - MPE_Finish_log( str.c_str() ); - else - MPE_Finish_log( "TestLog" ); -#endif - - MPI_Finalize(); - return 0; -} diff --git a/apps/gpu/MusselOyster/CMakeLists.txt b/apps/gpu/MusselOyster/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..966c802b233fd333c7e7b44a57c7f4177b419ca3 --- /dev/null +++ b/apps/gpu/MusselOyster/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(MusselOyster LANGUAGES CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES MusselOyster.cpp) diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/MusselOyster/MusselOyster.cpp similarity index 96% rename from apps/gpu/LBM/MusselOyster/MusselOyster.cpp rename to apps/gpu/MusselOyster/MusselOyster.cpp index 1cff9cf2675fbe9d42f4765c6c9e1bcea4bd7065..191a960fc1cf54d9bd74689d4d59b211220262c2 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/MusselOyster/MusselOyster.cpp @@ -25,7 +25,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "geometries/Sphere/Sphere.h" #include "geometries/TriangularMesh/TriangularMesh.h" @@ -37,7 +36,6 @@ ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" @@ -51,6 +49,7 @@ ////////////////////////////////////////////////////////////////////////// #include "utilities/communication.h" +#include <parallel/MPICommunicator.h> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -86,14 +85,12 @@ const std::string simulationName("MusselOyster"); void runVirtualFluids(const vf::basics::ConfigurationFile& config) { - vf::gpu::Communicator &communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); SPtr<Parameter> para = - std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -151,7 +148,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) std::cout << "Write result files to " << para->getFName() << std::endl; para->setUseStreams(useStreams); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -191,12 +188,12 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) bivalveRef_1_STL = std::make_shared<TriangularMesh>(stlPath + bivalveType + "_Level1.stl"); if (para->getNumprocs() > 1) { - const uint generatePart = vf::gpu::MpiCommunicator::getInstance().getPID(); + const uint generatePart = communicator.getProcessID(); real overlap = (real)8.0 * dxGrid; gridBuilder->setNumberOfLayers(10, 8); - if (communicator.getNumberOfProcess() == 2) { + if (communicator.getNumberOfProcesses() == 2) { const real zSplit = 0.0; // round(((double)bbzp + bbzm) * 0.5); if (generatePart == 0) { @@ -247,7 +244,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 4) { + } else if (communicator.getNumberOfProcesses() == 4) { const real xSplit = 100.0; const real zSplit = 0.0; @@ -337,7 +334,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs } ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 8) { + } else if (communicator.getNumberOfProcesses() == 8) { real xSplit = 140.0; // 100.0 // mit groesserem Level 1 140.0 real ySplit = 32.0; // 32.0 real zSplit = 0.0; @@ -577,14 +574,11 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) int main(int argc, char *argv[]) { - MPI_Init(&argc, &argv); - std::string str, str2, configFile; - - if (argv != NULL) { + if (argc > 1) { try { VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); - vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/MusselOyster/configMusselOyster.txt"); + vf::basics::ConfigurationFile config = vf::basics::loadConfig(argc, argv, "./apps/gpu/MusselOyster/configMusselOyster.txt"); runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// @@ -598,7 +592,5 @@ int main(int argc, char *argv[]) VF_LOG_CRITICAL("Unknown exception!"); } } - - MPI_Finalize(); return 0; } diff --git a/apps/gpu/LBM/MusselOyster/configMusselOyster.txt b/apps/gpu/MusselOyster/configMusselOyster.txt similarity index 81% rename from apps/gpu/LBM/MusselOyster/configMusselOyster.txt rename to apps/gpu/MusselOyster/configMusselOyster.txt index 3d64ef74215db49adfdee6ba569fccb462b98d73..f3536cebd4b669a854b9ad640501f119e3020ceb 100644 --- a/apps/gpu/LBM/MusselOyster/configMusselOyster.txt +++ b/apps/gpu/MusselOyster/configMusselOyster.txt @@ -1,15 +1,15 @@ # Tesla 03 -# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/MusselOyster.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/LBM/MusselOyster/configMusselOyster.txt" +# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/MusselOyster.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/MusselOyster/configMusselOyster.txt" # Phoenix -# mpirun -np 2 "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/MusselOyster/configMusselOyster.txt" +# mpirun -np 2 "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/MusselOyster/configMusselOyster.txt" # Phoenix mpich -# mpirun -np 4 nvprof -f -o MusselOyster.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# mpirun -np 4 nvprof -f -o MusselOyster.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/SphereScaling/configPhoenix4GPU.txt" # Phoenix openmpi -# mpirun -np 4 nvprof -f -o MusselOyster.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# mpirun -np 4 nvprof -f -o MusselOyster.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/MusselOyster" "./VirtualFluids_dev/apps/gpu/SphereScaling/configPhoenix4GPU.txt" # Aragorn - ./bin/MusselOyster "../apps/gpu/LBM/MusselOyster/configMusselOyster.txt" + ./bin/MusselOyster "../apps/gpu/MusselOyster/configMusselOyster.txt" ################################################## #GPU Mapping @@ -40,7 +40,7 @@ GridPath=./output/MusselOysterResults/grid/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt b/apps/gpu/MusselOyster/configPhoenix1GPU.txt similarity index 96% rename from apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt rename to apps/gpu/MusselOyster/configPhoenix1GPU.txt index 369d68be327f72ef3762a2ddaf31ff89b84e06c7..0f48e6f2cf60369aaf5a1e9116dcc8ffdda84297 100644 --- a/apps/gpu/LBM/MusselOyster/configPhoenix1GPU.txt +++ b/apps/gpu/MusselOyster/configPhoenix1GPU.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridMusselOyster/Mussel1GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt b/apps/gpu/MusselOyster/configPhoenix8GPU.txt similarity index 96% rename from apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt rename to apps/gpu/MusselOyster/configPhoenix8GPU.txt index 2bf6955062da5c98f6a7b931c19821c52eaf15ea..97b1125a788b79fe4ebef5ed67abb65b6fbbfbfc 100644 --- a/apps/gpu/LBM/MusselOyster/configPhoenix8GPU.txt +++ b/apps/gpu/MusselOyster/configPhoenix8GPU.txt @@ -26,7 +26,7 @@ NumberOfDevices=4 #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/SphereGPU/CMakeLists.txt b/apps/gpu/SphereGPU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a162d6d200e4c0e533764b8f9927314b1f28ee9 --- /dev/null +++ b/apps/gpu/SphereGPU/CMakeLists.txt @@ -0,0 +1,3 @@ +PROJECT(SphereGPU LANGUAGES CXX) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES Sphere.cpp) diff --git a/apps/gpu/LBM/SphereGPU/Sphere.cpp b/apps/gpu/SphereGPU/Sphere.cpp similarity index 91% rename from apps/gpu/LBM/SphereGPU/Sphere.cpp rename to apps/gpu/SphereGPU/Sphere.cpp index f70188bbd81a22088affbbc45d43dafdd418fe46..3a5de66b576aaaa6999f2ca1a38f43553d86301d 100644 --- a/apps/gpu/LBM/SphereGPU/Sphere.cpp +++ b/apps/gpu/SphereGPU/Sphere.cpp @@ -41,18 +41,19 @@ #include <string> ////////////////////////////////////////////////////////////////////////// +#include <basics/DataTypes.h> +#include <basics/PointerDefinitions.h> +#include <basics/config/ConfigurationFile.h> -#include "DataTypes.h" #include <logger/Logger.h> -#include "PointerDefinitions.h" -#include "config/ConfigurationFile.h" + +#include <parallel/MPICommunicator.h> ////////////////////////////////////////////////////////////////////////// #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "GridGenerator/geometries/Sphere/Sphere.h" #include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h" @@ -62,7 +63,6 @@ #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" @@ -70,8 +70,7 @@ #include "VirtualFluids_GPU/Factories/GridScalingFactory.h" #include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h" #include "VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.h" - -////////////////////////////////////////////////////////////////////////// +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" int main(int argc, char *argv[]) { @@ -79,7 +78,6 @@ int main(int argc, char *argv[]) ////////////////////////////////////////////////////////////////////////// // Simulation parameters ////////////////////////////////////////////////////////////////////////// - const bool useConfigFile = true; const real L = 1.0; @@ -94,32 +92,25 @@ int main(int argc, char *argv[]) ////////////////////////////////////////////////////////////////////////// // setup simulation parameters (with or without config file) - ////////////////////////// + ////////////////////////////////////////////////////////////////////////// - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance();; SPtr<Parameter> para; BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); vf::basics::ConfigurationFile config; if (useConfigFile) { VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); - vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/SphereGPU/config.txt"); + config = vf::basics::loadConfig(argc, argv, "./apps/gpu/SphereGPU/config.txt"); para = std::make_shared<Parameter>(&config); } else { para = std::make_shared<Parameter>(); } - ////////////////////////////////////////////////////////////////////////// - // setup gridGenerator - ////////////////////////////////////////////////////////////////////////// - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); ////////////////////////////////////////////////////////////////////////// // create grid ////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); real dx = L / real(nx); gridBuilder->addCoarseGrid(-1.0 * L, -0.6 * L, -0.6 * L, @@ -129,7 +120,7 @@ int main(int argc, char *argv[]) // auto sphere = std::make_shared<Sphere>(0.0, 0.0, 0.0, dSphere / 2.0); // use stl - std::string stlPath = "./apps/gpu/LBM/SphereGPU/sphere02.stl"; + std::string stlPath = "./apps/gpu/SphereGPU/sphere02.stl"; if (useConfigFile && config.contains("STLPath")) { stlPath = config.getValue<std::string>("STLPath"); } @@ -180,6 +171,8 @@ int main(int argc, char *argv[]) para->setTimestepOut(timeStepOut); para->setTimestepEnd(timeStepEnd); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); + ////////////////////////////////////////////////////////////////////////// // set boundary conditions ////////////////////////////////////////////////////////////////////////// @@ -207,7 +200,7 @@ int main(int argc, char *argv[]) const uint tAveraging = 100; const uint tStartOutProbe = 0; const uint tOutProbe = para->getTimestepOut(); - SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>( "pointProbe", para->getOutputPath(), tStartAveraging, tAveraging, tStartOutProbe, tOutProbe); + SPtr<PointProbe> pointProbe = std::make_shared<PointProbe>("pointProbe", para->getOutputPath(), tStartAveraging, tAveraging, tStartOutProbe, tOutProbe); std::vector<real> probeCoordsX = {0.3, 0.5}; std::vector<real> probeCoordsY = {0.0, 0.0}; std::vector<real> probeCoordsZ = {0.0, 0.0}; @@ -226,7 +219,7 @@ int main(int argc, char *argv[]) ////////////////////////////////////////////////////////////////////////// // setup to copy mesh to simulation ////////////////////////////////////////////////////////////////////////// - + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); SPtr<GridProvider> gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); diff --git a/apps/gpu/LBM/SphereGPU/config.txt b/apps/gpu/SphereGPU/config.txt similarity index 100% rename from apps/gpu/LBM/SphereGPU/config.txt rename to apps/gpu/SphereGPU/config.txt diff --git a/apps/gpu/LBM/SphereGPU/sphere02.stl b/apps/gpu/SphereGPU/sphere02.stl similarity index 100% rename from apps/gpu/LBM/SphereGPU/sphere02.stl rename to apps/gpu/SphereGPU/sphere02.stl diff --git a/apps/gpu/SphereRefined/CMakeLists.txt b/apps/gpu/SphereRefined/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..87432021ba02e7b56b5dabade18e98d7978bce46 --- /dev/null +++ b/apps/gpu/SphereRefined/CMakeLists.txt @@ -0,0 +1,9 @@ +PROJECT(SphereRefined LANGUAGES CUDA CXX) + +#LIST(APPEND CS_COMPILER_FLAGS_CXX "-DOMPI_SKIP_MPICXX" ) + +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES SphereRefined.cpp) + +set_source_files_properties(SphereRefined.cpp PROPERTIES LANGUAGE CUDA) + +set_target_properties(SphereRefined PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/apps/gpu/SphereRefined/SphereRefined.cpp b/apps/gpu/SphereRefined/SphereRefined.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2aae0b4eb19a48e5486c908e80f257aaf463a97d --- /dev/null +++ b/apps/gpu/SphereRefined/SphereRefined.cpp @@ -0,0 +1,223 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file SphereRefined.cpp +//! \ingroup Applications +//! \author Martin Schoenherr +//======================================================================================= +#define _USE_MATH_DEFINES +#include <exception> +#include <fstream> +#include <iostream> +#include <memory> +#include <sstream> +#include <stdexcept> +#include <string> + +////////////////////////////////////////////////////////////////////////// + +#include "DataTypes.h" +#include "PointerDefinitions.h" + +#include <logger/Logger.h> + +////////////////////////////////////////////////////////////////////////// + +#include "GridGenerator/grid/BoundaryConditions/Side.h" +#include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" +#include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "GridGenerator/grid/GridFactory.h" +#include "GridGenerator/geometries/Cuboid/Cuboid.h" +#include "GridGenerator/geometries/Sphere/Sphere.h" +#include "GridGenerator/geometries/TriangularMesh/TriangularMesh.h" + +////////////////////////////////////////////////////////////////////////// + +#include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" +#include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" +#include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" +#include "VirtualFluids_GPU/LBM/Simulation.h" +#include "VirtualFluids_GPU/Output/FileWriter.h" +#include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Factories/GridScalingFactory.h" +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" + +#include <parallel/MPICommunicator.h> + +////////////////////////////////////////////////////////////////////////// + +int main() +{ + try { + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); + vf::logging::Logger::initializeLogger(); + ////////////////////////////////////////////////////////////////////////// + // Simulation parameters + ////////////////////////////////////////////////////////////////////////// + std::string path("output/SphereRefined"); + std::string simulationName("SphereRefined"); + + const real L = 1.0; + const real dSphere = 0.2; + const real Re = 300.0; + const real velocity = 1.0; + const real velocityLB = (real)0.5e-2; // LB units + const uint nx = 50; + + const uint timeStepOut = 10000; + const uint timeStepEnd = 10000; + + ////////////////////////////////////////////////////////////////////////// + // compute parameters in lattice units + ////////////////////////////////////////////////////////////////////////// + + const real dx = L / real(nx); + const real dt = velocityLB / velocity * dx; + + const real viscosityLB = nx * velocityLB / Re; // LB units + + ////////////////////////////////////////////////////////////////////////// + // create grid + ////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); + + gridBuilder->addCoarseGrid(-1.0 * L, -0.6 * L, -0.6 * L, + 2.0 * L, 0.6 * L, 0.6 * L, dx); + + // add fine grid + gridBuilder->addGrid(std::make_shared<Sphere>(0., 0., 0., 0.22), 2); + + GridScalingFactory scalingFactory = GridScalingFactory(); + scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible); + + // use primitive + auto sphere = std::make_shared<Sphere>(0.0, 0.0, 0.0, dSphere / 2.0); + + gridBuilder->addGeometry(sphere); + + gridBuilder->setPeriodicBoundaryCondition(false, false, false); + + gridBuilder->buildGrids(false); + + ////////////////////////////////////////////////////////////////////////// + // set parameters + ////////////////////////////////////////////////////////////////////////// + SPtr<Parameter> para = std::make_shared<Parameter>(); + + para->setOutputPath(path); + para->setOutputPrefix(simulationName); + + para->setPrintFiles(true); + + para->setVelocityLB(velocityLB); + para->setViscosityLB(viscosityLB); + + para->setVelocityRatio(velocity / velocityLB); + para->setDensityRatio(1.0); + + para->setTimestepOut(timeStepOut); + para->setTimestepEnd(timeStepEnd); + + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); + + ////////////////////////////////////////////////////////////////////////// + // set boundary conditions + ////////////////////////////////////////////////////////////////////////// + + gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MX, velocityLB, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::PY, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::MY, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::MZ, 0.0, 0.0, 0.0); + gridBuilder->setSlipBoundaryCondition(SideType::PZ, 0.0, 0.0, 0.0); + + gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); + + BoundaryConditionFactory bcFactory; + + bcFactory.setSlipBoundaryCondition(BoundaryConditionFactory::SlipBC::SlipCompressible); + bcFactory.setVelocityBoundaryCondition(BoundaryConditionFactory::VelocityBC::VelocityCompressible); + bcFactory.setPressureBoundaryCondition(BoundaryConditionFactory::PressureBC::PressureNonEquilibriumCompressible); + + + ////////////////////////////////////////////////////////////////////////// + // set copy mesh to simulation + ////////////////////////////////////////////////////////////////////////// + + + auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); + SPtr<GridProvider> gridGenerator = + GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + + + ////////////////////////////////////////////////////////////////////////// + // run simulation + ////////////////////////////////////////////////////////////////////////// + + VF_LOG_INFO("Start Running DrivenCavity Showcase..."); + printf("\n"); + VF_LOG_INFO("world parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("dt [s] = {}", dt); + VF_LOG_INFO("world_length [m] = {}", L); + VF_LOG_INFO("world_velocity [m/s] = {}", velocity); + VF_LOG_INFO("dx [m] = {}", dx); + printf("\n"); + VF_LOG_INFO("LB parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("Re = {}", Re); + VF_LOG_INFO("lb_velocity [dx/dt] = {}", velocityLB); + VF_LOG_INFO("lb_viscosity [dx^2/dt] = {}", viscosityLB); + printf("\n"); + VF_LOG_INFO("simulation parameter:"); + VF_LOG_INFO("--------------"); + VF_LOG_INFO("nx = {}", nx); + VF_LOG_INFO("ny = {}", nx); + VF_LOG_INFO("nz = {}", nx); + VF_LOG_INFO("number of nodes = {}", nx * nx * nx); + VF_LOG_INFO("n timesteps = {}", timeStepOut); + VF_LOG_INFO("write_nth_timestep = {}", timeStepEnd); + VF_LOG_INFO("output_path = {}", path); + + Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory, &scalingFactory); + sim.run(); + + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); + } + + return 0; +} diff --git a/apps/gpu/SphereRefined/configSphere.txt b/apps/gpu/SphereRefined/configSphere.txt new file mode 100644 index 0000000000000000000000000000000000000000..458346a67c7f001580494af1dc9262034613be68 --- /dev/null +++ b/apps/gpu/SphereRefined/configSphere.txt @@ -0,0 +1,34 @@ +################################################## +#GPU Mapping +################################################## +#Devices="0 1 2 3" +#NumberOfDevices=4 + +################################################## +#informations for Writing +################################################## +#Path = "output/" +#Prefix="DrivenCavity" +#WriteGrid=true +################################################## +#informations for reading +################################################## +#GridPath="grid/" + +################################################## +#number of grid levels +################################################## +#NOGL=1 + +################################################## +#LBM Version +################################################## +#D3Qxx=27 +#MainKernelName=CumulantAA2016CompSP27 + +################################################## +#simulation parameter +################################################## +#TimeEnd=100000 +#TimeOut=1000 +#TimeStartOut=0 \ No newline at end of file diff --git a/apps/gpu/SphereRefined/sphere02.stl b/apps/gpu/SphereRefined/sphere02.stl new file mode 100644 index 0000000000000000000000000000000000000000..3ff142d1a343b2e1016b75e65dde821d7a1f8e5a --- /dev/null +++ b/apps/gpu/SphereRefined/sphere02.stl @@ -0,0 +1,3138 @@ +solid Visualization Toolkit generated SLA File + facet normal 0.10450589731384756 0.020787518098262223 0.9943069930951618 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.088595824750780858 0.059197831240794162 0.99430699314302085 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.059197831240794162 0.088595824750780858 0.99430699314302085 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.020787518098262226 0.10450589731384755 0.9943069930951618 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.020787518098262219 0.10450589731384756 0.9943069930951618 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.059197831240794162 0.088595824750780858 0.99430699314302085 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.088595824750780858 0.059197831240794162 0.99430699314302085 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.10450589731384755 0.020787518098262226 0.9943069930951618 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.10450589731384756 -0.020787518098262219 0.9943069930951618 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.088595824750780858 -0.059197831240794162 0.99430699314302085 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.059197831240794162 -0.088595824750780858 0.99430699314302085 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal -0.020787518098262233 -0.10450589731384756 0.9943069930951618 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.020787518098262216 -0.10450589731384756 0.9943069930951618 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.059197831240794162 -0.088595824750780858 0.99430699314302085 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.088595824750780858 -0.059197831240794162 0.99430699314302085 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.10450589731384756 -0.020787518098262223 0.9943069930951618 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0 0 0.10000000149011612 + endloop + endfacet + facet normal 0.10450589731384756 0.020787518098262223 -0.9943069930951618 + outer loop + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.088595824750780858 0.059197831240794162 -0.99430699314302085 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.059197831240794162 0.088595824750780858 -0.99430699314302085 + outer loop + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.020787518098262226 0.10450589731384755 -0.9943069930951618 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal -0.020787518098262219 0.10450589731384756 -0.9943069930951618 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.059197831240794162 0.088595824750780858 -0.99430699314302085 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.088595824750780858 0.059197831240794162 -0.99430699314302085 + outer loop + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.10450589731384755 0.02078751809826223 -0.9943069930951618 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + endloop + endfacet + facet normal -0.10450589731384756 -0.020787518098262216 -0.9943069930951618 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.088595824750780858 -0.059197831240794162 -0.99430699314302085 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.059197831240794162 -0.088595824750780858 -0.99430699314302085 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.020787518098262233 -0.10450589731384756 -0.9943069930951618 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal 0.020787518098262212 -0.10450589731384755 -0.9943069930951618 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.059197831240794162 -0.088595824750780858 -0.99430699314302085 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.088595824750780858 -0.059197831240794162 -0.99430699314302085 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.10450589731384756 -0.020787518098262223 -0.9943069930951618 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0 0 -0.10000000149011612 + vertex 0.020791169255971909 0 -0.097814761102199554 + endloop + endfacet + facet normal 0.30843476522401231 0.061351521400747594 0.94926497166124379 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.30843478276930947 0.061351500668862545 0.94926496730034626 + outer loop + vertex 0.020791169255971909 0 0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal 0.49754554609711599 0.098967962699230083 0.86177361987826373 + outer loop + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.49754549605911413 0.098968004229828863 0.86177364399826861 + outer loop + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.6632812473204962 0.13193484346784404 0.7366486163918875 + outer loop + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.66328124731730775 0.13193484347015969 0.73664861639434354 + outer loop + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.79874089113149127 0.15887934482690994 0.58031917306068981 + outer loop + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.79874079057134661 0.15887942196636892 0.58031929035065921 + outer loop + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.89882617438269374 0.17878756470117699 0.40018310178316374 + outer loop + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.89882620092364052 0.17878753861432078 0.40018305382588132 + outer loop + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.96014288401665793 0.19098433051579031 0.20408485433664575 + outer loop + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.96014294936226929 0.19098422428494741 0.20408464632156809 + outer loop + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.98078527328214282 0.19509035781625048 -0 + outer loop + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.98078527328214282 0.19509035781625048 -0 + outer loop + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.96014290587992079 0.19098421563577428 -0.20408485898382991 + outer loop + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.96014292559861558 0.1909843387869575 -0.2040846509687585 + outer loop + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.89882617942320453 0.17878753433762079 -0.40018310402734325 + outer loop + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.89882619396083974 0.17878756859551068 -0.40018305607006494 + outer loop + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.79874087880382028 0.15887943951689917 -0.58031916410411333 + outer loop + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.7987408154183383 0.1588793297666366 -0.58031928139408939 + outer loop + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.66328124732023808 0.13193484347074255 -0.73664861639160084 + outer loop + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.66328124731817861 0.13193484346738305 -0.73664861639405699 + outer loop + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.49754554356199898 0.098968013678745081 -0.86177361548731513 + outer loop + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.49754551322598684 0.098967956160755946 -0.86177363960732289 + outer loop + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.30843476568236111 0.061351497270056753 -0.94926497307189694 + outer loop + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.3084347739583525 0.061351523138116801 -0.94926496871099864 + outer loop + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.26147837970812587 0.17471428421919066 0.9492649660842799 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.26147840938106925 0.17471426893077599 0.9492649607246284 + outer loop + vertex 0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal 0.42179874557711361 0.28183684066621417 0.86177364398829248 + outer loop + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.42179864590164712 0.28183687150574754 0.86177368268901633 + outer loop + vertex 0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.56230267786378618 0.37571865044532143 0.73664862327622749 + outer loop + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.56230279592432497 0.37571862212216495 0.73664854760347465 + outer loop + vertex 0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.67713972638750908 0.45245040321610314 0.5803192428116053 + outer loop + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.67713981980897864 0.4524503781983546 0.58031915330896144 + outer loop + vertex 0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.76198801003014671 0.50914415869095786 0.40018308090319588 + outer loop + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.76198794657394719 0.50914418433618069 0.40018316910218049 + outer loop + vertex 0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.81396988974665174 0.54387724854201425 0.20408468120903095 + outer loop + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.81396982149820041 0.54387729795136042 0.20408482173673517 + outer loop + vertex 0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.83146963292153175 0.55557020216110709 -0 + outer loop + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.83146963292153175 0.55557020216110709 -0 + outer loop + vertex 0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.81396984640124925 0.54387731459104727 -0.20408467806956454 + outer loop + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.81396986593198373 0.54387723262956311 -0.20408481859726049 + outer loop + vertex 0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.76198798009585644 0.50914420673480953 -0.40018307677589038 + outer loop + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.76198797950532793 0.509144138294924 -0.40018316497487411 + outer loop + vertex 0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.67713976273003673 0.45245034005942358 -0.58031924964628023 + outer loop + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.67713977536749692 0.45245043594349216 -0.58031916014362273 + outer loop + vertex 0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.56230271938745569 0.37571857098187661 -0.7366486321095076 + outer loop + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.56230273840009004 0.37571869089438792 -0.73664855643676341 + outer loop + vertex 0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.42179871051676798 0.28183691468019506 -0.86177363694298537 + outer loop + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.42179870086462851 0.28183681079029427 -0.86177367564370844 + outer loop + vertex 0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.26147839157789088 0.17471425703507376 -0.94926496781800662 + outer loop + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.26147838880858149 0.17471429029992128 -0.94926496245835557 + outer loop + vertex 0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.17471429029992128 0.26147838880858149 0.94926496245835557 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.17471425703507376 0.26147839157789088 0.94926496781800662 + outer loop + vertex 0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal 0.28183681079029427 0.42179870086462851 0.86177367564370844 + outer loop + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.28183691468019506 0.42179871051676798 0.86177363694298537 + outer loop + vertex 0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.37571869089438792 0.56230273840009004 0.73664855643676341 + outer loop + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.37571857098187661 0.56230271938745569 0.7366486321095076 + outer loop + vertex 0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.45245043594349216 0.67713977536749692 0.58031916014362273 + outer loop + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.45245034005942358 0.67713976273003673 0.58031924964628023 + outer loop + vertex 0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.509144138294924 0.76198797950532793 0.40018316497487411 + outer loop + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.50914420673480953 0.76198798009585644 0.40018307677589038 + outer loop + vertex 0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.54387723262956311 0.81396986593198373 0.20408481859726049 + outer loop + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.54387731459104727 0.81396984640124925 0.20408467806956454 + outer loop + vertex 0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.55557020216110709 0.83146963292153175 -0 + outer loop + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.55557020216110709 0.83146963292153175 -0 + outer loop + vertex 0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.54387729795136042 0.81396982149820041 -0.20408482173673517 + outer loop + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.54387724854201425 0.81396988974665174 -0.20408468120903095 + outer loop + vertex 0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.50914418433618069 0.76198794657394719 -0.40018316910218049 + outer loop + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.50914415869095786 0.76198801003014671 -0.40018308090319588 + outer loop + vertex 0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.4524503781983546 0.67713981980897864 -0.58031915330896144 + outer loop + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.45245040321610314 0.67713972638750908 -0.5803192428116053 + outer loop + vertex 0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.37571862212216495 0.56230279592432497 -0.73664854760347465 + outer loop + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.37571865044532143 0.56230267786378618 -0.73664862327622749 + outer loop + vertex 0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.28183687150574754 0.42179864590164712 -0.86177368268901633 + outer loop + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.28183684066621417 0.42179874557711361 -0.86177364398829248 + outer loop + vertex 0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.17471426893077599 0.26147840938106925 -0.9492649607246284 + outer loop + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.17471428421919066 0.26147837970812587 -0.9492649660842799 + outer loop + vertex 0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.061351523138116808 0.3084347739583525 0.94926496871099864 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal 0.061351497270056753 0.30843476568236106 0.94926497307189694 + outer loop + vertex 0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + endloop + endfacet + facet normal 0.09896795616075596 0.49754551322598684 0.86177363960732289 + outer loop + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal 0.098968013678745095 0.49754554356199898 0.86177361548731501 + outer loop + vertex 0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal 0.13193484346738305 0.6632812473181785 0.73664861639405688 + outer loop + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal 0.13193484347074255 0.66328124732023797 0.73664861639160084 + outer loop + vertex 0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal 0.15887932976663663 0.79874081541833841 0.5803192813940895 + outer loop + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal 0.15887943951689923 0.79874087880382039 0.58031916410411333 + outer loop + vertex 0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal 0.17878756859551068 0.89882619396083951 0.40018305607006488 + outer loop + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal 0.17878753433762079 0.89882617942320442 0.40018310402734319 + outer loop + vertex 0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal 0.19098433878695753 0.96014292559861558 0.2040846509687585 + outer loop + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal 0.19098421563577431 0.96014290587992079 0.20408485898382991 + outer loop + vertex 0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal 0.19509035781625048 0.98078527328214271 -0 + outer loop + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal 0.19509035781625048 0.98078527328214271 -0 + outer loop + vertex 0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal 0.19098422428494746 0.9601429493622694 -0.20408464632156811 + outer loop + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal 0.19098433051579031 0.96014288401665793 -0.20408485433664572 + outer loop + vertex 0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal 0.17878753861432081 0.89882620092364052 -0.40018305382588126 + outer loop + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal 0.17878756470117702 0.89882617438269363 -0.40018310178316374 + outer loop + vertex 0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal 0.15887942196636895 0.79874079057134661 -0.58031929035065921 + outer loop + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal 0.15887934482690999 0.79874089113149138 -0.58031917306068981 + outer loop + vertex 0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal 0.13193484347015971 0.66328124731730786 -0.73664861639434365 + outer loop + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal 0.13193484346784407 0.6632812473204962 -0.73664861639188761 + outer loop + vertex 0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal 0.098968004229828876 0.49754549605911413 -0.86177364399826861 + outer loop + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal 0.098967962699230097 0.49754554609711604 -0.86177361987826384 + outer loop + vertex 0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal 0.061351500668862552 0.30843478276930947 -0.94926496730034626 + outer loop + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal 0.061351521400747608 0.30843476522401225 -0.94926497166124379 + outer loop + vertex 0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal -0.061351521400747587 0.30843476522401225 0.94926497166124379 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.061351500668862524 0.30843478276930947 0.94926496730034626 + outer loop + vertex 1.2730919672892854e-18 0.020791169255971909 0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal -0.098967962699230083 0.49754554609711604 0.86177361987826384 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.098968004229828835 0.49754549605911413 0.86177364399826861 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.13193484346784401 0.66328124732049609 0.7366486163918875 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.13193484347015969 0.66328124731730786 0.73664861639434365 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.15887934482690991 0.79874089113149138 0.58031917306068992 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.15887942196636889 0.79874079057134661 0.58031929035065921 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.17878756470117696 0.89882617438269374 0.4001831017831638 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.17878753861432076 0.89882620092364052 0.40018305382588132 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.19098433051579028 0.96014288401665793 0.20408485433664575 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.19098422428494741 0.9601429493622694 0.20408464632156811 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.19509035781625042 0.98078527328214271 0 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.19509035781625042 0.98078527328214271 0 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.19098421563577425 0.96014290587992079 -0.20408485898382991 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.19098433878695747 0.96014292559861558 -0.20408465096875852 + outer loop + vertex 6.0896904347255889e-18 0.099452190101146698 -0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.17878753433762073 0.89882617942320442 -0.40018310402734325 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.17878756859551062 0.89882619396083963 -0.40018305607006494 + outer loop + vertex 5.823541763914202e-18 0.095105648040771484 -0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.15887943951689915 0.79874087880382016 -0.58031916410411333 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.15887932976663657 0.7987408154183383 -0.58031928139408939 + outer loop + vertex 5.302876236065149e-18 0.086602538824081421 -0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.13193484347074252 0.66328124732023797 -0.73664861639160084 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.13193484346738302 0.66328124731817861 -0.73664861639405699 + outer loop + vertex 4.5504495898297635e-18 0.074314482510089874 -0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.098968013678745068 0.49754554356199898 -0.86177361548731513 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.098967956160755932 0.49754551322598684 -0.86177363960732289 + outer loop + vertex 3.5991468040503975e-18 0.058778524398803711 -0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.061351497270056739 0.30843476568236111 -0.94926497307189694 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex 1.2730919672892854e-18 0.020791169255971909 -0.097814761102199554 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.061351523138116801 0.30843477395835256 -0.94926496871099864 + outer loop + vertex 2.4905436306751913e-18 0.040673665702342987 -0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.17471428421919066 0.26147837970812587 0.9492649660842799 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.17471426893077599 0.26147840938106925 0.9492649607246284 + outer loop + vertex -0.0079564359039068222 0.019208535552024841 0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal -0.28183684066621417 0.42179874557711361 0.86177364398829248 + outer loop + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.28183687150574754 0.42179864590164712 0.86177368268901633 + outer loop + vertex -0.015565137378871441 0.037577565759420395 0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.37571865044532143 0.56230267786378618 0.73664862327622749 + outer loop + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.37571862212216495 0.56230279592432497 0.73664854760347465 + outer loop + vertex -0.022493567317724228 0.054304275661706924 0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.45245040321610314 0.67713972638750908 0.5803192428116053 + outer loop + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.4524503781983546 0.67713981980897864 0.58031915330896144 + outer loop + vertex -0.028438922017812729 0.068657629191875458 0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.50914415869095786 0.76198801003014671 0.40018308090319588 + outer loop + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.50914418433618069 0.76198794657394719 0.40018316910218049 + outer loop + vertex -0.033141355961561203 0.080010317265987396 0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.54387724854201425 0.81396988974665174 0.20408468120903095 + outer loop + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.54387729795136042 0.81396982149820041 0.20408482173673517 + outer loop + vertex -0.036395356059074402 0.087866164743900299 0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.55557020216110709 0.83146963292153175 0 + outer loop + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.55557020216110709 0.83146963292153175 0 + outer loop + vertex -0.038058705627918243 0.091881841421127319 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.54387731459104727 0.81396984640124925 -0.20408467806956454 + outer loop + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.54387723262956311 0.81396986593198373 -0.20408481859726049 + outer loop + vertex -0.038058705627918243 0.091881841421127319 -0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.50914420673480953 0.76198798009585644 -0.40018307677589038 + outer loop + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.509144138294924 0.76198797950532793 -0.40018316497487411 + outer loop + vertex -0.036395356059074402 0.087866164743900299 -0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.45245034005942358 0.67713976273003673 -0.58031924964628023 + outer loop + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.45245043594349216 0.67713977536749692 -0.58031916014362273 + outer loop + vertex -0.033141355961561203 0.080010317265987396 -0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.37571857098187661 0.56230271938745569 -0.7366486321095076 + outer loop + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.37571869089438792 0.56230273840009004 -0.73664855643676341 + outer loop + vertex -0.028438922017812729 0.068657629191875458 -0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.28183691468019506 0.42179871051676798 -0.86177363694298537 + outer loop + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.28183681079029427 0.42179870086462851 -0.86177367564370844 + outer loop + vertex -0.022493567317724228 0.054304275661706924 -0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.17471425703507376 0.26147839157789088 -0.94926496781800662 + outer loop + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.0079564359039068222 0.019208535552024841 -0.097814761102199554 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.17471429029992128 0.26147838880858149 -0.94926496245835557 + outer loop + vertex -0.015565137378871441 0.037577565759420395 -0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.26147838880858149 0.17471429029992128 0.94926496245835557 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.26147839157789088 0.17471425703507376 0.94926496781800662 + outer loop + vertex -0.01470157690346241 0.01470157690346241 0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal -0.42179870086462851 0.28183681079029427 0.86177367564370844 + outer loop + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.42179871051676798 0.28183691468019506 0.86177363694298537 + outer loop + vertex -0.028760623186826706 0.028760623186826706 0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.56230273840009004 0.37571869089438792 0.73664855643676341 + outer loop + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.56230271938745569 0.37571857098187661 0.7366486321095076 + outer loop + vertex -0.041562695056200027 0.041562695056200027 0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.67713977536749692 0.45245043594349216 0.58031916014362273 + outer loop + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.67713976273003673 0.45245034005942358 0.58031924964628023 + outer loop + vertex -0.052548274397850037 0.052548274397850037 0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.76198797950532793 0.509144138294924 0.40018316497487411 + outer loop + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.76198798009585644 0.50914420673480953 0.40018307677589038 + outer loop + vertex -0.061237242072820663 0.061237242072820663 0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.81396986593198373 0.54387723262956311 0.20408481859726049 + outer loop + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.81396984640124925 0.54387731459104727 0.20408467806956454 + outer loop + vertex -0.067249849438667297 0.067249849438667297 0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.83146963292153175 0.55557020216110709 0 + outer loop + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.83146963292153175 0.55557020216110709 0 + outer loop + vertex -0.070323318243026733 0.070323318243026733 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.81396982149820041 0.54387729795136042 -0.20408482173673517 + outer loop + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.81396988974665174 0.54387724854201425 -0.20408468120903095 + outer loop + vertex -0.070323318243026733 0.070323318243026733 -0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.76198794657394719 0.50914418433618069 -0.40018316910218049 + outer loop + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.76198801003014671 0.50914415869095786 -0.40018308090319588 + outer loop + vertex -0.067249849438667297 0.067249849438667297 -0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.67713981980897864 0.4524503781983546 -0.58031915330896144 + outer loop + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.67713972638750908 0.45245040321610314 -0.5803192428116053 + outer loop + vertex -0.061237242072820663 0.061237242072820663 -0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.56230279592432497 0.37571862212216495 -0.73664854760347465 + outer loop + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.56230267786378618 0.37571865044532143 -0.73664862327622749 + outer loop + vertex -0.052548274397850037 0.052548274397850037 -0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.42179864590164712 0.28183687150574754 -0.86177368268901633 + outer loop + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.42179874557711361 0.28183684066621417 -0.86177364398829248 + outer loop + vertex -0.041562695056200027 0.041562695056200027 -0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.26147840938106925 0.17471426893077599 -0.9492649607246284 + outer loop + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.01470157690346241 0.01470157690346241 -0.097814761102199554 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.26147837970812587 0.17471428421919066 -0.9492649660842799 + outer loop + vertex -0.028760623186826706 0.028760623186826706 -0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.30843477395835256 0.061351523138116815 0.94926496871099864 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + endloop + endfacet + facet normal -0.30843476568236106 0.061351497270056773 0.94926497307189694 + outer loop + vertex -0.019208535552024841 0.0079564359039068222 0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + endloop + endfacet + facet normal -0.49754551322598684 0.098967956160755974 0.86177363960732301 + outer loop + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + endloop + endfacet + facet normal -0.49754554356199887 0.098968013678745095 0.86177361548731501 + outer loop + vertex -0.037577565759420395 0.015565137378871441 0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + endloop + endfacet + facet normal -0.6632812473181785 0.13193484346738307 0.73664861639405688 + outer loop + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + endloop + endfacet + facet normal -0.66328124732023797 0.13193484347074261 0.73664861639160095 + outer loop + vertex -0.054304275661706924 0.022493567317724228 0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + endloop + endfacet + facet normal -0.79874081541833841 0.15887932976663666 0.58031928139408939 + outer loop + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + endloop + endfacet + facet normal -0.79874087880382028 0.15887943951689923 0.58031916410411333 + outer loop + vertex -0.068657629191875458 0.028438922017812729 0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + endloop + endfacet + facet normal -0.89882619396083963 0.1787875685955107 0.40018305607006494 + outer loop + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + endloop + endfacet + facet normal -0.89882617942320453 0.17878753433762085 0.40018310402734325 + outer loop + vertex -0.080010317265987396 0.033141355961561203 0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + endloop + endfacet + facet normal -0.96014292559861558 0.19098433878695759 0.20408465096875852 + outer loop + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + endloop + endfacet + facet normal -0.96014290587992079 0.19098421563577436 0.20408485898382991 + outer loop + vertex -0.087866164743900299 0.036395356059074402 0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + endloop + endfacet + facet normal -0.98078527328214271 0.19509035781625053 0 + outer loop + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + endloop + endfacet + facet normal -0.98078527328214271 0.19509035781625053 0 + outer loop + vertex -0.091881841421127319 0.038058705627918243 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + endloop + endfacet + facet normal -0.9601429493622694 0.19098422428494752 -0.20408464632156814 + outer loop + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + endloop + endfacet + facet normal -0.96014288401665793 0.19098433051579036 -0.20408485433664575 + outer loop + vertex -0.091881841421127319 0.038058705627918243 -0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + endloop + endfacet + facet normal -0.89882620092364052 0.17878753861432084 -0.40018305382588126 + outer loop + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + endloop + endfacet + facet normal -0.89882617438269374 0.17878756470117704 -0.4001831017831638 + outer loop + vertex -0.087866164743900299 0.036395356059074402 -0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + endloop + endfacet + facet normal -0.79874079057134661 0.15887942196636898 -0.58031929035065921 + outer loop + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + endloop + endfacet + facet normal -0.79874089113149138 0.15887934482690999 -0.58031917306068981 + outer loop + vertex -0.080010317265987396 0.033141355961561203 -0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + endloop + endfacet + facet normal -0.66328124731730775 0.13193484347015974 -0.73664861639434365 + outer loop + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + endloop + endfacet + facet normal -0.66328124732049609 0.13193484346784407 -0.7366486163918875 + outer loop + vertex -0.068657629191875458 0.028438922017812729 -0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + endloop + endfacet + facet normal -0.49754549605911413 0.09896800422982889 -0.86177364399826861 + outer loop + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + endloop + endfacet + facet normal -0.49754554609711604 0.098967962699230111 -0.86177361987826384 + outer loop + vertex -0.054304275661706924 0.022493567317724228 -0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + endloop + endfacet + facet normal -0.30843478276930947 0.061351500668862552 -0.94926496730034626 + outer loop + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.019208535552024841 0.0079564359039068222 -0.097814761102199554 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + endloop + endfacet + facet normal -0.30843476522401231 0.061351521400747615 -0.94926497166124379 + outer loop + vertex -0.037577565759420395 0.015565137378871441 -0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + endloop + endfacet + facet normal -0.30843476522401225 -0.061351521400747573 0.94926497166124379 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.30843478276930947 -0.061351500668862524 0.94926496730034626 + outer loop + vertex -0.020791169255971909 2.5461839345785708e-18 0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal -0.49754554609711604 -0.098967962699230055 0.86177361987826384 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.49754549605911413 -0.098968004229828835 0.86177364399826861 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal -0.6632812473204962 -0.13193484346784398 0.7366486163918875 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.66328124731730786 -0.13193484347015966 0.73664861639434365 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal -0.79874089113149138 -0.15887934482690988 0.58031917306068992 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.79874079057134661 -0.15887942196636889 0.58031929035065921 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal -0.89882617438269374 -0.17878756470117693 0.4001831017831638 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.89882620092364052 -0.17878753861432073 0.40018305382588132 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal -0.96014288401665793 -0.19098433051579022 0.20408485433664572 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.9601429493622694 -0.19098422428494735 0.20408464632156811 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal -0.98078527328214282 -0.19509035781625039 0 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.98078527328214282 -0.19509035781625039 0 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal -0.96014290587992079 -0.1909842156357742 -0.20408485898382989 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.96014292559861558 -0.19098433878695742 -0.2040846509687585 + outer loop + vertex -0.099452190101146698 1.2179380869451178e-17 -0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal -0.89882617942320464 -0.17878753433762073 -0.40018310402734331 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.89882619396083963 -0.17878756859551059 -0.40018305607006494 + outer loop + vertex -0.095105648040771484 1.1647083527828404e-17 -0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal -0.79874087880382028 -0.15887943951689912 -0.58031916410411333 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.79874081541833841 -0.15887932976663655 -0.58031928139408928 + outer loop + vertex -0.086602538824081421 1.0605752472130298e-17 -0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal -0.66328124732023808 -0.1319348434707425 -0.73664861639160084 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.6632812473181785 -0.13193484346738299 -0.73664861639405688 + outer loop + vertex -0.074314482510089874 9.100899179659527e-18 -0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal -0.49754554356199887 -0.098968013678745026 -0.86177361548731501 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.49754551322598689 -0.098967956160755918 -0.86177363960732289 + outer loop + vertex -0.058778524398803711 7.1982936081007951e-18 -0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal -0.30843476568236111 -0.061351497270056739 -0.94926497307189694 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.020791169255971909 2.5461839345785708e-18 -0.097814761102199554 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal -0.3084347739583525 -0.06135152313811678 -0.94926496871099864 + outer loop + vertex -0.040673665702342987 4.9810872613503827e-18 -0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal -0.26147837970812587 -0.17471428421919066 0.9492649660842799 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.26147840938106925 -0.17471426893077599 0.9492649607246284 + outer loop + vertex -0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal -0.42179874557711361 -0.28183684066621417 0.86177364398829248 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.42179864590164712 -0.28183687150574754 0.86177368268901633 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal -0.56230267786378618 -0.37571865044532143 0.73664862327622749 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.56230279592432497 -0.37571862212216495 0.73664854760347465 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal -0.67713972638750908 -0.45245040321610314 0.5803192428116053 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.67713981980897864 -0.4524503781983546 0.58031915330896144 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal -0.76198801003014671 -0.50914415869095786 0.40018308090319588 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.76198794657394719 -0.50914418433618069 0.40018316910218049 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal -0.81396988974665174 -0.54387724854201425 0.20408468120903095 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.81396982149820041 -0.54387729795136042 0.20408482173673517 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal -0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal -0.81396984640124925 -0.54387731459104727 -0.20408467806956454 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.81396986593198373 -0.54387723262956311 -0.20408481859726049 + outer loop + vertex -0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal -0.76198798009585644 -0.50914420673480953 -0.40018307677589038 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.76198797950532793 -0.509144138294924 -0.40018316497487411 + outer loop + vertex -0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal -0.67713976273003673 -0.45245034005942358 -0.58031924964628023 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.67713977536749692 -0.45245043594349216 -0.58031916014362273 + outer loop + vertex -0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal -0.56230271938745569 -0.37571857098187661 -0.7366486321095076 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.56230273840009004 -0.37571869089438792 -0.73664855643676341 + outer loop + vertex -0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal -0.42179871051676798 -0.28183691468019506 -0.86177363694298537 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.42179870086462851 -0.28183681079029427 -0.86177367564370844 + outer loop + vertex -0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal -0.26147839157789088 -0.17471425703507376 -0.94926496781800662 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal -0.26147838880858149 -0.17471429029992128 -0.94926496245835557 + outer loop + vertex -0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal -0.17471429029992128 -0.26147838880858149 0.94926496245835557 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.17471425703507376 -0.26147839157789088 0.94926496781800662 + outer loop + vertex -0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal -0.28183681079029427 -0.42179870086462851 0.86177367564370844 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.28183691468019506 -0.42179871051676798 0.86177363694298537 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal -0.37571869089438792 -0.56230273840009004 0.73664855643676341 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.37571857098187661 -0.56230271938745569 0.7366486321095076 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal -0.45245043594349216 -0.67713977536749692 0.58031916014362273 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.45245034005942358 -0.67713976273003673 0.58031924964628023 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal -0.509144138294924 -0.76198797950532793 0.40018316497487411 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.50914420673480953 -0.76198798009585644 0.40018307677589038 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal -0.54387723262956311 -0.81396986593198373 0.20408481859726049 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.54387731459104727 -0.81396984640124925 0.20408467806956454 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal -0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal -0.54387729795136042 -0.81396982149820041 -0.20408482173673517 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.54387724854201425 -0.81396988974665174 -0.20408468120903095 + outer loop + vertex -0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal -0.50914418433618069 -0.76198794657394719 -0.40018316910218049 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.50914415869095786 -0.76198801003014671 -0.40018308090319588 + outer loop + vertex -0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal -0.4524503781983546 -0.67713981980897864 -0.58031915330896144 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.45245040321610314 -0.67713972638750908 -0.5803192428116053 + outer loop + vertex -0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal -0.37571862212216495 -0.56230279592432497 -0.73664854760347465 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.37571865044532143 -0.56230267786378618 -0.73664862327622749 + outer loop + vertex -0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal -0.28183687150574754 -0.42179864590164712 -0.86177368268901633 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.28183684066621417 -0.42179874557711361 -0.86177364398829248 + outer loop + vertex -0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal -0.17471426893077599 -0.26147840938106925 -0.9492649607246284 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal -0.17471428421919066 -0.26147837970812587 -0.9492649660842799 + outer loop + vertex -0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal -0.061351523138116815 -0.3084347739583525 0.94926496871099864 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal -0.061351497270056773 -0.308434765682361 0.94926497307189694 + outer loop + vertex -0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + endloop + endfacet + facet normal -0.098967956160755974 -0.49754551322598678 0.86177363960732289 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal -0.098968013678745109 -0.49754554356199887 0.86177361548731501 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + endloop + endfacet + facet normal -0.1319348434673831 -0.6632812473181785 0.73664861639405688 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal -0.13193484347074261 -0.66328124732023797 0.73664861639160084 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + endloop + endfacet + facet normal -0.15887932976663666 -0.79874081541833841 0.58031928139408939 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal -0.15887943951689926 -0.79874087880382028 0.58031916410411333 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + endloop + endfacet + facet normal -0.17878756859551073 -0.89882619396083951 0.40018305607006494 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal -0.1787875343376209 -0.89882617942320453 0.40018310402734331 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + endloop + endfacet + facet normal -0.19098433878695761 -0.96014292559861558 0.20408465096875852 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal -0.19098421563577436 -0.96014290587992068 0.20408485898382989 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + endloop + endfacet + facet normal -0.19509035781625056 -0.98078527328214271 0 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal -0.19509035781625056 -0.98078527328214271 0 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + endloop + endfacet + facet normal -0.19098422428494752 -0.9601429493622694 -0.20408464632156814 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal -0.19098433051579039 -0.96014288401665793 -0.20408485433664575 + outer loop + vertex -0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + endloop + endfacet + facet normal -0.17878753861432084 -0.89882620092364052 -0.40018305382588126 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal -0.17878756470117704 -0.89882617438269374 -0.4001831017831638 + outer loop + vertex -0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + endloop + endfacet + facet normal -0.15887942196636901 -0.79874079057134661 -0.58031929035065921 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal -0.15887934482690999 -0.79874089113149138 -0.58031917306068981 + outer loop + vertex -0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + endloop + endfacet + facet normal -0.13193484347015974 -0.66328124731730775 -0.73664861639434354 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal -0.13193484346784412 -0.66328124732049609 -0.73664861639188761 + outer loop + vertex -0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + endloop + endfacet + facet normal -0.098968004229828904 -0.49754549605911413 -0.86177364399826872 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal -0.098967962699230125 -0.49754554609711599 -0.86177361987826384 + outer loop + vertex -0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + endloop + endfacet + facet normal -0.061351500668862566 -0.30843478276930947 -0.94926496730034626 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + endloop + endfacet + facet normal -0.061351521400747615 -0.3084347652240122 -0.94926497166124379 + outer loop + vertex -0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + endloop + endfacet + facet normal 0.061351521400747566 -0.30843476522401225 0.94926497166124391 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.06135150066886251 -0.30843478276930952 0.94926496730034615 + outer loop + vertex -3.819275695072703e-18 -0.020791169255971909 0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + endloop + endfacet + facet normal 0.098967962699230042 -0.49754554609711604 0.86177361987826384 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.098968004229828821 -0.49754549605911419 0.86177364399826872 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + endloop + endfacet + facet normal 0.13193484346784395 -0.6632812473204962 0.7366486163918875 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.13193484347015963 -0.66328124731730786 0.73664861639434354 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + endloop + endfacet + facet normal 0.15887934482690988 -0.79874089113149138 0.58031917306068992 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.15887942196636887 -0.79874079057134661 0.58031929035065932 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + endloop + endfacet + facet normal 0.17878756470117688 -0.89882617438269374 0.40018310178316374 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.17878753861432073 -0.89882620092364052 0.40018305382588132 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + endloop + endfacet + facet normal 0.1909843305157902 -0.96014288401665793 0.20408485433664572 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.19098422428494732 -0.9601429493622694 0.20408464632156811 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + endloop + endfacet + facet normal 0.19509035781625034 -0.98078527328214271 0 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.19509035781625034 -0.98078527328214271 0 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + endloop + endfacet + facet normal 0.19098421563577417 -0.96014290587992079 -0.20408485898382989 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.19098433878695739 -0.96014292559861558 -0.2040846509687585 + outer loop + vertex -1.8269071304176767e-17 -0.099452190101146698 -0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + endloop + endfacet + facet normal 0.17878753433762073 -0.89882617942320464 -0.40018310402734331 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.17878756859551054 -0.89882619396083963 -0.40018305607006488 + outer loop + vertex -1.7470625291742606e-17 -0.095105648040771484 -0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + endloop + endfacet + facet normal 0.15887943951689912 -0.79874087880382028 -0.58031916410411344 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.15887932976663652 -0.7987408154183383 -0.58031928139408939 + outer loop + vertex -1.5908628708195447e-17 -0.086602538824081421 -0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + endloop + endfacet + facet normal 0.13193484347074247 -0.66328124732023797 -0.73664861639160084 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.13193484346738296 -0.6632812473181785 -0.73664861639405688 + outer loop + vertex -1.3651348769489291e-17 -0.074314482510089874 -0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + endloop + endfacet + facet normal 0.098968013678745026 -0.49754554356199898 -0.86177361548731501 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.098967956160755904 -0.49754551322598684 -0.86177363960732289 + outer loop + vertex -1.0797439998560886e-17 -0.058778524398803711 -0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + endloop + endfacet + facet normal 0.061351497270056718 -0.30843476568236106 -0.94926497307189694 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex -3.819275695072703e-18 -0.020791169255971909 -0.097814761102199554 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + endloop + endfacet + facet normal 0.06135152313811678 -0.30843477395835256 -0.94926496871099864 + outer loop + vertex -7.4716313056158803e-18 -0.040673665702342987 -0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + endloop + endfacet + facet normal 0.17471428421919066 -0.26147837970812587 0.9492649660842799 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.17471426893077599 -0.26147840938106925 0.9492649607246284 + outer loop + vertex 0.0079564359039068222 -0.019208535552024841 0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + endloop + endfacet + facet normal 0.28183684066621417 -0.42179874557711361 0.86177364398829248 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.28183687150574754 -0.42179864590164712 0.86177368268901633 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + endloop + endfacet + facet normal 0.37571865044532143 -0.56230267786378618 0.73664862327622749 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.37571862212216495 -0.56230279592432497 0.73664854760347465 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + endloop + endfacet + facet normal 0.45245040321610314 -0.67713972638750908 0.5803192428116053 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.4524503781983546 -0.67713981980897864 0.58031915330896144 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + endloop + endfacet + facet normal 0.50914415869095786 -0.76198801003014671 0.40018308090319588 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.50914418433618069 -0.76198794657394719 0.40018316910218049 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + endloop + endfacet + facet normal 0.54387724854201425 -0.81396988974665174 0.20408468120903095 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.54387729795136042 -0.81396982149820041 0.20408482173673517 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + endloop + endfacet + facet normal 0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.55557020216110709 -0.83146963292153175 0 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + endloop + endfacet + facet normal 0.54387731459104727 -0.81396984640124925 -0.20408467806956454 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.54387723262956311 -0.81396986593198373 -0.20408481859726049 + outer loop + vertex 0.038058705627918243 -0.091881841421127319 -0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + endloop + endfacet + facet normal 0.50914420673480953 -0.76198798009585644 -0.40018307677589038 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.509144138294924 -0.76198797950532793 -0.40018316497487411 + outer loop + vertex 0.036395356059074402 -0.087866164743900299 -0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + endloop + endfacet + facet normal 0.45245034005942358 -0.67713976273003673 -0.58031924964628023 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.45245043594349216 -0.67713977536749692 -0.58031916014362273 + outer loop + vertex 0.033141355961561203 -0.080010317265987396 -0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + endloop + endfacet + facet normal 0.37571857098187661 -0.56230271938745569 -0.7366486321095076 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.37571869089438792 -0.56230273840009004 -0.73664855643676341 + outer loop + vertex 0.028438922017812729 -0.068657629191875458 -0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + endloop + endfacet + facet normal 0.28183691468019506 -0.42179871051676798 -0.86177363694298537 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.28183681079029427 -0.42179870086462851 -0.86177367564370844 + outer loop + vertex 0.022493567317724228 -0.054304275661706924 -0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + endloop + endfacet + facet normal 0.17471425703507376 -0.26147839157789088 -0.94926496781800662 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.0079564359039068222 -0.019208535552024841 -0.097814761102199554 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + endloop + endfacet + facet normal 0.17471429029992128 -0.26147838880858149 -0.94926496245835557 + outer loop + vertex 0.015565137378871441 -0.037577565759420395 -0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + endloop + endfacet + facet normal 0.26147838880858149 -0.17471429029992128 0.94926496245835557 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.26147839157789088 -0.17471425703507376 0.94926496781800662 + outer loop + vertex 0.01470157690346241 -0.01470157690346241 0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + endloop + endfacet + facet normal 0.42179870086462851 -0.28183681079029427 0.86177367564370844 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.42179871051676798 -0.28183691468019506 0.86177363694298537 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + endloop + endfacet + facet normal 0.56230273840009004 -0.37571869089438792 0.73664855643676341 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.56230271938745569 -0.37571857098187661 0.7366486321095076 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + endloop + endfacet + facet normal 0.67713977536749692 -0.45245043594349216 0.58031916014362273 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.67713976273003673 -0.45245034005942358 0.58031924964628023 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + endloop + endfacet + facet normal 0.76198797950532793 -0.509144138294924 0.40018316497487411 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.76198798009585644 -0.50914420673480953 0.40018307677589038 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + endloop + endfacet + facet normal 0.81396986593198373 -0.54387723262956311 0.20408481859726049 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.81396984640124925 -0.54387731459104727 0.20408467806956454 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + endloop + endfacet + facet normal 0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.83146963292153175 -0.55557020216110709 0 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + endloop + endfacet + facet normal 0.81396982149820041 -0.54387729795136042 -0.20408482173673517 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.81396988974665174 -0.54387724854201425 -0.20408468120903095 + outer loop + vertex 0.070323318243026733 -0.070323318243026733 -0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + endloop + endfacet + facet normal 0.76198794657394719 -0.50914418433618069 -0.40018316910218049 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.76198801003014671 -0.50914415869095786 -0.40018308090319588 + outer loop + vertex 0.067249849438667297 -0.067249849438667297 -0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + endloop + endfacet + facet normal 0.67713981980897864 -0.4524503781983546 -0.58031915330896144 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.67713972638750908 -0.45245040321610314 -0.5803192428116053 + outer loop + vertex 0.061237242072820663 -0.061237242072820663 -0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + endloop + endfacet + facet normal 0.56230279592432497 -0.37571862212216495 -0.73664854760347465 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.56230267786378618 -0.37571865044532143 -0.73664862327622749 + outer loop + vertex 0.052548274397850037 -0.052548274397850037 -0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + endloop + endfacet + facet normal 0.42179864590164712 -0.28183687150574754 -0.86177368268901633 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.42179874557711361 -0.28183684066621417 -0.86177364398829248 + outer loop + vertex 0.041562695056200027 -0.041562695056200027 -0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + endloop + endfacet + facet normal 0.26147840938106925 -0.17471426893077599 -0.9492649607246284 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.01470157690346241 -0.01470157690346241 -0.097814761102199554 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + endloop + endfacet + facet normal 0.26147837970812587 -0.17471428421919066 -0.9492649660842799 + outer loop + vertex 0.028760623186826706 -0.028760623186826706 -0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + endloop + endfacet + facet normal 0.3084347739583525 -0.061351523138116801 0.94926496871099864 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.040673665702342987 0 0.091354548931121826 + endloop + endfacet + facet normal 0.30843476568236111 -0.061351497270056753 0.94926497307189694 + outer loop + vertex 0.019208535552024841 -0.0079564359039068222 0.097814761102199554 + vertex 0.040673665702342987 0 0.091354548931121826 + vertex 0.020791169255971909 0 0.097814761102199554 + endloop + endfacet + facet normal 0.49754551322598684 -0.098967956160755946 0.86177363960732289 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.058778524398803711 0 0.080901697278022766 + endloop + endfacet + facet normal 0.49754554356199898 -0.098968013678745081 0.86177361548731513 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 0.091354548931121826 + vertex 0.058778524398803711 0 0.080901697278022766 + vertex 0.040673665702342987 0 0.091354548931121826 + endloop + endfacet + facet normal 0.66328124731817861 -0.13193484346738305 0.73664861639405699 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.074314482510089874 0 0.06691306084394455 + endloop + endfacet + facet normal 0.66328124732023808 -0.13193484347074255 0.73664861639160084 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 0.080901697278022766 + vertex 0.074314482510089874 0 0.06691306084394455 + vertex 0.058778524398803711 0 0.080901697278022766 + endloop + endfacet + facet normal 0.7987408154183383 -0.1588793297666366 0.58031928139408939 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.086602538824081421 0 0.05000000074505806 + endloop + endfacet + facet normal 0.79874087880382028 -0.15887943951689917 0.58031916410411333 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 0.06691306084394455 + vertex 0.086602538824081421 0 0.05000000074505806 + vertex 0.074314482510089874 0 0.06691306084394455 + endloop + endfacet + facet normal 0.89882619396083974 -0.17878756859551068 0.40018305607006494 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.095105648040771484 0 0.030901700258255005 + endloop + endfacet + facet normal 0.89882617942320453 -0.17878753433762079 0.40018310402734325 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 0.05000000074505806 + vertex 0.095105648040771484 0 0.030901700258255005 + vertex 0.086602538824081421 0 0.05000000074505806 + endloop + endfacet + facet normal 0.96014292559861558 -0.1909843387869575 0.2040846509687585 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.099452190101146698 0 0.010452846065163612 + endloop + endfacet + facet normal 0.96014290587992079 -0.19098421563577428 0.20408485898382991 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 0.030901700258255005 + vertex 0.099452190101146698 0 0.010452846065163612 + vertex 0.095105648040771484 0 0.030901700258255005 + endloop + endfacet + facet normal 0.98078527328214282 -0.19509035781625048 0 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + endloop + endfacet + facet normal 0.98078527328214282 -0.19509035781625048 0 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 0.010452846065163612 + vertex 0.099452190101146698 0 -0.010452846065163612 + vertex 0.099452190101146698 0 0.010452846065163612 + endloop + endfacet + facet normal 0.96014294936226929 -0.19098422428494741 -0.20408464632156809 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.095105648040771484 0 -0.030901700258255005 + endloop + endfacet + facet normal 0.96014288401665793 -0.19098433051579031 -0.20408485433664575 + outer loop + vertex 0.091881841421127319 -0.038058705627918243 -0.010452846065163612 + vertex 0.095105648040771484 0 -0.030901700258255005 + vertex 0.099452190101146698 0 -0.010452846065163612 + endloop + endfacet + facet normal 0.89882620092364052 -0.17878753861432078 -0.40018305382588132 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.086602538824081421 0 -0.05000000074505806 + endloop + endfacet + facet normal 0.89882617438269374 -0.17878756470117699 -0.40018310178316374 + outer loop + vertex 0.087866164743900299 -0.036395356059074402 -0.030901700258255005 + vertex 0.086602538824081421 0 -0.05000000074505806 + vertex 0.095105648040771484 0 -0.030901700258255005 + endloop + endfacet + facet normal 0.79874079057134661 -0.15887942196636892 -0.58031929035065921 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.074314482510089874 0 -0.06691306084394455 + endloop + endfacet + facet normal 0.79874089113149127 -0.15887934482690994 -0.58031917306068981 + outer loop + vertex 0.080010317265987396 -0.033141355961561203 -0.05000000074505806 + vertex 0.074314482510089874 0 -0.06691306084394455 + vertex 0.086602538824081421 0 -0.05000000074505806 + endloop + endfacet + facet normal 0.66328124731730775 -0.13193484347015969 -0.73664861639434354 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.058778524398803711 0 -0.080901697278022766 + endloop + endfacet + facet normal 0.6632812473204962 -0.13193484346784404 -0.7366486163918875 + outer loop + vertex 0.068657629191875458 -0.028438922017812729 -0.06691306084394455 + vertex 0.058778524398803711 0 -0.080901697278022766 + vertex 0.074314482510089874 0 -0.06691306084394455 + endloop + endfacet + facet normal 0.49754549605911413 -0.098968004229828863 -0.86177364399826861 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.040673665702342987 0 -0.091354548931121826 + endloop + endfacet + facet normal 0.49754554609711599 -0.098967962699230083 -0.86177361987826373 + outer loop + vertex 0.054304275661706924 -0.022493567317724228 -0.080901697278022766 + vertex 0.040673665702342987 0 -0.091354548931121826 + vertex 0.058778524398803711 0 -0.080901697278022766 + endloop + endfacet + facet normal 0.30843478276930947 -0.061351500668862545 -0.94926496730034626 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.019208535552024841 -0.0079564359039068222 -0.097814761102199554 + vertex 0.020791169255971909 0 -0.097814761102199554 + endloop + endfacet + facet normal 0.30843476522401231 -0.061351521400747594 -0.94926497166124379 + outer loop + vertex 0.037577565759420395 -0.015565137378871441 -0.091354548931121826 + vertex 0.020791169255971909 0 -0.097814761102199554 + vertex 0.040673665702342987 0 -0.091354548931121826 + endloop + endfacet +endsolid diff --git a/apps/gpu/LBM/SphereScaling/CMakeLists.txt b/apps/gpu/SphereScaling/CMakeLists.txt similarity index 81% rename from apps/gpu/LBM/SphereScaling/CMakeLists.txt rename to apps/gpu/SphereScaling/CMakeLists.txt index db3747f2b620cab1efc5cf50f02aee1a8fee4a54..7d2d7722190e02876dc05e581cd9ce67a3362ebd 100644 --- a/apps/gpu/LBM/SphereScaling/CMakeLists.txt +++ b/apps/gpu/SphereScaling/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(SphereScaling LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES SphereScaling.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES SphereScaling.cpp) set_source_files_properties(SphereScaling.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp b/apps/gpu/SphereScaling/SphereScaling.cpp similarity index 97% rename from apps/gpu/LBM/SphereScaling/SphereScaling.cpp rename to apps/gpu/SphereScaling/SphereScaling.cpp index e4291f81a288528397246f2fb56f95aa3c04ac0c..9873522362c06a9c427be296e813602839b04642 100755 --- a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp +++ b/apps/gpu/SphereScaling/SphereScaling.cpp @@ -1,15 +1,13 @@ #define _USE_MATH_DEFINES +#include <cmath> #include <exception> +#include <filesystem> #include <fstream> #include <iostream> -#include <math.h> #include <memory> #include <sstream> #include <stdexcept> #include <string> -#include <filesystem> - -#include "mpi.h" ////////////////////////////////////////////////////////////////////////// @@ -25,7 +23,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "geometries/Conglomerate/Conglomerate.h" #include "geometries/Cuboid/Cuboid.h" @@ -39,7 +36,6 @@ ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" @@ -58,6 +54,7 @@ ////////////////////////////////////////////////////////////////////////// #include "utilities/communication.h" +#include <parallel/MPICommunicator.h> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -65,13 +62,9 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); @@ -124,7 +117,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) else para->setMaxLevel(1); - para->setMainKernel(vf::CollisionKernel::Compressible::CumulantK17); + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); scalingFactory.setScalingFactory(GridScalingFactory::GridScaling::ScaleCompressible); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,6 +142,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) VF_LOG_INFO("mainKernel = {}\n", para->getMainKernel()); ////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); if (useGridGenerator) { real sideLengthCube; @@ -170,12 +164,12 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) const real dCubeLev1 = 72.0; // Phoenix: 72.0 if (para->getNumprocs() > 1) { - const uint generatePart = vf::gpu::MpiCommunicator::getInstance().getPID(); + const uint generatePart = communicator.getProcessID(); real overlap = (real)8.0 * dxGrid; gridBuilder->setNumberOfLayers(10, 8); - if (communicator.getNumberOfProcess() == 2) { + if (communicator.getNumberOfProcesses() == 2) { real zSplit = 0.5 * sideLengthCube; if (scalingType == "weak") { @@ -249,7 +243,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 4) { + } else if (communicator.getNumberOfProcesses() == 4) { real ySplit = 0.5 * sideLengthCube; real zSplit = 0.5 * sideLengthCube; @@ -365,7 +359,7 @@ void runVirtualFluids(const vf::basics::ConfigurationFile& config) gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); // set pressure BC after velocity BCs // gridBuilder->setVelocityBoundaryCondition(SideType::GEOMETRY, 0.0, 0.0, 0.0); ////////////////////////////////////////////////////////////////////////// - } else if (communicator.getNumberOfProcess() == 8) { + } else if (communicator.getNumberOfProcesses() == 8) { real xSplit = 0.5 * sideLengthCube; real ySplit = 0.5 * sideLengthCube; real zSplit = 0.5 * sideLengthCube; @@ -658,7 +652,7 @@ int main(int argc, char *argv[]) try { VF_LOG_INFO("For the default config path to work, execute the app from the project root."); - vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/SphereScaling/config.txt"); + vf::basics::ConfigurationFile config = vf::basics::loadConfig(argc, argv, "./apps/gpu/SphereScaling/config.txt"); runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/SphereScaling/config.txt b/apps/gpu/SphereScaling/config.txt similarity index 85% rename from apps/gpu/LBM/SphereScaling/config.txt rename to apps/gpu/SphereScaling/config.txt index 5cfaeb492f97d348140ca3161b0738b4dd3ceaa7..b835c0b4ce0931f7775184233c8e627d97e1844b 100644 --- a/apps/gpu/LBM/SphereScaling/config.txt +++ b/apps/gpu/SphereScaling/config.txt @@ -1,12 +1,12 @@ # Tesla 03 -# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/SphereScaling.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/LBM/SphereScaling/config.txt" +# mpiexec -n 2 "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/build/bin/Release/SphereScaling.exe" "C:/Users/Master/Documents/MasterAnna/VirtualFluids_dev/apps/gpu/SphereScaling/config.txt" # Phoenix -# mpirun -np 2 "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/config.txt" +# mpirun -np 2 "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/SphereScaling/config.txt" # Phoenix mpich -# mpirun -np 2 nvprof -f -o SphereScaling.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# mpirun -np 2 nvprof -f -o SphereScaling.%q{PMI_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/SphereScaling/configPhoenix4GPU.txt" # Phoenix openmpi -# mpirun -np 2 nvprof -f -o SphereScaling.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/LBM/SphereScaling/configPhoenix4GPU.txt" +# mpirun -np 2 nvprof -f -o SphereScaling.%q{OMPI_COMM_WORLD_RANK}.nvprof "./VirtualFluids_dev/build/bin/SphereScaling" "./VirtualFluids_dev/apps/gpu/SphereScaling/configPhoenix4GPU.txt" ################################################## #GPU Mapping @@ -34,7 +34,7 @@ GridPath=/output/grids/SphereScalingResults/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt b/apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt rename to apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt index 5488797815bd797916434e8b6a0a82ce623a8db4..e61f25ccb640beb4375a12336c40e73528096e74 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt +++ b/apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongOS.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling1GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt index e93f161aa16977ecd65aab230f40db0bbef60130..a205af0cf09aeb51cbd481684ca653cde6492755 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix1GPU_1LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling1GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt b/apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt rename to apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt index 795e6bcb7d0dc3314f26b171c2f61d88e005a797..20602597eae3571cb228f8d9bdd6984d30b22b24 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt +++ b/apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongOS.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt index ef75fb88e563869b67f8aa33d839ec85c1d749b6..a1bdbe2feb3dc93d0bf858b909af9d07d34a3006 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix2GPU_1LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt rename to apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt index 99a057d31c7f15659d32776967853e076b5939ee..783b68ccc3623a11d43da29e75d05d77ede15caa 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt +++ b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongOS.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt index ea6338672305177b5119a2f557675bc491fddadc..2f95e25e0ea343ac5eb8d31e61bedea52110235a 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt rename to apps/gpu/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt index ad05efa37ec5fadc9bc5fe9711485ec6f03e1960..6ecc44955f34c4aacc998554c367ab632239ee75 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix4GPU_1LevWeakStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt index 45dc8c8b632f184e493dfedcc5963d8f60057022..12372f1c52ecc13a5a8902727129a880df40fc8d 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix4GPU_2LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling4GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_regressionTest.txt b/apps/gpu/SphereScaling/configPhoenix4GPU_regressionTest.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix4GPU_regressionTest.txt rename to apps/gpu/SphereScaling/configPhoenix4GPU_regressionTest.txt index c5789cdf96049b7c0a31ce693c29cd2db4952a58..9b8c6e42de49997cc218a2a0ee6f832b903d142b 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix4GPU_regressionTest.txt +++ b/apps/gpu/SphereScaling/configPhoenix4GPU_regressionTest.txt @@ -1,7 +1,7 @@ ################################################## #GPU Mapping ################################################## -Devices="0 1 2 3" +Devices=0 1 2 3 NumberOfDevices=4 ################################################## diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt index 892f11013d6742af416ba3b93a993b059a6fa3a0..41ef2d6a246a7c72ff00f1eaf94391aafedcd1b3 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongOS.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt index b026d6b7304f9f13effec6c899512beb804787f5..994c713a2c2f5b35fdf7a31ddd7f3b4186d3d4e7 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt index ae848a2889d1301de78c6fff42e045965fa9baf7..da9adb7ed35032b42a9f415bf523e1e641aab1bd 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakOS.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt index fc8403eca0bcf96645c85b81c3109ec7619f34d2..2ef3c31b63bfbf7abe176cfd7b7536d0ac73eb73 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_1LevWeakStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt similarity index 96% rename from apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt index a6d54810d8d4f0ded262a61c5535764c2f6f91b3..d37a513612fb8e88764b5ba0db859f296d88c7fc 100644 --- a/apps/gpu/LBM/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_2LevStrongStream.txt @@ -26,7 +26,7 @@ GridPath=/work/y0078217/Grids/GridSphereScaling/SphereScaling8GPU/ #LBM Version ################################################## #D3Qxx=27 -#MainKernelName=CumulantK17CompChim +#MainKernelName=K17CompressibleNavierStokes ################################################## #simulation parameter diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt b/apps/gpu/SphereScaling/configPhoenix8GPU_regressionTest.txt similarity index 96% rename from apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt rename to apps/gpu/SphereScaling/configPhoenix8GPU_regressionTest.txt index c5789cdf96049b7c0a31ce693c29cd2db4952a58..9b8c6e42de49997cc218a2a0ee6f832b903d142b 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt +++ b/apps/gpu/SphereScaling/configPhoenix8GPU_regressionTest.txt @@ -1,7 +1,7 @@ ################################################## #GPU Mapping ################################################## -Devices="0 1 2 3" +Devices=0 1 2 3 NumberOfDevices=4 ################################################## diff --git a/apps/gpu/LBM/TGV_3D/CMakeLists.txt b/apps/gpu/TGV_3D/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D/CMakeLists.txt rename to apps/gpu/TGV_3D/CMakeLists.txt diff --git a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp b/apps/gpu/TGV_3D/TGV_3D.cpp similarity index 94% rename from apps/gpu/LBM/TGV_3D/TGV_3D.cpp rename to apps/gpu/TGV_3D/TGV_3D.cpp index c813bc319c085506420638dac3ef623b110dc771..6bb6d2b9201a4f21e5b70d31b8e9c60ad5a8a34c 100644 --- a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp +++ b/apps/gpu/TGV_3D/TGV_3D.cpp @@ -35,14 +35,12 @@ #include <filesystem> #include <fstream> #include <iostream> -#include <math.h> +#include <cmath> #include <memory> #include <sstream> #include <stdexcept> #include <string> -#include "mpi.h" - ////////////////////////////////////////////////////////////////////////// #include "DataTypes.h" @@ -58,7 +56,6 @@ #include "GridGenerator/grid/BoundaryConditions/Side.h" #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" -#include "GridGenerator/grid/GridFactory.h" #include "GridGenerator/io/GridVTKWriter/GridVTKWriter.h" #include "GridGenerator/io/STLReaderWriter/STLReader.h" @@ -67,7 +64,6 @@ ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" @@ -77,7 +73,7 @@ #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" - +#include <parallel/MPICommunicator.h> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -132,20 +128,11 @@ std::string simulationName("TGV_3D"); void multipleLevel(const std::string& configPath) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - - auto gridFactory = GridFactory::make(); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); vf::basics::ConfigurationFile config; config.load(configPath); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -166,6 +153,7 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// real dx = 2.0 * PI / real(nx); + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); gridBuilder->addCoarseGrid(-PI, -PI, -PI, PI, PI, PI, dx); @@ -254,7 +242,7 @@ void multipleLevel(const std::string& configPath) } ); - para->setMainKernel( kernel ); + para->configureMainKernel( kernel ); if( !useLimiter ) para->setQuadricLimiters( 1000000.0, 1000000.0, 1000000.0 ); diff --git a/apps/gpu/LBM/TGV_3D/config.txt b/apps/gpu/TGV_3D/config.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D/config.txt rename to apps/gpu/TGV_3D/config.txt diff --git a/apps/gpu/LBM/TGV_3D_GridRef/CMakeLists.txt b/apps/gpu/TGV_3D_GridRef/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D_GridRef/CMakeLists.txt rename to apps/gpu/TGV_3D_GridRef/CMakeLists.txt diff --git a/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp b/apps/gpu/TGV_3D_GridRef/TGV_3D_GridRef.cpp similarity index 94% rename from apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp rename to apps/gpu/TGV_3D_GridRef/TGV_3D_GridRef.cpp index 876496783e61867a45843b0aa871bbc794eca73f..4dc29b9309643a82fb82572ec37fb69468cebb51 100644 --- a/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp +++ b/apps/gpu/TGV_3D_GridRef/TGV_3D_GridRef.cpp @@ -67,7 +67,7 @@ ////////////////////////////////////////////////////////////////////////// -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" +#include "parallel/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" @@ -77,6 +77,7 @@ #include "VirtualFluids_GPU/LBM/Simulation.h" #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/Parameter/Parameter.h" +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -122,7 +123,7 @@ uint gpuIndex = 0; bool useLimiter = false; bool useWale = false; -std::string kernel( "CumulantK17CompChimRedesigned" ); +std::string kernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); std::string path("D:/out/TGV_3D/"); //MOLLOK @@ -131,18 +132,12 @@ std::string simulationName("TGV_3D_Gridref_noSqPress"); void multipleLevel(const std::string& configPath) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - - auto gridFactory = GridFactory::make(); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + //vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); vf::basics::ConfigurationFile config; config.load(configPath); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); GridScalingFactory scalingFactory = GridScalingFactory(); @@ -158,11 +153,11 @@ void multipleLevel(const std::string& configPath) const real viscosity = nx / ( 2.0 * PI ) * velocity / Re; - *logging::out << logging::Logger::INFO_HIGH << "velocity = " << velocity << " s\n"; - - *logging::out << logging::Logger::INFO_HIGH << "viscosity = " << viscosity << "\n"; + VF_LOG_INFO("velocity = {}", velocity); + VF_LOG_INFO("viscosity = {}", viscosity); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); real dx = 2.0 * PI / real(nx); @@ -268,7 +263,7 @@ void multipleLevel(const std::string& configPath) } ); - para->setMainKernel( kernel ); + para->configureMainKernel( kernel ); if( !useLimiter ) para->setQuadricLimiters( 1000000.0, 1000000.0, 1000000.0 ); diff --git a/apps/gpu/LBM/TGV_3D_GridRef/config.txt b/apps/gpu/TGV_3D_GridRef/config.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D_GridRef/config.txt rename to apps/gpu/TGV_3D_GridRef/config.txt diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt b/apps/gpu/TGV_3D_MultiGPU/CMakeLists.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D_MultiGPU/CMakeLists.txt rename to apps/gpu/TGV_3D_MultiGPU/CMakeLists.txt diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp b/apps/gpu/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp similarity index 99% rename from apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp rename to apps/gpu/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp index e643c4f72019c681bc7ae4b2711d46e3399dad71..f409b417378b0a2eab05b65181fac4d86e981c50 100644 --- a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp +++ b/apps/gpu/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp @@ -127,7 +127,7 @@ bool useWale = false; int mpirank; int mpiWorldSize; -std::string kernel( "CumulantK17CompChim" ); +std::string kernel( "K17CompressibleNavierStokes" ); //std::string path("F:/Work/Computations/out/TaylorGreen3DNew/"); //LEGOLAS //std::string path("results/"); //PHOENIX @@ -309,7 +309,7 @@ void multipleLevel(const std::string& configPath) } ); - para->setMainKernel(kernel); + para->configureMainKernel(kernel); if( !useLimiter ) para->setQuadricLimiters( 1000000.0, 1000000.0, 1000000.0 ); diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/config.txt b/apps/gpu/TGV_3D_MultiGPU/config.txt similarity index 100% rename from apps/gpu/LBM/TGV_3D_MultiGPU/config.txt rename to apps/gpu/TGV_3D_MultiGPU/config.txt diff --git a/apps/gpu/LBM/WTG_RUB/CMakeLists.txt b/apps/gpu/WTG_RUB/CMakeLists.txt similarity index 82% rename from apps/gpu/LBM/WTG_RUB/CMakeLists.txt rename to apps/gpu/WTG_RUB/CMakeLists.txt index 606987dfb093c9c93bbd25bf5ff68fdc81311e1b..d67ec1c079fa418bcfc7374aa7aa7673756329a8 100644 --- a/apps/gpu/LBM/WTG_RUB/CMakeLists.txt +++ b/apps/gpu/WTG_RUB/CMakeLists.txt @@ -1,6 +1,6 @@ PROJECT(WTG_RUB LANGUAGES CUDA CXX) -vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES WTG_RUB.cpp) +vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator FILES WTG_RUB.cpp) set_source_files_properties(WTG_RUB.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp b/apps/gpu/WTG_RUB/WTG_RUB.cpp similarity index 97% rename from apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp rename to apps/gpu/WTG_RUB/WTG_RUB.cpp index 00fe00a24eb454c9aa0973d6ebe20f22c6a52369..129c08731a60ad2f75b62cdfaa4baa5eec92f00b 100644 --- a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp +++ b/apps/gpu/WTG_RUB/WTG_RUB.cpp @@ -31,7 +31,7 @@ //! \author Martin Schoenherr //======================================================================================= #define _USE_MATH_DEFINES -#include <math.h> +#include <cmath> #include <string> #include <sstream> #include <iostream> @@ -41,8 +41,6 @@ #include <memory> #include <filesystem> -#include "mpi.h" - ////////////////////////////////////////////////////////////////////////// #include "DataTypes.h" @@ -68,7 +66,6 @@ ////////////////////////////////////////////////////////////////////////// #include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" @@ -76,7 +73,9 @@ #include "VirtualFluids_GPU/Output/FileWriter.h" #include "VirtualFluids_GPU/GPU/CudaMemoryManager.h" #include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" +#include <parallel/MPICommunicator.h> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -129,11 +128,8 @@ std::string chooseVariation(); void multipleLevel(const std::string& configPath) { - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); + //auto gridBuilder = MultipleGridBuilder::makeShared(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -191,6 +187,7 @@ void multipleLevel(const std::string& configPath) // bool reset_diff = false; bool reset_flow = false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); gridBuilder->addCoarseGrid(x_min, y_min, z_min, x_max, y_max, z_max, dx); @@ -218,7 +215,7 @@ void multipleLevel(const std::string& configPath) vf::basics::ConfigurationFile config; config.load(configPath); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -227,8 +224,8 @@ void multipleLevel(const std::string& configPath) //const real vx = velocityLB / (real)sqrt(2.0); // LB units //const real vy = velocityLB / (real)sqrt(2.0); // LB units - VF_LOG_INFO("velocityLB [dx/dt] = " << velocityLB); - VF_LOG_INFO("viscosityLB [dx^2/dt] = " << viscosityLB); + VF_LOG_INFO("velocityLB [dx/dt] = {}", velocityLB); + VF_LOG_INFO("viscosityLB [dx^2/dt] = {}", viscosityLB); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -246,7 +243,7 @@ void multipleLevel(const std::string& configPath) para->setVelocityRatio(velocity/ velocityLB); - para->setMainKernel("CumulantK17CompChim"); // CumulantK17Unified, CumulantK17CompChim + para->configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); para->setInitialCondition([&](real coordX, real coordY, real coordZ, real &rho, real &vx, real &vy, real &vz) { rho = (real)0.0; @@ -406,14 +403,14 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r // FineGrid Level 2 -> dx = 1 cm; lvl 2 auto FG2_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); auto FG2_2 = std::make_shared<Cuboid>(500, -20, 5 + z_offset, 680, 210, 50 + z_offset); - auto FG2 = new Conglomerate(); + auto FG2 = std::make_shared<Conglomerate>(); FG2->add(FG2_1); FG2->add(FG2_2); // FineGrid Level 3 ->dx = 5 mm; lvl 3 auto FG3_1 = std::make_shared<Cuboid>(517, -20, -5 + z_offset, 665, 200, 30 + z_offset); auto FG3_2 = std::make_shared<Cuboid>(550, 58, -5 + z_offset, 650, 132, 40 + z_offset); - auto FG3 = new Conglomerate(); + auto FG3 = std::make_shared<Conglomerate>(); FG3->add(FG3_1); FG3->add(FG3_2); @@ -463,7 +460,7 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r //auto FG1_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); auto FG1_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 760, 200, 20 + z_offset); auto FG1_2 = std::make_shared<Cuboid>(500, -20, 5 + z_offset, 680, 210, 50 + z_offset); - auto FG1 = new Conglomerate(); + auto FG1 = std::make_shared<Conglomerate>(); FG1->add(FG1_1); FG1->add(FG1_2); @@ -510,14 +507,14 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r // FineGrid Level 1 -> dx = 8.0 mm; lvl 1 auto FG1_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 780, 200, 30 + z_offset); auto FG1_2 = std::make_shared<Cuboid>(500, -20, 5 + z_offset, 720, 210, 75 + z_offset); - auto FG1 = new Conglomerate(); + auto FG1 = std::make_shared<Conglomerate>(); FG1->add(FG1_1); FG1->add(FG1_2); // FineGrid Level 2 -> dx = 4.0 mm; lvl 2 auto FG2_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); auto FG2_2 = std::make_shared<Cuboid>(520, -20, 5 + z_offset, 700, 210, 50 + z_offset); - auto FG2 = new Conglomerate(); + auto FG2 = std::make_shared<Conglomerate>(); FG2->add(FG2_1); FG2->add(FG2_2); @@ -565,7 +562,7 @@ void addFineGrids(SPtr<MultipleGridBuilder> gridBuilder, uint &maxLevel, real &r // FineGrid Level 2 -> dx = 1 cm; lvl 2 auto FG2_1 = std::make_shared<Cuboid>(-20, -20, -5 + z_offset, 760, 200, 10 + z_offset); auto FG2_2 = std::make_shared<Cuboid>(500, -20, 5 + z_offset, 680, 210, 50 + z_offset); - auto FG2 = new Conglomerate(); + auto FG2 = std::make_shared<Conglomerate>(); FG2->add(FG2_1); FG2->add(FG2_2); diff --git a/apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt b/apps/gpu/WTG_RUB/configDrivenCavity.txt similarity index 100% rename from apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt rename to apps/gpu/WTG_RUB/configDrivenCavity.txt diff --git a/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt b/apps/gpu/gridGeneratorTest/CMakeLists.txt similarity index 51% rename from apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt rename to apps/gpu/gridGeneratorTest/CMakeLists.txt index 6493b72cfd996a6866fe0fb07291dd2e3438dd03..b946a710edffbdcb98894e0d49763c6ead3dabf9 100644 --- a/apps/gpu/LBM/gridGeneratorTest/CMakeLists.txt +++ b/apps/gpu/gridGeneratorTest/CMakeLists.txt @@ -1,5 +1,3 @@ -PROJECT(GridGeneratorTest LANGUAGES CUDA CXX) +PROJECT(GridGeneratorTest LANGUAGES CXX) vf_add_library(BUILDTYPE binary PRIVATE_LINK basics VirtualFluids_GPU GridGenerator MPI::MPI_CXX FILES gridGenerator.cpp) - -set_source_files_properties(DrivenCavity.cpp PROPERTIES LANGUAGE CUDA) diff --git a/apps/gpu/LBM/gridGeneratorTest/config.txt b/apps/gpu/gridGeneratorTest/config.txt similarity index 100% rename from apps/gpu/LBM/gridGeneratorTest/config.txt rename to apps/gpu/gridGeneratorTest/config.txt diff --git a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp b/apps/gpu/gridGeneratorTest/gridGenerator.cpp similarity index 90% rename from apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp rename to apps/gpu/gridGeneratorTest/gridGenerator.cpp index 90cc4c0ab33745c65688db4bf170b25a9099da51..e9ef5ae4790105471c227800d494f68deeb73c8d 100644 --- a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp +++ b/apps/gpu/gridGeneratorTest/gridGenerator.cpp @@ -1,24 +1,14 @@ -//#define MPI_LOGGING - -//Martin Branch - -#include <mpi.h> -#if defined( MPI_LOGGING ) - #include <mpe.h> -#endif - -#include <string> +#include <fstream> #include <iostream> #include <stdexcept> -#include <fstream> +#include <string> #define _USE_MATH_DEFINES -#include <math.h> +#include <cmath> #include "StringUtilities/StringUtil.h" #include "basics/config/ConfigurationFile.h" #include "VirtualFluids_GPU/LBM/Simulation.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridProvider.h" #include "VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.h" @@ -55,45 +45,26 @@ #include "utilities/communication.h" #include "utilities/transformator/TransformatorImp.h" +#include <parallel/MPICommunicator.h> -void multipleLevel(const std::string& configPath) +void runVirtualFluids(const vf::basics::ConfigurationFile &config) { - auto gridFactory = GridFactory::make(); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_UNDER_TRIANGLE); - - auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); + auto gridBuilder = std::make_shared<MultipleGridBuilder>(); - vf::gpu::Communicator& communicator = vf::gpu::MpiCommunicator::getInstance(); - vf::basics::ConfigurationFile config; - config.load(configPath); - SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcess(), communicator.getPID(), &config); + SPtr<Parameter> para = std::make_shared<Parameter>(communicator.getNumberOfProcesses(), communicator.getProcessID(), &config); BoundaryConditionFactory bcFactory = BoundaryConditionFactory(); - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool useGridGenerator = true; - if(useGridGenerator){ - - enum testCase{ - TGV, - TGV3D, - SphereTest, - DrivAer, - PaperPlane, - DLC, - MultiGPU, - StlGroupTest - }; + if (useGridGenerator) { + enum testCase { TGV, TGV3D, SphereTest, DrivAer, PaperPlane, DLC, MultiGPU, StlGroupTest }; int testcase = SphereTest; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (testcase == TGV) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// { @@ -180,7 +151,7 @@ void multipleLevel(const std::string& configPath) para->setUseWale(false); - para->setMainKernel("CumulantK15Comp"); + para->configureMainKernel("CumulantK15Comp"); ////////////////////////////////////////////////////////////////////////// @@ -265,7 +236,7 @@ void multipleLevel(const std::string& configPath) para->setUseWale(false); - para->setMainKernel("CumulantK20Comp"); + para->configureMainKernel("CumulantK20Comp"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -368,7 +339,7 @@ void multipleLevel(const std::string& configPath) para->setUseWale(false); - para->setMainKernel("CumulantAA2016CompSP27"); + para->configureMainKernel("CumulantAA2016CompSP27"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -446,8 +417,8 @@ void multipleLevel(const std::string& configPath) para->setUseWale(false); - para->setMainKernel("CumulantAA2016CompSP27"); - //para->setMainKernel(kernelMapper->getEnum("CumulantOneCompSP27")); + para->configureMainKernel("CumulantAA2016CompSP27"); + //para->configureMainKernel(kernelMapper->getEnum("CumulantOneCompSP27")); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -540,7 +511,7 @@ void multipleLevel(const std::string& configPath) gridBuilder->addGrid(DLC_RefBox_Level_3, 3); gridBuilder->addGrid(DLC_RefBox_Level_4, 4); - Conglomerate* refinement = new Conglomerate(); + auto refinement = std::make_shared<Conglomerate>(); refinement->add(DLC_RefBox_Level_5); refinement->add(VW370_SERIE_STL); @@ -555,10 +526,10 @@ void multipleLevel(const std::string& configPath) ////////////////////////////////////////////////////////////////////////// - gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx , 0.0, 0.0); - gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx , 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PY, vx, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MY, vx, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::PZ, vx, 0.0, 0.0); + gridBuilder->setVelocityBoundaryCondition(SideType::MZ, vx, 0.0, 0.0); gridBuilder->setPressureBoundaryCondition(SideType::PX, 0.0); gridBuilder->setVelocityBoundaryCondition(SideType::MX, vx, 0.0, 0.0); @@ -643,13 +614,13 @@ void multipleLevel(const std::string& configPath) para->setUseWale(false); - para->setMainKernel("CumulantK15Comp"); + para->configureMainKernel("CumulantK15Comp"); para->setDevices( { 0, 1 } ); para->setMaxDev(2); //const uint generatePart = 1; - const uint generatePart = communicator.getPID(); + const uint generatePart = communicator.getProcessID(); std::ofstream logFile2; @@ -700,12 +671,12 @@ void multipleLevel(const std::string& configPath) gridBuilder->buildGrids(true); // buildGrids() has to be called before setting the BCs!!!! if( generatePart == 0 ){ - gridBuilder->findCommunicationIndices(CommunicationDirections::PX, LBM); + gridBuilder->findCommunicationIndices(CommunicationDirections::PX); gridBuilder->setCommunicationProcess(CommunicationDirections::PX, 1); } if( generatePart == 1 ){ - gridBuilder->findCommunicationIndices(CommunicationDirections::MX, LBM); + gridBuilder->findCommunicationIndices(CommunicationDirections::MX); gridBuilder->setCommunicationProcess(CommunicationDirections::MX, 0); } @@ -752,75 +723,46 @@ void multipleLevel(const std::string& configPath) //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); } - } - else - { + } else { //gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); //gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); } - logFile.close(); - //return; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// auto cudaMemoryManager = std::make_shared<CudaMemoryManager>(para); SPtr<GridProvider> gridGenerator; - if( useGridGenerator ) gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); - else gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); + if (useGridGenerator) + gridGenerator = GridProvider::makeGridGenerator(gridBuilder, para, cudaMemoryManager, communicator); + else + gridGenerator = GridProvider::makeGridReader(FILEFORMAT::BINARY, para, cudaMemoryManager); - SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); Simulation sim(para, cudaMemoryManager, communicator, *gridGenerator, &bcFactory); sim.run(); } -int main( int argc, char* argv[]) +int main(int argc, char *argv[]) { - MPI_Init(&argc, &argv); - std::string str, str2; - if ( argv != NULL ) - { - //str = static_cast<std::string>(argv[0]); - - try - { - ////////////////////////////////////////////////////////////////////////// - - std::string targetPath; - - targetPath = __FILE__; - -#ifdef _WIN32 - targetPath = targetPath.substr(0, targetPath.find_last_of('\\') + 1); -#else - targetPath = targetPath.substr(0, targetPath.find_last_of('/') + 1); -#endif + if (argc > 1) { - std::cout << targetPath << std::endl; - - multipleLevel(targetPath + "config.txt"); + try { + VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); + vf::basics::ConfigurationFile config = vf::basics::loadConfig(argc, argv); + runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// - } - catch (const std::bad_alloc& e) - { - std::cout << "Bad alloc: " << e.what() << std::flush; - } - catch (const std::exception& e) - { - std::cout << e.what() << std::flush; + } catch (const spdlog::spdlog_ex &ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } catch (const std::bad_alloc &e) { + VF_LOG_CRITICAL("Bad Alloc: {}", e.what()); + } catch (const std::exception &e) { + VF_LOG_CRITICAL("exception: {}", e.what()); + } catch (...) { + VF_LOG_CRITICAL("Unknown exception!"); } - catch (...) - { - std::cout << "unknown exeption" << std::endl; - } - } - - MPI_Finalize(); - return 0; + return 0; } diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.cpp index 58a4128fbd1ae54f59c625cb7b7ca4f851885962..6821f270428a32c2b579174a6c3e1662d0ccc55b 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.cpp @@ -1,6 +1,7 @@ #include "MathematicaListOfListsImp.h" #include <iomanip> +#include <limits> std::shared_ptr<MathematicaListOfLists> MathematicaListOfListsImp::getNewInstance(std::string listName, std::vector<std::vector<double>> listOfLists) { diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.h index ba19ba20dde6f9810f1003fb56964c9915cb425b..a1e82892ca92fc8b3b484440edb30bfbf957d965 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/ListOfLists/MathematicaListOfListsImp.h @@ -1,5 +1,5 @@ #ifndef MATHEMATICA_LIST_OF_LISTS_IMP_H -#define MATHEMATICA_LIST_OF_LISTS_IMÃœ_H +#define MATHEMATICA_LIST_OF_LISTS_IMP_H #include "MathematicaListOfLists.h" diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/PointList/MathematicaPointListImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/PointList/MathematicaPointListImp.cpp index 6689d5f14ad94cad908584c2847cc02536df60a6..cd00dddf194903666dc36abba86985c0a643d310 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/PointList/MathematicaPointListImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/PointList/MathematicaPointListImp.cpp @@ -4,6 +4,7 @@ #include "MathematicaPointList.h" #include <iomanip> +#include <limits> std::shared_ptr<MathematicaPointList> MathematicaPointListImp::getNewInstance(std::string listName, std::vector<std::shared_ptr<DataPoint> > plotData) { diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReader.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReader.h index 4ac2f917f904f32a80427514bffeeccc4dce53e9..21ee18ef262a24ed5ba978c9f1623ebc0ce5a286 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReader.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReader.h @@ -9,6 +9,7 @@ class PostProcessingConfigData; class PostProcessingConfigFileReader { public: + virtual ~PostProcessingConfigFileReader() = default; virtual std::shared_ptr<PostProcessingConfigData> readConfigFile(std::string filePath) = 0; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp index 6c52eeb93f3e556ebfad4e993eb56c63c95b56fd..968af578a868b9e2655f4062d89fda8fed37941b 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.cpp @@ -64,7 +64,3 @@ std::shared_ptr<PostProcessingConfigData> PostProcessingConfigFileReaderImp::rea return data; } - -PostProcessingConfigFileReaderImp::PostProcessingConfigFileReaderImp() -{ -} diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.h index a47d53820807a6ac2fada77d7cb7efc09f658e07..e5355a708adb753e78089a68dc9f889df9a83fc5 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/PostProcessingConfigFileReader/PostProcessingConfigFileReaderImp.h @@ -8,10 +8,10 @@ class PostProcessingConfigFileReaderImp : public PostProcessingConfigFileReader public: static std::shared_ptr<PostProcessingConfigFileReader> getNewInstance(); - std::shared_ptr<PostProcessingConfigData> readConfigFile(std::string filePath); + std::shared_ptr<PostProcessingConfigData> readConfigFile(std::string filePath) override; private: - PostProcessingConfigFileReaderImp(); + PostProcessingConfigFileReaderImp() = default; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTestPostProcessing/main.cpp b/apps/gpu/tests/NumericalTestPostProcessing/main.cpp index bf88ad153d49bea167e148bab1abba8fa760b70f..e5dbeef9c7d3928c039049627129689ab92c653b 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/main.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/main.cpp @@ -39,12 +39,12 @@ int main(int argc, char **argv) std::shared_ptr<MathematicaAssistantFactory> assistantFactory = MathematicaAssistantFactoryImp::getNewInstance(); std::vector<std::shared_ptr<MathematicaAssistant> > mathematicaAssistants = assistantFactory->makeMathematicaAssistants(configData->getAssistants(), functionFactory); - for (int sim = 0; sim < configData->getSimulations().size(); sim++) { - for (int comb = 0; comb < configData->getDataCombinations().size(); comb++) { + for (uint sim = 0; sim < configData->getSimulations().size(); sim++) { + for (uint comb = 0; comb < configData->getDataCombinations().size(); comb++) { std::shared_ptr<LogFileDataAssistantStrategy> strategy = assistentStrategyFactory->makeLogFileDataAssistantStrategy(configData->getSimulations().at(sim)); std::vector<std::shared_ptr<LogFileDataGroup> > logFileDataSorted = assistentLogFile->findDataCombination(logFileDataVector, strategy, configData->getDataCombinations().at(comb)); - for (int i = 0; i < logFileDataSorted.size(); i++) { - for (int j = 0; j < mathematicaAssistants.size(); j++) + for (uint i = 0; i < logFileDataSorted.size(); i++) { + for (uint j = 0; j < mathematicaAssistants.size(); j++) mathematicaAssistants.at(j)->makeMathematicaOutput(logFileDataSorted.at(i), aMathmaticaFile); } } diff --git a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp index bf93a95f450ff1a21062644d9be098eb2c2c235f..a8a4a4df2e4d04564dbeb2a881cebd95ce6a1a9f 100644 --- a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp @@ -17,7 +17,7 @@ std::shared_ptr<PhiTest> PhiTest::getNewInstance(std::shared_ptr<ColorConsoleOut void PhiTest::evaluate() { - for (int i = 0; i < postProStrategies.size(); i++) + for (uint i = 0; i < postProStrategies.size(); i++) phiDiff.push_back(postProStrategies.at(i)->getPhiDiff(dataToCalculate)); orderOfAccuracy = calcOrderOfAccuracy(phiDiff); @@ -46,7 +46,7 @@ std::string PhiTest::getDataToCalculate() std::vector<int> PhiTest::getLx() { std::vector<int> lxINT; - for (int i = 0; i < lx.size(); i++) + for (uint i = 0; i < lx.size(); i++) lxINT.push_back((int)lx.at(i)); return lxINT; } @@ -62,7 +62,7 @@ double PhiTest::getOrderOfAccuracy() } PhiTest::PhiTest(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiTestParameterStruct> testPara, std::string dataToCalculate) - : TestImp(colorOutput), viscosity(viscosity), dataToCalculate(dataToCalculate) + : TestImp(colorOutput), dataToCalculate(dataToCalculate) { minOrderOfAccuracy = testPara->minOrderOfAccuracy; startStepCalculation = testPara->startTimeStepCalculation; @@ -92,7 +92,7 @@ std::vector<std::string> PhiTest::buildTestOutput() std::vector<std::string> output = buildBasicTestOutput(); std::ostringstream oss; - for (int i = 0; i < phiDiff.size(); i++) { + for (uint i = 0; i < phiDiff.size(); i++) { oss << "PhiDiff" << simInfos.at(i)->getLx() << ": " << phiDiff.at(i); output.push_back(oss.str()); oss.str(std::string()); @@ -125,7 +125,7 @@ std::vector<std::string> PhiTest::buildBasicTestOutput() output.push_back(oss.str()); oss.str(std::string()); - for (int i = 0; i < simInfos.size(); i++) { + for (uint i = 0; i < simInfos.size(); i++) { oss << "L: " << std::setfill(' ') << std::right << std::setw(4) << simInfos.at(i)->getLx() << simInfos.at(i)->getSimulationParameterString(); output.push_back(oss.str()); oss.str(std::string()); diff --git a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.h b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.h index 84b1d33896a89834460c9d8495f1e068a2221364..4bf1c02f85e35b9cf1766642b6a0e9b58e6b4d07 100644 --- a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.h +++ b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.h @@ -40,7 +40,6 @@ private: std::vector<double> phiDiff; double orderOfAccuracy; double minOrderOfAccuracy; - double viscosity; std::string dataToCalculate; std::vector<std::shared_ptr<PhiTestPostProcessingStrategy> > postProStrategies; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculator.h b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculator.h index 21ab49017188b92a97ea59a53d7ce28e51a694a8..5c90fa1ae0fe1332608d2932f2fa40435bb21fc5 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculator.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculator.h @@ -8,6 +8,7 @@ class L2NormCalculator { public: + virtual ~L2NormCalculator() = default; virtual double calc(std::vector<double> basicData, std::vector<double> divergentData, std::vector<unsigned int> level, double lx, double lz, double l0) = 0; virtual std::string getErrorMessage() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculatorFactory/L2NormCalculatorFactory.h b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculatorFactory/L2NormCalculatorFactory.h index 2b13f7ca3ca1337d8cbd7181ce4fc556e831a248..ffd1030cfa2abf8fb8b82699fe209dcf4e2416de 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculatorFactory/L2NormCalculatorFactory.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2NormCalculatorFactory/L2NormCalculatorFactory.h @@ -9,6 +9,7 @@ class L2NormCalculator; class L2NormCalculatorFactory { public: + virtual ~L2NormCalculatorFactory() = default; virtual std::shared_ptr<L2NormCalculator> makeL2NormCalculator(std::string type) = 0; }; diff --git a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutput.h b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutput.h index 73b5dff2a02af7a60d3bccc9df6c0ec90c8c5940..5c9f03658f40e77cdd9d8ce8f82d3cd08e2c02d6 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutput.h +++ b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutput.h @@ -12,6 +12,7 @@ class SimulationInfo; class ColorConsoleOutput { public: + virtual ~ColorConsoleOutput() = default; virtual void makeSimulationHeadOutput(std::shared_ptr<SimulationInfo> simInfo) = 0; virtual void makeTestOutput(std::vector<std::string> testOutput, TestStatus status) = 0; virtual void makeFinalTestOutputHead(int numberOfTests, int numberOfExecutedTest, int numberOfPassedTest, int numberOfFailedTest, int numberOfErrorTest, int numberOfNotExecutedTest) = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriter.h b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriter.h index 3af764aeeaa8b6f29831ead54b1f312d3be54e9f..a6e1eecf4a976e8c8e6a34c34f8b1e5e08887fd1 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriter.h +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriter.h @@ -10,7 +10,7 @@ class AnalyticalResults; class AnalyticalResults2DToVTKWriter { public: - + virtual ~AnalyticalResults2DToVTKWriter() = default; virtual void writeAnalyticalResult(std::shared_ptr<Parameter> para, std::shared_ptr<AnalyticalResults> analyticalResult) = 0; }; diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp index 126ff07a31c4f434cc82b4bb8b7e1d944b22cae1..15032a8fd4ec6ce8f7684c33ceae0085d92f54c4 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp @@ -40,7 +40,7 @@ void AnalyticalResults2DToVTKWriterImp::writeAnalyticalResult(std::shared_ptr<Pa for (int level = para->getCoarse(); level <= para->getFine(); level++) { #pragma omp parallel for for (int timeStep = 0; timeStep < analyticalResult->getNumberOfTimeSteps(); timeStep++) { - const unsigned int numberOfParts = para->getParH(level)->size_Mat / para->getlimitOfNodesForVTK() + 1; + const unsigned int numberOfParts = para->getParH(level)->size_Mat / para->getLimitOfNodesForVTK() + 1; std::vector<std::string> fname; unsigned int time = analyticalResult->getTimeSteps().at(timeStep) * analyticalResult->getTimeStepLength(); @@ -93,13 +93,13 @@ void AnalyticalResults2DToVTKWriterImp::writeTimeStep(std::shared_ptr<Parameter> std::vector<double> vz = analyticalResult->getVz()[timeStep]; for (unsigned int part = 0; part < fname.size(); part++) { - if (((part + 1) * para->getlimitOfNodesForVTK()) > para->getParH(level)->size_Mat) - sizeOfNodes = para->getParH(level)->size_Mat - (part * para->getlimitOfNodesForVTK()); + if (((part + 1) * para->getLimitOfNodesForVTK()) > para->getParH(level)->size_Mat) + sizeOfNodes = para->getParH(level)->size_Mat - (part * para->getLimitOfNodesForVTK()); else - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); diff --git a/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialCondition.h b/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialCondition.h index 0735f39696efe134393f6fca66a5d318d59bcb13..1c9b322a29c80c28173d5791adc75e3756f22bbc 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialCondition.h +++ b/apps/gpu/tests/NumericalTests/Utilities/InitialCondition/InitialCondition.h @@ -11,6 +11,7 @@ class Parameter; class InitialCondition { public: + virtual ~InitialCondition() = default; virtual void setParameter(std::shared_ptr<Parameter> para) = 0; virtual void init(const int level) = 0; virtual real getInitVX(int i, int level) = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/KernelConfiguration/KernelConfiguration.h b/apps/gpu/tests/NumericalTests/Utilities/KernelConfiguration/KernelConfiguration.h index dbcb9b003579b34be5f5a6be09154d3762576086..7407fe4cc33da0a929d090a30878b8fe628f03bf 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/KernelConfiguration/KernelConfiguration.h +++ b/apps/gpu/tests/NumericalTests/Utilities/KernelConfiguration/KernelConfiguration.h @@ -7,7 +7,8 @@ class KernelConfiguration { public: - virtual std::string getMainKernel() = 0; + virtual ~KernelConfiguration() = default; + virtual std::string getMainKernel() = 0; virtual bool getMultiKernelOn() = 0; virtual std::vector<int> getMultiKernelLevel() = 0; virtual std::vector<std::string> getMultiKernel() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/BasicSimulationInfo/BasicSimulationInfo.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/BasicSimulationInfo/BasicSimulationInfo.h index 20897bc5f8de3c94f7659b67b4ba6bdb3598d958..a8f14cab134f821b5dd46116e2b690779cab8176 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/BasicSimulationInfo/BasicSimulationInfo.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/BasicSimulationInfo/BasicSimulationInfo.h @@ -12,7 +12,7 @@ public: std::string getOutput(); private: - BasicSimulationInfo() {}; + BasicSimulationInfo() = default; BasicSimulationInfo(int numberOfTimeSteps, double viscosity, int basicTimeStepLength, std::string kernel); int numberOfTimeSteps; diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformation.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformation.h index 6c035169a8d74cd51aa0e94281b2f01bf3b4fc33..b234c86551603df780613da31b07aa5836f528d0 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformation.h @@ -1,11 +1,12 @@ #ifndef LOGFILE_INFORMATION_H #define LOGFILE_INFORMATION_H -#include <iostream> +#include <string> class LogFileInformation { public: + virtual ~LogFileInformation() = default; virtual std::string getOutput() = 0; private: diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformationImp.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformationImp.h index 83c4cff969f8910cabdd4ef4f57c8ef3f8fe8925..c89decfe90014d2090a6d9a89ec3b8d79d49ce8d 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformationImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/LogFileInformationImp.h @@ -8,6 +8,7 @@ class LogFileInformationImp : public LogFileInformation { public: + LogFileInformationImp() = default; virtual std::string getOutput() = 0; protected: diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/SimulationLogFileInformation/SimulationLogFileInformation.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/SimulationLogFileInformation/SimulationLogFileInformation.h index ce72f8f124a1273e9c2124e2ea30b9a055237733..45a41cc1f43eae3d1fa6fb17457b77a83826e7d6 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/SimulationLogFileInformation/SimulationLogFileInformation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileInformation/SimulationLogFileInformation/SimulationLogFileInformation.h @@ -9,6 +9,7 @@ class SimulationLogFileInformation : public LogFileInformationImp { public: + virtual ~SimulationLogFileInformation() = default; virtual std::string getOutput() = 0; virtual std::vector<std::string> getFilePathExtension() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueue.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueue.h index cb8c413d13769551ef2b9c23592d02f03f14c291..013d553901a93328fbd5f44c0b035ecd24b49d3e 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueue.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueue.h @@ -1,13 +1,10 @@ #ifndef LOGFILE_QUEUE_H #define LOGFILE_QUEUE_H -#include <memory> - -class LogFileWriter; - class LogFileQueue { public: + virtual ~LogFileQueue() = default; virtual void writeLogFiles() = 0; private: diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.cpp index 9decb8a93ccaa3bf8e1b198bb646f4f499ada72f..fa6b0b2b5a6c7e296dd4dc3b9034c027c416cbc5 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.cpp @@ -13,7 +13,7 @@ std::shared_ptr<LogFileQueueImp> LogFileQueueImp::getNewInstance(std::string bas void LogFileQueueImp::writeLogFiles() { - for (int i = 0; i < logFileWriter.size(); i++){ + for (uint i = 0; i < logFileWriter.size(); i++){ logFileWriter.at(i)->writeLogFile(basicLogFilePath); } } diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.h index 3fe27faeb0d8f48bf087c76fb8c57c36cb0a4bb1..133924382995d2a91abfbb51185bccdd7fe33e63 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileQueue/LogFileQueueImp.h @@ -5,17 +5,20 @@ #include <string> #include <vector> +#include <memory> + +class LogFileWriter; class LogFileQueueImp : public LogFileQueue { public: static std::shared_ptr<LogFileQueueImp> getNewInstance(std::string basicLogFilePath); - void writeLogFiles(); + void writeLogFiles() override; void addLogFileWriter(std::shared_ptr<LogFileWriter> aLogFileWriter); private: - LogFileQueueImp() {}; + LogFileQueueImp() = default; LogFileQueueImp(std::string basicLogFilePath); std::string calcDateAndTime(); diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriter.h b/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriter.h index d828256c677e1fece336845de68fb1fc3d3868df..396deec9d1a771fd74e9ca7f3e23910a6c9c7fcb 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriter.h +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriter.h @@ -6,6 +6,7 @@ class LogFileWriter { public: + virtual ~LogFileWriter() = default; virtual void writeLogFile(std::string basicFilePath) = 0; private: diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h index b5facb26a1dd1e2e0439a415fae2c692340449fe..d21deb7bda97df58830ec9f4dc3dcb8445915911 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h @@ -12,6 +12,7 @@ class LogFileQueue; class NumericalTestFactory { public: + virtual ~NumericalTestFactory() = default; virtual std::vector<std::shared_ptr<TestSimulation> > getTestSimulations() = 0; virtual std::shared_ptr<TestQueue> getTestQueue() = 0; virtual std::shared_ptr<LogFileQueue> getLogFileQueue() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h index 1d9b33d357406de2e94c6eb7f2ef9a570ce59e21..ff9753a4afde382e48fc8d07a8763f26f4c6b23d 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.h @@ -93,7 +93,7 @@ private: int simID; int numberOfSimulations; - int simPerKernel, numberOfTestGroupsBetweenKernels, numberOfTestsForOneSimulation, numberOfTestsBetweenKernels; - int posBasicSimulationForL2Test, posDivergentSimulationForL2Test; + // int simPerKernel, numberOfTestGroupsBetweenKernels, numberOfTestsForOneSimulation, numberOfTestsBetweenKernels; + // int posBasicSimulationForL2Test, posDivergentSimulationForL2Test; }; -#endif \ No newline at end of file +#endif diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp index cdf82c32ef982dec19df49ae347e5601017a538b..b0368e4e4215aca06cda79faf47403d7a2650f8d 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.cpp @@ -13,7 +13,7 @@ std::shared_ptr<NumericalTestGridReader> NumericalTestGridReader::getNewInstance return std::shared_ptr<NumericalTestGridReader>(new NumericalTestGridReader(para, initialCondition, cudaManager)); } -void NumericalTestGridReader::setInitalNodeValues(uint numberOfNodes, int level) const +void NumericalTestGridReader::setInitialNodeValues(uint numberOfNodes, int level) const { initialCondition->init(level); for (uint j = 0; j <= numberOfNodes; j++){ diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.h index 84f5d72705db06349f0b31a42eb99ded45bb0e1d..99363655817874672eaf5b898fb087cb20effb02 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestGridReader/NumericalTestGridReader.h @@ -13,7 +13,7 @@ public: static std::shared_ptr<NumericalTestGridReader> getNewInstance(std::shared_ptr<Parameter> para, std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<CudaMemoryManager> cudaManager); protected: - virtual void setInitalNodeValues(uint numberOfNodes, int level) const override; + virtual void setInitialNodeValues(uint numberOfNodes, int level) const override; private: NumericalTestGridReader(std::shared_ptr<Parameter> para, std::shared_ptr<InitialCondition> initialCondition, std::shared_ptr<CudaMemoryManager> cudaManager); diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h index b3835c11bf101c3a0e10beddba0095d0f1f0bef3..0e3c9fcb23964922b8ed155a89ca8c3504aa67fc 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestSimulation/NumericalTestSimulation.h @@ -10,6 +10,7 @@ enum SimulationStatus { initialized , executed, crashed}; class NumericalTestSimulation { public: + virtual ~NumericalTestSimulation() = default; virtual void run() = 0; virtual SimulationStatus getSimulationStatus() = 0; virtual void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver) = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h b/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h index 686c2300e75257717820b6bb97554b37493d46e3..e995bd4de187da87bce2cc987ac460138e3ffcb8 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h +++ b/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h @@ -10,6 +10,7 @@ class SimulationResults; class PostProcessingStrategy { public: + virtual ~PostProcessingStrategy() = default; virtual void evaluate() = 0; }; #endif \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.h b/apps/gpu/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.h index 7ed53fce60606e8a91b52330cb87822207f36f94..979c57ec3a2fd2bc26f85d07db06e31169b5aa7a 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/AnalyticalResults/AnalyticalResult.h @@ -10,6 +10,7 @@ class SimulationResults; class AnalyticalResults : public ResultsImp { public: + virtual ~AnalyticalResults() = default; virtual void calc(std::shared_ptr<SimulationResults> simResults) = 0; virtual bool isCalculated() = 0; }; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Results/Results.h b/apps/gpu/tests/NumericalTests/Utilities/Results/Results.h index 264831a96b1df5cf212b033f2a8dc2acfb03ae5a..3744bf591d98769cee398fcfde78dac1d14737ae 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Results/Results.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Results/Results.h @@ -6,6 +6,7 @@ class Results { public: + virtual ~Results() = default; virtual int getNumberOfTimeSteps() = 0; virtual std::vector<std::vector<double> > getVx() = 0; virtual std::vector<std::vector<double> > getVy() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h b/apps/gpu/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h index cd0c29e9c41765b3c877fb4830d66d41f5c98ee7..aa49cba4875a6ad2090cdd715da9971b6bec8967 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h +++ b/apps/gpu/tests/NumericalTests/Utilities/SimulationInfo/SimulationInfo.h @@ -10,6 +10,7 @@ class TimeInfo; class SimulationInfo { public: + virtual ~SimulationInfo() = default; virtual std::string getKernelName() = 0; virtual double getViscosity() = 0; virtual std::string getSimulationName() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameter.h b/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameter.h index b9ca9b2e332f4a7f3a79ca0ffae65f621b942230..7de661ce17d681c88fdeef50aebb56ce9af36202 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameter.h +++ b/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameter.h @@ -11,6 +11,7 @@ class KernelConfiguration; class SimulationParameter { public: + virtual ~SimulationParameter() = default; virtual std::shared_ptr<KernelConfiguration> getKernelConfiguration() = 0; virtual double getViscosity() = 0; virtual std::string getGridPath() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/SimulationObserver.h b/apps/gpu/tests/NumericalTests/Utilities/Test/SimulationObserver.h index 9cf022b558255ee2dbb3862caf78ccea8c0e1873..ac579cdc97015c16b5bb8cf27ae664c82aa86655 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/SimulationObserver.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/SimulationObserver.h @@ -4,6 +4,7 @@ class SimulationObserver { public: + virtual ~SimulationObserver() = default; virtual void update() = 0; }; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h index c5809671330d2ac5a32f13f3db0d6d3690f06b6f..994bf272eeae9c1d93f15748def233fa0672812c 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h @@ -10,8 +10,8 @@ class Test : public SimulationObserver { public: + virtual ~Test() = default; virtual void run() = 0; - virtual void update() = 0; virtual TestStatus getTestStatus() = 0; virtual void makeConsoleOutput() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h index f4fc758ec75f3c0e12b79faf2efb74a2e749e00e..06c2b3013e22f9de7280dc42b86ad2c1974b1b40 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/TestImp.h @@ -16,9 +16,9 @@ class TestImp : public Test { public: void run() override; - void update(); - TestStatus getTestStatus(); - virtual void makeConsoleOutput(); + void update() override; + TestStatus getTestStatus() override; + void makeConsoleOutput() override; void addSimulation(std::shared_ptr<NumericalTestSimulation> sim, std::shared_ptr<SimulationInfo> simInfo, std::shared_ptr<PostProcessingStrategy> postProStrategy); diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h index dcc0ece599e45539fd1416b3cd06bb67576a915a..736146d5a9aa3ce295e661fcd0bd3340f0a56ad0 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueue.h @@ -6,6 +6,7 @@ enum TestSuiteResult { PASSED, FAILED }; class TestQueue { public: + virtual ~TestQueue() = default; virtual TestSuiteResult run() = 0; virtual void makeFinalOutput() = 0; virtual int getNumberOfFailedTests() const noexcept = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp index c7ceef408bcc7d098810aa0f8fd82498902ee211..f55b932bf8f55b3bbab7983a17646b0826484915 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.cpp @@ -6,7 +6,7 @@ TestSuiteResult TestQueueImp::run() { - for (const auto test : tests) + for (const auto& test : tests) test->run(); makeFinalOutput(); @@ -19,7 +19,7 @@ void TestQueueImp::makeFinalOutput() calcTestNumbers(); colorOutput->makeFinalTestOutputHead(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, numberOfErrorTest, numberOfNotExecutedTest); - for (int i = 0; i < tests.size(); i++) + for (uint i = 0; i < tests.size(); i++) tests.at(i)->makeConsoleOutput(); colorOutput->makeFinalTestOutputFoot(numberOfTests, numberOfExecutedTest, numberOfPassedTest, numberOfFailedTest, numberOfErrorTest, numberOfNotExecutedTest); @@ -54,7 +54,7 @@ void TestQueueImp::calcTestNumbers() numberOfErrorTest = 0; numberOfNotExecutedTest = 0; - for (int i = 0; i < tests.size(); i++) { + for (uint i = 0; i < tests.size(); i++) { switch (tests.at(i)->getTestStatus()) { case passed: numberOfPassedTest++; diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h index 89952773f810a983d34f9e35e9508e9d0d7e3ce3..386b5805fb1ff7068ee75e764d6374f2e2fda767 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestQueue/TestQueueImp.h @@ -13,7 +13,7 @@ class TestQueueImp : public TestQueue { public: TestSuiteResult run() override; - void makeFinalOutput(); + void makeFinalOutput() override; int getNumberOfFailedTests() const noexcept override; diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h index 729ca06a3a57bfc1202d4f93728a68b18a57f8db..1f356304f05b1d08a52ed8c1842959af8f2965c1 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulation.h @@ -15,6 +15,7 @@ class Parameter; class TestSimulation { public: + virtual ~TestSimulation() = default; virtual void run() = 0; virtual void makeSimulationHeadOutput() = 0; virtual void startPostProcessing() = 0; diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp index dc4aca9b35b0bea92b3d8e3e5b07cb8ed3e054d5..2dd40ef77149c408e3f8ded6f3a7349761fa3a0b 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.cpp @@ -87,7 +87,7 @@ std::vector<std::string> TestSimulationImp::getDataToCalcTests() void TestSimulationImp::notifyObserver() { - for (int i = 0; i < simObserver.size(); i++) + for (uint i = 0; i < simObserver.size(); i++) simObserver.at(i)->update(); } diff --git a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h index b876cb079f241226bbb3455f7b4bc97b80039131..2a36fda25912ea15f2ee5a8b64d6fe0f7a982180 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/TestSimulation/TestSimulationImp.h @@ -5,7 +5,7 @@ #include "Utilities/NumericalTestSimulation/NumericalTestSimulation.h" #include <functional> -#include <time.h> +#include <ctime> #include <vector> class ToVectorWriter; @@ -28,20 +28,20 @@ public: std::shared_ptr<ColorConsoleOutput> colorOutput); void run() override; - std::shared_ptr<SimulationParameter> getSimulationParameter(); + std::shared_ptr<SimulationParameter> getSimulationParameter() override; std::shared_ptr<SimulationInfo> getSimulationInfo(); - std::shared_ptr<TimeTracking> getTimeTracking(); + std::shared_ptr<TimeTracking> getTimeTracking() override; - SimulationStatus getSimulationStatus(); + SimulationStatus getSimulationStatus() override; - void makeSimulationHeadOutput(); - void startPostProcessing(); + void makeSimulationHeadOutput() override; + void startPostProcessing() override; - void setParameter(std::shared_ptr<Parameter> para); + void setParameter(std::shared_ptr<Parameter> para) override; std::shared_ptr<SimulationResults> getSimulationResults(); std::shared_ptr<AnalyticalResults> getAnalyticalResults(); - void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver); + void registerSimulationObserver(std::shared_ptr<SimulationObserver> simObserver) override; std::vector<std::string> getDataToCalcTests(); private: diff --git a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeImp.h b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeImp.h index 87e14e74fb08f6e7f0ceba7923e3adf4db39d455..f6f6c39ef9e641c67af5ae8a7c5af220f68c7c66 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeImp.h @@ -5,26 +5,26 @@ #include "TimeTracking.h" #include <memory> -#include <time.h> +#include <ctime> class TimeImp : public TimeTracking, public TimeInfo { public: static std::shared_ptr<TimeImp> getNewInstance(); - void setSimulationStartTime(); - void setSimulationEndTime(); - void setTestStartTime(); - void setTestEndTime(); - void setAnalyticalResultWriteStartTime(); - void setAnalyticalResultWriteEndTime(); - void setResultCheckStartTime(); - void setResultCheckEndTime(); + void setSimulationStartTime() override; + void setSimulationEndTime() override; + void setTestStartTime() override; + void setTestEndTime() override; + void setAnalyticalResultWriteStartTime() override; + void setAnalyticalResultWriteEndTime() override; + void setResultCheckStartTime() override; + void setResultCheckEndTime() override; - std::string getSimulationTime(); - std::string getResultCheckTime(); - std::string getTestTime(); - std::string getAnalyticalResultWriteTime(); + std::string getSimulationTime() override; + std::string getResultCheckTime() override; + std::string getTestTime() override; + std::string getAnalyticalResultWriteTime() override; private: TimeImp(); diff --git a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeInfo.h b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeInfo.h index 11e49b28406ecf08f83f13cfc5cbe09c3ebd8a84..02cf14c5c6db3de64595e58e51acf6771baa1e21 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeInfo.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeInfo.h @@ -6,9 +6,10 @@ class TimeInfo { public: - virtual std::string getSimulationTime() = 0; - virtual std::string getResultCheckTime() = 0; - virtual std::string getTestTime() = 0; - virtual std::string getAnalyticalResultWriteTime() = 0; + virtual ~TimeInfo() = default; + virtual std::string getSimulationTime() = 0; + virtual std::string getResultCheckTime() = 0; + virtual std::string getTestTime() = 0; + virtual std::string getAnalyticalResultWriteTime() = 0; }; -#endif \ No newline at end of file +#endif diff --git a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeTracking.h b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeTracking.h index 736ca764116934dc31e18d7d7c910ead554b253b..663456d6a2c0d428f23a373448ac3c93ad19067f 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Time/TimeTracking.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Time/TimeTracking.h @@ -4,6 +4,7 @@ class TimeTracking { public: + virtual ~TimeTracking() = default; virtual void setSimulationStartTime() = 0; virtual void setSimulationEndTime() = 0; @@ -16,4 +17,4 @@ public: virtual void setAnalyticalResultWriteStartTime() = 0; virtual void setAnalyticalResultWriteEndTime() = 0; }; -#endif \ No newline at end of file +#endif diff --git a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp index 3564f65025a38d37c577b6ea6a882e6f48fd1e65..8646cc1991802b10d284c41acade4f5002df906b 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/VirtualFluidSimulationFactory/VirtualFluidSimulationFactory.cpp @@ -9,9 +9,10 @@ #include "VirtualFluids_GPU/Parameter/Parameter.h" #include "VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" #include "VirtualFluids_GPU/LBM/Simulation.h" +#include <parallel/MPICommunicator.h> + std::shared_ptr<Parameter> vf::gpu::tests::makeParameter(std::shared_ptr<SimulationParameter> simPara) { auto para = std::make_shared<Parameter>(1, 0); @@ -97,7 +98,7 @@ std::shared_ptr<Parameter> vf::gpu::tests::makeParameter(std::shared_ptr<Simulat // TODO: Find out if we still need this // para->setNeedInterface(std::vector<bool>{true, true, true, true, true, true}); - para->setMainKernel(simPara->getKernelConfiguration()->getMainKernel()); + para->configureMainKernel(simPara->getKernelConfiguration()->getMainKernel()); para->setMultiKernelOn(simPara->getKernelConfiguration()->getMultiKernelOn()); para->setMultiKernelLevel(simPara->getKernelConfiguration()->getMultiKernelLevel()); para->setMultiKernel(simPara->getKernelConfiguration()->getMultiKernel()); @@ -119,8 +120,9 @@ const std::function<void()> vf::gpu::tests::makeVirtualFluidSimulation(std::shar auto cudaManager = std::make_shared<CudaMemoryManager>(para); auto grid = makeGridReader(condition, para, cudaManager); BoundaryConditionFactory bc_factory; + vf::parallel::Communicator &communicator = *vf::parallel::MPICommunicator::getInstance(); auto simulation = - std::make_shared<Simulation>(para, cudaManager, vf::gpu::MpiCommunicator::getInstance(), *grid.get(), &bc_factory); + std::make_shared<Simulation>(para, cudaManager, communicator, *grid.get(), &bc_factory); simulation->setDataWriter(dataWriter); return [simulation]() { simulation->run(); }; diff --git a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt index 6ca01d34f0d8fb224f67cdf786160c30dd2bbd97..34db5ea1deff1bbecf61c1b49686c19babfddb50 100644 --- a/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt +++ b/apps/gpu/tests/NumericalTests/configK17chim_nu10tm3.txt @@ -6,7 +6,7 @@ Devices=0 ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest=CumulantK17CompChim +KernelsToTest=K17CompressibleNavierStokesChimeraLegacy NumberOfTimeSteps=20 Viscosity=0.001 Rho0=1.0 diff --git a/apps/gpu/wifi/UniformInflow/configUniformInflow.txt b/apps/gpu/wifi/UniformInflow/configUniformInflow.txt new file mode 100755 index 0000000000000000000000000000000000000000..8509a4ef259a168b31781e63e724371f15e0b46e --- /dev/null +++ b/apps/gpu/wifi/UniformInflow/configUniformInflow.txt @@ -0,0 +1,34 @@ +################################################## +#informations for Writing +################################################## +Path = output/wifi/ +################################################## +#informations for reading +################################################## +GridPath = . +################################################## +Devices = 0 +################################################## +tStartOut = 0 +tOut = 10000 +tEnd = 10000 +################################################## +tStartAveraging = 0 +tStartTmpAveraging = 0 +tAveraging = 10 +tStartOutProbe = 10 +tOutProbe = 10 +################################################## +Ma = 0.05 +nodesPerDiameter = 32 +bodyForce = true +SGSconstant = 0.333 +TurbulenceModel = QR +QuadricLimiterP = 100000.0 +QuadricLimiterM = 100000.0 +QuadricLimiterD = 100000.0 + +################################################## +turbineDiameter = 126 +NumberOfNodesPerAL = 100 +# SmearingWidth = 15 \ No newline at end of file diff --git a/apps/gpu/wifi/UniformInflow/uniform_inflow.py b/apps/gpu/wifi/UniformInflow/uniform_inflow.py new file mode 100755 index 0000000000000000000000000000000000000000..1c71d7c362326d2f49166f76350ab4b8d0ccf1c0 --- /dev/null +++ b/apps/gpu/wifi/UniformInflow/uniform_inflow.py @@ -0,0 +1,150 @@ +#%% +import numpy as np +from pathlib import Path +from mpi4py import MPI +from pyfluids import basics, gpu, logger +from wiFI.wind_farm import create_wind_farm_from_json +from wiFI.logging.logger import LoggerConfig +from wiFI.aeroelastics.stiff_rotor import StiffRotorGPU +from wiFI.interfaces.implementations.velocity_provider.VirtualFluids import VFFarm +import multiprocessing as mp + +mp.set_start_method("spawn", force=True) +#%% +def main(): + communicator = gpu.MpiCommunicator.get_instance() + sim_name = "NREL5MW" + sim_dir = Path("/workspaces/VirtualFluids_dev/output/wifi/") + config_file = Path("apps/gpu/wifi/UniformInflow")/"configUniformInflow.txt" + farm_file = Path("/workspaces/VirtualFluids_dev/wifi/resources/turbine_data/NREL5MW")/"SingleTurbine.json" + use_tip_correction = False + tip_speed_ratio = 7.5 + #%% + logger.Logger.initialize_logger() + #%% + grid_builder = gpu.grid_generator.MultipleGridBuilder() + + config = basics.ConfigurationFile() + config.load(str(config_file)) + + para = gpu.Parameter(communicator.get_number_of_process(), communicator.get_pid(), config) + para.set_use_streams(True) + bc_factory = gpu.BoundaryConditionFactory() + + grid_scaling_factory = gpu.GridScalingFactory() + grid_scaling_factory.set_scaling_factory(gpu.GridScaling.ScaleCompressible) + + #%% + turbine_diameter = config.get_float_value("turbineDiameter", 126) + + + viscosity = config.get_float_value("viscosity", 1.56e-5) + + velocity = 8 + mach = config.get_float_value("Ma", 0.05) + nodes_per_diameter = config.get_uint_value("NodesPerDiameter", 32) + + density = config.get_float_value("Density", 1.225) + level = 0 + n_blade_nodes = config.get_int_value("NumberOfNodesPerAL", 32) + + + # all in s + t_start_out = config.get_float_value("tStartOut") + t_out = config.get_float_value("tOut") + t_end = config.get_float_value("tEnd") # total time of simulation + + t_start_averaging = config.get_float_value("tStartAveraging") + t_start_tmp_averaging = config.get_float_value("tStartTmpAveraging") + t_averaging = config.get_float_value("tAveraging") + t_start_out_probe = config.get_float_value("tStartOutProbe") + t_out_probe = config.get_float_value("tOutProbe") + + #%% + length = np.array([4,3,3])*turbine_diameter + dx = turbine_diameter / nodes_per_diameter + dt = dx * mach / (np.sqrt(3) * velocity) + velocity_LB = velocity * dt / dx # LB units + viscosity_LB = viscosity * dt / (dx * dx) # LB units + pressure_gradient = 0 + epsilon = dx*pow(2,-level)*1.5 + + logger.vf_log_info(f"velocity [dx/dt] = {velocity_LB}") + logger.vf_log_info(f"dt = {dt}") + logger.vf_log_info(f"dx = {dx}") + logger.vf_log_info(f"viscosity [10^8 dx^2/dt] = {viscosity_LB*1e8}") + logger.vf_log_info(f"dpdx = {pressure_gradient}") + logger.vf_log_info(f"mach number = {mach}") + + farm = create_wind_farm_from_json(farm_file, sim_dir, tip_speed_ratio, velocity, True, log_turbine=True, logger_config=LoggerConfig(0, 1.0, timesteps_in_buffer=1)) + + farm.turbine.add_blade_forces_logging(True) + farm.turbine.add_blade_coordinate_logging(True) + farm.turbine.add_blade_velocities_logging(True) + + #%% + para.set_output_prefix(sim_name) + para.set_print_files(True) + + para.set_forcing(0, 0, 0) + para.set_velocity_LB(velocity_LB) + para.set_viscosity_LB(viscosity_LB) + para.set_velocity_ratio(dx/dt) + para.set_viscosity_ratio(dx*dx/dt) + + para.set_main_kernel("CumulantK17") + + para.set_timestep_start_out(int(t_start_out)) + # para.set_timestep_out(20) + para.set_timestep_out(int(t_out)) + para.set_timestep_end(int(t_end)) + para.set_is_body_force(True) + #%% + tm_factory = gpu.TurbulenceModelFactory(para) + tm_factory.read_config_file(config) + #%% + grid_builder.add_coarse_grid(-1.*turbine_diameter, -0.5 * length[1], -0.5 * length[2], length[0]-1.*turbine_diameter, 0.5 * length[1], 0.5 * length[2], dx) + grid_builder.set_periodic_boundary_condition(False, True, True) + grid_builder.build_grids(False) + + + + grid_builder.set_velocity_boundary_condition(gpu.SideType.MX, velocity_LB, 0.0, 0.0) + grid_builder.set_pressure_boundary_condition(gpu.SideType.PX, 0) + + bc_factory.set_velocity_boundary_condition(gpu.VelocityBC.VelocityCompressible) + bc_factory.set_pressure_boundary_condition(gpu.PressureBC.OutflowNonReflective) + + #%% + para.set_initial_condition_uniform(velocity_LB, 0, 0) + + coupled_farm = VFFarm(farm, density, epsilon, level, dt, dx, n_blade_nodes, StiffRotorGPU, (density, ), use_tip_correction, 0) + para.add_actuator(coupled_farm) + + # wall_model_probe = gpu.probes.WallModelProbe("wallModelProbe", para.get_output_path(), int(t_start_averaging/dt), int(t_start_tmp_averaging/dt), int(t_averaging/dt), int(t_start_out_probe/dt), int(t_out_probe/dt)) + # wall_model_probe.add_all_available_statistics() + # wall_model_probe.set_file_name_to_n_out() + # wall_model_probe.set_force_output_to_stress(True) + # if para.get_is_body_force(): + # wall_model_probe.set_evaluate_pressure_gradient(True) + # para.add_probe(wall_model_probe) + + # plane_locs = [farm.positions.x[0] + i*turbine_diameter for i in range(-1,6)] + + # for n_probe, probe_pos in enumerate(plane_locs): + # plane_probe = gpu.probes.PlaneProbe(f"planeProbe_{n_probe+1}", para.get_output_path(), int(t_start_averaging/dt), int(t_averaging/dt), int(t_start_out_probe/dt), int(t_out_probe/dt)) + # plane_probe.set_probe_plane(probe_pos, 0, 0, dx, length[1], length[2]) + # plane_probe.add_all_available_statistics() + # para.add_probe(plane_probe) + + #%% + cuda_memory_manager = gpu.CudaMemoryManager(para) + grid_generator = gpu.GridProvider.make_grid_generator(grid_builder, para, cuda_memory_manager, communicator) + #%% + sim = gpu.Simulation(para, cuda_memory_manager, communicator, grid_generator, bc_factory, tm_factory, grid_scaling_factory) + #%% + sim.run() + MPI.Finalize() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/gpu.cmake b/gpu.cmake index 6bdbf656326c4d733ec2c5b5d08751b3055a7b00..8f3fde523efa4cbf2f0884723728832f82a53231 100644 --- a/gpu.cmake +++ b/gpu.cmake @@ -5,20 +5,23 @@ add_subdirectory(src/gpu/GridGenerator) add_subdirectory(src/gpu/VirtualFluids_GPU) -if(BUILD_VF_ALL_SAMPLES) - list(APPEND USER_APPS - "apps/gpu/LBM/ActuatorLine" - "apps/gpu/LBM/SphereScaling" - "apps/gpu/LBM/TGV_3D") -endif() - ############################################################# ### Apps ### ############################################################# -add_subdirectory(apps/gpu/LBM/DrivenCavity) -add_subdirectory(apps/gpu/LBM/SphereGPU) -add_subdirectory(apps/gpu/LBM/BoundaryLayer) +if(BUILD_VF_ALL_SAMPLES) + list(APPEND USER_APPS + "apps/gpu/DrivenCavityUniform" + "apps/gpu/DrivenCavityMultiGPU" + "apps/gpu/ActuatorLine" + "apps/gpu/SphereScaling" + "apps/gpu/TGV_3D" + "apps/gpu/gridGeneratorTest") +endif() + +add_subdirectory(apps/gpu/DrivenCavity) +add_subdirectory(apps/gpu/SphereGPU) +add_subdirectory(apps/gpu/BoundaryLayer) ############################################################# ### Numeric Tests ### diff --git a/pyproject.toml b/pyproject.toml index 257da6fd95d683081dbff865c864079eae9c675d..df0b13b9c22718ef4172d4698fd29b8e85f0ad22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,46 @@ [build-system] -requires = [ - "setuptools>=42", - "scikit-build", - "cmake", - "ninja; platform_system!='Windows'" +requires = ["scikit-build-core"] +build-backend = "scikit_build_core.build" + +[project] +name = "pyfluids" +version = "0.1.0" +description = "Python bindings for VirtualFluids" +readme = "README.md" +requires-python = ">=3.6" +classifiers = [ + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", ] -build-backend = "setup_builder" -backend-path = ["utilities"] \ No newline at end of file +url = "https://git.rz.tu-bs.de/irmb/virtualfluids" + +[tool.cmake] +jobs = 8 + +[tool.scikit-build] +build-dir = "build" +strict-config = true +logging.level = "INFO" + +[tool.scikit-build.wheel] +packages = ["pythonbindings/pyfluids", "pythonbindings/pyfluids-stubs", "pythonbindings/pymuparser"] + +[tool.scikit_build.cmake] +verbose = true +build-type = "Release" + +[tool.scikit-build.cmake.define] +BUILD_VF_PYTHON_BINDINGS = "ON" +BUILD_SHARED_LIBS = "OFF" +BUILD_VF_UNIT_TESTS = "OFF" +BUILD_WARNINGS_AS_ERRORS = "OFF" + + +[mypy] +plugins = "numpy.typing.mypy_plugin" + diff --git a/pythonbindings/CMakeLists.txt b/pythonbindings/CMakeLists.txt index 037b68baf53d5da8a1ccd20155cb0e7be483176b..8dbf9047ac964b2886a180c6be5d1b753e4fcb24 100644 --- a/pythonbindings/CMakeLists.txt +++ b/pythonbindings/CMakeLists.txt @@ -6,27 +6,81 @@ endif() project(VirtualFluidsPython LANGUAGES ${PYFLUIDS_LANGUAGES}) -pybind11_add_module(python_bindings MODULE src/VirtualFluids.cpp) -target_compile_definitions(python_bindings PUBLIC VF_DOUBLE_ACCURACY) +add_custom_target(python_bindings) -set_target_properties( python_bindings PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/pythonbindings/pyfluids - OUTPUT_NAME "bindings") +set(PYFLUIDS_DIR ${SKBUILD_PLATLIB_DIR}/pyfluids) +set(PYMUPRASER_DIR ${SKBUILD_PLATLIB_DIR}/pymuparser) + + +pybind11_add_module(basics_bindings MODULE src/basics/basics.cpp) +set_target_properties( basics_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "basics") +target_link_libraries(basics_bindings PRIVATE basics) +target_include_directories(basics_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) +target_include_directories(basics_bindings PRIVATE ${CMAKE_BINARY_DIR}) +add_dependencies(python_bindings basics_bindings) + + +pybind11_add_module(logger_bindings MODULE src/logger.cpp) +set_target_properties( logger_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "logger") +target_link_libraries(logger_bindings PRIVATE logger) +target_include_directories(logger_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) +target_include_directories(logger_bindings PRIVATE ${CMAKE_BINARY_DIR}) +add_dependencies(python_bindings logger_bindings) + + +pybind11_add_module(lbm_bindings MODULE src/lbm.cpp) +set_target_properties( lbm_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "lbm") +target_link_libraries(lbm_bindings PRIVATE lbm) +target_include_directories(lbm_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) +target_include_directories(lbm_bindings PRIVATE ${CMAKE_BINARY_DIR}) +add_dependencies(python_bindings lbm_bindings) + +pybind11_add_module(communicator_bindings MODULE src/communicator.cpp) +set_target_properties( communicator_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "communicator") +target_link_libraries(communicator_bindings PRIVATE parallel) +target_include_directories(communicator_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) +target_include_directories(communicator_bindings PRIVATE ${CMAKE_BINARY_DIR}) +target_compile_definitions(communicator_bindings PRIVATE VF_MPI) +add_dependencies(python_bindings communicator_bindings) -target_link_libraries(python_bindings PRIVATE basics logger mpi lbm) IF(BUILD_VF_GPU) - set_source_files_properties(src/VirtualFluids.cpp PROPERTIES LANGUAGE CUDA) + pybind11_add_module(gpu_bindings MODULE src/gpu/gpu.cpp) + set_target_properties( gpu_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "gpu") + set_source_files_properties(src/gpu/gpu.cpp PROPERTIES LANGUAGE CUDA) - target_include_directories(python_bindings PRIVATE ${VF_THIRD_DIR}/cuda_samples/) - target_compile_definitions(python_bindings PRIVATE VF_GPU_PYTHONBINDINGS) + target_include_directories(gpu_bindings PRIVATE ${VF_THIRD_DIR}/cuda_samples/) + + target_link_libraries(gpu_bindings PRIVATE basics GridGenerator VirtualFluids_GPU parallel) + + target_include_directories(gpu_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) + target_include_directories(gpu_bindings PRIVATE ${CMAKE_BINARY_DIR}) + add_dependencies(python_bindings gpu_bindings) - target_link_libraries(python_bindings PRIVATE GridGenerator VirtualFluids_GPU) ENDIF() IF(BUILD_VF_CPU) - target_compile_definitions(python_bindings PRIVATE VF_METIS VF_MPI VF_CPU_PYTHONBINDINGS) - target_link_libraries(python_bindings PRIVATE simulationconfig VirtualFluidsCore muparser) + pybind11_add_module(cpu_bindings MODULE src/cpu/cpu.cpp) + set_target_properties( cpu_bindings PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${PYFLUIDS_DIR} + OUTPUT_NAME "cpu") + target_link_libraries(cpu_bindings PRIVATE simulationconfig VirtualFluidsCore muparser) + + target_include_directories(cpu_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) + target_include_directories(cpu_bindings PRIVATE ${CMAKE_BINARY_DIR}) + + target_compile_definitions(cpu_bindings PRIVATE VF_METIS VF_MPI) + add_dependencies(python_bindings cpu_bindings) # include bindings for muparsers pybind11_add_module(pymuparser MODULE src/muParser.cpp) @@ -41,6 +95,15 @@ IF(BUILD_VF_CPU) target_link_libraries(pymuparser PRIVATE muparser) ENDIF() - -target_include_directories(python_bindings PRIVATE ${CMAKE_SOURCE_DIR}/src/) -target_include_directories(python_bindings PRIVATE ${CMAKE_BINARY_DIR}) \ No newline at end of file +if(BUILD_VF_DOUBLE_ACCURACY) +IF(BUILD_VF_CPU) + target_compile_definitions(cpu_bindings PRIVATE VF_DOUBLE_ACCURACY) +endif() + target_compile_definitions(basics_bindings PRIVATE VF_DOUBLE_ACCURACY) + target_compile_definitions(logger_bindings PRIVATE VF_DOUBLE_ACCURACY) + target_compile_definitions(lbm_bindings PRIVATE VF_DOUBLE_ACCURACY) + IF(BUILD_VF_GPU) + target_compile_definitions(gpu_bindings PRIVATE VF_DOUBLE_ACCURACY) + endif() + target_compile_definitions(communicator_bindings PRIVATE VF_DOUBLE_ACCURACY) +endif() \ No newline at end of file diff --git a/pythonbindings/pyfluids-stubs/__init__.pyi b/pythonbindings/pyfluids-stubs/__init__.pyi index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..df0d398713cd56ef06bf96637d3aca0f6032dc58 100644 --- a/pythonbindings/pyfluids-stubs/__init__.pyi +++ b/pythonbindings/pyfluids-stubs/__init__.pyi @@ -0,0 +1,6 @@ +from . import basics as basics +from . import logger as logger +from . import lbm as lbm +from . import gpu as gpu +from . import cpu as cpu + diff --git a/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi b/pythonbindings/pyfluids-stubs/basics/__init__.pyi similarity index 95% rename from pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi rename to pythonbindings/pyfluids-stubs/basics/__init__.pyi index a646f7e590e2aba91ab1c367f75b8c6ebe8f79ae..ed74e648a0b6739b31853c9633d63eeac3b91df4 100644 --- a/pythonbindings/pyfluids-stubs/bindings/basics/__init__.pyi +++ b/pythonbindings/pyfluids-stubs/basics/__init__.pyi @@ -32,10 +32,13 @@ r""" ! \author Henry Korb ======================================================================================= """ -from typing import ClassVar +from __future__ import annotations -from typing import overload +from typing import ClassVar, overload +from . import logger as logger + +from pyfluids.bindings.basics import logger as logger class ConfigurationFile: def __init__(self) -> None: ... def contains(self, key: str) -> bool: ... diff --git a/pythonbindings/pyfluids-stubs/bindings/__init__.pyi b/pythonbindings/pyfluids-stubs/bindings/__init__.pyi deleted file mode 100644 index 4e7f353eab97cc536f8f18e72319af1cd7a1916a..0000000000000000000000000000000000000000 --- a/pythonbindings/pyfluids-stubs/bindings/__init__.pyi +++ /dev/null @@ -1,38 +0,0 @@ -r""" -======================================================================================= - ____ ____ __ ______ __________ __ __ __ __ - \ \ | | | | | _ \ |___ ___| | | | | / \ | | - \ \ | | | | | |_) | | | | | | | / \ | | - \ \ | | | | | _ / | | | | | | / /\ \ | | - \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ - \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| - \ \ | | ________________________________________________________________ - \ \ | | | ______________________________________________________________| - \ \| | | | __ __ __ __ ______ _______ - \ | | |_____ | | | | | | | | | _ \ / _____) - \ | | _____| | | | | | | | | | | \ \ \_______ - \ | | | | |_____ | \_/ | | | | |_/ / _____ | - \ _____| |__| |________| \_______/ |__| |______/ (_______/ - - This file is part of VirtualFluids. VirtualFluids is free software: you can - redistribute it and/or modify it under the terms of the GNU General Public - License as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. - - VirtualFluids is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License along - with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. - -! \file __init__.pyi -! \ingroup bindings -! \author Henry Korb -======================================================================================= -""" -class ostream_redirect: - def __init__(self, stdout: bool = ..., stderr: bool = ...) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, *args) -> None: ... diff --git a/pythonbindings/pyfluids-stubs/bindings/lbm.pyi b/pythonbindings/pyfluids-stubs/bindings/lbm.pyi deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi b/pythonbindings/pyfluids-stubs/gpu/__init__.pyi similarity index 81% rename from pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi rename to pythonbindings/pyfluids-stubs/gpu/__init__.pyi index 64a598ee1974b089393b328566def02fb3600005..8f78fd3387dc59c94ddf2315635e674a7330dae9 100644 --- a/pythonbindings/pyfluids-stubs/bindings/gpu/__init__.pyi +++ b/pythonbindings/pyfluids-stubs/gpu/__init__.pyi @@ -32,77 +32,88 @@ r""" ! \author Henry Korb ======================================================================================= """ -from typing import Any, Callable, ClassVar, List, Optional +from __future__ import annotations +from typing import Callable, ClassVar, List, Optional -from typing import overload -import numpy -import pyfluids.bindings.basics -import pyfluids.bindings.gpu.grid_generator as grid_generator +from typing import overload, Union +import numpy as np +import numpy.typing as npt +import basics + +from . import grid_generator as grid_generator +from . import probes as probes + +class PreCollisionInteractor: + def __init__(self, *args, **kwargs) -> None: ... + + +class FileCollection: + def __init__(self, *args, **kwargs) -> None: ... class ActuatorFarm(PreCollisionInteractor): def __init__(self, number_of_blades_per_turbine: int, density: float, number_of_nodes_per_blade: int, epsilon: float, level: int, delta_t: float, delta_x: float, use_host_arrays: bool) -> None: ... def add_turbine(self, posX: float, posY: float, posZ: float, diameter: float, omega: float, azimuth: float, yaw: float, bladeRadii: List[float]) -> None: ... def calc_blade_forces(self) -> None: ... - def get_all_azimuths(self) -> numpy.ndarray[numpy.float32]: ... - def get_all_blade_coords_x(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_azimuths(self) -> npt.NDArray[np.float32]: ... + def get_all_blade_coords_x(self) -> npt.NDArray[np.float32]: ... def get_all_blade_coords_x_device(self) -> int: ... - def get_all_blade_coords_y(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_coords_y(self) -> npt.NDArray[np.float32]: ... def get_all_blade_coords_y_device(self) -> int: ... - def get_all_blade_coords_z(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_coords_z(self) -> npt.NDArray[np.float32]: ... def get_all_blade_coords_z_device(self) -> int: ... - def get_all_blade_forces_x(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_forces_x(self) -> npt.NDArray[np.float32]: ... def get_all_blade_forces_x_device(self) -> int: ... - def get_all_blade_forces_y(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_forces_y(self) -> npt.NDArray[np.float32]: ... def get_all_blade_forces_y_device(self) -> int: ... - def get_all_blade_forces_z(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_forces_z(self) -> npt.NDArray[np.float32]: ... def get_all_blade_forces_z_device(self) -> int: ... - def get_all_blade_radii(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_radii(self) -> npt.NDArray[np.float32]: ... def get_all_blade_radii_device(self) -> int: ... - def get_all_blade_velocities_x(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_velocities_x(self) -> npt.NDArray[np.float32]: ... def get_all_blade_velocities_x_device(self) -> int: ... - def get_all_blade_velocities_y(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_velocities_y(self) -> npt.NDArray[np.float32]: ... def get_all_blade_velocities_y_device(self) -> int: ... - def get_all_blade_velocities_z(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_blade_velocities_z(self) -> npt.NDArray[np.float32]: ... def get_all_blade_velocities_z_device(self) -> int: ... - def get_all_omegas(self) -> numpy.ndarray[numpy.float32]: ... - def get_all_turbine_pos_x(self) -> numpy.ndarray[numpy.float32]: ... - def get_all_turbine_pos_y(self) -> numpy.ndarray[numpy.float32]: ... - def get_all_turbine_pos_z(self) -> numpy.ndarray[numpy.float32]: ... - def get_all_yaws(self) -> numpy.ndarray[numpy.float32]: ... + def get_all_omegas(self) -> npt.NDArray[np.float32]: ... + def get_all_turbine_pos_x(self) -> npt.NDArray[np.float32]: ... + def get_all_turbine_pos_y(self) -> npt.NDArray[np.float32]: ... + def get_all_turbine_pos_z(self) -> npt.NDArray[np.float32]: ... + def get_all_yaws(self) -> npt.NDArray[np.float32]: ... def get_turbine_azimuth(self, turbine: int) -> float: ... - def get_turbine_blade_coords_x(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_coords_x(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_coords_x_device(self, turbine: int) -> int: ... - def get_turbine_blade_coords_y(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_coords_y(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_coords_y_device(self, turbine: int) -> int: ... - def get_turbine_blade_coords_z(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_coords_z(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_coords_z_device(self, turbine: int) -> int: ... - def get_turbine_blade_forces_x(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_forces_x(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_forces_x_device(self, turbine: int) -> int: ... - def get_turbine_blade_forces_y(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_forces_y(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_forces_y_device(self, turbine: int) -> int: ... - def get_turbine_blade_forces_z(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_forces_z(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_forces_z_device(self, turbine: int) -> int: ... - def get_turbine_blade_radii(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_radii(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_radii_device(self, turbine: int) -> int: ... - def get_turbine_blade_velocities_x(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_velocities_x(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_velocities_x_device(self, turbine: int) -> int: ... - def get_turbine_blade_velocities_y(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_velocities_y(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_velocities_y_device(self, turbine: int) -> int: ... - def get_turbine_blade_velocities_z(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_blade_velocities_z(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_blade_velocities_z_device(self, turbine: int) -> int: ... def get_turbine_omega(self, turbine: int) -> float: ... - def get_turbine_pos(self, turbine: int) -> numpy.ndarray[numpy.float32]: ... + def get_turbine_pos(self, turbine: int) -> npt.NDArray[np.float32]: ... def get_turbine_yaw(self, turbine: int) -> float: ... - def set_all_azimuths(self, azimuths: numpy.ndarray[numpy.float32]) -> None: ... - def set_all_blade_coords(self, blade_coords_x: numpy.ndarray[numpy.float32], blade_coords_y: numpy.ndarray[numpy.float32], blade_coords_z: numpy.ndarray[numpy.float32]) -> None: ... - def set_all_blade_forces(self, blade_forces_x: numpy.ndarray[numpy.float32], blade_forces_y: numpy.ndarray[numpy.float32], blade_forces_z: numpy.ndarray[numpy.float32]) -> None: ... - def set_all_blade_velocities(self, blade_velocities_x: numpy.ndarray[numpy.float32], blade_velocities_y: numpy.ndarray[numpy.float32], blade_velocities_z: numpy.ndarray[numpy.float32]) -> None: ... - def set_all_omegas(self, omegas: numpy.ndarray[numpy.float32]) -> None: ... - def set_all_yaws(self, yaws: numpy.ndarray[numpy.float32]) -> None: ... + def set_all_azimuths(self, azimuths: npt.NDArray[np.float32]) -> None: ... + def set_all_blade_coords(self, blade_coords_x: npt.NDArray[np.float32], blade_coords_y: npt.NDArray[np.float32], blade_coords_z: npt.NDArray[np.float32]) -> None: ... + def set_all_blade_forces(self, blade_forces_x: npt.NDArray[np.float32], blade_forces_y: npt.NDArray[np.float32], blade_forces_z: npt.NDArray[np.float32]) -> None: ... + def set_all_blade_velocities(self, blade_velocities_x: npt.NDArray[np.float32], blade_velocities_y: npt.NDArray[np.float32], blade_velocities_z: npt.NDArray[np.float32]) -> None: ... + def set_all_omegas(self, omegas: npt.NDArray[np.float32]) -> None: ... + def set_all_yaws(self, yaws: npt.NDArray[np.float32]) -> None: ... def set_turbine_azimuth(self, turbine: int, azimuth: float) -> None: ... - def set_turbine_blade_coords(self, turbine: int, blade_coords_x: numpy.ndarray[numpy.float32], blade_coords_y: numpy.ndarray[numpy.float32], blade_coords_z: numpy.ndarray[numpy.float32]) -> None: ... - def set_turbine_blade_forces(self, turbine: int, blade_forces_x: numpy.ndarray[numpy.float32], blade_forces_y: numpy.ndarray[numpy.float32], blade_forces_z: numpy.ndarray[numpy.float32]) -> None: ... - def set_turbine_blade_velocities(self, turbine: int, blade_velocities_x: numpy.ndarray[numpy.float32], blade_velocities_y: numpy.ndarray[numpy.float32], blade_velocities_z: numpy.ndarray[numpy.float32]) -> None: ... + def set_turbine_blade_coords(self, turbine: int, blade_coords_x: npt.NDArray[np.float32], blade_coords_y: npt.NDArray[np.float32], blade_coords_z: npt.NDArray[np.float32]) -> None: ... + def set_turbine_blade_forces(self, turbine: int, blade_forces_x: npt.NDArray[np.float32], blade_forces_y: npt.NDArray[np.float32], blade_forces_z: npt.NDArray[np.float32]) -> None: ... + def set_turbine_blade_velocities(self, turbine: int, blade_velocities_x: npt.NDArray[np.float32], blade_velocities_y: npt.NDArray[np.float32], blade_velocities_z: npt.NDArray[np.float32]) -> None: ... def set_turbine_omega(self, turbine: int, omega: float) -> None: ... def set_turbine_yaw(self, turbine: int, yaw: float) -> None: ... @property @@ -116,21 +127,23 @@ class ActuatorFarm(PreCollisionInteractor): @property def number_of_indices(self) -> int: ... @property - def number_of_nodes(self) -> int: ... + def number_of_grid_nodes(self) -> int: ... @property def number_of_nodes_per_blade(self) -> int: ... @property def number_of_turbines(self) -> int: ... + class BoundaryConditionFactory: def __init__(self) -> None: ... - def set_geometry_boundary_condition(self, boundary_condition_type) -> None: ... - def set_no_slip_boundary_condition(self, boundary_condition_type) -> None: ... - def set_precursor_boundary_condition(self, boundary_condition_type) -> None: ... - def set_pressure_boundary_condition(self, boundary_condition_type) -> None: ... - def set_slip_boundary_condition(self, boundary_condition_type) -> None: ... - def set_stress_boundary_condition(self, boundary_condition_type) -> None: ... - def set_velocity_boundary_condition(self, boundary_condition_type) -> None: ... + def set_geometry_boundary_condition(self, boundary_condition_type: Union[SlipBC, VelocityBC, NoSlipBC]) -> None: ... + def set_no_slip_boundary_condition(self, boundary_condition_type: NoSlipBC) -> None: ... + def set_precursor_boundary_condition(self, boundary_condition_type: PrecursorBC) -> None: ... + def set_pressure_boundary_condition(self, boundary_condition_type: PressureBC) -> None: ... + def set_slip_boundary_condition(self, boundary_condition_type: SlipBC) -> None: ... + def set_stress_boundary_condition(self, boundary_condition_type: StressBC) -> None: ... + def set_velocity_boundary_condition(self, boundary_condition_type: VelocityBC) -> None: ... + class MpiCommunicator: def __init__(self, *args, **kwargs) -> None: ... @@ -139,9 +152,11 @@ class MpiCommunicator: def get_number_of_process(self) -> int: ... def get_pid(self) -> int: ... + class CudaMemoryManager: def __init__(self, parameter: Parameter) -> None: ... + class FileType: __members__: ClassVar[dict] = ... # read-only VTK: ClassVar[FileType] = ... @@ -157,10 +172,14 @@ class FileType: @property def name(self) -> str: ... + class GridProvider: def __init__(self, *args, **kwargs) -> None: ... @staticmethod - def make_grid_generator(builder: grid_generator.GridBuilder, para: Parameter, cuda_memory_manager: CudaMemoryManager, communicator: Communicator) -> GridProvider: ... + def make_grid_generator(builder: grid_generator.GridBuilder, para: Parameter, cuda_memory_manager: CudaMemoryManager, communicator: MpiCommunicator) -> GridProvider: ... + +class MultipleGridBuilder: + def __init__(self) -> None: ... class GridScaling: __members__: ClassVar[dict] = ... # read-only @@ -179,10 +198,12 @@ class GridScaling: @property def name(self) -> str: ... + class GridScalingFactory: def __init__(self) -> None: ... def set_scaling_factory(self, scaling_type) -> None: ... + class NoSlipBC: __members__: ClassVar[dict] = ... # read-only NoSlip3rdMomentsCompressible: ClassVar[NoSlipBC] = ... @@ -202,6 +223,7 @@ class NoSlipBC: @property def name(self) -> str: ... + class OutputVariable: __members__: ClassVar[dict] = ... # read-only Distributions: ClassVar[OutputVariable] = ... @@ -218,13 +240,14 @@ class OutputVariable: @property def name(self) -> str: ... + class Parameter: @overload - def __init__(self, number_of_processes: int, my_ID: int, config_data: Optional[pyfluids.bindings.basics.ConfigurationFile]) -> None: ... + def __init__(self, number_of_processes: int, my_ID: int, config_data: Optional[basics.ConfigurationFile]) -> None: ... @overload def __init__(self, number_of_processes: int, my_ID: int) -> None: ... @overload - def __init__(self, config_data: pyfluids.bindings.basics.ConfigurationFile) -> None: ... + def __init__(self, config_data: basics.ConfigurationFile) -> None: ... def add_actuator(self, actuator: PreCollisionInteractor) -> None: ... def add_probe(self, probe: PreCollisionInteractor) -> None: ... def get_SGS_constant(self) -> float: ... @@ -245,7 +268,7 @@ class Parameter: def set_diff_on(self, is_diff: bool) -> None: ... def set_forcing(self, forcing_x: float, forcing_y: float, forcing_z: float) -> None: ... def set_has_wall_model_monitor(self, has_wall_monitor: bool) -> None: ... - def set_initial_condition(self, init_func: Callable[[float,float,float],List[float]]) -> None: ... + def set_initial_condition(self, init_func: Callable[[float, float, float], List[float]]) -> None: ... def set_initial_condition_log_law(self, u_star: float, z0: float, velocity_ratio: float) -> None: ... def set_initial_condition_perturbed_log_law(self, u_star: float, z0: float, length_x: float, length_z: float, height: float, velocity_ratio: float) -> None: ... def set_initial_condition_uniform(self, velocity_x: float, velocity_y: float, velocity_z: float) -> None: ... @@ -270,8 +293,6 @@ class Parameter: def set_viscosity_LB(self, viscosity: float) -> None: ... def set_viscosity_ratio(self, viscosity_ratio: float) -> None: ... -class PreCollisionInteractor: - def __init__(self, *args, **kwargs) -> None: ... class PrecursorBC: __members__: ClassVar[dict] = ... # read-only @@ -290,9 +311,11 @@ class PrecursorBC: @property def name(self) -> str: ... + class PrecursorWriter(PreCollisionInteractor): def __init__(self, filename: str, output_path: str, x_pos: float, y_min: float, y_max: float, z_min: float, z_max: float, t_start_out: int, t_save: int, output_variable: OutputVariable, max_timesteps_per_file: int) -> None: ... + class PressureBC: __members__: ClassVar[dict] = ... # read-only NotSpecified: ClassVar[PressureBC] = ... @@ -314,6 +337,7 @@ class PressureBC: @property def name(self) -> str: ... + class SideType: __members__: ClassVar[dict] = ... # read-only GEOMETRY: ClassVar[SideType] = ... @@ -335,6 +359,7 @@ class SideType: @property def name(self) -> str: ... + class Simulation: @overload def __init__(self, parameter: Parameter, memoryManager: CudaMemoryManager, communicator, gridProvider: GridProvider, bcFactory: BoundaryConditionFactory, gridScalingFactory: GridScalingFactory) -> None: ... @@ -346,6 +371,7 @@ class Simulation: def addKineticEnergyAnalyzer(self, t_analyse: int) -> None: ... def run(self) -> None: ... + class SlipBC: __members__: ClassVar[dict] = ... # read-only NotSpecified: ClassVar[SlipBC] = ... @@ -366,6 +392,7 @@ class SlipBC: @property def name(self) -> str: ... + class StressBC: __members__: ClassVar[dict] = ... # read-only NotSpecified: ClassVar[StressBC] = ... @@ -384,6 +411,7 @@ class StressBC: @property def name(self) -> str: ... + class TurbulenceModel: __members__: ClassVar[dict] = ... # read-only AMD: ClassVar[TurbulenceModel] = ... @@ -402,15 +430,18 @@ class TurbulenceModel: @property def name(self) -> str: ... + class TurbulenceModelFactory: def __init__(self, para: Parameter) -> None: ... - def read_config_file(self, config_data: pyfluids.bindings.basics.ConfigurationFile) -> None: ... + def read_config_file(self, config_data: basics.ConfigurationFile) -> None: ... def set_model_constant(self, model_constant: float) -> None: ... def set_turbulence_model(self, turbulence_model: TurbulenceModel) -> None: ... + class VTKFileCollection(FileCollection): def __init__(self, prefix: str) -> None: ... + class VelocityBC: __members__: ClassVar[dict] = ... # read-only NotSpecified: ClassVar[VelocityBC] = ... @@ -430,7 +461,5 @@ class VelocityBC: @property def name(self) -> str: ... -class FileCollection: - def __init__(self, *args, **kwargs) -> None: ... def create_file_collection(prefix: str, type: FileType) -> FileCollection: ... diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi b/pythonbindings/pyfluids-stubs/gpu/grid_generator.pyi similarity index 79% rename from pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi rename to pythonbindings/pyfluids-stubs/gpu/grid_generator.pyi index 433a20e7efe472bd791b1d2a0f43859676e8fcf0..b1afd89f6455b5fdf5df568c7e03656229d69c1d 100644 --- a/pythonbindings/pyfluids-stubs/bindings/gpu/grid_generator.pyi +++ b/pythonbindings/pyfluids-stubs/gpu/grid_generator.pyi @@ -32,15 +32,23 @@ r""" ! \author Henry Korb ======================================================================================= """ -from typing import Any, List +from __future__ import annotations + +from typing import List from typing import overload -import pyfluids.bindings.basics -import pyfluids.bindings.gpu +import gpu + + class BoundingBox: def __init__(self, min_x: float, max_x: float, min_y: float, max_y: float, min_z: float, max_z: float) -> None: ... + +class Object: + def __init__(self, *args, **kwargs) -> None: ... + + class Conglomerate(Object): def __init__(self, *args, **kwargs) -> None: ... def add(self, object: Object) -> None: ... @@ -48,27 +56,33 @@ class Conglomerate(Object): def make_shared() -> Conglomerate: ... def subtract(self, object: Object) -> None: ... + class Cuboid(Object): def __init__(self, min_x1: float, min_x2: float, min_x3: float, max_x1: float, max_x2: float, max_x3: float) -> None: ... + class GridBuilder: def __init__(self, *args, **kwargs) -> None: ... def get_number_of_grid_levels(self) -> int: ... + class GridFactory: def __init__(self, *args, **kwargs) -> None: ... @staticmethod def make() -> GridFactory: ... + class LevelGridBuilder(GridBuilder): def __init__(self, *args, **kwargs) -> None: ... - def set_no_slip_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType) -> None: ... + def set_no_slip_boundary_condition(self, side_type: gpu.SideType) -> None: ... def set_periodic_boundary_condition(self, periodic_x: bool, periodic_y: bool, periodic_z: bool) -> None: ... - def set_precursor_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType, file_collection: pyfluids.bindings.gpu.VelocityFileCollection, n_t_read: int, velocity_x: float = ..., velocity_y: float = ..., velocity_z: float = ..., file_level_to_grid_level_map: List[int] = ...) -> None: ... - def set_pressure_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType, rho: float) -> None: ... - def set_slip_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType, normal_x: float, normal_y: float, normal_z: float) -> None: ... - def set_stress_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType, normal_x: float, normal_y: float, normal_z: float, sampling_offset: int, z0: float, dx: float, q: float) -> None: ... - def set_velocity_boundary_condition(self, side_type: pyfluids.bindings.gpu.SideType, vx: float, vy: float, vz: float) -> None: ... + def set_precursor_boundary_condition(self, side_type: gpu.SideType, file_collection: gpu.FileCollection, n_t_read: int, velocity_x: float = ..., velocity_y: float = ..., velocity_z: float = ..., file_level_to_grid_level_map: List[int] = ...) -> None: ... + def set_pressure_boundary_condition(self, side_type: gpu.SideType, rho: float) -> None: ... + def set_slip_boundary_condition(self, side_type: gpu.SideType, normal_x: float, normal_y: float, normal_z: float) -> None: ... + def set_stress_boundary_condition(self, side_type: gpu.SideType, normal_x: float, normal_y: float, normal_z: float, sampling_offset: int, z0: float, dx: float, q: float = ...) -> None: ... + def set_velocity_boundary_condition(self, side_type: gpu.SideType, vx: float, vy: float, vz: float) -> None: ... + + class MultipleGridBuilder(LevelGridBuilder): def __init__(self, *args, **kwargs) -> None: ... @@ -86,14 +100,13 @@ class MultipleGridBuilder(LevelGridBuilder): @staticmethod def make_shared(grid_factory: GridFactory) -> MultipleGridBuilder: ... -class Object: - def __init__(self, *args, **kwargs) -> None: ... class Sphere(Object): def __init__(self, *args, **kwargs) -> None: ... @staticmethod def make_shared() -> Sphere: ... + class TriangularMesh(Object): def __init__(self, *args, **kwargs) -> None: ... @staticmethod diff --git a/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi b/pythonbindings/pyfluids-stubs/gpu/probes.pyi similarity index 95% rename from pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi rename to pythonbindings/pyfluids-stubs/gpu/probes.pyi index af9c40078e6009efebda4450b5c5e23586aa1e83..4c275d1d6f2eb2bc6a63ae0a8a015d5b0eee6472 100644 --- a/pythonbindings/pyfluids-stubs/bindings/gpu/probes.pyi +++ b/pythonbindings/pyfluids-stubs/gpu/probes.pyi @@ -32,27 +32,11 @@ r""" ! \author Henry Korb ======================================================================================= """ +from __future__ import annotations from typing import ClassVar, List -import pyfluids.bindings.gpu +import gpu -class PlanarAverageProbe(Probe): - def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int, plane_normal: str) -> None: ... - -class PlaneProbe(Probe): - def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ... - def set_probe_plane(self, pos_x: float, pos_y: float, pos_z: float, delta_x: float, delta_y: float, delta_z: float) -> None: ... - -class PointProbe(Probe): - def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int, output_timeseries: bool) -> None: ... - def add_probe_points_from_list(self, point_coords_x: List[float], point_coords_y: List[float], point_coords_z: List[float]) -> None: ... - def add_probe_points_from_x_normal_plane(self, pos_x: float, pos0_y: float, pos0_z: float, pos1_y: float, pos1_z: float, n_y: int, n_z: int) -> None: ... - -class Probe(pyfluids.bindings.gpu.PreCollisionInteractor): - def __init__(self, *args, **kwargs) -> None: ... - def add_all_available_statistics(self) -> None: ... - def add_statistic(self, variable: Statistic) -> None: ... - def set_file_name_to_n_out(self) -> None: ... class Statistic: __members__: ClassVar[dict] = ... # read-only @@ -79,6 +63,30 @@ class Statistic: @property def name(self) -> str: ... + +class Probe(gpu.PreCollisionInteractor): + def __init__(self, *args, **kwargs) -> None: ... + def add_all_available_statistics(self) -> None: ... + def add_statistic(self, variable: Statistic) -> None: ... + def set_file_name_to_n_out(self) -> None: ... + + +class PlanarAverageProbe(Probe): + def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int, plane_normal: str) -> None: ... + + +class PlaneProbe(Probe): + def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ... + def set_probe_plane(self, pos_x: float, pos_y: float, pos_z: float, delta_x: float, delta_y: float, delta_z: float) -> None: ... + + +class PointProbe(Probe): + def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_avg: int, t_start_out: int, t_out: int, output_timeseries: bool) -> None: ... + def add_probe_point(self, point_coord_x: float, point_coord_y: float, point_coord_z: float) -> None: ... + def add_probe_points_from_list(self, point_coords_x: List[float], point_coords_y: List[float], point_coords_z: List[float]) -> None: ... + def add_probe_points_from_x_normal_plane(self, pos_x: float, pos0_y: float, pos0_z: float, pos1_y: float, pos1_z: float, n_y: int, n_z: int) -> None: ... + + class WallModelProbe(Probe): def __init__(self, probe_name: str, output_path: str, t_start_avg: int, t_start_tmp_avg: int, t_avg: int, t_start_out: int, t_out: int) -> None: ... def set_evaluate_pressure_gradient(self, eval_press_grad: bool) -> None: ... diff --git a/pythonbindings/pyfluids-stubs/bindings/logger.pyi b/pythonbindings/pyfluids-stubs/logger.pyi similarity index 98% rename from pythonbindings/pyfluids-stubs/bindings/logger.pyi rename to pythonbindings/pyfluids-stubs/logger.pyi index fe84eeb18f3245ef72ed023b2de9db7b9131d144..91c1346c2de2313de2c8df4a0b6d5eb4f4ab87bd 100644 --- a/pythonbindings/pyfluids-stubs/bindings/logger.pyi +++ b/pythonbindings/pyfluids-stubs/logger.pyi @@ -32,12 +32,16 @@ r""" ! \author Henry Korb ======================================================================================= """ +from __future__ import annotations + + class Logger: @staticmethod def change_log_path(path: str) -> None: ... @staticmethod def initialize_logger() -> None: ... + def vf_log_critical(message: str) -> None: ... def vf_log_debug(message: str) -> None: ... def vf_log_info(message: str) -> None: ... diff --git a/pythonbindings/pyfluids/__init__.py b/pythonbindings/pyfluids/__init__.py index f0537b758267e22a72e5030340de7b87d52f35c3..5b4197972c0a8738c551e57e635415e3858f53e6 100644 --- a/pythonbindings/pyfluids/__init__.py +++ b/pythonbindings/pyfluids/__init__.py @@ -33,22 +33,26 @@ r""" ======================================================================================= """ try: - from .bindings import basics + from . import basics except ImportError: print("Basics bindings not included") try: - from .bindings import logger + from . import logger except ImportError: print("Logger bindings not included") try: - from .bindings import lbm + from . import lbm except ImportError: print("LBM bindings not included") try: - from .bindings import gpu + from . import communicator +except ImportError: + print("communicator bindings not included") +try: + from . import gpu except ImportError: print("GPU bindings not included") try: - from .bindings import cpu + from . import cpu except ImportError: print("CPU bindings not included") \ No newline at end of file diff --git a/pythonbindings/pyfluids/timeseries_probe_reader.py b/pythonbindings/pyfluids/timeseries_probe_reader.py new file mode 100644 index 0000000000000000000000000000000000000000..d8aa7af05a82b92a1a9cab9ea791de897ac89c13 --- /dev/null +++ b/pythonbindings/pyfluids/timeseries_probe_reader.py @@ -0,0 +1,47 @@ +import numpy as np +from pathlib import Path +import pandas as pd +#%% + + +class TimeseriesProbeReader: + def __init__(self, file: Path): + self.file = file + self.quants, self.positions, self.data = \ + self.read_file() + + def read_file(self): + with open(self.file, "rb") as f: + header_length = 0 + header_length += len(f.readline()) # first line + quant_line = f.readline() + header_length += len(f.readline()) # number of points + number_of_points_line = f.readline() + header_length += len(f.readline()) # positions + n_points = int(number_of_points_line) + positions = np.zeros((n_points, 3)) + for i in range(n_points): + pos_line = f.readline() + header_length += len(pos_line) + positions[i] = [float(pos) for pos in pos_line.split(b", ")] + + header_length += len(quant_line) + header_length += len(number_of_points_line) + + quants = quant_line.decode().split(" ")[1:-1] + n_quants = len(quants) + data = np.fromfile(self.file, dtype=np.float32, offset=header_length) + n_timesteps = len(data)//(n_quants*n_points+1) + return quants, positions, data.reshape(n_timesteps, n_points*n_quants+1) + + def get_data(self): + return self.data + + def get_positions(self): + return self.positions + + def get_quantities(self): + return self.quants + + def to_dataframe(self): + return pd.DataFrame(self.data[:,1:], columns=self.quants, index=self.data[:,0]) \ No newline at end of file diff --git a/pythonbindings/src/basics/basics.cpp b/pythonbindings/src/basics/basics.cpp index 0b294b7a8de2f4f396dac418b0544b5f99ecec3d..126d8614e1b40ba0658a5335d5eb9d147309eae0 100644 --- a/pythonbindings/src/basics/basics.cpp +++ b/pythonbindings/src/basics/basics.cpp @@ -37,12 +37,8 @@ namespace basics { namespace py = pybind11; - py::module makeModule(py::module_ &parentModule) + PYBIND11_MODULE(basics, m) { - py::module basicsModule = parentModule.def_submodule("basics"); - - configuration::makeModule(basicsModule); - - return basicsModule; + configuration::makeModule(m); } } \ No newline at end of file diff --git a/pythonbindings/src/basics/submodules/configuration_file.cpp b/pythonbindings/src/basics/submodules/configuration_file.cpp index 7fcd48c34824b9370eeac1872c899bf980176a52..cb9154e23aa9df3dae66163b4703bfe4ecae0c31 100644 --- a/pythonbindings/src/basics/submodules/configuration_file.cpp +++ b/pythonbindings/src/basics/submodules/configuration_file.cpp @@ -53,7 +53,7 @@ namespace configuration .def("get_double_value", static_cast<double (vf::basics::ConfigurationFile::*)(const std::string&, double ) const>(&vf::basics::ConfigurationFile::getValue), py::arg("key"), py::arg("default_value")) .def("get_bool_value" , static_cast<bool (vf::basics::ConfigurationFile::*)(const std::string&) const>(&vf::basics::ConfigurationFile::getValue), py::arg("key")) .def("get_bool_value" , static_cast<bool (vf::basics::ConfigurationFile::*)(const std::string&, bool ) const>(&vf::basics::ConfigurationFile::getValue), py::arg("key"), py::arg("default_value")) - .def("get_string_value", static_cast<std::string (vf::basics::ConfigurationFile::*)(const std::string&) const>(&vf::basics::ConfigurationFile::getValue), py::arg("key")) + .def("get_string_value", static_cast<std::string (vf::basics::ConfigurationFile::*)(const std::string&) const>(&vf::basics::ConfigurationFile::getValue<std::string>), py::arg("key")) .def("get_string_value", static_cast<std::string (vf::basics::ConfigurationFile::*)(const std::string&, std::string) const>(&vf::basics::ConfigurationFile::getValue), py::arg("key"), py::arg("default_value")); } } \ No newline at end of file diff --git a/pythonbindings/src/gpu/submodules/communicator.cpp b/pythonbindings/src/communicator.cpp similarity index 78% rename from pythonbindings/src/gpu/submodules/communicator.cpp rename to pythonbindings/src/communicator.cpp index f17fa749461b522ffb3254cad7f9b6675d3de4fc..fe706bb9eba4083f2a1a705a3ee615b727de77c8 100644 --- a/pythonbindings/src/gpu/submodules/communicator.cpp +++ b/pythonbindings/src/communicator.cpp @@ -30,18 +30,20 @@ //! \ingroup submodules //! \author Henry Korb //======================================================================================= +#include <pybind11/cast.h> #include <pybind11/pybind11.h> -#include <gpu/VirtualFluids_GPU/Communication/MpiCommunicator.h> -namespace communicator +#include <parallel/MPICommunicator.h> + +namespace communicator_bindings { - namespace py = pybind11; +namespace py = pybind11; - void makeModule(py::module_ &parentModule) - { - py::class_<vf::gpu::MpiCommunicator, std::unique_ptr<vf::gpu::MpiCommunicator, py::nodelete>>(parentModule, "MpiCommunicator") - .def_static("get_instance", &vf::gpu::MpiCommunicator::getInstance, py::return_value_policy::reference) - .def("get_number_of_process", &vf::gpu::MpiCommunicator::getNumberOfProcess) - .def("get_pid", &vf::gpu::MpiCommunicator::getPID); - } -} \ No newline at end of file +PYBIND11_MODULE(communicator, m) +{ + py::class_<vf::parallel::MPICommunicator, std::shared_ptr<vf::parallel::MPICommunicator>>(m, "Communicator") + .def_static("get_instance", &vf::parallel::MPICommunicator::getInstance) + .def("get_number_of_processes", &vf::parallel::MPICommunicator::getNumberOfProcesses) + .def("get_process_id", py::overload_cast<>(&vf::parallel::MPICommunicator::getProcessID, py::const_)); +} +} // namespace communicator_bindings diff --git a/pythonbindings/src/cpu/cpu.cpp b/pythonbindings/src/cpu/cpu.cpp index 75143d913596c74a26f25ce64f1e6d214a442e34..baced0fc11afd6a12721759780d82f8a26d56cfc 100644 --- a/pythonbindings/src/cpu/cpu.cpp +++ b/pythonbindings/src/cpu/cpu.cpp @@ -38,18 +38,16 @@ #include "submodules/simulationparameters.cpp" #include "submodules/writer.cpp" -namespace cpu +namespace cpu_bindings { namespace py = pybind11; - py::module makeModule(py::module_ &parentModule) + PYBIND11_MODULE(cpu, m) { - py::module cpuModule = parentModule.def_submodule("cpu"); - boundaryconditions::makeModule(cpuModule); - simulation::makeModule(cpuModule); - geometry::makeModule(cpuModule); - kernel::makeModule(cpuModule); - parameters::makeModule(cpuModule); - writer::makeModule(cpuModule); - return cpuModule; + boundaryconditions::makeModule(m); + simulation::makeModule(m); + geometry::makeModule(m); + kernel::makeModule(m); + parameters::makeModule(m); + writer::makeModule(m); } } \ No newline at end of file diff --git a/pythonbindings/src/gpu/gpu.cpp b/pythonbindings/src/gpu/gpu.cpp index 9eb160ae7765f16a6437e343cb878bb4b80877bf..dcb4ded4b1f0f92748323081b7de9504c2995542 100644 --- a/pythonbindings/src/gpu/gpu.cpp +++ b/pythonbindings/src/gpu/gpu.cpp @@ -35,7 +35,6 @@ #include "submodules/simulation.cpp" #include "submodules/parameter.cpp" #include "submodules/boundary_conditions.cpp" -#include "submodules/communicator.cpp" #include "submodules/cuda_memory_manager.cpp" #include "submodules/probes.cpp" #include "submodules/precursor_writer.cpp" @@ -46,27 +45,22 @@ #include "submodules/actuator_farm.cpp" #include "submodules/grid_scaling_factory.cpp" -namespace gpu +namespace gpu_bindings { - namespace py = pybind11; - - py::module makeModule(py::module_ &parentModule) - { - py::module gpuModule = parentModule.def_submodule("gpu"); - simulation::makeModule(gpuModule); - parameter::makeModule(gpuModule); - pre_collision_interactor::makeModule(gpuModule); - actuator_farm::makeModule(gpuModule); - boundary_conditions::makeModule(gpuModule); - transient_bc_setter::makeModule(gpuModule); - communicator::makeModule(gpuModule); - cuda_memory_manager::makeModule(gpuModule); - probes::makeModule(gpuModule); - precursor_writer::makeModule(gpuModule); - grid_generator::makeModule(gpuModule); - grid_provider::makeModule(gpuModule); - turbulence_model::makeModule(gpuModule); - grid_scaling_factory::makeModule(gpuModule); - return gpuModule; - } -} \ No newline at end of file +PYBIND11_MODULE(gpu, m) +{ + simulation::makeModule(m); + parameter::makeModule(m); + pre_collision_interactor::makeModule(m); + actuator_farm::makeModule(m); + boundary_conditions::makeModule(m); + transient_bc_setter::makeModule(m); + cuda_memory_manager::makeModule(m); + probes::makeModule(m); + precursor_writer::makeModule(m); + grid_generator::makeModule(m); + grid_provider::makeModule(m); + turbulence_model::makeModule(m); + grid_scaling_factory::makeModule(m); +} +} // namespace gpu_bindings diff --git a/pythonbindings/src/gpu/submodules/actuator_farm.cpp b/pythonbindings/src/gpu/submodules/actuator_farm.cpp index a930616db3e0d0713bdf57157387d75d171603de..86e3f5a42152e60d6b62e32fb894406efc8384ea 100644 --- a/pythonbindings/src/gpu/submodules/actuator_farm.cpp +++ b/pythonbindings/src/gpu/submodules/actuator_farm.cpp @@ -30,10 +30,13 @@ //! \ingroup submodules //! \author Henry Korb //======================================================================================= + #include <pybind11/pybind11.h> #include <pybind11/numpy.h> #include <gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h> #include <gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h> + + class PyActuatorFarm : public ActuatorFarm { public: @@ -43,13 +46,20 @@ public: PYBIND11_OVERRIDE_NAME(void, ActuatorFarm, "calc_blade_forces", calcBladeForces); } }; + namespace actuator_farm { namespace py = pybind11; + template<class dtype> + dtype* np_to_arr(py::array_t<dtype, py::array::c_style> array){ return static_cast<dtype *>(array.request().ptr); }; + + template<class dtype> + intptr_t arr_to_cp(dtype* array){ return reinterpret_cast<intptr_t>(array); }; + void makeModule(py::module_ &parentModule) { - using arr = py::array_t<float, py::array::c_style>; + using arr = py::array_t<real, py::array::c_style>; py::class_<ActuatorFarm, PreCollisionInteractor, PyActuatorFarm, std::shared_ptr<ActuatorFarm>>(parentModule, "ActuatorFarm", py::dynamic_attr()) .def(py::init< const uint, @@ -71,7 +81,7 @@ namespace actuator_farm .def_property_readonly("number_of_turbines", &ActuatorFarm::getNumberOfTurbines) .def_property_readonly("number_of_nodes_per_blade", &ActuatorFarm::getNumberOfNodesPerBlade) .def_property_readonly("number_of_blades_per_turbine", &ActuatorFarm::getNumberOfBladesPerTurbine) - .def_property_readonly("number_of_nodes", &ActuatorFarm::getNumberOfNodes) + .def_property_readonly("number_of_grid_nodes", &ActuatorFarm::getNumberOfGridNodes) .def_property_readonly("number_of_indices", &ActuatorFarm::getNumberOfIndices) .def_property_readonly("density", &ActuatorFarm::getDensity) .def_property_readonly("delta_t", &ActuatorFarm::getDeltaT) @@ -79,7 +89,9 @@ namespace actuator_farm .def("add_turbine", &ActuatorFarm::addTurbine, py::arg("posX"), py::arg("posY"), py::arg("posZ"), py::arg("diameter"), py::arg("omega"), py::arg("azimuth"), py::arg("yaw"), py::arg("bladeRadii")) - .def("get_turbine_pos", [](ActuatorFarm& al, uint turbine){ real position[3] = {al.getTurbinePosX(turbine), al.getTurbinePosY(turbine), al.getTurbinePosZ(turbine)}; return arr(3, position); }, py::arg("turbine")) + .def("get_turbine_pos", [](ActuatorFarm& al, uint turbine){ + real position[3] = {al.getTurbinePosX(turbine), al.getTurbinePosY(turbine), al.getTurbinePosZ(turbine)}; return arr(3, position); + }, py::arg("turbine")) .def("get_turbine_azimuth", &ActuatorFarm::getTurbineAzimuth, py::arg("turbine")) .def("get_turbine_yaw", &ActuatorFarm::getTurbineYaw, py::arg("turbine")) .def("get_turbine_omega", &ActuatorFarm::getTurbineOmega, py::arg("turbine")) @@ -112,59 +124,53 @@ namespace actuator_farm .def("get_turbine_blade_forces_y", [](ActuatorFarm& al, uint turbine){ return arr({al.getNumberOfBladesPerTurbine(), al.getNumberOfNodesPerBlade()}, al.getTurbineBladeForcesYDevice(turbine)); }, py::arg("turbine") ) .def("get_turbine_blade_forces_z", [](ActuatorFarm& al, uint turbine){ return arr({al.getNumberOfBladesPerTurbine(), al.getNumberOfNodesPerBlade()}, al.getTurbineBladeForcesZDevice(turbine)); }, py::arg("turbine") ) - .def("get_all_blade_radii_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t>(al.getAllBladeRadiiDevice()); } ) - .def("get_all_blade_coords_x_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeCoordsXDevice()); } ) - .def("get_all_blade_coords_y_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeCoordsYDevice()); } ) - .def("get_all_blade_coords_z_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeCoordsZDevice()); } ) - .def("get_all_blade_velocities_x_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeVelocitiesXDevice()); } ) - .def("get_all_blade_velocities_y_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeVelocitiesYDevice()); } ) - .def("get_all_blade_velocities_z_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeVelocitiesZDevice()); } ) - .def("get_all_blade_forces_x_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeForcesXDevice()); } ) - .def("get_all_blade_forces_y_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeForcesYDevice()); } ) - .def("get_all_blade_forces_z_device", [](ActuatorFarm& al) -> intptr_t { return reinterpret_cast<intptr_t> (al.getAllBladeForcesZDevice()); } ) + .def("get_all_blade_radii_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeRadiiDevice()); } ) + .def("get_all_blade_coords_x_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeCoordsXDevice()); } ) + .def("get_all_blade_coords_y_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeCoordsYDevice()); } ) + .def("get_all_blade_coords_z_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeCoordsZDevice()); } ) + .def("get_all_blade_velocities_x_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeVelocitiesXDevice()); } ) + .def("get_all_blade_velocities_y_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeVelocitiesYDevice()); } ) + .def("get_all_blade_velocities_z_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeVelocitiesZDevice()); } ) + .def("get_all_blade_forces_x_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeForcesXDevice()); } ) + .def("get_all_blade_forces_y_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeForcesYDevice()); } ) + .def("get_all_blade_forces_z_device", [](ActuatorFarm& al) -> intptr_t { return arr_to_cp(al.getAllBladeForcesZDevice()); } ) - .def("get_turbine_blade_radii_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeRadiiDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_coords_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeCoordsXDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_coords_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeCoordsYDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_coords_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeCoordsZDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_velocities_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeVelocitiesXDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_velocities_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeVelocitiesYDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_velocities_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeVelocitiesZDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_forces_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeForcesXDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_forces_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeForcesYDevice(turbine)); }, py::arg("turbine") ) - .def("get_turbine_blade_forces_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return reinterpret_cast<intptr_t>(al.getTurbineBladeForcesZDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_radii_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeRadiiDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_coords_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeCoordsXDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_coords_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeCoordsYDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_coords_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeCoordsZDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_velocities_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeVelocitiesXDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_velocities_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeVelocitiesYDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_velocities_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeVelocitiesZDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_forces_x_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeForcesXDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_forces_y_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeForcesYDevice(turbine)); }, py::arg("turbine") ) + .def("get_turbine_blade_forces_z_device", [](ActuatorFarm& al, uint turbine) -> intptr_t { return arr_to_cp(al.getTurbineBladeForcesZDevice(turbine)); }, py::arg("turbine") ) - .def("set_all_azimuths", [](ActuatorFarm& al, arr azimuths){ al.setAllAzimuths(static_cast<float *>(azimuths.request().ptr)); }, py::arg("azimuths")) - .def("set_all_yaws", [](ActuatorFarm& al, arr yaws){ al.setAllYaws(static_cast<float *>(yaws.request().ptr)); }, py::arg("yaws")) - .def("set_all_omegas", [](ActuatorFarm& al, arr omegas){ al.setAllOmegas(static_cast<float *>(omegas.request().ptr)); }, py::arg("omegas")) + .def("set_all_azimuths", [](ActuatorFarm& al, arr azimuths){ al.setAllAzimuths(np_to_arr(azimuths)); }, py::arg("azimuths")) + .def("set_all_yaws", [](ActuatorFarm& al, arr yaws){ al.setAllYaws(np_to_arr(yaws)); }, py::arg("yaws")) + .def("set_all_omegas", [](ActuatorFarm& al, arr omegas){ al.setAllOmegas(np_to_arr(omegas)); }, py::arg("omegas")) .def("set_turbine_azimuth", &ActuatorFarm::setTurbineAzimuth, py::arg("turbine"), py::arg("azimuth")) .def("set_turbine_yaw", &ActuatorFarm::setTurbineYaw, py::arg("turbine"), py::arg("yaw")) .def("set_turbine_omega", &ActuatorFarm::setTurbineOmega, py::arg("turbine"), py::arg("omega")) - .def("set_all_blade_coords", [](ActuatorFarm& al, arr coordsX, arr coordsY, arr coordsZ) - { - al.setAllBladeCoords(static_cast<float *>(coordsX.request().ptr), static_cast<float *>(coordsY.request().ptr), static_cast<float *>(coordsZ.request().ptr)); + .def("set_all_blade_coords", [](ActuatorFarm& al, arr coordsX, arr coordsY, arr coordsZ){ + al.setAllBladeCoords(np_to_arr(coordsX), np_to_arr(coordsY), np_to_arr(coordsZ)); }, py::arg("blade_coords_x"), py::arg("blade_coords_y"), py::arg("blade_coords_z") ) - .def("set_all_blade_velocities", [](ActuatorFarm& al, arr velocitiesX, arr velocitiesY, arr velocitiesZ) - { - al.setAllBladeVelocities(static_cast<float *>(velocitiesX.request().ptr), static_cast<float *>(velocitiesY.request().ptr), static_cast<float *>(velocitiesZ.request().ptr)); + .def("set_all_blade_velocities", [](ActuatorFarm& al, arr velocitiesX, arr velocitiesY, arr velocitiesZ){ + al.setAllBladeVelocities(np_to_arr(velocitiesX), np_to_arr(velocitiesY), np_to_arr(velocitiesZ)); }, py::arg("blade_velocities_x"), py::arg("blade_velocities_y"), py::arg("blade_velocities_z") ) - .def("set_all_blade_forces", [](ActuatorFarm& al, arr forcesX, arr forcesY, arr forcesZ) - { - al.setAllBladeForces(static_cast<float *>(forcesX.request().ptr), static_cast<float *>(forcesY.request().ptr), static_cast<float *>(forcesZ.request().ptr)); + .def("set_all_blade_forces", [](ActuatorFarm& al, arr forcesX, arr forcesY, arr forcesZ){ + al.setAllBladeForces(np_to_arr(forcesX), np_to_arr(forcesY), np_to_arr(forcesZ)); }, py::arg("blade_forces_x"), py::arg("blade_forces_y"), py::arg("blade_forces_z") ) - .def("set_turbine_blade_coords", [](ActuatorFarm& al, uint turbine, arr coordsX, arr coordsY, arr coordsZ) - { - al.setTurbineBladeCoords(turbine, static_cast<float *>(coordsX.request().ptr), static_cast<float *>(coordsY.request().ptr), static_cast<float *>(coordsZ.request().ptr)); + .def("set_turbine_blade_coords", [](ActuatorFarm& al, uint turbine, arr coordsX, arr coordsY, arr coordsZ){ + al.setTurbineBladeCoords(turbine, np_to_arr(coordsX), np_to_arr(coordsY), np_to_arr(coordsZ)); }, py::arg("turbine"), py::arg("blade_coords_x"), py::arg("blade_coords_y"), py::arg("blade_coords_z") ) - .def("set_turbine_blade_velocities", [](ActuatorFarm& al, uint turbine, arr velocitiesX, arr velocitiesY, arr velocitiesZ) - { - al.setTurbineBladeVelocities(turbine, static_cast<float *>(velocitiesX.request().ptr), static_cast<float *>(velocitiesY.request().ptr), static_cast<float *>(velocitiesZ.request().ptr)); + .def("set_turbine_blade_velocities", [](ActuatorFarm& al, uint turbine, arr velocitiesX, arr velocitiesY, arr velocitiesZ){ + al.setTurbineBladeVelocities(turbine, np_to_arr(velocitiesX), np_to_arr(velocitiesY), np_to_arr(velocitiesZ)); }, py::arg("turbine"), py::arg("blade_velocities_x"), py::arg("blade_velocities_y"), py::arg("blade_velocities_z") ) - .def("set_turbine_blade_forces", [](ActuatorFarm& al, uint turbine, arr forcesX, arr forcesY, arr forcesZ) - { - al.setTurbineBladeForces(turbine, static_cast<float *>(forcesX.request().ptr), static_cast<float *>(forcesY.request().ptr), static_cast<float *>(forcesZ.request().ptr)); + .def("set_turbine_blade_forces", [](ActuatorFarm& al, uint turbine, arr forcesX, arr forcesY, arr forcesZ){ + al.setTurbineBladeForces(turbine, np_to_arr(forcesX), np_to_arr(forcesY), np_to_arr(forcesZ)); }, py::arg("turbine"), py::arg("blade_forces_x"), py::arg("blade_forces_y"), py::arg("blade_forces_z") ) .def("calc_blade_forces", &ActuatorFarm::calcBladeForces); } diff --git a/pythonbindings/src/gpu/submodules/grid_generator.cpp b/pythonbindings/src/gpu/submodules/grid_generator.cpp index 59d0bd5708b11f246664d1e8c7ee198f986d80c1..6c57900e4298094b59355e82a22433e1b647e059 100644 --- a/pythonbindings/src/gpu/submodules/grid_generator.cpp +++ b/pythonbindings/src/gpu/submodules/grid_generator.cpp @@ -38,10 +38,13 @@ #include "gpu/GridGenerator/geometries/Cuboid/Cuboid.h" #include "gpu/GridGenerator/geometries/Sphere/Sphere.h" #include "gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h" -#include "gpu/GridGenerator/grid/GridFactory.h" #include "gpu/GridGenerator/grid/GridBuilder/GridBuilder.h" #include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "basics/constants/NumericConstants.h" + +using namespace vf::basics::constant; + namespace grid_generator { @@ -59,9 +62,6 @@ namespace grid_generator // .value("MZ", CommunicationDirections::MZ) // .value("PZ", CommunicationDirections::PZ); - py::class_<GridFactory, std::shared_ptr<GridFactory>>(gridGeneratorModule, "GridFactory") - .def_static("make", &GridFactory::make, py::return_value_policy::reference); - py::class_<BoundingBox, std::shared_ptr<BoundingBox>>(gridGeneratorModule, "BoundingBox") .def(py::init<real, real, real, real, real, real>(), py::arg("min_x"), py::arg("max_x"), py::arg("min_y"), py::arg("max_y"), py::arg("min_z"), py::arg("max_z")); @@ -91,16 +91,16 @@ namespace grid_generator .def("set_pressure_boundary_condition", &LevelGridBuilder::setPressureBoundaryCondition, py::arg("side_type"), py::arg("rho")) .def("set_periodic_boundary_condition", &LevelGridBuilder::setPeriodicBoundaryCondition, py::arg("periodic_x"), py::arg("periodic_y"), py::arg("periodic_z")) .def("set_no_slip_boundary_condition", &LevelGridBuilder::setNoSlipBoundaryCondition, py::arg("side_type")) - .def("set_precursor_boundary_condition", &LevelGridBuilder::setPrecursorBoundaryCondition, py::arg("side_type"), py::arg("file_collection"), py::arg("n_t_read"), py::arg("velocity_x")=0.0f, py::arg("velocity_y")=0.0f, py::arg("velocity_z")=0.0f, py::arg("file_level_to_grid_level_map")=std::vector<uint>()) + .def("set_precursor_boundary_condition", &LevelGridBuilder::setPrecursorBoundaryCondition, py::arg("side_type"), py::arg("file_collection"), py::arg("n_t_read"), py::arg("velocity_x")=c0o1, py::arg("velocity_y")=c0o1, py::arg("velocity_z")=c0o1, py::arg("file_level_to_grid_level_map")=std::vector<uint>()) .def("set_stress_boundary_condition", &LevelGridBuilder::setStressBoundaryCondition, py::arg("side_type"), py::arg("normal_x"), py::arg("normal_y"), py::arg("normal_z"), py::arg("sampling_offset"), py::arg("z0"), py::arg("dx")); py::class_<MultipleGridBuilder, LevelGridBuilder, std::shared_ptr<MultipleGridBuilder>>(gridGeneratorModule, "MultipleGridBuilder") - .def_static("make_shared", &MultipleGridBuilder::makeShared, py::return_value_policy::reference, py::arg("grid_factory")) + .def(py::init()) .def("add_coarse_grid", &MultipleGridBuilder::addCoarseGrid, py::arg("start_x"), py::arg("start_y"), py::arg("start_z"), py::arg("end_x"), py::arg("end_y"), py::arg("end_z"), py::arg("delta")) - .def("add_grid", py::overload_cast<Object*>(&MultipleGridBuilder::addGrid), py::arg("grid_shape")) - .def("add_grid", py::overload_cast<Object*, uint>(&MultipleGridBuilder::addGrid), py::arg("grid_shape"), py::arg("level_fine")) - .def("add_geometry", py::overload_cast<Object*>(&MultipleGridBuilder::addGeometry), py::arg("solid_object")) - .def("add_geometry", py::overload_cast<Object*, uint>(&MultipleGridBuilder::addGeometry), py::arg("solid_object"), py::arg("level")) + .def("add_grid", py::overload_cast<SPtr<Object>>(&MultipleGridBuilder::addGrid), py::arg("grid_shape")) + .def("add_grid", py::overload_cast<SPtr<Object>, uint>(&MultipleGridBuilder::addGrid), py::arg("grid_shape"), py::arg("level_fine")) + .def("add_geometry", py::overload_cast<SPtr<Object>>(&MultipleGridBuilder::addGeometry), py::arg("solid_object")) + .def("add_geometry", py::overload_cast<SPtr<Object>, uint>(&MultipleGridBuilder::addGeometry), py::arg("solid_object"), py::arg("level")) .def("get_number_of_levels", &MultipleGridBuilder::getNumberOfLevels) .def("build_grids", &MultipleGridBuilder::buildGrids, py::arg("enable_thin_walls")) .def("set_subdomain_box", &MultipleGridBuilder::setSubDomainBox, py::arg("bounding_box")) diff --git a/pythonbindings/src/gpu/submodules/parameter.cpp b/pythonbindings/src/gpu/submodules/parameter.cpp index e1d8a1f63eb877ec7ae42beb858b0b7cb9253815..53c270f16327aee73b55e746d1d0bb94993203a2 100644 --- a/pythonbindings/src/gpu/submodules/parameter.cpp +++ b/pythonbindings/src/gpu/submodules/parameter.cpp @@ -83,7 +83,7 @@ namespace parameter .def("set_max_dev", &Parameter::setMaxDev, py::arg("max_dev")) .def("set_is_body_force", &Parameter::setIsBodyForce, py::arg("is_body_force")) .def("set_use_streams", &Parameter::setUseStreams, py::arg("use_streams")) - .def("set_main_kernel", &Parameter::setMainKernel, py::arg("kernel")) + .def("set_main_kernel", &Parameter::configureMainKernel, py::arg("kernel")) .def("set_AD_kernel", &Parameter::setADKernel, py::arg("ad_kernel")) .def("set_has_wall_model_monitor", &Parameter::setHasWallModelMonitor, py::arg("has_wall_monitor")) .def("set_outflow_pressure_correction_factor", &Parameter::setOutflowPressureCorrectionFactor, py::arg("correction_factor")) diff --git a/pythonbindings/src/gpu/submodules/probes.cpp b/pythonbindings/src/gpu/submodules/probes.cpp index 7c26958df81a60f00c9909a91f5576a5931652d4..9c3fc8ab15234013a093dbe00f6654ea3257d4b0 100644 --- a/pythonbindings/src/gpu/submodules/probes.cpp +++ b/pythonbindings/src/gpu/submodules/probes.cpp @@ -72,13 +72,16 @@ namespace probes uint, uint, uint, - uint>(), + uint, + bool>(), py::arg("probe_name"), py::arg("output_path"), py::arg("t_start_avg"), py::arg("t_avg"), py::arg("t_start_out"), - py::arg("t_out")) + py::arg("t_out"), + py::arg("output_timeseries")) + .def("add_probe_point", &PointProbe::addProbePoint, py::arg("point_coord_x"), py::arg("point_coord_y"), py::arg("point_coord_z")) .def("add_probe_points_from_list", &PointProbe::addProbePointsFromList, py::arg("point_coords_x"), py::arg("point_coords_y"), py::arg("point_coords_z")) .def("add_probe_points_from_x_normal_plane", &PointProbe::addProbePointsFromXNormalPlane, py::arg("pos_x"), py::arg("pos0_y"), py::arg("pos0_z"), py::arg("pos1_y"), py::arg("pos1_z"), py::arg("n_y"), py::arg("n_z")); diff --git a/pythonbindings/src/gpu/submodules/simulation.cpp b/pythonbindings/src/gpu/submodules/simulation.cpp index d32ef272a1fd26510439dde6ab3a9438d68009a7..545fe082fe59cacabde07052ccf1b041d0af7e25 100644 --- a/pythonbindings/src/gpu/submodules/simulation.cpp +++ b/pythonbindings/src/gpu/submodules/simulation.cpp @@ -32,7 +32,6 @@ //======================================================================================= #include <pybind11/pybind11.h> #include <gpu/VirtualFluids_GPU/LBM/Simulation.h> -#include <gpu/VirtualFluids_GPU/Communication/Communicator.h> #include <gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactory.h> #include <gpu/VirtualFluids_GPU/PreProcessor/PreProcessorFactory/PreProcessorFactory.h> #include <gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h> @@ -43,6 +42,7 @@ #include "gpu/VirtualFluids_GPU/Factories/BoundaryConditionFactory.h" #include "gpu/VirtualFluids_GPU/TurbulenceModels/TurbulenceModelFactory.h" #include "gpu/VirtualFluids_GPU/Factories/GridScalingFactory.h" +#include "parallel/Communicator.h" namespace simulation { @@ -54,7 +54,7 @@ namespace simulation py::class_<Simulation>(parentModule, "Simulation") .def(py::init< std::shared_ptr<Parameter>, std::shared_ptr<CudaMemoryManager>, - vf::gpu::Communicator &, + vf::parallel::Communicator &, GridProvider &, BoundaryConditionFactory*, GridScalingFactory*>(), @@ -66,7 +66,7 @@ namespace simulation py::arg("gridScalingFactory")) .def(py::init< std::shared_ptr<Parameter>, std::shared_ptr<CudaMemoryManager>, - vf::gpu::Communicator &, + vf::parallel::Communicator &, GridProvider &, BoundaryConditionFactory*>(), py::arg("parameter"), @@ -76,7 +76,7 @@ namespace simulation py::arg("bcFactory")) .def(py::init< std::shared_ptr<Parameter>, std::shared_ptr<CudaMemoryManager>, - vf::gpu::Communicator &, + vf::parallel::Communicator &, GridProvider &, BoundaryConditionFactory*, std::shared_ptr<TurbulenceModelFactory>, diff --git a/pythonbindings/src/lbm/lbm.cpp b/pythonbindings/src/lbm.cpp similarity index 93% rename from pythonbindings/src/lbm/lbm.cpp rename to pythonbindings/src/lbm.cpp index 90fd4a71b0101469666936c89974de316e0e2b18..622cc9742fdaa98f2ff6d974e495e6b8b490a2c2 100644 --- a/pythonbindings/src/lbm/lbm.cpp +++ b/pythonbindings/src/lbm.cpp @@ -32,14 +32,11 @@ //======================================================================================= #include <pybind11/pybind11.h> -namespace lbm +namespace lbm_bindings { namespace py = pybind11; - py::module makeModule(py::module_ &parentModule) + PYBIND11_MODULE(lbm, m) { - py::module lbmModule = parentModule.def_submodule("lbm"); - - return lbmModule; } } \ No newline at end of file diff --git a/pythonbindings/src/logger/logger.cpp b/pythonbindings/src/logger.cpp similarity index 73% rename from pythonbindings/src/logger/logger.cpp rename to pythonbindings/src/logger.cpp index c4c99c0a5077303b398e0726eaba0420ddb0dceb..367ae693475eca064c128de47c88e56fca91a58e 100644 --- a/pythonbindings/src/logger/logger.cpp +++ b/pythonbindings/src/logger.cpp @@ -33,25 +33,23 @@ #include <pybind11/pybind11.h> #include <logger/Logger.h> -namespace logging +namespace logger_bindings { + namespace py = pybind11; - py::module makeModule(py::module_ &parentModule) + PYBIND11_MODULE(logger, m) { - py::module loggerModule = parentModule.def_submodule("logger"); - - py::class_<vf::logging::Logger>(loggerModule, "Logger") + py::class_<vf::logging::Logger>(m, "Logger") .def_static("initialize_logger", &vf::logging::Logger::initializeLogger) .def_static("change_log_path", &vf::logging::Logger::changeLogPath, py::arg("path")); // use f-strings (f"text {float}") in python for compounded messages - loggerModule.def("vf_log_trace", [](std::string message){ VF_LOG_TRACE(message); }, py::arg("message")); - loggerModule.def("vf_log_debug", [](std::string message){ VF_LOG_DEBUG(message); }, py::arg("message")); - loggerModule.def("vf_log_info", [](std::string message){ VF_LOG_INFO(message); }, py::arg("message")); - loggerModule.def("vf_log_warning", [](std::string message){ VF_LOG_WARNING(message); }, py::arg("message")); - loggerModule.def("vf_log_critical", [](std::string message){ VF_LOG_CRITICAL(message); }, py::arg("message")); - - return loggerModule; + m.def("vf_log_trace", [](std::string message){ VF_LOG_TRACE(message); }, py::arg("message")); + m.def("vf_log_debug", [](std::string message){ VF_LOG_DEBUG(message); }, py::arg("message")); + m.def("vf_log_info", [](std::string message){ VF_LOG_INFO(message); }, py::arg("message")); + m.def("vf_log_warning", [](std::string message){ VF_LOG_WARNING(message); }, py::arg("message")); + m.def("vf_log_critical", [](std::string message){ VF_LOG_CRITICAL(message); }, py::arg("message")); } -} // namespace logging +} + diff --git a/regression-tests/driven_cavity_uniform_test.sh b/regression-tests/driven_cavity_uniform_test.sh index deb1300cad5914e69a4f2c01428bbef31d7af6d3..c7bb78d014cdd4b2103932c5a9e5134bd8f7b767 100755 --- a/regression-tests/driven_cavity_uniform_test.sh +++ b/regression-tests/driven_cavity_uniform_test.sh @@ -7,7 +7,7 @@ source ./regression-tests/__regression_test_executer.sh REFERENCE_DATA_DIR=regression_tests/gpu/DrivenCavity_uniform # 2. set cmake flags for the build of VirtualFluids -CMAKE_FLAGS="--preset=make_gpu -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=75 -DUSER_APPS="apps/gpu/LBM/DrivenCavityUniform"" +CMAKE_FLAGS="--preset=make_gpu -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=75 -DUSER_APPS="apps/gpu/DrivenCavityUniform"" # 3. define the application to be executed APPLICATION=./build/bin/DrivenCavityUniform diff --git a/regression-tests/flow_around_cylinder_test.sh b/regression-tests/flow_around_cylinder_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..1b0440abef66afb0aed4efc0f05173f1917ab24b --- /dev/null +++ b/regression-tests/flow_around_cylinder_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +source ./regression-tests/__regression_test_executer.sh + + +# 1. set reference data directory (must match the folder structure in https://github.com/irmb/test_data) +REFERENCE_DATA_DIR=regression_tests/cpu/FlowAroundCylinder_2023_06 + +# 2. set cmake flags for the build of VirtualFluids +CMAKE_FLAGS="--preset=make_cpu -DCMAKE_BUILD_TYPE=Release" + +# 3. define the application to be executed +APPLICATION="./build/bin/FlowAroundCylinder ./apps/cpu/FlowAroundCylinder/cylinder.cfg" + +# 4. set the path to the produced data +RESULT_DATA_DIR=output/FlowAroundCylinder + + +run_regression_test "$REFERENCE_DATA_DIR" "$CMAKE_FLAGS" "$APPLICATION" "$RESULT_DATA_DIR" diff --git a/regression-tests/multigpu_test/rocket4GPU.yml b/regression-tests/multigpu_test/rocket4GPU.yml index a05ffea6ad04e0d5cfb8d7749111726dfceb4609..e8722cf367832104a12935af5bbbe660ce8e7fcc 100755 --- a/regression-tests/multigpu_test/rocket4GPU.yml +++ b/regression-tests/multigpu_test/rocket4GPU.yml @@ -31,13 +31,13 @@ copy: to: "multigpu_test/CMakePresets.json" overwrite: true - - from: "apps/gpu/LBM/" - to: "multigpu_test/apps/gpu/LBM/" + - from: "apps/gpu/" + to: "multigpu_test/apps/gpu/" overwrite: true collect: - from: multigpu_test/output/4GPU/ - to: output/4GPU + to: output/4GPU/ overwrite: true - from: multigpu_test/slurm4GPU.out @@ -45,7 +45,7 @@ collect: overwrite: true clean: - - multigpu_test/output/* + - multigpu_test/* sbatch: multigpu_test/slurm4GPU.job continue_if_job_fails: true diff --git a/regression-tests/multigpu_test/rocket8GPU.yml b/regression-tests/multigpu_test/rocket8GPU.yml index e8cc08a9fa39425686a16d193dba1743533994bc..d179dbc84d1f80b0efb9fcb368bffaa2732c26da 100755 --- a/regression-tests/multigpu_test/rocket8GPU.yml +++ b/regression-tests/multigpu_test/rocket8GPU.yml @@ -31,13 +31,13 @@ copy: to: "multigpu_test/CMakePresets.json" overwrite: true - - from: "apps/gpu/LBM/" - to: "multigpu_test/apps/gpu/LBM/" + - from: "apps/gpu/" + to: "multigpu_test/apps/gpu/" overwrite: true collect: - from: multigpu_test/output/8GPU/ - to: output/8GPU + to: output/8GPU/ overwrite: true - from: multigpu_test/slurm8GPU.out @@ -45,7 +45,7 @@ collect: overwrite: true clean: - - multigpu_test/output/* + - multigpu_test/* sbatch: multigpu_test/slurm8GPU.job continue_if_job_fails: true diff --git a/regression-tests/multigpu_test/slurm4GPU.job b/regression-tests/multigpu_test/slurm4GPU.job index 70b33f07f4a4a7be7f5b50990098f3322238af4a..ce678a57945c87f881f88887e88d79dff51bef0e 100755 --- a/regression-tests/multigpu_test/slurm4GPU.job +++ b/regression-tests/multigpu_test/slurm4GPU.job @@ -2,14 +2,19 @@ #SBATCH --partition=gpu01_queue #SBATCH --nodes=1 -#SBATCH --time=10:00:00 +#SBATCH --time=03:00:00 #SBATCH --job-name=Regr4GPU #SBATCH --ntasks-per-node=4 #SBATCH --gres=gpu:4 #SBATCH --output=multigpu_test/slurm4GPU.out ##SBATCH --exclusive -module purge +echo "SLURM_JOBID="$SLURM_JOBID +echo "SLURM_JOB_NODELIST"=$SLURM_JOB_NODELIST +echo "SLURM_NNODES"=$SLURM_NNODES +echo "SLURM_TASKS_PER_NODE"=$SLURM_TASKS_PER_NODE + +module purge module load comp/gcc/10.2.0 module load mpi/openmpi/4.0.5_gcc_9.3/openmpi module load cuda/11.3 @@ -19,15 +24,15 @@ PATH=/home/irmb/tools/cmake-3.20.3-linux-x86_64/bin:$PATH module list cd multigpu_test -rm -r build && mkdir -p build +rm -rf build && mkdir -p build cd build -cmake .. -DBUILD_VF_GPU=ON -DCMAKE_CUDA_ARCHITECTURES=60 -DUSER_APPS=apps/gpu/LBM/DrivenCavityMultiGPU\;apps/gpu/LBM/SphereScaling +cmake .. -DBUILD_VF_GPU=ON -DCMAKE_CUDA_ARCHITECTURES=60 -DUSER_APPS=apps/gpu/DrivenCavityMultiGPU\;apps/gpu/SphereScaling make -j 16 cd .. mkdir -p output echo $'\n\n\n\n---First test: DrivenCavityMultiGPU on 4 GPUs\n\n' -mpirun -np 4 "./build/bin/DrivenCavityMultiGPU" "apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt" +mpirun -np 4 "./build/bin/DrivenCavityMultiGPU" "apps/gpu/DrivenCavityMultiGPU/configPhoenix4GPU_regressionTest.txt" echo $'\n\n\n\n---Second test: SphereScaling on 4 GPUs\n\n' -mpirun -np 4 "./build/bin/SphereScaling" "apps/gpu/LBM/SphereScaling/configPhoenix4GPU_regressionTest.txt" \ No newline at end of file +mpirun -np 4 "./build/bin/SphereScaling" "apps/gpu/SphereScaling/configPhoenix4GPU_regressionTest.txt" \ No newline at end of file diff --git a/regression-tests/multigpu_test/slurm8GPU.job b/regression-tests/multigpu_test/slurm8GPU.job index b91d7d473d935d4d0fbe8deba344dbaa58cf5080..0b97ce0cd17325f59d28c9fe0da92724201b1304 100755 --- a/regression-tests/multigpu_test/slurm8GPU.job +++ b/regression-tests/multigpu_test/slurm8GPU.job @@ -2,14 +2,19 @@ #SBATCH --partition=gpu01_queue #SBATCH --nodes=2 -#SBATCH --time=10:00:00 +#SBATCH --time=03:00:00 #SBATCH --job-name=Regr8GPU #SBATCH --ntasks-per-node=4 #SBATCH --gres=gpu:4 #SBATCH --output=multigpu_test/slurm8GPU.out ##SBATCH --exclusive -module purge +echo "SLURM_JOBID="$SLURM_JOBID +echo "SLURM_JOB_NODELIST"=$SLURM_JOB_NODELIST +echo "SLURM_NNODES"=$SLURM_NNODES +echo "SLURM_TASKS_PER_NODE"=$SLURM_TASKS_PER_NODE + +module purge module load comp/gcc/10.2.0 module load mpi/openmpi/4.0.5_gcc_9.3/openmpi module load cuda/11.3 @@ -19,15 +24,15 @@ PATH=/home/irmb/tools/cmake-3.20.3-linux-x86_64/bin:$PATH module list cd multigpu_test -rm -r build && mkdir -p build +rm -rf build && mkdir -p build cd build -cmake .. -DBUILD_VF_GPU=ON -DCMAKE_CUDA_ARCHITECTURES=60 -DUSER_APPS=apps/gpu/LBM/DrivenCavityMultiGPU\;apps/gpu/LBM/SphereScaling +cmake .. -DBUILD_VF_GPU=ON -DCMAKE_CUDA_ARCHITECTURES=60 -DUSER_APPS=apps/gpu/DrivenCavityMultiGPU\;apps/gpu/SphereScaling make -j 16 cd .. mkdir -p output echo $'\n\n\n\n---First test: DrivenCavityMultiGPU on 8 GPUs\n\n' -mpirun -np 8 "./build/bin/DrivenCavityMultiGPU" "apps/gpu/LBM/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt" +mpirun -np 8 "./build/bin/DrivenCavityMultiGPU" "apps/gpu/DrivenCavityMultiGPU/configPhoenix8GPU_regressionTest.txt" echo $'\n\n\n\n---Second test: SphereScaling on 8 GPUs\n\n' -mpirun -np 8 "./build/bin/SphereScaling" "apps/gpu/LBM/SphereScaling/configPhoenix8GPU_regressionTest.txt" \ No newline at end of file +mpirun -np 8 "./build/bin/SphereScaling" "apps/gpu/SphereScaling/configPhoenix8GPU_regressionTest.txt" \ No newline at end of file diff --git a/regression-tests/multigpu_test/utilities/parsejobid.py b/regression-tests/multigpu_test/utilities/parsejobid.py new file mode 100644 index 0000000000000000000000000000000000000000..f209f6d3d0ac20243a94d16f89d2aaddeeae24f7 --- /dev/null +++ b/regression-tests/multigpu_test/utilities/parsejobid.py @@ -0,0 +1,20 @@ +from pathlib import Path +import sys + +LAUNCH_MESSAGE = "Launched job" + + +def parsejobid(file: str) -> str: + file_path = Path(file) + if not file_path.exists(): + raise FileNotFoundError(file) + + text_content = file_path.read_text().strip() + launch_line = next( + filter(lambda line: LAUNCH_MESSAGE in line, text_content.splitlines()) + ) + return launch_line.split()[-1].strip() + + +if __name__ == "__main__": + print(parsejobid(sys.argv[1])) diff --git a/regression-tests/refined_sphere_in_channel_test.sh b/regression-tests/refined_sphere_in_channel_test.sh new file mode 100644 index 0000000000000000000000000000000000000000..51b6fa9481761f9727b4e4d7dc96945acae49265 --- /dev/null +++ b/regression-tests/refined_sphere_in_channel_test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +source ./regression-tests/__regression_test_executer.sh + +# 1. set reference data directory (must match the folder structure in https://github.com/irmb/test_data) +REFERENCE_DATA_DIR=regression_tests/gpu/SphereInChannel_3Levels + +# 2. set cmake flags for the build of VirtualFluids +CMAKE_FLAGS="--preset=make_gpu -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=75 -DUSER_APPS=apps/gpu/SphereRefined" + +# 3. define the application to be executed +APPLICATION=./build/bin/SphereRefined + +# 4. set the path to the produced data +RESULT_DATA_DIR=output/SphereRefined + + +run_regression_test "$REFERENCE_DATA_DIR" "$CMAKE_FLAGS" "$APPLICATION" "$RESULT_DATA_DIR" + +# fieldcompare dir output/Sphere reference_data/regression_tests/gpu/SphereInChannel --include-files "*.vtu" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5894f9dec06953c3eeb909af96db9cb19d202d65..0000000000000000000000000000000000000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[metadata] -name = pyfluids -description = Python binding for VirtualFluids -long_description = file: README.md -long_description_content_type = text/markdown -platforms = any -url = https://git.rz.tu-bs.de/irmb/virtualfluids -version = 0.1.0 - -[options] -python_requires = >=3.6 diff --git a/setup.py b/setup.py deleted file mode 100644 index 530431b3775970b5222bc87d32bfb407363f95d6..0000000000000000000000000000000000000000 --- a/setup.py +++ /dev/null @@ -1,72 +0,0 @@ -import sys -from pathlib import Path -from typing import List - -import skbuild - -""" -Install python wrapper of Virtual Fluids -install via python: - python setup.py install - set CMAKE Flags via -DBUILD_VF_GPU:BOOL=ON - CMAKE flags have to be separated by -- - example: python setup.py install -- -DBUILD_VF_CPU:BOOL=ON -or install via pip: - pip install . - for pip>21: - set CMAKE Flags via --config-settings "-DBUILD_VF_GPU=ON" - example: pip install . --config-settings="-DBUILD_VF_GPU=ON" - each option has to be passed in individually i.e --config-settings="-DOPT1=ON" --config-settings="-DOPT2=OFF" - for pip <21: - set CMAKE Flags via --global-option ="-DBUILD_VF_GPU=ON" - example: pip install . --global-option="-DBUILD_VF_GPU=ON" -""" - -package_name = "pyfluids" -target = "python_bindings" -src_dir = "pythonbindings" -stub_package = package_name+"-stubs" - -stub_dir = Path(src_dir)/stub_package - - -def add_subfiles(dir_path: Path, suffix: str, root_dir: Path) -> List[str]: - files = [] - for f in dir_path.iterdir(): - if f.is_dir(): - files.extend(add_subfiles(f, suffix, root_dir)) - if f.is_file(): - if f.suffix != suffix: - continue - files.append(str(f.relative_to(root_dir))) - return files - -def add_directory(dir_path: Path, suffix: str): - return add_subfiles(dir_path, suffix, dir_path) - -stub_files = add_directory(stub_dir, ".pyi") - -# hack to get config-args for installation with pip>21 -cmake_args = [] -if "config_args" in locals(): - cmake_args.extend([f"{k}={v}" for k, v in locals()["config_args"].items()]) - -cmake_args += [ - f"-DPython3_ROOT_DIR={Path(sys.prefix)}", - "-DBUILD_VF_PYTHON_BINDINGS=ON", - "-DBUILD_SHARED_LIBS=OFF", - "-DBUILD_VF_DOUBLE_ACCURACY=OFF", - "-DBUILD_VF_UNIT_TESTS:BOOL=OFF", - "-DBUILD_WARNINGS_AS_ERRORS=OFF", - ] - -skbuild.setup( - name=package_name, - packages=[package_name, "pymuparser", "pyfluids-stubs"], - package_dir={"": src_dir}, - cmake_args=cmake_args, - cmake_install_target=target, - package_data={ "pyfluids": ["py.typed"], - "pyfluids-stubs": stub_files}, - include_package_data=True, -) diff --git a/sonar-project.properties b/sonar-project.properties index a25bb1af8070f0ea5b75f67e624211f38fef38bf..3448b44658ea84e7a89c59a06e0d0d687539f002 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -21,6 +21,8 @@ sonar.sourceEncoding=UTF-8 sonar.cxx.coverage.reportPath=coverage/coverage.xml +sonar.cxx.coverage.exclusions=./src/**/*Test.* + sonar.cxx.cppcheck.reportPath=cppcheck.xml sonar.cxx.clangtidy.reportPath=build/clangtidy.txt diff --git a/src/basics/StringUtilities/StringUtilTest.cpp b/src/basics/StringUtilities/StringUtilTest.cpp index 52f9511b3774a03f6d6f1e19536839825eff1394..0b229dfd8696490a02f01c0ed3f4fac859c6157c 100644 --- a/src/basics/StringUtilities/StringUtilTest.cpp +++ b/src/basics/StringUtilities/StringUtilTest.cpp @@ -6,12 +6,6 @@ #include "StringUtil.h" -int main(int argc, char *argv[]) -{ - testing::InitGoogleTest(&argc, argv); - testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} TEST(StringUtilTest, endsWith_shouldReturnTrue) { diff --git a/src/basics/config/ConfigurationFile.cpp b/src/basics/config/ConfigurationFile.cpp index 547468cd2fd6aadccbdc5017230fcf6cdb803733..b714203913b739998cce007d98dccacb1cc99a4e 100644 --- a/src/basics/config/ConfigurationFile.cpp +++ b/src/basics/config/ConfigurationFile.cpp @@ -67,27 +67,19 @@ bool ConfigurationFile::load(const std::string& file) return true; } -////////////////////////////////////////////////////////////////////////// -template<> -bool ConfigurationFile::fromString<bool>(const std::string& str) const -{ - return str == "true"; -} - ////////////////////////////////////////////////////////////////////////// bool ConfigurationFile::contains(const std::string& key) const { return data.find(key) != data.end(); } ////////////////////////////////////////////////////////////////////////// -std::string ConfigurationFile::getString(const std::string& key) const +std::string ConfigurationFile::getValue(const std::string& key) const { std::map<std::string, std::string>::const_iterator iter = data.find(key); if (iter != data.end()) { - std::string value = iter->second; - return value; + return iter->second; } else { diff --git a/src/basics/config/ConfigurationFile.h b/src/basics/config/ConfigurationFile.h index 8ca12306e0ef321832efb19a2a428e6dc753df41..6c651b7039d91c7312c4b98f32e1a97b8b6433de 100644 --- a/src/basics/config/ConfigurationFile.h +++ b/src/basics/config/ConfigurationFile.h @@ -1,7 +1,8 @@ #ifndef BASICS_CONFIGURATIONFILE_H #define BASICS_CONFIGURATIONFILE_H -#include "Logger.h" +#include <logger/Logger.h> + #include <filesystem> #include <map> #include <vector> @@ -9,7 +10,7 @@ #include <string> #include <fstream> #include <iostream> -#include <stdlib.h> +#include <cstdlib> #include <basics/utilities/UbException.h> @@ -38,7 +39,7 @@ //!bool writeLogFile = config.getValue<bool>("writeLogFile"); //!string errorMessage = config.getValue<string>("errorMessage"); //!vector<double> origin = config.getVector<double>("origin"); -//! +//! //! \author Konstantin Kutscher @@ -70,36 +71,20 @@ public: template<class T> T getValue(const std::string& key, T defaultValue) const; - static ConfigurationFile loadConfig(int argc, char *argv[], std::string configPath = "./config.txt") - { - // the config file's default path can be replaced by passing a command line argument - - if (argc > 1) - { - configPath = argv[1]; - VF_LOG_INFO("Using command line argument for config path: {}", configPath); - } else { - VF_LOG_INFO("Using default config path: {}", configPath); - } - - vf::basics::ConfigurationFile config; - config.load(configPath); - return config; - } + //! the container is public to test this class + std::map<std::string, std::string> data; private: //! the container - std::map<std::string, std::string> data; - //! get string with key - std::string getString(const std::string& key) const; + std::string getValue(const std::string& key) const; //! remove leading and trailing tabs and spaces static std::string trim(const std::string& str); //! convert string to data type T template<class T> - T fromString(const std::string& str) const; + T convert_to(const std::string& str) const; void split(std::vector<std::string>& lst, const std::string& input, const std::string& separators, bool remove_empty = true) const; }; @@ -109,56 +94,44 @@ private: template<class T> std::vector<T> ConfigurationFile::getVector(const std::string& key) const { - std::string str = getString(key); - std::vector<T> v; - std::vector<std::string> strings; - split(strings, str, "\t\n\r;, "); - for (std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); ++it) + std::string string_value = getValue(key); + std::vector<T> values; + std::vector<std::string> string_vector; + split(string_vector, string_value, "\t\n\r;, "); + for (std::vector<std::string>::iterator it = string_vector.begin(); it != string_vector.end(); ++it) { if (*it != "") { - v.push_back(fromString<T>(*it)); + values.push_back(convert_to<T>(*it)); } } - return v; + return values; } ////////////////////////////////////////////////////////////////////////// template<class T> -T ConfigurationFile::fromString(const std::string& str) const +T ConfigurationFile::convert_to(const std::string& value) const { - std::istringstream stream(str); + if constexpr (std::is_same_v<T, bool>) + { + return (value == "true"); + } + + std::istringstream stream(value); T t; stream >> t; + if (stream.fail()) + throw UbException(UB_EXARGS, " cannot convert \"" + value + "\" to type <" + static_cast<std::string>(typeid(t).name()) + ">"); + return t; } -template<> -bool ConfigurationFile::fromString<bool>(const std::string& str) const; - ////////////////////////////////////////////////////////////////////////// template<class T> T ConfigurationFile::getValue(const std::string& key) const { - std::string str = getString(key); - bool bFlag = false; - if ((std::string)typeid(T).name() == (std::string)typeid(bool).name()) - { - bFlag = true; - } - - std::istringstream iss(str); - T x; - iss >> x; - if (!iss && !bFlag) - UB_THROW(UbException(UB_EXARGS, " cannot convert \"" + str + "\" to type <" + static_cast<std::string>(typeid(x).name()) + ">")); + std::string value = getValue(key); - if (bFlag) - { - bool value = (str == "true"); - x = value; - } - - return x; + return convert_to<T>(value); } template<class T> @@ -174,6 +147,24 @@ T ConfigurationFile::getValue(const std::string& key, T defaultValue) const } } +static ConfigurationFile loadConfig(int argc, char *argv[], std::string configPath = "./config.txt") +{ + // the config file's default path can be replaced by passing a command line argument + + if (argc > 1) + { + configPath = argv[1]; + VF_LOG_INFO("Using command line argument for config path: {}", configPath); + } else { + VF_LOG_INFO("Using default config path: {}", configPath); + } + + vf::basics::ConfigurationFile config; + config.load(configPath); + return config; +} + + } #endif diff --git a/src/basics/config/ConfigurationFileTest.cpp b/src/basics/config/ConfigurationFileTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f935b4ab95287cc8e2a20c882bd89b74d636cdf6 --- /dev/null +++ b/src/basics/config/ConfigurationFileTest.cpp @@ -0,0 +1,124 @@ +#include <gmock/gmock.h> + +#include "ConfigurationFile.h" + +using namespace vf::basics; + +TEST(ConfigurationFileTest, ContainsReturnsTrueForExistingKey) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + config.data["key2"] = "value2"; + + EXPECT_TRUE(config.contains("key1")); + EXPECT_TRUE(config.contains("key2")); +} + +TEST(ConfigurationFileTest, ContainsReturnsFalseForMissingKey) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + + EXPECT_FALSE(config.contains("key2")); +} + +TEST(ConfigurationFileTest, GetValueReturnsCorrectValue) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + config.data["key2"] = "1234"; + + EXPECT_EQ(config.getValue<std::string>("key1"), "value1"); + EXPECT_EQ(config.getValue<int>("key2"), 1234); +} + +TEST(ConfigurationFileTest, GetValueThrowsExceptionForMissingKey) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + + EXPECT_THROW(config.getValue<std::string>("key2"), UbException); +} + +TEST(ConfigurationFileTest, GetVectorReturnsCorrectValues) +{ + ConfigurationFile config; + config.data["key1"] = "1, 2, 3"; + config.data["key2"] = "4; 5; 6"; + + std::vector<int> v1 = config.getVector<int>("key1"); + std::vector<int> v2 = config.getVector<int>("key2"); + + EXPECT_EQ(v1.size(), 3); + EXPECT_EQ(v1[0], 1); + EXPECT_EQ(v1[1], 2); + EXPECT_EQ(v1[2], 3); + + EXPECT_EQ(v2.size(), 3); + EXPECT_EQ(v2[0], 4); + EXPECT_EQ(v2[1], 5); + EXPECT_EQ(v2[2], 6); +} + +TEST(ConfigurationFileTest, GetVectorThrowsExceptionForMissingKey) +{ + ConfigurationFile config; + config.data["key1"] = "1, 2, 3"; + + EXPECT_THROW(config.getVector<int>("key2"), UbException); +} + +TEST(ConfigurationFileTest, GetValueReturnsDefaultValueForMissingKey) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + + int defaultValue = 42; + int value = config.getValue<int>("key2", defaultValue); + + EXPECT_EQ(value, defaultValue); +} + +TEST(ConfigurationFileTest, GetValueReturnsCorrectValueForExistingKey) +{ + ConfigurationFile config; + config.data["key1"] = "42"; + + int defaultValue = 0; + int value = config.getValue<int>("key1", defaultValue); + + EXPECT_EQ(value, 42); +} + +TEST(ConfigurationFileTest, FromStringConvertsValueToBool) +{ + ConfigurationFile config; + config.data["key1"] = "true"; + config.data["key2"] = "false"; + + bool valueTrue = config.getValue<bool>("key1"); + bool valueFalse = config.getValue<bool>("key2"); + + EXPECT_TRUE(valueTrue); + EXPECT_FALSE(valueFalse); +} + + +TEST(ConfigurationFileTest, GetValueThrowsExceptionForWrongTypeConversion) +{ + ConfigurationFile config; + config.data["key1"] = "text"; + + EXPECT_THROW(config.getVector<int>("key1"), UbException);; +} + +TEST(ConfigurationFileTest, ClearRemovesAllData) +{ + ConfigurationFile config; + config.data["key1"] = "value1"; + config.data["key2"] = "value2"; + + config.clear(); + + EXPECT_TRUE(config.data.empty()); +} \ No newline at end of file diff --git a/src/basics/writer/WbWriter.h b/src/basics/writer/WbWriter.h index 55dceb7cb4a64dc90f0677796cab52135b726f56..dfb31c7f484f107bd860ea9244442810a06a2e59 100644 --- a/src/basics/writer/WbWriter.h +++ b/src/basics/writer/WbWriter.h @@ -40,6 +40,7 @@ #include <string> #include <vector> +#include <basics/DataTypes.h> #include <basics/utilities/UbException.h> #include <basics/utilities/UbSystem.h> #include <basics/utilities/UbTuple.h> @@ -83,6 +84,16 @@ public: { throw UbException(UB_EXARGS, "not implemented for " + (std::string) typeid(*this).name()); } + virtual std::string writePolyLines(const std::string & /*filename*/, real* /*coordinatesX*/, + real* /*coordinatesY*/, real* /*coordinatesZ*/, uint /*numberOfCoordinates*/) + { + throw UbException(UB_EXARGS, "not implemented for " + (std::string) typeid(*this).name()); + } + virtual std::string writePolyLines(const std::string & /*filename*/, std::vector<real>& /*coordinatesX*/, + std::vector<real>& /*coordinatesY*/, std::vector<real>& /*coordinatesZ*/) + { + throw UbException(UB_EXARGS, "not implemented for " + (std::string) typeid(*this).name()); + } virtual std::string writeLinesWithNodeData(const std::string & /*filename*/, std::vector<UbTupleFloat3> & /*nodes*/, std::vector<UbTupleInt2> & /*lines*/) { diff --git a/src/basics/writer/WbWriterVtkXmlBinary.cpp b/src/basics/writer/WbWriterVtkXmlBinary.cpp index 55c3541983ea4248512508146792832a34a1c563..748820e94052620283b8f9836058e96ad4f5bdd0 100644 --- a/src/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/src/basics/writer/WbWriterVtkXmlBinary.cpp @@ -39,50 +39,78 @@ using namespace std; -/*===============================================================================*/ -const std::string WbWriterVtkXmlBinary::pvdEndTag = " </Collection>\n</VTKFile>"; -/*===============================================================================*/ -string WbWriterVtkXmlBinary::writeCollection(const string &filename, const vector<string> &filenames, - const double &timeStep, const bool &sepGroups) +ofstream createFileStream(const std::string &vtkFilename) { - string vtkfilename = filename + ".pvd"; - ofstream out(vtkfilename.c_str()); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { + ofstream outputFileStream(vtkFilename.c_str(), ios::out | ios::binary); + if (!outputFileStream) { + outputFileStream.clear(); + const std::string path = UbSystem::getPathFromString(vtkFilename); + if (!path.empty()) { UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str()); + outputFileStream.open(vtkFilename.c_str(), ios::out | ios::binary); } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); + if (!outputFileStream) throw UbException(UB_EXARGS, "couldn't open file " + vtkFilename); } + return outputFileStream; +} - string endian; - if (UbSystem::isLittleEndian()) - endian = "LittleEndian"; - else - endian = "BigEndian"; - out << "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"" << endian << "\" >" << endl; - out << " <Collection>" << endl; +void addCollectionHeader(std::ofstream &outputFileStream) +{ + std::string endian = UbSystem::isLittleEndian() ? "LittleEndian" : "BigEndian"; + outputFileStream << "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"" << endian << "\" >" << endl; + outputFileStream << " <Collection>" << endl; +} +void addCollectionDatasetsForTimeStep(std::ofstream &outputFileStream, const vector<string> &filenames, double timeStep, bool separateGroups) +{ int group = 0, part = 0; for (size_t i = 0; i < filenames.size(); i++) { - out << " <DataSet timestep=\"" << timeStep << "\" group=\"" << group << "\" part=\"" << part - << "\" file=\"" << filenames[i] << "\"/>" << endl; - if (sepGroups) + outputFileStream << " <DataSet timestep=\"" << timeStep << "\" group=\"" << group << "\" part=\"" << part << "\" file=\"" << filenames[i] << "\"/>" << endl; + if (separateGroups) group++; else part++; } - out << pvdEndTag; - out.close(); +} - return vtkfilename; +std::string getCollectionEndString() +{ + return " </Collection>\n</VTKFile>"; +} + +void finalizeCollectionFile(std::ofstream &outputFileStream) +{ + outputFileStream << getCollectionEndString(); + outputFileStream.close(); +} + +std::string WbWriterVtkXmlBinary::writeCollectionForTimeSeries(const std::string &filename, + const std::map<uint, std::vector<std::string>> &filesNamesForTimeSteps, bool separateGroups) const +{ + std::string vtkFilename = filename + ".pvd"; + ofstream out = createFileStream(vtkFilename); + addCollectionHeader(out); + for (auto [timeStep, filenames]: filesNamesForTimeSteps) { + addCollectionDatasetsForTimeStep(out, filenames, timeStep, separateGroups); + } + finalizeCollectionFile(out); + return vtkFilename; +} + +string WbWriterVtkXmlBinary::writeCollection(const string &filename, const vector<string> &filenames, + const double &timeStep, const bool &separateGroups) const +{ + std::string vtkFilename = filename + ".pvd"; + ofstream out = createFileStream(vtkFilename); + addCollectionHeader(out); + addCollectionDatasetsForTimeStep(out, filenames, timeStep, separateGroups); + finalizeCollectionFile(out); + return vtkFilename; } + /*===============================================================================*/ string WbWriterVtkXmlBinary::addFilesToCollection(const string &filename, const vector<string> &filenames, - const double &timeStep, const bool &sepGroups) + const double &timeStep, const bool &separateGroups) const { string vtkfilename = filename; fstream test(vtkfilename.c_str(), ios::in); @@ -91,60 +119,51 @@ string WbWriterVtkXmlBinary::addFilesToCollection(const string &filename, const vtkfilename += ".pvd"; test.open(vtkfilename.c_str(), ios::in); if (!test) - return this->writeCollection(filename, filenames, timeStep, sepGroups); + return this->writeCollection(filename, filenames, timeStep, separateGroups); } fstream out(vtkfilename.c_str(), ios::in | ios::out); - out.seekp(-(int)pvdEndTag.size() - 1, ios_base::end); + out.seekp(-(int)getCollectionEndString().size() - 1, ios_base::end); int group = 0; for (size_t i = 0; i < filenames.size(); i++) { out << " <DataSet timestep=\"" << timeStep << "\" group=\"" << group << "\" part=\"" << i << "\" file=\"" << filenames[i] << "\"/>" << endl; - if (sepGroups) + if (separateGroups) group++; } - out << pvdEndTag; + out << getCollectionEndString(); return vtkfilename; } /*===============================================================================*/ string WbWriterVtkXmlBinary::writeParallelFile(const string &filename, vector<string> &pieceSources, - vector<string> &pointDataNames, vector<string> &cellDataNames) + vector<string> &pointDataNames, vector<string> &cellDataNames) const { string vtkfilename = filename + ".pvtu"; UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeParallelFile to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str()); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str()); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + std::ofstream out = createFileStream(vtkfilename); // VTK FILE + out << "<?xml version=\"1.0\"?>\n"; out << "<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << "\n"; - out << " <PUnstructuredGrid GhostLevel=\"0\">" + out << " <PUnstructuredGrid GhostLevel=\"1\">" << "\n"; - out << " <PPoints>\n"; - out << " <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n"; - out << " </PPoints>\n"; out << " <PPointData>\n"; for (size_t s = 0; s < pointDataNames.size(); s++) - out << " <PDataArray type=\"Float32\" Name=\"" << pointDataNames[s] << "\"/>\n"; + out << " <PDataArray type=\"Float64\" Name=\"" << pointDataNames[s] << "\"/>\n"; out << " </PPointData>\n"; if (cellDataNames.size() > 0) { out << " <PCellData>\n"; for (size_t s = 0; s < cellDataNames.size(); s++) - out << " <PDataArray type=\"Float32\" Name=\"" << cellDataNames[s] << "\"/>\n"; + out << " <PDataArray type=\"Float64\" Name=\"" << cellDataNames[s] << "\"/>\n"; out << " </PCellData>\n"; } + out << " <PPoints>\n"; + out << " <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n"; + out << " </PPoints>\n"; for (size_t s = 0; s < pieceSources.size(); s++) out << " <Piece Source=\"" << pieceSources[s] << "\"/>\n"; @@ -159,25 +178,6 @@ string WbWriterVtkXmlBinary::writeParallelFile(const string &filename, vector<st /*===============================================================================*/ -// helper functions - -ofstream createFileStream(std::string vtkfilename) -{ - - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } - return out; -} - void writeVtkHeader(ofstream &out, int numberOfNodes, int numberOfCells) { out << "<?xml version=\"1.0\"?>\n"; @@ -285,7 +285,7 @@ void writeCellData(ofstream &out, int bytesPerByteVal, int bytesScalarData, vect } } -void writeEndOfFile(ofstream &out) +void writeEndOfVtkFile(ofstream &out) { out << "\n</AppendedData>\n"; out << "</VTKFile>"; @@ -322,12 +322,38 @@ string WbWriterVtkXmlBinary::writeLines(const string &filename, vector<UbTupleFl writeCellConnectivity(out, bytesPerByteVal, bytesCellConnectivity, lines); writeCellOffsets(out, bytesPerByteVal, bytesCellOffsets, nofCells); writeCellTypes(out, bytesPerByteVal, bytesCellTypes, nofCells); - writeEndOfFile(out); + writeEndOfVtkFile(out); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeLines to " << vtkfilename << " - end"); return vtkfilename; } +/*===============================================================================*/ +std::string WbWriterVtkXmlBinary::writePolyLines(const std::string &filename, + real *coordinatesX, real *coordinatesY, real *coordinatesZ, + uint numberOfCoordinates) +{ + std::vector<UbTupleFloat3> nodes; + std::vector<UbTupleInt2> lines; + + auto actualNodeNumber = 0; + + for (uint i = 0; i < numberOfCoordinates - 1; i++) { + nodes.push_back(makeUbTuple(float(coordinatesX[i]), float(coordinatesY[i]), float(coordinatesZ[i]))); + nodes.push_back(makeUbTuple(float(coordinatesX[i + 1]), float(coordinatesY[i + 1]), float(coordinatesZ[i + 1]))); + lines.push_back(makeUbTuple(actualNodeNumber, actualNodeNumber + 1)); + actualNodeNumber += 2; + } + return WbWriterVtkXmlBinary::writeLines(filename, nodes, lines); +} + +std::string WbWriterVtkXmlBinary::writePolyLines(const std::string & filename, std::vector<real>& coordinatesX, + std::vector<real>& coordinatesY, std::vector<real>& coordinatesZ) +{ + return this->writePolyLines(filename, coordinatesX.data(), coordinatesY.data(), coordinatesZ.data(), + (uint)coordinatesX.size()); +} + /*===============================================================================*/ string WbWriterVtkXmlBinary::writeLinesWithLineData(const string &filename, vector<UbTupleFloat3> &nodes, vector<UbTupleInt2> &lines, vector<string> &datanames, @@ -361,7 +387,7 @@ string WbWriterVtkXmlBinary::writeLinesWithLineData(const string &filename, vect writeCellOffsets(out, bytesPerByteVal, bytesCellOffsets, nofCells); writeCellTypes(out, bytesPerByteVal, bytesCellTypes, nofCells); writeCellData(out, bytesPerByteVal, bytesScalarData, datanames, celldata); - writeEndOfFile(out); + writeEndOfVtkFile(out); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeLinesWithLineData to " << vtkfilename << " - end"); @@ -493,17 +519,7 @@ string WbWriterVtkXmlBinary::writeTriangles(const string &filename, vector<UbTup string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeTriangles to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)triangles.size(); @@ -598,17 +614,7 @@ string WbWriterVtkXmlBinary::writeTrianglesWithNodeData(const string &filename, string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeTrianglesWithNodeData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -721,17 +727,7 @@ string WbWriterVtkXmlBinary::writeQuads(const string &filename, vector<UbTupleFl string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeQuads to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -826,17 +822,7 @@ string WbWriterVtkXmlBinary::writeQuadsWithNodeData(const string &filename, vect string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeQuadsWithNodeData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -951,17 +937,7 @@ string WbWriterVtkXmlBinary::writeQuadsWithCellData(const string &filename, vect string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeQuadsWithCellData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -1080,17 +1056,7 @@ string WbWriterVtkXmlBinary::writeQuadsWithNodeAndCellData(const string &filenam string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeQuadsWithNodeAndCellData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -1224,17 +1190,7 @@ string WbWriterVtkXmlBinary::writeOctsWithCellData(const string &filename, vecto string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeOctsWithCellData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -1353,17 +1309,7 @@ string WbWriterVtkXmlBinary::writeOctsWithNodeData(const string &filename, vecto string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeOctsWithNodeData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -1482,17 +1428,7 @@ string WbWriterVtkXmlBinary::writeOcts(const string &filename, vector<UbTupleFlo string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeOcts to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); int nofCells = (int)cells.size(); @@ -1588,17 +1524,7 @@ std::string WbWriterVtkXmlBinary::writeNodes(const std::string &filename, std::v string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeNodes to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); @@ -1683,17 +1609,7 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string &file string vtkfilename = filename + getFileExtension(); UBLOG(logDEBUG1, "WbWriterVtkXmlBinary::writeNodesWithNodeData to " << vtkfilename << " - start"); - ofstream out(vtkfilename.c_str(), ios::out | ios::binary); - if (!out) { - out.clear(); // flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if (path.size() > 0) { - UbSystem::makeDirectory(path); - out.open(vtkfilename.c_str(), ios::out | ios::binary); - } - if (!out) - throw UbException(UB_EXARGS, "couldn't open file " + vtkfilename); - } + ofstream out = createFileStream(vtkfilename); int nofNodes = (int)nodes.size(); diff --git a/src/basics/writer/WbWriterVtkXmlBinary.h b/src/basics/writer/WbWriterVtkXmlBinary.h index 0f2c31eda81ad0c1975c9715ac1b7fb37a06339b..a1428aab86d7793b87966989b6b4b11787d70844 100644 --- a/src/basics/writer/WbWriterVtkXmlBinary.h +++ b/src/basics/writer/WbWriterVtkXmlBinary.h @@ -36,6 +36,7 @@ #include <string> #include <basics/writer/WbWriter.h> +#include <basics/DataTypes.h> #include "basics_export.h" @@ -69,11 +70,13 @@ public: // write a metafile std::string writeCollection(const std::string &filename, const std::vector<std::string> &filenames, - const double ×tep, const bool &sepGroups); + const double &timeStep, const bool &separateGroups) const; + std::string writeCollectionForTimeSeries(const std::string &filename, + const std::map<uint, std::vector<std::string>> &filesNamesForTimeSteps, bool separateGroups) const; std::string addFilesToCollection(const std::string &filename, const std::vector<std::string> &filenames, - const double ×tep, const bool &sepGroups); + const double &timeStep, const bool &separateGroups) const; std::string writeParallelFile(const std::string &filename, std::vector<std::string> &pieceSources, - std::vector<std::string> &pointDataNames, std::vector<std::string> &cellDataNames); + std::vector<std::string> &pointDataNames, std::vector<std::string> &cellDataNames) const; ////////////////////////////////////////////////////////////////////////// // nodes @@ -88,6 +91,10 @@ public: // nodenumbering must start with 0! std::string writeLines(const std::string &filename, std::vector<UbTupleFloat3> &nodes, std::vector<UbTupleInt2> &lines) override; + std::string writePolyLines(const std::string &filename, real* coordinatesX, + real* coordinatesY, real*coordinatesZ, uint numberOfCoordinates) override; + std::string writePolyLines(const std::string & filename, std::vector<real>& coordinatesX, + std::vector<real>& coordinatesY, std::vector<real>& coordinatesZ) override; // std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, // std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& // nodedata); diff --git a/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp b/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp index 9be87887a26d654d03dc8a32ed9e456ec352fef2..c745e8a67b5a628321e27ea1132b55fba4bebd95 100644 --- a/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp +++ b/src/cpu/LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.cpp @@ -70,7 +70,7 @@ void LiggghtsCouplingWrapper::setVariable(char const *name, std::string &value) void LiggghtsCouplingWrapper::run(int nSteps) { std::stringstream cmd; - cmd << "run " << nSteps; + cmd << "run " << nSteps << " pre no post no"; execCommand(cmd); } void LiggghtsCouplingWrapper::runUpto(int nSteps) diff --git a/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp index ea39fc17d606498a4b977d77a5151f4fff6e216c..efe93f4c951684e41e6dd1c4d2b81c57c711727f 100644 --- a/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp +++ b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.cpp @@ -27,7 +27,7 @@ // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // //! \file IBcumulantK17LBMKernel.cpp -//! \ingroup LBM +//! \ingroup LiggghtsCoupling //! \author Konstantin Kutscher, Martin Geier //======================================================================================= #include "IBcumulantK17LBMKernel.h" @@ -134,9 +134,9 @@ void IBcumulantK17LBMKernel::calculate(int step) } ///////////////////////////////////// - localDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); - nonLocalDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); - restDistributions = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); + localDistributionsF = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); + nonLocalDistributionsF = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); + restDistributionsF = dynamic_pointer_cast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); @@ -191,35 +191,35 @@ void IBcumulantK17LBMKernel::calculate(int step) // a b c //-1 0 1 - LBMReal mfcbb = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3); - LBMReal mfbcb = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3); - LBMReal mfbbc = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3); - LBMReal mfccb = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3); - LBMReal mfacb = (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3); - LBMReal mfcbc = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3); - LBMReal mfabc = (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3); - LBMReal mfbcc = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3); - LBMReal mfbac = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3); - LBMReal mfccc = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3); - LBMReal mfacc = (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3); - LBMReal mfcac = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3); - LBMReal mfaac = (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3); - - LBMReal mfabb = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3); - LBMReal mfbab = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3); - LBMReal mfbba = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p); - LBMReal mfaab = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3); - LBMReal mfcab = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3); - LBMReal mfaba = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p); - LBMReal mfcba = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p); - LBMReal mfbaa = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p); - LBMReal mfbca = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p); - LBMReal mfaaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p); - LBMReal mfcaa = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p); - LBMReal mfaca = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p); - LBMReal mfcca = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p); - - LBMReal mfbbb = (*this->restDistributions)(x1, x2, x3); + LBMReal mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); + LBMReal mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); + LBMReal mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); + LBMReal mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); + LBMReal mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); + LBMReal mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); + LBMReal mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); + LBMReal mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); + LBMReal mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); + LBMReal mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); + LBMReal mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); + LBMReal mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); + LBMReal mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); + + LBMReal mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); + LBMReal mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); + LBMReal mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); + LBMReal mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); + LBMReal mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); + LBMReal mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); + LBMReal mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); + LBMReal mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); + LBMReal mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); + LBMReal mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); + LBMReal mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); + LBMReal mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); + LBMReal mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); + + LBMReal mfbbb = (*this->restDistributionsF)(x1, x2, x3); LBMReal f[D3Q27System::ENDF + 1]; LBMReal fEq[D3Q27System::ENDF + 1]; @@ -753,35 +753,35 @@ void IBcumulantK17LBMKernel::calculate(int step) //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), //! DOI:10.3390/computation5020019 ]</b></a> //! - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = mfabb; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = mfbab; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = mfbba; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; - (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; - (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; - (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; - (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; - - (*this->restDistributions)(x1, x2, x3) = mfbbb; + (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb; + (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab; + (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba; + (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; + (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; + (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; + (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; + (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; + (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; + (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; + (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; + (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; + (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; + + (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; + (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; + (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; + + (*this->restDistributionsF)(x1, x2, x3) = mfbbb; ////////////////////////////////////////////////////////////////////////// f[vf::lbm::dir::DIR_000] = mfbbb; @@ -813,91 +813,93 @@ void IBcumulantK17LBMKernel::calculate(int step) f[vf::lbm::dir::DIR_MPM] = mfaca; f[vf::lbm::dir::DIR_PPM] = mfcca; } - if ((*particleData)(x1, x2, x3)->solidFraction < SOLFRAC_MIN) - continue; - - LBMReal vx1, vx2, vx3, drho; - D3Q27System::calcCompMacroscopicValues(f, drho, vx1, vx2, vx3); - D3Q27System::calcCompFeq(fEq, drho, vx1, vx2, vx3); - - std::array<double, 3> uPart; - uPart[0] = (*particleData)(x1, x2, x3)->uPart[0] * (1. + drho); - uPart[1] = (*particleData)(x1, x2, x3)->uPart[1] * (1. + drho); - uPart[2] = (*particleData)(x1, x2, x3)->uPart[2] * (1. + drho); - - D3Q27System::calcCompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]); - - if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) { - double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; - f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + bb0; - for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { - const int iOpp = D3Q27System::INVDIR[iPop]; - double const bb = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); - double const bbOpp = ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); - - - f[iPop] = fPre[iPop] + bb; - f[iOpp] = fPre[iOpp] + bbOpp; - - (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp); - (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp); - (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp); - } - } else { /* particleData.solidFraction < SOLFRAC_MAX */ -//#ifdef LBDEM_USE_WEIGHING - double const ooo = 1. / omega - 0.5; - double const B = (*particleData)(x1, x2, x3)->solidFraction * ooo / ((1. - (*particleData)(x1, x2, x3)->solidFraction) + ooo); -//#else -// T const B = particleData.solidFraction; -//#endif - double const oneMinB = 1. - B; - - double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; - f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + oneMinB * (f[vf::lbm::dir::DIR_000] - fPre[vf::lbm::dir::DIR_000]) + B * bb0; - - for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { - int const iOpp = D3Q27System::INVDIR[iPop]; - double const bb = B * ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); - double const bbOpp = B * ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); - - f[iPop] = fPre[iPop] + oneMinB * (f[iPop] - fPre[iPop]) + bb; - f[iOpp] = fPre[iOpp] + oneMinB * (f[iOpp] - fPre[iOpp]) + bbOpp; - - (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp); - (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp); - (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp); - } - } /* if solidFraction > SOLFRAC_MAX */ - - (*this->restDistributions)(x1, x2, x3) = f[vf::lbm::dir::DIR_000]; - - (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = f[vf::lbm::dir::DIR_M00]; - (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = f[vf::lbm::dir::DIR_0M0]; - (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = f[vf::lbm::dir::DIR_00M]; - (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = f[vf::lbm::dir::DIR_MM0]; - (*this->localDistributions)(D3Q27System::ET_NW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PM0]; - (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = f[vf::lbm::dir::DIR_M0M]; - (*this->localDistributions)(D3Q27System::ET_TW, x1p, x2, x3) = f[vf::lbm::dir::DIR_P0M]; - (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = f[vf::lbm::dir::DIR_0MM]; - (*this->localDistributions)(D3Q27System::ET_TS, x1, x2p, x3) = f[vf::lbm::dir::DIR_0PM]; - (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = f[vf::lbm::dir::DIR_MMM]; - (*this->localDistributions)(D3Q27System::ET_TNW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PMM]; - (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MPM]; - (*this->localDistributions)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PPM]; - - (*this->nonLocalDistributions)(D3Q27System::ET_W, x1p, x2, x3) = f[vf::lbm::dir::DIR_P00]; - (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2p, x3) = f[vf::lbm::dir::DIR_0P0]; - (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3p) = f[vf::lbm::dir::DIR_00P]; - (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PP0]; - (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MP0]; - (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_P0P]; - (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3p) = f[vf::lbm::dir::DIR_M0P]; - (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2p, x3p) = f[vf::lbm::dir::DIR_0PP]; - (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3p) = f[vf::lbm::dir::DIR_0MP]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[vf::lbm::dir::DIR_PPP]; - (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[vf::lbm::dir::DIR_MPP]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_PMP]; - (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3p) = f[vf::lbm::dir::DIR_MMP]; + if ((*particleData)(x1, x2, x3)->solidFraction >= SOLFRAC_MIN) { + // if ((*particleData)(x1, x2, x3)->solidFraction < SOLFRAC_MIN) + // continue; + // + LBMReal vx1, vx2, vx3, drho; + D3Q27System::calcCompMacroscopicValues(f, drho, vx1, vx2, vx3); + D3Q27System::calcCompFeq(fEq, drho, vx1, vx2, vx3); + + std::array<double, 3> uPart; + uPart[0] = (*particleData)(x1, x2, x3)->uPart[0] * (1. + drho); + uPart[1] = (*particleData)(x1, x2, x3)->uPart[1] * (1. + drho); + uPart[2] = (*particleData)(x1, x2, x3)->uPart[2] * (1. + drho); + + D3Q27System::calcCompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]); + + if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) { + double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; + f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + bb0; + for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { + const int iOpp = D3Q27System::INVDIR[iPop]; + double const bb = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); + double const bbOpp = ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); + + + f[iPop] = fPre[iPop] + bb; + f[iOpp] = fPre[iOpp] + bbOpp; + + (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp); + (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp); + (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp); + } + } else { /* particleData.solidFraction < SOLFRAC_MAX */ + //#ifdef LBDEM_USE_WEIGHING + double const ooo = 1. / omega - 0.5; + double const B = (*particleData)(x1, x2, x3)->solidFraction * ooo / ((1. - (*particleData)(x1, x2, x3)->solidFraction) + ooo); + //#else + // T const B = particleData.solidFraction; + //#endif + double const oneMinB = 1. - B; + + double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; + f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + oneMinB * (f[vf::lbm::dir::DIR_000] - fPre[vf::lbm::dir::DIR_000]) + B * bb0; + + for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { + int const iOpp = D3Q27System::INVDIR[iPop]; + double const bb = B * ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); + double const bbOpp = B * ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); + + f[iPop] = fPre[iPop] + oneMinB * (f[iPop] - fPre[iPop]) + bb; + f[iOpp] = fPre[iOpp] + oneMinB * (f[iOpp] - fPre[iOpp]) + bbOpp; + + (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp); + (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp); + (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp); + } + } /* if solidFraction > SOLFRAC_MAX */ + + (*this->restDistributionsF)(x1, x2, x3) = f[vf::lbm::dir::DIR_000]; + + (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = f[vf::lbm::dir::DIR_M00]; + (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = f[vf::lbm::dir::DIR_0M0]; + (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = f[vf::lbm::dir::DIR_00M]; + (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = f[vf::lbm::dir::DIR_MM0]; + (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PM0]; + (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = f[vf::lbm::dir::DIR_M0M]; + (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = f[vf::lbm::dir::DIR_P0M]; + (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = f[vf::lbm::dir::DIR_0MM]; + (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = f[vf::lbm::dir::DIR_0PM]; + (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = f[vf::lbm::dir::DIR_MMM]; + (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PMM]; + (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MPM]; + (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PPM]; + + (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = f[vf::lbm::dir::DIR_P00]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = f[vf::lbm::dir::DIR_0P0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = f[vf::lbm::dir::DIR_00P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PP0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MP0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_P0P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = f[vf::lbm::dir::DIR_M0P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = f[vf::lbm::dir::DIR_0PP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = f[vf::lbm::dir::DIR_0MP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[vf::lbm::dir::DIR_PPP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[vf::lbm::dir::DIR_MPP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_PMP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = f[vf::lbm::dir::DIR_MMP]; + } } } } diff --git a/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h index 985ba75df5f0d726868e4ff854c384ad62eeb630..d675e72aabd3122a01e092e99fa22eb491270805 100644 --- a/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h +++ b/src/cpu/LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h @@ -34,7 +34,7 @@ #ifndef IBcumulantK17LBMKernel_h__ #define IBcumulantK17LBMKernel_h__ -#include "LBMKernel.h" +#include "LiggghtsCouplingLBMKernel.h" #include "BCSet.h" #include "D3Q27System.h" #include "UbTiming.h" @@ -50,7 +50,7 @@ //! <a href="http://dx.doi.org/10.1016/j.jcp.2017.05.040"><b>[ Geier et al., (2017), 10.1016/j.jcp.2017.05.040]</b></a>, //! <a href="http://dx.doi.org/10.1016/j.jcp.2017.07.004"><b>[ Geier et al., (2017), 10.1016/j.jcp.2017.07.004]</b></a> //! -class IBcumulantK17LBMKernel : public LBMKernel +class IBcumulantK17LBMKernel : public LiggghtsCouplingLBMKernel { public: IBcumulantK17LBMKernel(); @@ -58,11 +58,6 @@ public: void calculate(int step) override; SPtr<LBMKernel> clone() override; double getCalculationTime() override { return .0; } - CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr getParticleData() { return particleData; }; - void setParticleData(CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData) - { - this->particleData = particleData; - }; protected: inline void forwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K); @@ -72,9 +67,9 @@ protected: virtual void initDataSet(); - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions; - CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions; - CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr restDistributions; + CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + CbArray4D<LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + CbArray3D<LBMReal, IndexerX3X2X1>::CbArray3DPtr restDistributionsF; mu::value_type muX1, muX2, muX3; mu::value_type muDeltaT; @@ -83,7 +78,6 @@ protected: LBMReal forcingX2; LBMReal forcingX3; - CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.cpp b/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c502c4b48150e558aa785fa1bdc8c16bbecc1986 --- /dev/null +++ b/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.cpp @@ -0,0 +1,1795 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file IBsharpInterfaceLBMKernel.cpp +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#include "BCArray3D.h" +#include "Block3D.h" +#include "D3Q27EsoTwist3DSplittedVector.h" +#include "D3Q27System.h" +#include "DataSet3D.h" +#include "LBMKernel.h" +#include "IBsharpInterfaceLBMKernel.h" +#include "NonNewtonianFluids/LBM/Rheology.h" +#include <cmath> +#include <iostream> +#include <string> + +#define PROOF_CORRECTNESS + +using namespace vf::lbm::dir; +using namespace vf::basics::constant; + +////////////////////////////////////////////////////////////////////////// +IBsharpInterfaceLBMKernel::IBsharpInterfaceLBMKernel() +{ + this->compressible = false; +} +////////////////////////////////////////////////////////////////////////// +void IBsharpInterfaceLBMKernel::initDataSet() +{ + SPtr<DistributionArray3D> f(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); + SPtr<DistributionArray3D> h(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); // For phase-field + // SPtr<DistributionArray3D> h2(new D3Q27EsoTwist3DSplittedVector(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.9)); + // SPtr<PhaseFieldArray3D> divU1(new PhaseFieldArray3D( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + // CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure(new CbArray3D<real, IndexerX3X2X1>( nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + // pressureOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + // p1Old = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + + rhoNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vxNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vyNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + vzNode = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + dataSet->setFdistributions(f); + dataSet->setHdistributions(h); // For phase-field + // dataSet->setH2distributions(h2); + // dataSet->setPhaseField(divU1); + // dataSet->setPressureField(pressure); + + phaseField = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, -999.0)); + phaseFieldOld = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 999.0)); + + particleData = std::make_shared<CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>>(nx[0] + 4, nx[1] + 4, nx[2] + 4); + + // divU = CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr(new CbArray3D<real, IndexerX3X2X1>(nx[0] + 4, nx[1] + 4, nx[2] + 4, 0.0)); + int minX1 = 0; + int minX2 = 0; + int minX3 = 0; + int maxX1 = nx[0] + 4; + int maxX2 = nx[1] + 4; + int maxX3 = nx[2] + 4; + + for (int x3 = minX3; x3 < maxX3; x3++) { + for (int x2 = minX2; x2 < maxX2; x2++) { + for (int x1 = minX1; x1 < maxX1; x1++) { + (*particleData)(x1, x2, x3) = std::make_shared<IBdynamicsParticleData>(); + } + } + } +} +////////////////////////////////////////////////////////////////////////// +SPtr<LBMKernel> IBsharpInterfaceLBMKernel::clone() +{ + SPtr<LBMKernel> kernel(new IBsharpInterfaceLBMKernel()); + kernel->setNX(nx); + dynamicPointerCast<IBsharpInterfaceLBMKernel>(kernel)->initDataSet(); + kernel->setCollisionFactorMultiphase(this->collFactorL, this->collFactorG); + kernel->setDensityRatio(this->densityRatio); + // kernel->setMultiphaseModelParameters(this->beta, this->kappa); + kernel->setSigma(this->sigma); + kernel->setContactAngle(this->contactAngle); + kernel->setPhiL(this->phiL); + kernel->setPhiH(this->phiH); + kernel->setPhaseFieldRelaxation(this->tauH); + kernel->setMobility(this->mob); + kernel->setInterfaceWidth(this->interfaceWidth); + + kernel->setBCSet(bcSet->clone(kernel)); + kernel->setWithForcing(withForcing); + kernel->setForcingX1(muForcingX1); + kernel->setForcingX2(muForcingX2); + kernel->setForcingX3(muForcingX3); + kernel->setIndex(ix1, ix2, ix3); + kernel->setDeltaT(deltaT); + kernel->setGhostLayerWidth(2); + dynamicPointerCast<IBsharpInterfaceLBMKernel>(kernel)->initForcing(); + + return kernel; +} +////////////////////////////////////////////////////////////////////////// +void IBsharpInterfaceLBMKernel::forwardInverseChimeraWithKincompressible(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) +{ + // using namespace UbMath; + real m2 = mfa + mfc; + real m1 = mfc - mfa; + real m0 = m2 + mfb; + mfa = m0; + m0 *= Kinverse; + m0 += oneMinusRho; + mfb = (m1 * Kinverse - m0 * vv) * K; + mfc = ((m2 - c2o1 * m1 * vv) * Kinverse + v2 * m0) * K; +} + +//////////////////////////////////////////////////////////////////////////////// +void IBsharpInterfaceLBMKernel::backwardInverseChimeraWithKincompressible(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho) +{ + // using namespace UbMath; + real m0 = (((mfc - mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 - vv) * c1o2) * K; + real m1 = (((mfa - mfc) - c2o1 * mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (-v2)) * K; + mfc = (((mfc + mfb) * c1o2 + mfb * vv) * Kinverse + (mfa * Kinverse + oneMinusRho) * (v2 + vv) * c1o2) * K; + mfa = m0; + mfb = m1; +} + +//////////////////////////////////////////////////////////////////////////////// +void IBsharpInterfaceLBMKernel::forwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) +{ + // using namespace UbMath; + real m1 = (mfa + mfc) + mfb; + real m2 = mfc - mfa; + mfc = (mfc + mfa) + (v2 * m1 - c2o1 * vv * m2); + mfb = m2 - vv * m1; + mfa = m1; +} + +void IBsharpInterfaceLBMKernel::backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2) +{ + // using namespace UbMath; + real ma = (mfc + mfa * (v2 - vv)) * c1o2 + mfb * (vv - c1o2); + real mb = ((mfa - mfc) - mfa * v2) - c2o1 * mfb * vv; + mfc = (mfc + mfa * (v2 + vv)) * c1o2 + mfb * (vv + c1o2); + mfb = mb; + mfa = ma; +} + +void IBsharpInterfaceLBMKernel::calculate(int step) +{ + using namespace D3Q27System; + // using namespace UbMath; + + forcingX1 = 0.0; + forcingX2 = 0.0; + forcingX3 = 0.0; + + real oneOverInterfaceScale = c4o1 / interfaceWidth; // 1.0;//1.5; + ///////////////////////////////////// + + localDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getLocalDistributions(); + nonLocalDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getNonLocalDistributions(); + restDistributionsF = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getFdistributions())->getZeroDistributions(); + + localDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getLocalDistributions(); + nonLocalDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getNonLocalDistributions(); + restDistributionsH1 = dynamicPointerCast<D3Q27EsoTwist3DSplittedVector>(dataSet->getHdistributions())->getZeroDistributions(); + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure = dataSet->getPressureField(); + + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); + + const int bcArrayMaxX1 = (int)bcArray->getNX1(); + const int bcArrayMaxX2 = (int)bcArray->getNX2(); + const int bcArrayMaxX3 = (int)bcArray->getNX3(); + + int minX1 = ghostLayerWidth; + int minX2 = ghostLayerWidth; + int minX3 = ghostLayerWidth; + int maxX1 = bcArrayMaxX1 - ghostLayerWidth; + int maxX2 = bcArrayMaxX2 - ghostLayerWidth; + int maxX3 = bcArrayMaxX3 - ghostLayerWidth; + // real omegaDRho = 1.0;// 1.25;// 1.3; + for (int x3 = minX3 - ghostLayerWidth; x3 < maxX3 + ghostLayerWidth; x3++) { + for (int x2 = minX2 - ghostLayerWidth; x2 < maxX2 + ghostLayerWidth; x2++) { + for (int x1 = minX1 - ghostLayerWidth; x1 < maxX1 + ghostLayerWidth; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + int x1p = x1 + 1; + int x2p = x2 + 1; + int x3p = x3 + 1; + + real mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + real mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb = (*this->restDistributionsH1)(x1, x2, x3); + + // omegaDRho = 2.0;// 1.5; + // real phiOld = (*phaseField)(x1, x2, x3); + + (*phaseField)(x1, x2, x3) = + (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) + (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) + ((mfbaa + mfbac) + (mfbca + mfbcc))) + ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc)) + mfbbb; + + if ((*phaseField)(x1, x2, x3) > 1) { + (*phaseField)(x1, x2, x3) = c1o1; + } + + if ((*phaseField)(x1, x2, x3) < 0) { + (*phaseField)(x1, x2, x3) = 0; + } + } + } + } + } + + this->swapDistributions(); + for (int x3 = minX3 - ghostLayerWidth + 1; x3 < maxX3 + ghostLayerWidth - 1; x3++) { + for (int x2 = minX2 - ghostLayerWidth + 1; x2 < maxX2 + ghostLayerWidth - 1; x2++) { + for (int x1 = minX1 - ghostLayerWidth + 1; x1 < maxX1 + ghostLayerWidth - 1; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + // int x1p = x1 + 1; + // int x2p = x2 + 1; + // int x3p = x3 + 1; + + SPtr<DistributionArray3D> distributionH = this->getDataSet()->getHdistributions(); + real hh[27]; + distributionH->getDistributionInv(hh, x1, x2, x3); + real phiD, vxP, vyP, vzP; + + D3Q27System::calcIncompMacroscopicValues(hh, phiD, vxP, vyP, vzP); + (*phaseFieldOld)(x1, x2, x3) = phiD; + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG, vx, vy, vz; + + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + + (*rhoNode)(x1, x2, x3) = rhoG; // *((*phaseField)(x1, x2, x3) > c1o2 ? densityRatio : c1o1); + (*vxNode)(x1, x2, x3) = vx; + (*vyNode)(x1, x2, x3) = vy; + (*vzNode)(x1, x2, x3) = vz; + } + } + } + } + + SPtr<DistributionArray3D> distribution = this->getDataSet()->getFdistributions(); + real ff[27]; + for (int x3 = minX3 - 1; x3 < maxX3 + 1; x3++) { + for (int x2 = minX2 - 1; x2 < maxX2 + 1; x2++) { + for (int x1 = minX1 - 1; x1 < maxX1 + 1; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + // int x1p = x1 + 1; + // int x2p = x2 + 1; + // int x3p = x3 + 1; + findNeighbors(phaseFieldOld, x1, x2, x3); + ////////////////////////////////Momentum conservation experiment 06.03.2023 + // surfacetension + + if ((((*phaseField)(x1, x2, x3) <= c1o2) || phi[DIR_000] <= c1o2) && + ((phi[DIR_P00] > c1o2) || (phi[DIR_M00] > c1o2) || (phi[DIR_00P] > c1o2) || (phi[DIR_00M] > c1o2) || (phi[DIR_0M0] > c1o2) || (phi[DIR_0P0] > c1o2) || (phi[DIR_PP0] > c1o2) || (phi[DIR_PM0] > c1o2) || (phi[DIR_P0P] > c1o2) || (phi[DIR_P0M] > c1o2) || (phi[DIR_MP0] > c1o2) || + (phi[DIR_MM0] > c1o2) || (phi[DIR_M0P] > c1o2) || (phi[DIR_M0M] > c1o2) || (phi[DIR_0PM] > c1o2) || (phi[DIR_0MM] > c1o2) || (phi[DIR_0PP] > c1o2) || (phi[DIR_0MP] > c1o2) || (phi[DIR_PPP] > c1o2) || (phi[DIR_PMP] > c1o2) || (phi[DIR_MPP] > c1o2) || (phi[DIR_MMP] > c1o2) || + (phi[DIR_PPM] > c1o2) || (phi[DIR_PMM] > c1o2) || (phi[DIR_MPM] > c1o2) || (phi[DIR_MMM] > c1o2))) { + real vx = (*vxNode)(x1, x2, x3); + real vy = (*vyNode)(x1, x2, x3); + real vz = (*vzNode)(x1, x2, x3); + findNeighbors(phaseField, x1, x2, x3); + real laplacePressure = c12o1 * sigma * computeCurvature_phi(); + // if (step > 5000) + // UBLOG(logINFO, x1 << ","<< x2 << ","<< x3 << " "<< "3*dP=" << laplacePressure << " dP=" << laplacePressure / 3.0<< " phi=" << phi[DIR_000]<< "\n"); + findNeighbors(phaseFieldOld, x1, x2, x3); + + // 16.03.23 c: BB gas side with updated boundary velocity + + distribution->getDistributionInv(ff, x1, x2, x3); + real rhoG; + if (phi[DIR_000] > c1o2) { // initialization necessary + real sumRho = 0; + real sumWeight = 1.e-100; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] <= c1o2)) { + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumWeight += WEIGTH[fdir]; + } + } + rhoG = sumRho / sumWeight; // uncheck excpetion: what if there is no adequate neighbor? + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + if ((phi[D3Q27System::INVDIR[fdir]] > c1o2)) { + /// here we need reconstruction from scrach + real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; + + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real fGEQOld = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1, x2, x3), vx, vy, vz); + // real fGEQNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; // fL -feqOLD + feqNew; + // real fBC = fGG - c6o1 * WEIGTH[fdir] * (vBC); + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + ///// other possibility is tor replace the node itself instead of the neighbor (only c1o1 of them is allowed!) + // real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + // real feqOLD = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1 , x2 , x3 ), (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1 , x2 , x3 )); + // real feqNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, (*vxNode)(x1 , x2 , x3 ), (*vyNode)(x1 , x2 , x3 ), (*vzNode)(x1, x2, x3 )); + // real fBC = fG - feqOLD + feqNew; + // distribution->setDistributionForDirection(fBC, x1, x2, x3, fdir); + } + } + } + // distribution->setDistributionForDirection(D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz), x1, x2, x3, DIR_000); + { + real fL = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoG, vx, vy, vz); + distribution->setDistributionForDirection(fL - feqOLD + feqNew, x1, x2, x3, DIR_000); + } + + } else { // no refill of gas required + rhoG = (*rhoNode)(x1, x2, x3); + if ((*phaseField)(x1, x2, x3) <= c1o2) { // no refill liquid + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + // real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + // real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + // real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real feqNew = + // D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / + // (c1o1 / collFactorL - c1o1) + feqNew; + + // if ((*phaseField)(x1, x2, x3) <= c1o2) + distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real vxBC = c1o2 * (vx + (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = c1o2 * (vy + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); real feqL = + // D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + + // D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * + // (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * + // (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * + // (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, + // x2, x3, fdir); distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL-2*fL+2*feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * + // D3Q27System::DX3[fdir]), x1, x2, x3, fdir); real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC; real flWW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 + // - c1o1) * vBC; real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); real number = 666; distribution->setDistributionForDirection((fBC + fG) / densityRatio * + // 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC, x1, x2, x3, fdir); + //// real eqBC= D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + //// real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + // real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + //D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + //D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + ////real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + // distribution->setDistributionForDirection(c2o1*laplacePressure * WEIGTH[fdir] +(fBC + fG - eqBC - eqG) / densityRatio + (eqBC + eqG) - fL, x1, x2, x3, fdir);// -0* (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, + //fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + // //if (vxBC != 0) { + // // int set = 0; + // //} + + real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real laplacePressureBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + laplacePressureBC = c6o1 * c2o1 * computeCurvature_phi() * sigma; + findNeighbors(phaseFieldOld, x1, x2, x3); + } else + laplacePressureBC = laplacePressure; // curv; // reset to the above + laplacePressureBC = laplacePressure * (c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / + (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + + laplacePressureBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // laplacePressureBC *= sigma; + distribution->setDistributionForDirection(laplacePressureBC * WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio * 0) - fL - 0 * (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, + x2, x3, fdir); + } + } + } + } else { // refill liquid + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + // real dvDir = vBC - vDir; + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); + real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + + // real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + // real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real feqNew = + // D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / + // (c1o1 / collFactorL - c1o1) + feqNew; + + ff[D3Q27System::INVDIR[fdir]] = fBC; + if (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2) { + // real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); real feqL = + // D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + + // D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * + // (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * + // (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + // D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * + // (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + // distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL- (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vBC), x1, x2, x3, fdir); + // distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * + // D3Q27System::DX3[fdir]), x1, x2, x3, fdir); distribution->setDistributionForDirection(0, x1, x2, x3, fdir); real flW = (fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; real flWW = (fBC + fG) / densityRatio * 0 + // - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC; real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); + // real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + //D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + + //D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // //real flNew = (fBC + fG - eqBC - eqG) / densityRatio + eqBC + eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + // distribution->setDistributionForDirection(c2o1*laplacePressure* WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBC + eqG) - fL, x1, x2, x3, fdir);// - 0*(feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, x2, x3, + //fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); + + //// real number = 666; + + real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + + real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + + // real flNew = (fBC + fG-eqBC-eqG) / densityRatio +eqBC+eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; + real laplacePressureBC; + if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { + findNeighbors(phaseField, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + laplacePressureBC = c12o1 * computeCurvature_phi() * sigma; + findNeighbors(phaseFieldOld, x1, x2, x3); + } else + laplacePressureBC = laplacePressure; // curv; // reset to the above + laplacePressureBC = laplacePressure * (c1o1 - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) / + (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) + + laplacePressureBC * (-c1o1 + c2o1 * (*phaseField)(x1, x2, x3)) / (c2o1 * (*phaseField)(x1, x2, x3) - c2o1 * (*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // laplacePressureBC *= sigma; + distribution->setDistributionForDirection(laplacePressureBC * WEIGTH[fdir] + (fBC + fG - eqBC - eqG) / densityRatio + (eqBCN + eqGN) * (c1o1 - c1o1 / densityRatio * 0) - fL - 0 * (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC, x1, + x2, x3, fdir); + } + + } else { + ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + ; + } + } + + real sum2 = 1e-100; + real sumRho = 0; + real sumVx = 0; + real sumVy = 0; + real sumVz = 0; + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if ((phi[fdir] > c1o2)) { + + sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); // * tempRho; + sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + sum2 += WEIGTH[fdir]; + } + } + real rhoL; + D3Q27System::calcIncompMacroscopicValues(ff, rhoG, vx, vy, vz); + rhoL = sumRho / sum2; + // vx = sumVx / sum2; + // vy = sumVy / sum2; + // vz = sumVz / sum2; + // rhoL = (*rhoNode)(x1, x2, x3)/densityRatio; + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // ff[D3Q27System::INVDIR[fdir]] = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // } + + for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + if (((phi[fdir] <= c1o2))) //&& (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2))) + { + real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); + ff[D3Q27System::INVDIR[fdir]] = (ff[D3Q27System::INVDIR[fdir]] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + } + } + + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // if ((phi[D3Q27System::INVDIR[fdir]] <= c1o2) && (phi[fdir] > c1o2)) { + // //real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // //real vBC = -(D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX2[fdir] * vzBC); + // real vDir = -(D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX2[fdir] * vz); + // //vBC = (vBC + vDir) / (c2o1 -( vBC - vDir)); + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) - c6o1 * WEIGTH[fdir] * vDir; + // //real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]) + c6o1 * WEIGTH[fdir] * (vx * D3Q27System::DX1[fdir] + vy * D3Q27System::DX2[fdir] + vz * + //D3Q27System::DX3[fdir]); real fL= D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); distribution->setDistributionForDirection(fL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); ff[fdir] = fL; + // } + // if (!(phi[fdir] > c1o2)) { + // //std::cout << "Eq at dir=" << fdir << "\n"; + // real vxBC = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real feqL = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir], fdir); + // ff[fdir] = feqL; + // } + // } + // real sumRho2= 0; + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // sumRho2 += ff[fdir];// -D3Q27System::getIncompFeqForDirection(fdir, 0, sumVx, sumVy, sumVz); + // } + // ff[DIR_000] = rhoL - sumRho2; + // rhoL = 27.0 / 18.0 * sumRho2; + // std::cout << "rhoL=" << rhoL <<" sumRho="<< 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "\n"; + D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + // std::cout << "RecalCrhoL=" << rhoL << " sumRho=" << 27.0 / 18.0 * sumRho2 << " vx=" << vx << " vy=" << vy << "ffRest="<<ff[DIR_000]<<"\n"; + // distribution->setDistributionForDirection(ff[DIR_000], x1, x2, x3, DIR_000); + { + real fG = distribution->getDistributionInvForDirection(x1, x2, x3, DIR_000); + real feqOLD = D3Q27System::getIncompFeqForDirection(DIR_000, (*rhoNode)(x1, x2, x3), vx, vy, vz); + real feqNew = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + distribution->setDistributionForDirection(fG - feqOLD + feqNew, x1, x2, x3, DIR_000); + } + // for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + // ff[D3Q27System::INVDIR[fdir]]=distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + // } + // D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); + // std::cout << "AfterRead rhoL=" << rhoL << " rhoGToL=" << rhoG/densityRatio << " vx=" << vx << " vy=" << vy << "ffRest=" << ff[DIR_000] <<" x="<<x1<<" y="<<x2<<" z="<<x3<< "\n"; + + // real feqL = D3Q27System::getIncompFeqForDirection(DIR_000, rhoL, vx, vy, vz); + // distribution->setDistributionForDirection(feqL, x1, x2, x3, DIR_000); + } + } + + } // end Loop + } + } + } + } + + this->swapDistributions(); + + real collFactorM; + + for (int x3 = minX3; x3 < maxX3; x3++) { + for (int x2 = minX2; x2 < maxX2; x2++) { + for (int x1 = minX1; x1 < maxX1; x1++) { + if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { + int x1p = x1 + 1; + int x2p = x2 + 1; + int x3p = x3 + 1; + + findNeighbors(phaseField, x1, x2, x3); + + real mfcbb = (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3); + real mfbcb = (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3); + real mfbbc = (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3); + real mfccb = (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3); + real mfacb = (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3); + real mfcbc = (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3); + real mfabc = (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3); + real mfbcc = (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3); + real mfbac = (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3); + real mfccc = (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3); + real mfacc = (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3); + real mfcac = (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3); + real mfaac = (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3); + real mfabb = (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3); + real mfbab = (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3); + real mfbba = (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p); + real mfaab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3); + real mfcab = (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3); + real mfaba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p); + real mfcba = (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p); + real mfbaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p); + real mfbca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p); + real mfaaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p); + real mfcaa = (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p); + real mfaca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p); + real mfcca = (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p); + real mfbbb = (*this->restDistributionsF)(x1, x2, x3); + + real f[D3Q27System::ENDF + 1]; + real fEq[D3Q27System::ENDF + 1]; + real fEqSolid[D3Q27System::ENDF + 1]; + real fPre[D3Q27System::ENDF + 1]; + + f[vf::lbm::dir::DIR_000] = mfbbb; + + f[vf::lbm::dir::DIR_P00] = mfcbb; + f[vf::lbm::dir::DIR_0P0] = mfbcb; + f[vf::lbm::dir::DIR_00P] = mfbbc; + f[vf::lbm::dir::DIR_PP0] = mfccb; + f[vf::lbm::dir::DIR_MP0] = mfacb; + f[vf::lbm::dir::DIR_P0P] = mfcbc; + f[vf::lbm::dir::DIR_M0P] = mfabc; + f[vf::lbm::dir::DIR_0PP] = mfbcc; + f[vf::lbm::dir::DIR_0MP] = mfbac; + f[vf::lbm::dir::DIR_PPP] = mfccc; + f[vf::lbm::dir::DIR_MPP] = mfacc; + f[vf::lbm::dir::DIR_PMP] = mfcac; + f[vf::lbm::dir::DIR_MMP] = mfaac; + + f[vf::lbm::dir::DIR_M00] = mfabb; + f[vf::lbm::dir::DIR_0M0] = mfbab; + f[vf::lbm::dir::DIR_00M] = mfbba; + f[vf::lbm::dir::DIR_MM0] = mfaab; + f[vf::lbm::dir::DIR_PM0] = mfcab; + f[vf::lbm::dir::DIR_M0M] = mfaba; + f[vf::lbm::dir::DIR_P0M] = mfcba; + f[vf::lbm::dir::DIR_0MM] = mfbaa; + f[vf::lbm::dir::DIR_0PM] = mfbca; + f[vf::lbm::dir::DIR_MMM] = mfaaa; + f[vf::lbm::dir::DIR_PMM] = mfcaa; + f[vf::lbm::dir::DIR_MPM] = mfaca; + f[vf::lbm::dir::DIR_PPM] = mfcca; + + if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MIN) { + fPre[vf::lbm::dir::DIR_000] = mfbbb; + + fPre[vf::lbm::dir::DIR_P00] = mfcbb; + fPre[vf::lbm::dir::DIR_0P0] = mfbcb; + fPre[vf::lbm::dir::DIR_00P] = mfbbc; + fPre[vf::lbm::dir::DIR_PP0] = mfccb; + fPre[vf::lbm::dir::DIR_MP0] = mfacb; + fPre[vf::lbm::dir::DIR_P0P] = mfcbc; + fPre[vf::lbm::dir::DIR_M0P] = mfabc; + fPre[vf::lbm::dir::DIR_0PP] = mfbcc; + fPre[vf::lbm::dir::DIR_0MP] = mfbac; + fPre[vf::lbm::dir::DIR_PPP] = mfccc; + fPre[vf::lbm::dir::DIR_MPP] = mfacc; + fPre[vf::lbm::dir::DIR_PMP] = mfcac; + fPre[vf::lbm::dir::DIR_MMP] = mfaac; + + fPre[vf::lbm::dir::DIR_M00] = mfabb; + fPre[vf::lbm::dir::DIR_0M0] = mfbab; + fPre[vf::lbm::dir::DIR_00M] = mfbba; + fPre[vf::lbm::dir::DIR_MM0] = mfaab; + fPre[vf::lbm::dir::DIR_PM0] = mfcab; + fPre[vf::lbm::dir::DIR_M0M] = mfaba; + fPre[vf::lbm::dir::DIR_P0M] = mfcba; + fPre[vf::lbm::dir::DIR_0MM] = mfbaa; + fPre[vf::lbm::dir::DIR_0PM] = mfbca; + fPre[vf::lbm::dir::DIR_MMM] = mfaaa; + fPre[vf::lbm::dir::DIR_PMM] = mfcaa; + fPre[vf::lbm::dir::DIR_MPM] = mfaca; + fPre[vf::lbm::dir::DIR_PPM] = mfcca; + } + + (*particleData)(x1, x2, x3)->hydrodynamicForce.fill(0.0); + + + + real rhoH = 1.0; + real rhoL = 1.0 / densityRatio; + + // real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); + + real dX1_phi = gradX1_phi(); + real dX2_phi = gradX2_phi(); + real dX3_phi = gradX3_phi(); + + real denom = sqrt(dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi) + 1.0e-20; //+ 1e-9+1e-3; + // 01.09.2022: unclear what value we have to add to the normal: lager values better cut of in gas phase? + real normX1 = dX1_phi / denom; + real normX2 = dX2_phi / denom; + real normX3 = dX3_phi / denom; + + collFactorM = phi[DIR_000] > c1o2 ? collFactorL : collFactorG; + // real collFactorMInv = phi[DIR_000] > c1o2 ? collFactorG : collFactorL; + + // real mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(); + + //----------- Calculating Macroscopic Values ------------- + real rho = phi[DIR_000] > c1o2 ? rhoH : rhoL; + + real m0, m1, m2; + real rhoRef = c1o1; + + real vvx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + (mfcbb - mfabb)) / rhoRef; + real vvy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + (mfbcb - mfbab)) / rhoRef; + real vvz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + (mfbbc - mfbba)) / rhoRef; + ///////////////////// + + forcingX1 = 0.0; + forcingX2 = 0.0; + forcingX3 = 0.0; + + if (withForcing) { + muRho = rho; + muPhi = phi[DIR_000]; + forcingX1 += muForcingX1.Eval(); + forcingX2 += muForcingX2.Eval(); + forcingX3 += muForcingX3.Eval(); + + vvx += (forcingX1)*deltaT * c1o2; + vvy += (forcingX2)*deltaT * c1o2; + vvz += (forcingX3)*deltaT * c1o2; + } + if ((*particleData)(x1, x2, x3)->solidFraction <= SOLFRAC_MAX) { + real vx2; + real vy2; + real vz2; + vx2 = vvx * vvx; + vy2 = vvy * vvy; + vz2 = vvz * vvz; + /////////////////////////////////////////////////////////////////////////////////////////// + real oMdrho; + /////////////// + + oMdrho = mfccc + mfaaa; + m0 = mfaca + mfcac; + m1 = mfacc + mfcaa; + m2 = mfaac + mfcca; + oMdrho += m0; + m1 += m2; + oMdrho += m1; + m0 = mfbac + mfbca; + m1 = mfbaa + mfbcc; + m0 += m1; + m1 = mfabc + mfcba; + m2 = mfaba + mfcbc; + m1 += m2; + m0 += m1; + m1 = mfacb + mfcab; + m2 = mfaab + mfccb; + m1 += m2; + m0 += m1; + oMdrho += m0; + m0 = mfabb + mfcbb; + m1 = mfbab + mfbcb; + m2 = mfbba + mfbbc; + m0 += m1 + m2; + m0 += mfbbb; // hat gefehlt + oMdrho = (rhoRef - (oMdrho + m0)) / rhoRef; // 12.03.21 check derivation!!!! + + //////////////////////////////////////////////////////////////////////////////////// + real wadjust; + // real qudricLimit = 0.01 / (c1o1 + 1.0e4 * phi[DIR_000] * (c1o1 - phi[DIR_000])); + // real qudricLimit = 0.01 / (c1o1 + (((*phaseField)(x1, x2, x3) > c1o2) ? 1.0e6 * phi[DIR_000] * (c1o1 - phi[DIR_000]):c0o1)); + real qudricLimit = 0.01; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! see also Eq. (6)-(14) in \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + forwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + forwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + forwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + forwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + forwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + forwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c3o1, c1o9, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////// + // Cumulants + //////////////////////////////////////////////////////////////////////////////////// + + // mfaaa = 0.0; + real OxxPyyPzz = 1.0; // omega2 or bulk viscosity + // real OxyyPxzz = 1.;//-s9;//2+s9;// + // real OxyyMxzz = 1.;//2+s9;// + real O4 = 1.; + real O5 = 1.; + real O6 = 1.; + ///// + + /////fourth order parameters; here only for test. Move out of loop! + + real OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0))); + real OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM); + real Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / + (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0)); + real A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + // FIXME: warning C4459: declaration of 'B' hides global declaration (message : see declaration of 'D3Q27System::B' ) + real BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / + (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + + // Cum 4. + real CUMcbb = mfcbb - ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); + real CUMbcb = mfbcb - ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); + real CUMbbc = mfbbc - ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); + + real CUMcca = mfcca - ((mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMcac = mfcac - ((mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + real CUMacc = mfacc - ((mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho); + + // Cum 5. + real CUMbcc = mfbcc - (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) - c1o3 * (mfbca + mfbac) * oMdrho; + real CUMcbc = mfcbc - (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) - c1o3 * (mfcba + mfabc) * oMdrho; + real CUMccb = mfccb - (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) - c1o3 * (mfacb + mfcab) * oMdrho; + + // Cum 6. + real CUMccc = mfccc + + ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - 4. * (mfabb * mfcbb + mfbab * mfbcb + mfbba * mfbbc) - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + 2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho - + c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho) + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) + + c1o27 * oMdrho; + + // 2. + // linear combinations + real mxxPyyPzz = mfcaa + mfaca + mfaac; + mxxPyyPzz -= mfaaa; // 12.03.21 shifted by mfaaa + // mxxPyyPzz-=(mfaaa+mfaaaS)*c1o2;//12.03.21 shifted by mfaaa + real mxxMyy = mfcaa - mfaca; + real mxxMzz = mfcaa - mfaac; + + /// + real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + real mmfabb = mfabb; + real mmfbab = mfbab; + real mmfbba = mfbba; + /// + + real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) * 0; + // real dxux = -c1o2 * (mxxMyy + mxxMzz) * collFactorM - mfaaa * c1o3* omegaDRho; + real dyuy = dxux + collFactorM * c3o2 * mxxMyy; + real dzuz = dxux + collFactorM * c3o2 * mxxMzz; + real Dxy = -c3o1 * collFactorM * mfbba; + real Dxz = -c3o1 * collFactorM * mfbab; + real Dyz = -c3o1 * collFactorM * mfabb; + + if (phi[DIR_000] > c1o2) { + /// QR eddyviscosity: + real eddyR = -(Dxy * Dxy + Dxz * Dxz + c1o3 * dxux * dxux) * (dxux) - (Dxy * Dxy + Dyz * Dyz + c1o3 * dyuy * dyuy) * dyuy - (Dxz * Dxz + Dyz * Dyz + c1o3 * dzuz * dzuz) * dzuz - c2o1 * Dxy * Dxz * Dyz; + real eddyQ = Dxy * Dxz + Dxy * Dyz + Dxz * Dyz + c1o2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz); + real nuEddy = 5.0e1 * (eddyR / (eddyQ + 1e-100)) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); + nuEddy = (nuEddy < c1o1 / collFactorM) ? c1o1 / collFactorM : nuEddy; + collFactorM = c1o1 / nuEddy; + // collFactorM = c1o1 / (c1o1 / collFactorM +1.e2*nuEddy*(dX1_phi*dX1_phi+dX2_phi*dX2_phi+dX3_phi*dX3_phi)); + collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; + OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0))); + OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM); + Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / + (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0)); + A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / + (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // non Newtonian fluid collision factor + if (phi[DIR_000] > c1o2) { + real shearRate = sqrt(c2o1 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); + collFactorM = Rheology::getBinghamCollFactor(collFactorM, shearRate, c1o1); + collFactorM = (collFactorM < c1o1) ? c1o1 : collFactorM; + } + // omega = Rheology::getHerschelBulkleyCollFactor(omega, shearRate, drho); + // omega = Rheology::getBinghamCollFactor(omega, shearRate, drho); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + ///////// + // real mxxMyyh = -c2o1 * (dxux - dyuy) / collFactorMInv * c1o3; + // real mxxMzzh = -c2o1 * (dxux - dzuz) / collFactorMInv * c1o3; + + // relax + mxxPyyPzz += OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz) - 3. * (1. - c1o2 * OxxPyyPzz) * (vx2 * dxux + vy2 * dyuy + vz2 * dzuz); + mxxMyy += collFactorM * (-mxxMyy) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vy2 * dyuy); + mxxMzz += collFactorM * (-mxxMzz) - 3. * (1. - c1o2 * collFactorM) * (vx2 * dxux - vz2 * dzuz); + + mfabb += collFactorM * (-mfabb); + mfbab += collFactorM * (-mfbab); + mfbba += collFactorM * (-mfbba); + + // mxxMyyh += collFactorMInv * (-mxxMyyh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vy2 * dyuy); + // mxxMzzh += collFactorMInv * (-mxxMzzh) - 3. * (1. - c1o2 * collFactorMInv) * (vx2 * dxux - vz2 * dzuz); + + mxxPyyPzz += mfaaa; // 12.03.21 shifted by mfaaa + + // mxxPyyPzz += (mfaaa + mfaaaS) * c1o2; + // mfaaa = mfaaaS; + // linear combinations back + mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + mfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + mfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + + // 3. + // linear combinations + real mxxyPyzz = mfcba + mfabc; + real mxxyMyzz = mfcba - mfabc; + + real mxxzPyyz = mfcab + mfacb; + real mxxzMyyz = mfcab - mfacb; + + real mxyyPxzz = mfbca + mfbac; + real mxyyMxzz = mfbca - mfbac; + + mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz - mfaaa); + mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz - mfaaa); + mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz - mfaaa); + mmfabb += mfabb; + mmfbab += mfbab; + mmfbba += mfbba; + + // relax + wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit); + mfbbb += wadjust * (-mfbbb); + wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxyPyzz) / (fabs(mxxyPyzz) + qudricLimit); + mxxyPyzz += wadjust * (-mxxyPyzz); + wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxyMyzz) / (fabs(mxxyMyzz) + qudricLimit); + mxxyMyzz += wadjust * (-mxxyMyzz); + wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxxzPyyz) / (fabs(mxxzPyyz) + qudricLimit); + mxxzPyyz += wadjust * (-mxxzPyyz); + wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxxzMyyz) / (fabs(mxxzMyyz) + qudricLimit); + mxxzMyyz += wadjust * (-mxxzMyyz); + wadjust = OxyyPxzz + (1. - OxyyPxzz) * fabs(mxyyPxzz) / (fabs(mxyyPxzz) + qudricLimit); + mxyyPxzz += wadjust * (-mxyyPxzz); + wadjust = OxyyMxzz + (1. - OxyyMxzz) * fabs(mxyyMxzz) / (fabs(mxyyMxzz) + qudricLimit); + mxyyMxzz += wadjust * (-mxyyMxzz); + + // linear combinations back + mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; + mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; + mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; + mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; + mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; + mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // 4. + CUMacc = -O4 * (c1o1 / collFactorM - c1o2) * (dyuy + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMacc); + CUMcac = -O4 * (c1o1 / collFactorM - c1o2) * (dxux + dzuz) * c2o3 * A + (c1o1 - O4) * (CUMcac); + CUMcca = -O4 * (c1o1 / collFactorM - c1o2) * (dyuy + dxux) * c2o3 * A + (c1o1 - O4) * (CUMcca); + CUMbbc = -O4 * (c1o1 / collFactorM - c1o2) * Dxy * c1o3 * BB + (c1o1 - O4) * (CUMbbc); + CUMbcb = -O4 * (c1o1 / collFactorM - c1o2) * Dxz * c1o3 * BB + (c1o1 - O4) * (CUMbcb); + CUMcbb = -O4 * (c1o1 / collFactorM - c1o2) * Dyz * c1o3 * BB + (c1o1 - O4) * (CUMcbb); + + // 5. + CUMbcc += O5 * (-CUMbcc); + CUMcbc += O5 * (-CUMcbc); + CUMccb += O5 * (-CUMccb); + + // 6. + CUMccc += O6 * (-CUMccc); + + // back cumulants to central moments + // 4. + mfcbb = CUMcbb + ((mfcaa + c1o3) * mfabb + 2. * mfbba * mfbab); + mfbcb = CUMbcb + ((mfaca + c1o3) * mfbab + 2. * mfbba * mfabb); + mfbbc = CUMbbc + ((mfaac + c1o3) * mfbba + 2. * mfbab * mfabb); + + mfcca = CUMcca + (mfcaa * mfaca + 2. * mfbba * mfbba) + c1o3 * (mfcaa + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho; + mfcac = CUMcac + (mfcaa * mfaac + 2. * mfbab * mfbab) + c1o3 * (mfcaa + mfaac) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho; + mfacc = CUMacc + (mfaac * mfaca + 2. * mfabb * mfabb) + c1o3 * (mfaac + mfaca) * oMdrho + c1o9 * (oMdrho - c1o1) * oMdrho; + + // 5. + mfbcc = CUMbcc + (mfaac * mfbca + mfaca * mfbac + 4. * mfabb * mfbbb + 2. * (mfbab * mfacb + mfbba * mfabc)) + c1o3 * (mfbca + mfbac) * oMdrho; + mfcbc = CUMcbc + (mfaac * mfcba + mfcaa * mfabc + 4. * mfbab * mfbbb + 2. * (mfabb * mfcab + mfbba * mfbac)) + c1o3 * (mfcba + mfabc) * oMdrho; + mfccb = CUMccb + (mfcaa * mfacb + mfaca * mfcab + 4. * mfbba * mfbbb + 2. * (mfbab * mfbca + mfabb * mfcba)) + c1o3 * (mfacb + mfcab) * oMdrho; + + // 6. + mfccc = CUMccc - + ((-4. * mfbbb * mfbbb - (mfcaa * mfacc + mfaca * mfcac + mfaac * mfcca) - 4. * (mfabb * mfcbb + mfbac * mfbca + mfbba * mfbbc) - 2. * (mfbca * mfbac + mfcba * mfabc + mfcab * mfacb)) + + (4. * (mfbab * mfbab * mfaca + mfabb * mfabb * mfcaa + mfbba * mfbba * mfaac) + 2. * (mfcaa * mfaca * mfaac) + 16. * mfbba * mfbab * mfabb) - c1o3 * (mfacc + mfcac + mfcca) * oMdrho - c1o9 * oMdrho * oMdrho - + c1o9 * (mfcaa + mfaca + mfaac) * oMdrho * (1. - 2. * oMdrho) - c1o27 * oMdrho * oMdrho * (-2. * oMdrho) + (2. * (mfbab * mfbab + mfabb * mfabb + mfbba * mfbba) + (mfaac * mfaca + mfaac * mfcaa + mfaca * mfcaa)) * c2o3 * oMdrho) - + c1o27 * oMdrho; + + //////// + + //////////////////////////////////////////////////////////////////////////////////// + // forcing + mfbaa = -mfbaa; + mfaba = -mfaba; + mfaab = -mfaab; + + backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, vvx, vx2, c1o1, c1o1, oMdrho); + backwardChimera(mfaba, mfbba, mfcba, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfaab, mfbab, mfcab, vvx, vx2); + backwardChimera(mfabb, mfbbb, mfcbb, vvx, vx2); + backwardChimera(mfacb, mfbcb, mfccb, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, vvx, vx2, c3o1, c1o3, oMdrho); + backwardChimera(mfabc, mfbbc, mfcbc, vvx, vx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, vvx, vx2, c9o1, c1o9, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfaab, mfabb, mfacb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, vvy, vy2, c18o1, c1o18, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, vvy, vy2, c3o2, c2o3, oMdrho); + backwardChimera(mfbab, mfbbb, mfbcb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, vvy, vy2, c9o2, c2o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, vvy, vy2, c6o1, c1o6, oMdrho); + backwardChimera(mfcab, mfcbb, mfccb, vvy, vy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, vvy, vy2, c18o1, c1o18, oMdrho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, vvz, vz2, c9o4, c4o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, vvz, vz2, c36o1, c1o36, oMdrho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, vvz, vz2, c9o1, c1o9, oMdrho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, vvz, vz2, c36o1, c1o36, oMdrho); + ////////////////////////////////////////////////////////////////////////// + // proof correctness + ////////////////////////////////////////////////////////////////////////// + // #ifdef PROOF_CORRECTNESS + real rho_post = (mfaaa + mfaac + mfaca + mfcaa + mfacc + mfcac + mfccc + mfcca) + (mfaab + mfacb + mfcab + mfccb) + (mfaba + mfabc + mfcba + mfcbc) + (mfbaa + mfbac + mfbca + mfbcc) + (mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc) + mfbbb; + + if (UbMath::isNaN(rho_post) || UbMath::isInfinity(rho_post)) UB_THROW(UbException(UB_EXARGS, "rho_post is not a number (nan or -1.#IND) or infinity number -1.#INF, node=" + UbSystem::toString(x1) + "," + UbSystem::toString(x2) + "," + UbSystem::toString(x3))); + + ////////////////////////////////////////////////////////////////////////// + // write distribution + ////////////////////////////////////////////////////////////////////////// + // if (phi[DIR_000] < c1o2) { + (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = mfabb; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = mfbab; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = mfbba; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; //* rho * c1o3; + (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; //* rho * c1o3; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; //* rho * c1o3; + + (*this->restDistributionsF)(x1, x2, x3) = mfbbb; // *rho* c1o3; + + f[vf::lbm::dir::DIR_000] = mfbbb; + + f[vf::lbm::dir::DIR_P00] = mfcbb; + f[vf::lbm::dir::DIR_0P0] = mfbcb; + f[vf::lbm::dir::DIR_00P] = mfbbc; + f[vf::lbm::dir::DIR_PP0] = mfccb; + f[vf::lbm::dir::DIR_MP0] = mfacb; + f[vf::lbm::dir::DIR_P0P] = mfcbc; + f[vf::lbm::dir::DIR_M0P] = mfabc; + f[vf::lbm::dir::DIR_0PP] = mfbcc; + f[vf::lbm::dir::DIR_0MP] = mfbac; + f[vf::lbm::dir::DIR_PPP] = mfccc; + f[vf::lbm::dir::DIR_MPP] = mfacc; + f[vf::lbm::dir::DIR_PMP] = mfcac; + f[vf::lbm::dir::DIR_MMP] = mfaac; + + f[vf::lbm::dir::DIR_M00] = mfabb; + f[vf::lbm::dir::DIR_0M0] = mfbab; + f[vf::lbm::dir::DIR_00M] = mfbba; + f[vf::lbm::dir::DIR_MM0] = mfaab; + f[vf::lbm::dir::DIR_PM0] = mfcab; + f[vf::lbm::dir::DIR_M0M] = mfaba; + f[vf::lbm::dir::DIR_P0M] = mfcba; + f[vf::lbm::dir::DIR_0MM] = mfbaa; + f[vf::lbm::dir::DIR_0PM] = mfbca; + f[vf::lbm::dir::DIR_MMM] = mfaaa; + f[vf::lbm::dir::DIR_PMM] = mfcaa; + f[vf::lbm::dir::DIR_MPM] = mfaca; + f[vf::lbm::dir::DIR_PPM] = mfcca; + } + if ((*particleData)(x1, x2, x3)->solidFraction >= SOLFRAC_MIN) { + real vx1, vx2, vx3, drho; + D3Q27System::calcIncompMacroscopicValues(f, drho, vx1, vx2, vx3); + D3Q27System::calcIncompFeq(fEq, drho, vx1, vx2, vx3); + + std::array<double, 3> uPart; + uPart[0] = (*particleData)(x1, x2, x3)->uPart[0]; + uPart[1] = (*particleData)(x1, x2, x3)->uPart[1]; + uPart[2] = (*particleData)(x1, x2, x3)->uPart[2]; + + D3Q27System::calcIncompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]); + real rhoPhaseField = (phi[DIR_000] > c1o2) ? c1o1 : c1o1 / densityRatio; + if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) { + double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; + f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + bb0; + for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { + const int iOpp = D3Q27System::INVDIR[iPop]; + double const bb = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); + double const bbOpp = ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); + + f[iPop] = fPre[iPop] + bb; + f[iOpp] = fPre[iOpp] + bbOpp; + + (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp) * rhoPhaseField; + (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp) * rhoPhaseField; + (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp) * rhoPhaseField; + } + } else { /* particleData.solidFraction < SOLFRAC_MAX */ + // #ifdef LBDEM_USE_WEIGHING + double const ooo = 1. / collFactorM - 0.5; + double const B = (*particleData)(x1, x2, x3)->solidFraction * ooo / ((1. - (*particleData)(x1, x2, x3)->solidFraction) + ooo); + // #else + // T const B = particleData.solidFraction; + // #endif + double const oneMinB = 1. - B; + + double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; + f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + oneMinB * (f[vf::lbm::dir::DIR_000] - fPre[vf::lbm::dir::DIR_000]) + B * bb0; + + for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { + int const iOpp = D3Q27System::INVDIR[iPop]; + double const bb = B * ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); + double const bbOpp = B * ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); + + f[iPop] = fPre[iPop] + oneMinB * (f[iPop] - fPre[iPop]) + bb; + f[iOpp] = fPre[iOpp] + oneMinB * (f[iOpp] - fPre[iOpp]) + bbOpp; + + (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp) * rhoPhaseField; + (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp) * rhoPhaseField; + (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp) * rhoPhaseField; + } + } /* if solidFraction > SOLFRAC_MAX */ + + (*this->restDistributionsF)(x1, x2, x3) = f[vf::lbm::dir::DIR_000]; + + (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = f[vf::lbm::dir::DIR_M00]; + (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = f[vf::lbm::dir::DIR_0M0]; + (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = f[vf::lbm::dir::DIR_00M]; + (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = f[vf::lbm::dir::DIR_MM0]; + (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PM0]; + (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = f[vf::lbm::dir::DIR_M0M]; + (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = f[vf::lbm::dir::DIR_P0M]; + (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = f[vf::lbm::dir::DIR_0MM]; + (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = f[vf::lbm::dir::DIR_0PM]; + (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = f[vf::lbm::dir::DIR_MMM]; + (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PMM]; + (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MPM]; + (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PPM]; + + (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = f[vf::lbm::dir::DIR_P00]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = f[vf::lbm::dir::DIR_0P0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = f[vf::lbm::dir::DIR_00P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PP0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MP0]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_P0P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = f[vf::lbm::dir::DIR_M0P]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = f[vf::lbm::dir::DIR_0PP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = f[vf::lbm::dir::DIR_0MP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[vf::lbm::dir::DIR_PPP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[vf::lbm::dir::DIR_MPP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_PMP]; + (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = f[vf::lbm::dir::DIR_MMP]; + } + + + + ///////////////////// P H A S E - F I E L D S O L V E R + //////////////////////////////////////////// + /////CUMULANT PHASE-FIELD + real omegaD = 1.0 / (3.0 * mob + 0.5); + { + mfcbb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + mfbcb = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + mfbbc = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + mfccb = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + mfacb = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + mfcbc = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + mfabc = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + mfbcc = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + mfbac = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + mfccc = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + mfacc = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + mfcac = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + mfaac = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + mfabb = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + mfbab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + mfbba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + mfaab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + mfcab = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + mfaba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + mfcba = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + mfbaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + mfbca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + mfaaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + mfcaa = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + mfaca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + mfbbb = (*this->restDistributionsH1)(x1, x2, x3); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // second component + real concentration = + ((((mfccc + mfaaa) + (mfaca + mfcac)) + ((mfacc + mfcaa) + (mfaac + mfcca))) + (((mfbac + mfbca) + (mfbaa + mfbcc)) + ((mfabc + mfcba) + (mfaba + mfcbc)) + ((mfacb + mfcab) + (mfaab + mfccb))) + ((mfabb + mfcbb) + (mfbab + mfbcb) + (mfbba + mfbbc))) + mfbbb; + //////////////////////////////////////////////////////////////////////////////////// + real oneMinusRho = c1o1 - concentration; + + real cx = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfcaa - mfacc) + (mfcca - mfaac))) + (((mfcba - mfabc) + (mfcbc - mfaba)) + ((mfcab - mfacb) + (mfccb - mfaab))) + (mfcbb - mfabb)); + real cy = ((((mfccc - mfaaa) + (mfaca - mfcac)) + ((mfacc - mfcaa) + (mfcca - mfaac))) + (((mfbca - mfbac) + (mfbcc - mfbaa)) + ((mfacb - mfcab) + (mfccb - mfaab))) + (mfbcb - mfbab)); + real cz = ((((mfccc - mfaaa) + (mfcac - mfaca)) + ((mfacc - mfcaa) + (mfaac - mfcca))) + (((mfbac - mfbca) + (mfbcc - mfbaa)) + ((mfabc - mfcba) + (mfcbc - mfaba))) + (mfbbc - mfbba)); + + //////////////////////////////////////////////////////////////////////////////////// + // calculate the square of velocities for this lattice node + real cx2 = cx * cx; + real cy2 = cy * cy; + real cz2 = cz * cz; + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from well conditioned distributions to central moments as defined in Appendix J in \ref + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! see also Eq. (6)-(14) in \ref + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, c1o36, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + forwardChimera(mfaab, mfabb, mfacb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, c1o18, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho); + forwardChimera(mfbab, mfbbb, mfbcb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho); + forwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6o1, c1o6, oneMinusRho); + forwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + forwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + forwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1o1, c1o1, oneMinusRho); + forwardChimera(mfaba, mfbba, mfcba, cx, cx2); + forwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, c1o3, oneMinusRho); + forwardChimera(mfaab, mfbab, mfcab, cx, cx2); + forwardChimera(mfabb, mfbbb, mfcbb, cx, cx2); + forwardChimera(mfacb, mfbcb, mfccb, cx, cx2); + forwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3o1, c1o3, oneMinusRho); + forwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + forwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c3o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + //! - experimental Cumulant ... to be published ... hopefully + //! + + // linearized orthogonalization of 3rd order central moments + real Mabc = mfabc - mfaba * c1o3; + real Mbca = mfbca - mfbaa * c1o3; + real Macb = mfacb - mfaab * c1o3; + real Mcba = mfcba - mfaba * c1o3; + real Mcab = mfcab - mfaab * c1o3; + real Mbac = mfbac - mfbaa * c1o3; + // linearized orthogonalization of 5th order central moments + real Mcbc = mfcbc - mfaba * c1o9; + real Mbcc = mfbcc - mfbaa * c1o9; + real Mccb = mfccb - mfaab * c1o9; + + // 31.05.2022 addaptive mobility + // omegaD = c1o1 + (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) / (sqrt((cx - vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * + // concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration)) + fabs((1.0 - concentration) * (concentration)) * c1o6 * oneOverInterfaceScale+1.0e-200); omegaD = c2o1 * (concentration * (concentration - c1o1)) / (-c6o1 * (sqrt((cx - + // vvx * concentration) * (cx - vvx * concentration) + (cy - vvy * concentration) * (cy - vvy * concentration) + (cz - vvz * concentration) * (cz - vvz * concentration))) + (concentration * (concentration - c1o1))+1.0e-200); + // collision of 1st order moments + cx = cx * (c1o1 - omegaD) + omegaD * vvx * concentration + normX1 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration)*c1o3 * oneOverInterfaceScale; + cy = cy * (c1o1 - omegaD) + omegaD * vvy * concentration + normX2 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration)*c1o3 * oneOverInterfaceScale; + cz = cz * (c1o1 - omegaD) + omegaD * vvz * concentration + normX3 * (c1o1 - 0.5 * omegaD) * (1.0 - concentration) * (concentration)*c1o3 * oneOverInterfaceScale; + + cx2 = cx * cx; + cy2 = cy * cy; + cz2 = cz * cz; + + // equilibration of 2nd order moments + mfbba = c0o1; + mfbab = c0o1; + mfabb = c0o1; + + mfcaa = c1o3 * concentration; + mfaca = c1o3 * concentration; + mfaac = c1o3 * concentration; + + // equilibration of 3rd order moments + Mabc = c0o1; + Mbca = c0o1; + Macb = c0o1; + Mcba = c0o1; + Mcab = c0o1; + Mbac = c0o1; + mfbbb = c0o1; + + // from linearized orthogonalization 3rd order central moments to central moments + mfabc = Mabc + mfaba * c1o3; + mfbca = Mbca + mfbaa * c1o3; + mfacb = Macb + mfaab * c1o3; + mfcba = Mcba + mfaba * c1o3; + mfcab = Mcab + mfaab * c1o3; + mfbac = Mbac + mfbaa * c1o3; + + // equilibration of 4th order moments + mfacc = c1o9 * concentration; + mfcac = c1o9 * concentration; + mfcca = c1o9 * concentration; + + mfcbb = c0o1; + mfbcb = c0o1; + mfbbc = c0o1; + + // equilibration of 5th order moments + Mcbc = c0o1; + Mbcc = c0o1; + Mccb = c0o1; + + // from linearized orthogonalization 5th order central moments to central moments + mfcbc = Mcbc + mfaba * c1o9; + mfbcc = Mbcc + mfbaa * c1o9; + mfccb = Mccb + mfaab * c1o9; + + // equilibration of 6th order moment + mfccc = c1o27 * concentration; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), DOI:10.1016/j.camwa.2015.05.001 ]</b></a> + //! see also Eq. (88)-(96) in + //! <a href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfbaa, mfcaa, cx, cx2, c1o1, c1o1, oneMinusRho); + backwardChimera(mfaba, mfbba, mfcba, cx, cx2); + backwardInverseChimeraWithKincompressible(mfaca, mfbca, mfcca, cx, cx2, c3o1, c1o3, oneMinusRho); + backwardChimera(mfaab, mfbab, mfcab, cx, cx2); + backwardChimera(mfabb, mfbbb, mfcbb, cx, cx2); + backwardChimera(mfacb, mfbcb, mfccb, cx, cx2); + backwardInverseChimeraWithKincompressible(mfaac, mfbac, mfcac, cx, cx2, c3o1, c1o3, oneMinusRho); + backwardChimera(mfabc, mfbbc, mfcbc, cx, cx2); + backwardInverseChimeraWithKincompressible(mfacc, mfbcc, mfccc, cx, cx2, c9o1, c1o9, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaba, mfaca, cy, cy2, c6o1, c1o6, oneMinusRho); + backwardChimera(mfaab, mfabb, mfacb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfaac, mfabc, mfacc, cy, cy2, c18o1, c1o18, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbba, mfbca, cy, cy2, c3o2, c2o3, oneMinusRho); + backwardChimera(mfbab, mfbbb, mfbcb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfbac, mfbbc, mfbcc, cy, cy2, c9o2, c2o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcba, mfcca, cy, cy2, c6o1, c1o6, oneMinusRho); + backwardChimera(mfcab, mfcbb, mfccb, cy, cy2); + backwardInverseChimeraWithKincompressible(mfcac, mfcbc, mfccc, cy, cy2, c18o1, c1o18, oneMinusRho); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithKincompressible(mfaaa, mfaab, mfaac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaba, mfabb, mfabc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfaca, mfacb, mfacc, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbaa, mfbab, mfbac, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbba, mfbbb, mfbbc, cz, cz2, c9o4, c4o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfbca, mfbcb, mfbcc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcaa, mfcab, mfcac, cz, cz2, c36o1, c1o36, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcba, mfcbb, mfcbc, cz, cz2, c9o1, c1o9, oneMinusRho); + backwardInverseChimeraWithKincompressible(mfcca, mfccb, mfccc, cz, cz2, c36o1, c1o36, oneMinusRho); + + (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3) = mfabb; + (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3) = mfbab; + (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3) = mfbba; + (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3) = mfaab; + (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3) = mfcab; + (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3) = mfaba; + (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3) = mfcba; + (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3) = mfbaa; + (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3) = mfbca; + (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3) = mfaaa; + (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3) = mfcaa; + (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3) = mfaca; + (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3) = mfcca; + + (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3) = mfcbb; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3) = mfbcb; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p) = mfbbc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3) = mfccb; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3) = mfacb; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p) = mfcbc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p) = mfabc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p) = mfbcc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p) = mfbac; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p) = mfccc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p) = mfacc; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p) = mfcac; + (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p) = mfaac; + + (*this->restDistributionsH1)(x1, x2, x3) = mfbbb; + + } + } + } + } + } +} +////////////////////////////////////////////////////////////////////////// + +real IBsharpInterfaceLBMKernel::gradX1_phi() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) + (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) + (phi[DIR_PPM] - phi[DIR_MMP]))) + + WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) + (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_PM0] - phi[DIR_MP0]) + (phi[DIR_PP0] - phi[DIR_MM0])))) + + +WEIGTH[DIR_0P0] * (phi[DIR_P00] - phi[DIR_M00])); +} + +real IBsharpInterfaceLBMKernel::gradX2_phi() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PPM] - phi[DIR_MMP]) - (phi[DIR_PMP] - phi[DIR_MPM]))) + + WEIGTH[DIR_PP0] * (((phi[DIR_0PP] - phi[DIR_0MM]) + (phi[DIR_0PM] - phi[DIR_0MP])) + ((phi[DIR_PP0] - phi[DIR_MM0]) - (phi[DIR_PM0] - phi[DIR_MP0])))) + + +WEIGTH[DIR_0P0] * (phi[DIR_0P0] - phi[DIR_0M0])); +} + +real IBsharpInterfaceLBMKernel::gradX3_phi() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi[DIR_PPP] - phi[DIR_MMM]) - (phi[DIR_PMM] - phi[DIR_MPP])) + ((phi[DIR_PMP] - phi[DIR_MPM]) - (phi[DIR_PPM] - phi[DIR_MMP]))) + + WEIGTH[DIR_PP0] * (((phi[DIR_P0P] - phi[DIR_M0M]) - (phi[DIR_P0M] - phi[DIR_M0P])) + ((phi[DIR_0MP] - phi[DIR_0PM]) + (phi[DIR_0PP] - phi[DIR_0MM])))) + + +WEIGTH[DIR_0P0] * (phi[DIR_00P] - phi[DIR_00M])); +} + +real IBsharpInterfaceLBMKernel::gradX1_rhoInv(real rhoL, real rhoDIV) +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0 / (rhoL + rhoDIV * phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP])))) + + WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_P0P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0M])) + (1.0 / (rhoL + rhoDIV * phi[DIR_P0M]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0P]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_PM0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MP0])) + (1.0 / (rhoL + rhoDIV * phi[DIR_PP0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MM0]))))) + + +WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_P00]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M00]))); +} + +real IBsharpInterfaceLBMKernel::gradX2_rhoInv(real rhoL, real rhoDIV) +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0 / (rhoL + rhoDIV * phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM])))) + + WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_0PP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_0PM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MP]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_PP0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MM0])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PM0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MP0]))))) + + +WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_0P0]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0M0]))); +} + +real IBsharpInterfaceLBMKernel::gradX3_rhoInv(real rhoL, real rhoDIV) +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((1.0 / (rhoL + rhoDIV * phi[DIR_PPP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PMM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPP]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_PMP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MPM])) - (1.0 / (rhoL + rhoDIV * phi[DIR_PPM]) - 1.0 / (rhoL + rhoDIV * phi[DIR_MMP])))) + + WEIGTH[DIR_PP0] * (((1.0 / (rhoL + rhoDIV * phi[DIR_P0P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0M])) - (1.0 / (rhoL + rhoDIV * phi[DIR_P0M]) - 1.0 / (rhoL + rhoDIV * phi[DIR_M0P]))) + + ((1.0 / (rhoL + rhoDIV * phi[DIR_0MP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0PM])) + (1.0 / (rhoL + rhoDIV * phi[DIR_0PP]) - 1.0 / (rhoL + rhoDIV * phi[DIR_0MM]))))) + + +WEIGTH[DIR_0P0] * (1.0 / (rhoL + rhoDIV * phi[DIR_00P]) - 1.0 / (rhoL + rhoDIV * phi[DIR_00M]))); +} + +real IBsharpInterfaceLBMKernel::gradX1_phi2() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) + (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) + (phi2[DIR_PPM] - phi2[DIR_MMP]))) + + WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) + (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_PM0] - phi2[DIR_MP0]) + (phi2[DIR_PP0] - phi2[DIR_MM0])))) + + +WEIGTH[DIR_0P0] * (phi2[DIR_P00] - phi2[DIR_M00])); +} + +real IBsharpInterfaceLBMKernel::gradX2_phi2() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PPM] - phi2[DIR_MMP]) - (phi2[DIR_PMP] - phi2[DIR_MPM]))) + + WEIGTH[DIR_PP0] * (((phi2[DIR_0PP] - phi2[DIR_0MM]) + (phi2[DIR_0PM] - phi2[DIR_0MP])) + ((phi2[DIR_PP0] - phi2[DIR_MM0]) - (phi2[DIR_PM0] - phi2[DIR_MP0])))) + + +WEIGTH[DIR_0P0] * (phi2[DIR_0P0] - phi2[DIR_0M0])); +} + +real IBsharpInterfaceLBMKernel::gradX3_phi2() +{ + using namespace D3Q27System; + return 3.0 * ((WEIGTH[DIR_PPP] * (((phi2[DIR_PPP] - phi2[DIR_MMM]) - (phi2[DIR_PMM] - phi2[DIR_MPP])) + ((phi2[DIR_PMP] - phi2[DIR_MPM]) - (phi2[DIR_PPM] - phi2[DIR_MMP]))) + + WEIGTH[DIR_PP0] * (((phi2[DIR_P0P] - phi2[DIR_M0M]) - (phi2[DIR_P0M] - phi2[DIR_M0P])) + ((phi2[DIR_0MP] - phi2[DIR_0PM]) + (phi2[DIR_0PP] - phi2[DIR_0MM])))) + + +WEIGTH[DIR_0P0] * (phi2[DIR_00P] - phi2[DIR_00M])); +} + +real IBsharpInterfaceLBMKernel::nabla2_phi() +{ + using namespace D3Q27System; + real sum = 0.0; + sum += WEIGTH[DIR_PPP] * ((((phi[DIR_PPP] - phi[DIR_000]) + (phi[DIR_MMM] - phi[DIR_000])) + ((phi[DIR_MMP] - phi[DIR_000]) + (phi[DIR_PPM] - phi[DIR_000]))) + (((phi[DIR_MPP] - phi[DIR_000]) + (phi[DIR_PMM] - phi[DIR_000])) + ((phi[DIR_PMP] - phi[DIR_000]) + (phi[DIR_MPM] - phi[DIR_000])))); + sum += WEIGTH[DIR_0PP] * ((((phi[DIR_0PP] - phi[DIR_000]) + (phi[DIR_0MM] - phi[DIR_000])) + ((phi[DIR_0MP] - phi[DIR_000]) + (phi[DIR_0PM] - phi[DIR_000]))) + (((phi[DIR_P0P] - phi[DIR_000]) + (phi[DIR_M0M] - phi[DIR_000])) + ((phi[DIR_M0P] - phi[DIR_000]) + (phi[DIR_P0M] - phi[DIR_000]))) + + (((phi[DIR_PP0] - phi[DIR_000]) + (phi[DIR_MM0] - phi[DIR_000])) + ((phi[DIR_MP0] - phi[DIR_000]) + (phi[DIR_PM0] - phi[DIR_000])))); + sum += WEIGTH[DIR_00P] * (((phi[DIR_00P] - phi[DIR_000]) + (phi[DIR_00M] - phi[DIR_000])) + ((phi[DIR_0P0] - phi[DIR_000]) + (phi[DIR_0M0] - phi[DIR_000])) + ((phi[DIR_P00] - phi[DIR_000]) + (phi[DIR_M00] - phi[DIR_000]))); + + return 6.0 * sum; +} + +real IBsharpInterfaceLBMKernel::computeCurvature_phi() +{ + using namespace D3Q27System; + using namespace UbMath; + + real phiX = gradX1_phi(); + real phiY = gradX2_phi(); + real phiZ = gradX3_phi(); + real phiXX = + c4o9 * (phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]) + (c1o9 * (((phi[DIR_PP0] - c2o1 * phi[DIR_0P0] + phi[DIR_MP0]) + (phi[DIR_PM0] - c2o1 * phi[DIR_0M0] + phi[DIR_MM0])) + ((phi[DIR_P0P] - c2o1 * phi[DIR_00P] + phi[DIR_M0P]) + (phi[DIR_P0M] - c2o1 * phi[DIR_00M] + phi[DIR_M0M]))) + + c1o36 * (((phi[DIR_PPP] - c2o1 * phi[DIR_0PP] + phi[DIR_MPP]) + (phi[DIR_PMP] - c2o1 * phi[DIR_0MP] + phi[DIR_MMP])) + ((phi[DIR_PPM] - c2o1 * phi[DIR_0PM] + phi[DIR_MPM]) + (phi[DIR_PMM] - c2o1 * phi[DIR_0MM] + phi[DIR_MMM])))); + real phiYY = + c4o9 * (phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]) + (c1o9 * (((phi[DIR_PP0] - c2o1 * phi[DIR_P00] + phi[DIR_PM0]) + (phi[DIR_MP0] - c2o1 * phi[DIR_M00] + phi[DIR_MM0])) + ((phi[DIR_0PP] - c2o1 * phi[DIR_00P] + phi[DIR_0MP]) + (phi[DIR_0PM] - c2o1 * phi[DIR_00M] + phi[DIR_0MM]))) + + c1o36 * (((phi[DIR_PPP] - c2o1 * phi[DIR_P0P] + phi[DIR_PMP]) + (phi[DIR_MPM] - c2o1 * phi[DIR_M0M] + phi[DIR_MMM])) + ((phi[DIR_MPP] - c2o1 * phi[DIR_M0P] + phi[DIR_MMP]) + (phi[DIR_PPM] - c2o1 * phi[DIR_P0M] + phi[DIR_PMM])))); + real phiZZ = + c4o9 * (phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]) + (c1o9 * (((phi[DIR_M0P] - c2o1 * phi[DIR_M00] + phi[DIR_M0M]) + (phi[DIR_P0P] - c2o1 * phi[DIR_P00] + phi[DIR_P0M])) + ((phi[DIR_0MP] - c2o1 * phi[DIR_0M0] + phi[DIR_0MM]) + (phi[DIR_0PP] - c2o1 * phi[DIR_0P0] + phi[DIR_0PM]))) + + c1o36 * (((phi[DIR_MPP] - c2o1 * phi[DIR_MP0] + phi[DIR_MPM]) + (phi[DIR_PMP] - c2o1 * phi[DIR_PM0] + phi[DIR_PMM])) + ((phi[DIR_MMP] - c2o1 * phi[DIR_MM0] + phi[DIR_MMM]) + (phi[DIR_PPP] - c2o1 * phi[DIR_PP0] + phi[DIR_PPM])))); + real phiXY = c1o4 * (c2o3 * (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0]) + c1o6 * ((phi[DIR_MMP] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_MPP]) + (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PPM] - phi[DIR_MPM]))); + real phiXZ = c1o4 * (c2o3 * (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P]) + c1o6 * ((phi[DIR_MPM] - phi[DIR_PPM] + phi[DIR_PPP] - phi[DIR_MPP]) + (phi[DIR_MMM] - phi[DIR_PMM] + phi[DIR_PMP] - phi[DIR_MMP]))); + real phiYZ = c1o4 * (c2o3 * (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM]) + c1o6 * ((phi[DIR_MMM] - phi[DIR_MMP] + phi[DIR_MPP] - phi[DIR_MPM]) + (phi[DIR_PMM] - phi[DIR_PMP] + phi[DIR_PPP] - phi[DIR_PPM]))); + + // non isotropic FD (to be improved): + // real phiX = (phi[DIR_P00] - phi[DIR_M00]) * c1o2; //gradX1_phi(); + // real phiY = (phi[DIR_0P0] - phi[DIR_0M0]) * c1o2; //gradX2_phi(); + // real phiZ = (phi[DIR_00P] - phi[DIR_00M]) * c1o2; //gradX3_phi(); + + // real phiXX = phi[DIR_P00] - c2o1 * phi[DIR_000] + phi[DIR_M00]; + // real phiYY = phi[DIR_0P0] - c2o1 * phi[DIR_000] + phi[DIR_0M0]; + // real phiZZ =( phi[DIR_00P] - c2o1 * phi[DIR_000] + phi[DIR_00M]); + // real phiXY = c1o4 * (phi[DIR_MM0] - phi[DIR_PM0] + phi[DIR_PP0] - phi[DIR_MP0]); + // real phiXZ = c1o4 * (phi[DIR_M0M] - phi[DIR_P0M] + phi[DIR_P0P] - phi[DIR_M0P]); + // real phiYZ = c1o4 * (phi[DIR_0MM] - phi[DIR_0MP] + phi[DIR_0PP] - phi[DIR_0PM]); + // real back= (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - phiXX * (phiY * phiY + phiZ * phiZ) - phiYY * (phiX * phiX + phiZ * phiZ) - phiZZ * (phiX * phiX + phiY * phiY)) / (c2o1 * pow(phiX * phiX + phiY * phiY + phiZ * phiZ, c3o2)); + return (c2o1 * (phiX * phiY * phiXY + phiX * phiZ * phiXZ + phiY * phiZ * phiYZ) - phiXX * (phiY * phiY + phiZ * phiZ) - phiYY * (phiX * phiX + phiZ * phiZ) - phiZZ * (phiX * phiX + phiY * phiY)) / (c2o1 * pow(phiX * phiX + phiY * phiY + phiZ * phiZ, c3o2)); +} + +void IBsharpInterfaceLBMKernel::computePhasefield() +{ + using namespace D3Q27System; + SPtr<DistributionArray3D> distributionsH = dataSet->getHdistributions(); + + int minX1 = ghostLayerWidth; + int minX2 = ghostLayerWidth; + int minX3 = ghostLayerWidth; + int maxX1 = (int)distributionsH->getNX1() - ghostLayerWidth; + int maxX2 = (int)distributionsH->getNX2() - ghostLayerWidth; + int maxX3 = (int)distributionsH->getNX3() - ghostLayerWidth; + + //------------- Computing the phase-field ------------------ + for (int x3 = minX3; x3 < maxX3; x3++) { + for (int x2 = minX2; x2 < maxX2; x2++) { + for (int x1 = minX1; x1 < maxX1; x1++) { + // if(!bcArray->isSolid(x1,x2,x3) && !bcArray->isUndefined(x1,x2,x3)) + { + int x1p = x1 + 1; + int x2p = x2 + 1; + int x3p = x3 + 1; + + h[DIR_P00] = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3); + h[DIR_0P0] = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3); + h[DIR_00P] = (*this->localDistributionsH1)(D3Q27System::ET_T, x1, x2, x3); + h[DIR_PP0] = (*this->localDistributionsH1)(D3Q27System::ET_NE, x1, x2, x3); + h[DIR_MP0] = (*this->localDistributionsH1)(D3Q27System::ET_NW, x1p, x2, x3); + h[DIR_P0P] = (*this->localDistributionsH1)(D3Q27System::ET_TE, x1, x2, x3); + h[DIR_M0P] = (*this->localDistributionsH1)(D3Q27System::ET_TW, x1p, x2, x3); + h[DIR_0PP] = (*this->localDistributionsH1)(D3Q27System::ET_TN, x1, x2, x3); + h[DIR_0MP] = (*this->localDistributionsH1)(D3Q27System::ET_TS, x1, x2p, x3); + h[DIR_PPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNE, x1, x2, x3); + h[DIR_MPP] = (*this->localDistributionsH1)(D3Q27System::ET_TNW, x1p, x2, x3); + h[DIR_PMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSE, x1, x2p, x3); + h[DIR_MMP] = (*this->localDistributionsH1)(D3Q27System::ET_TSW, x1p, x2p, x3); + + h[DIR_M00] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_W, x1p, x2, x3); + h[DIR_0M0] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_S, x1, x2p, x3); + h[DIR_00M] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_B, x1, x2, x3p); + h[DIR_MM0] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SW, x1p, x2p, x3); + h[DIR_PM0] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_SE, x1, x2p, x3); + h[DIR_M0M] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BW, x1p, x2, x3p); + h[DIR_P0M] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BE, x1, x2, x3p); + h[DIR_0MM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BS, x1, x2p, x3p); + h[DIR_0PM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BN, x1, x2, x3p); + h[DIR_MMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSW, x1p, x2p, x3p); + h[DIR_PMM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BSE, x1, x2p, x3p); + h[DIR_MPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNW, x1p, x2, x3p); + h[DIR_PPM] = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); + + h[DIR_000] = (*this->restDistributionsH1)(x1, x2, x3); + } + } + } + } +} + +void IBsharpInterfaceLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); + + phi[DIR_000] = (*ph)(x1, x2, x3); + + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + + if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) { + phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); + } else { + phi[k] = (*ph)(x1, x2, x3); // neutral wetting + // phi[k] = 0.0;//unwetting + } + } +} + +void IBsharpInterfaceLBMKernel::findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3) +{ + using namespace D3Q27System; + + SPtr<BCArray3D> bcArray = this->getBCSet()->getBCArray(); + + phi2[DIR_000] = (*ph)(x1, x2, x3); + + for (int k = FSTARTDIR; k <= FENDDIR; k++) { + + if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) { + phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); + } else { + phi2[k] = 0.05; + } + } +} + +void IBsharpInterfaceLBMKernel::swapDistributions() +{ + LBMKernel::swapDistributions(); + dataSet->getHdistributions()->swap(); +} + +void IBsharpInterfaceLBMKernel::initForcing() +{ + muForcingX1.DefineVar("x1", &muX1); + muForcingX1.DefineVar("x2", &muX2); + muForcingX1.DefineVar("x3", &muX3); + muForcingX2.DefineVar("x1", &muX1); + muForcingX2.DefineVar("x2", &muX2); + muForcingX2.DefineVar("x3", &muX3); + muForcingX3.DefineVar("x1", &muX1); + muForcingX3.DefineVar("x2", &muX2); + muForcingX3.DefineVar("x3", &muX3); + + muDeltaT = deltaT; + + muForcingX1.DefineVar("dt", &muDeltaT); + muForcingX2.DefineVar("dt", &muDeltaT); + muForcingX3.DefineVar("dt", &muDeltaT); + + muNu = (1.0 / 3.0) * (1.0 / collFactor - 1.0 / 2.0); + + muForcingX1.DefineVar("nu", &muNu); + muForcingX2.DefineVar("nu", &muNu); + muForcingX3.DefineVar("nu", &muNu); + + muForcingX1.DefineVar("rho", &muRho); + muForcingX2.DefineVar("rho", &muRho); + muForcingX3.DefineVar("rho", &muRho); +} diff --git a/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.h b/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..a24131488a642a0a44712dd73fe4188cfeafaab2 --- /dev/null +++ b/src/cpu/LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.h @@ -0,0 +1,133 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file IBsharpInterfaceLBMKernel.h +//! \ingroup LBMKernel +//! \author M. Geier, K. Kutscher, Hesameddin Safari +//======================================================================================= + +#ifndef IBsharpInterfaceLBMKernel_H +#define IBsharpInterfaceLBMKernel_H + +#include "BCSet.h" +#include "D3Q27System.h" +#include "LiggghtsCouplingLBMKernel.h" +#include "basics/container/CbArray3D.h" +#include "basics/container/CbArray4D.h" +#include "basics/utilities/UbTiming.h" +#include "IBdynamicsParticleData.h" + +//! \brief Multiphase Cascaded Cumulant LBM kernel. +//! \details CFD solver that use Cascaded Cumulant Lattice Boltzmann method for D3Q27 model +//! \author M. Geier, K. Kutscher, Hesameddin Safari +class IBsharpInterfaceLBMKernel : public LiggghtsCouplingLBMKernel +{ +public: + IBsharpInterfaceLBMKernel(); + virtual ~IBsharpInterfaceLBMKernel(void) = default; + void calculate(int step) override; + SPtr<LBMKernel> clone() override; + + /// refactor + // CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressure; + + double getCalculationTime() override + { + return .0; + } + +protected: + virtual void initDataSet(); + void swapDistributions() override; + + void initForcing(); + + void forwardInverseChimeraWithKincompressible(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void backwardInverseChimeraWithKincompressible(real &mfa, real &mfb, real &mfc, real vv, real v2, real Kinverse, real K, real oneMinusRho); + void forwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2); + void backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2); + + real f1[D3Q27System::ENDF + 1]; + + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr restDistributionsF; + + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsH1; + CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsH1; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr restDistributionsH1; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr pressureOld; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr p1Old; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseField; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr phaseFieldOld; + // CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr divU; + + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr rhoNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vxNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vyNode; + CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr vzNode; + + real h[D3Q27System::ENDF + 1]; + // real h2[D3Q27System::ENDF + 1]; + // real g [D3Q27System::ENDF+1]; + real phi[D3Q27System::ENDF + 1]; + real phi2[D3Q27System::ENDF + 1]; + // real pr1[D3Q27System::ENDF+1]; + real phi_cutoff[D3Q27System::ENDF + 1]; + + real gradX1_phi(); + real gradX2_phi(); + real gradX3_phi(); + real gradX1_rhoInv(real rhoL, real rhoDIV); + real gradX2_rhoInv(real rhoL, real rhoDIV); + real gradX3_rhoInv(real rhoL, real rhoDIV); + real gradX1_phi2(); + real gradX2_phi2(); + real gradX3_phi2(); + void computePhasefield(); + void findNeighbors(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3); + void findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3); + + real nabla2_phi(); + + real computeCurvature_phi(); + + mu::value_type muX1, muX2, muX3; + mu::value_type muDeltaT; + mu::value_type muNu; + mu::value_type muRho; + mu::value_type muPhi; + real forcingX1; + real forcingX2; + real forcingX3; + +}; + +#endif diff --git a/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.cpp b/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff7a3bf1b19d5efd626f638d47dc05727fc2bc89 --- /dev/null +++ b/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.cpp @@ -0,0 +1,92 @@ +#include "LiggghtsCouplingLBMKernel.h" +#include "D3Q27System.h" + +//void LiggghtsCouplingLBMKernel::collisionOperator(int x1, int x2, int x3, real collFactorM, real fPre[]) +//{ +// //if ((*particleData)(x1, x2, x3)->solidFraction >= SOLFRAC_MIN) { +// LBMReal f[D3Q27System::ENDF + 1]; +// LBMReal fEq[D3Q27System::ENDF + 1]; +// LBMReal fEqSolid[D3Q27System::ENDF + 1]; +// LBMReal vx1, vx2, vx3, drho; +// D3Q27System::calcIncompMacroscopicValues(f, drho, vx1, vx2, vx3); +// D3Q27System::calcIncompFeq(fEq, drho, vx1, vx2, vx3); +// +// std::array<double, 3> uPart; +// uPart[0] = (*particleData)(x1, x2, x3)->uPart[0]; +// uPart[1] = (*particleData)(x1, x2, x3)->uPart[1]; +// uPart[2] = (*particleData)(x1, x2, x3)->uPart[2]; +// +// D3Q27System::calcIncompFeq(fEqSolid, drho, uPart[0], uPart[1], uPart[2]); +// real rhoPhaseField = (phi[DIR_000] > c1o2) ? c1o1 : c1o1 / densityRatio; +// if ((*particleData)(x1, x2, x3)->solidFraction > SOLFRAC_MAX) { +// double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; +// f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + bb0; +// for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { +// const int iOpp = D3Q27System::INVDIR[iPop]; +// double const bb = ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); +// double const bbOpp = ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); +// +// f[iPop] = fPre[iPop] + bb; +// f[iOpp] = fPre[iOpp] + bbOpp; +// +// (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp) * rhoPhaseField; +// (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp) * rhoPhaseField; +// (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp) * rhoPhaseField; +// } +// } else { /* particleData.solidFraction < SOLFRAC_MAX */ +// // #ifdef LBDEM_USE_WEIGHING +// double const ooo = 1. / collFactorM - 0.5; +// double const B = (*particleData)(x1, x2, x3)->solidFraction * ooo / ((1. - (*particleData)(x1, x2, x3)->solidFraction) + ooo); +// // #else +// // T const B = particleData.solidFraction; +// // #endif +// double const oneMinB = 1. - B; +// +// double const bb0 = fEq[vf::lbm::dir::DIR_000] - fEqSolid[vf::lbm::dir::DIR_000]; +// f[vf::lbm::dir::DIR_000] = fPre[vf::lbm::dir::DIR_000] + oneMinB * (f[vf::lbm::dir::DIR_000] - fPre[vf::lbm::dir::DIR_000]) + B * bb0; +// +// for (int iPop = D3Q27System::FSTARTDIR; iPop <= D3Q27System::FENDDIR; iPop++) { +// int const iOpp = D3Q27System::INVDIR[iPop]; +// double const bb = B * ((fPre[iOpp] - fEq[iOpp]) - (fPre[iPop] - fEqSolid[iPop])); +// double const bbOpp = B * ((fPre[iPop] - fEq[iPop]) - (fPre[iOpp] - fEqSolid[iOpp])); +// +// f[iPop] = fPre[iPop] + oneMinB * (f[iPop] - fPre[iPop]) + bb; +// f[iOpp] = fPre[iOpp] + oneMinB * (f[iOpp] - fPre[iOpp]) + bbOpp; +// +// (*particleData)(x1, x2, x3)->hydrodynamicForce[0] -= D3Q27System::DX1[iPop] * (bb - bbOpp) * rhoPhaseField; +// (*particleData)(x1, x2, x3)->hydrodynamicForce[1] -= D3Q27System::DX2[iPop] * (bb - bbOpp) * rhoPhaseField; +// (*particleData)(x1, x2, x3)->hydrodynamicForce[2] -= D3Q27System::DX3[iPop] * (bb - bbOpp) * rhoPhaseField; +// } +// } /* if solidFraction > SOLFRAC_MAX */ +// +// // (*this->restDistributionsF)(x1, x2, x3) = f[vf::lbm::dir::DIR_000]; +// +// // (*this->localDistributionsF)(D3Q27System::ET_E, x1, x2, x3) = f[vf::lbm::dir::DIR_M00]; +// // (*this->localDistributionsF)(D3Q27System::ET_N, x1, x2, x3) = f[vf::lbm::dir::DIR_0M0]; +// // (*this->localDistributionsF)(D3Q27System::ET_T, x1, x2, x3) = f[vf::lbm::dir::DIR_00M]; +// // (*this->localDistributionsF)(D3Q27System::ET_NE, x1, x2, x3) = f[vf::lbm::dir::DIR_MM0]; +// // (*this->localDistributionsF)(D3Q27System::ET_NW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PM0]; +// // (*this->localDistributionsF)(D3Q27System::ET_TE, x1, x2, x3) = f[vf::lbm::dir::DIR_M0M]; +// // (*this->localDistributionsF)(D3Q27System::ET_TW, x1p, x2, x3) = f[vf::lbm::dir::DIR_P0M]; +// // (*this->localDistributionsF)(D3Q27System::ET_TN, x1, x2, x3) = f[vf::lbm::dir::DIR_0MM]; +// // (*this->localDistributionsF)(D3Q27System::ET_TS, x1, x2p, x3) = f[vf::lbm::dir::DIR_0PM]; +// // (*this->localDistributionsF)(D3Q27System::ET_TNE, x1, x2, x3) = f[vf::lbm::dir::DIR_MMM]; +// // (*this->localDistributionsF)(D3Q27System::ET_TNW, x1p, x2, x3) = f[vf::lbm::dir::DIR_PMM]; +// // (*this->localDistributionsF)(D3Q27System::ET_TSE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MPM]; +// // (*this->localDistributionsF)(D3Q27System::ET_TSW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PPM]; +// +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_W, x1p, x2, x3) = f[vf::lbm::dir::DIR_P00]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_S, x1, x2p, x3) = f[vf::lbm::dir::DIR_0P0]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_B, x1, x2, x3p) = f[vf::lbm::dir::DIR_00P]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_SW, x1p, x2p, x3) = f[vf::lbm::dir::DIR_PP0]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_SE, x1, x2p, x3) = f[vf::lbm::dir::DIR_MP0]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_P0P]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BE, x1, x2, x3p) = f[vf::lbm::dir::DIR_M0P]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BS, x1, x2p, x3p) = f[vf::lbm::dir::DIR_0PP]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BN, x1, x2, x3p) = f[vf::lbm::dir::DIR_0MP]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSW, x1p, x2p, x3p) = f[vf::lbm::dir::DIR_PPP]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BSE, x1, x2p, x3p) = f[vf::lbm::dir::DIR_MPP]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNW, x1p, x2, x3p) = f[vf::lbm::dir::DIR_PMP]; +// // (*this->nonLocalDistributionsF)(D3Q27System::ET_BNE, x1, x2, x3p) = f[vf::lbm::dir::DIR_MMP]; +// //} +//} \ No newline at end of file diff --git a/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.h b/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.h new file mode 100644 index 0000000000000000000000000000000000000000..86ac895486d357e9facc30c210b325af527dfbf2 --- /dev/null +++ b/src/cpu/LiggghtsCoupling/LBM/LiggghtsCouplingLBMKernel.h @@ -0,0 +1,66 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LiggghtsCouplingLBMKernel.h +//! \ingroup LBM +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef LiggghtsCouplingLBMKernel_h +#define LiggghtsCouplingLBMKernel_h + +#include "LBMKernel.h" +#include "IBdynamicsParticleData.h" +#include "basics/container/CbArray3D.h" +#include "basics/container/CbArray4D.h" + +class LiggghtsCouplingLBMKernel : public LBMKernel +{ +public: + virtual ~LiggghtsCouplingLBMKernel() = default; + + CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr getParticleData() + { + return particleData; + }; + void setParticleData(CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData) + { + this->particleData = particleData; + }; + + + protected: + //void collisionOperator(); + CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData; + + //CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF; + //CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF; + //CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr restDistributionsF; +}; + +#endif \ No newline at end of file diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h b/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h index 88e5be001b5f71f97b4369ab3795ee5e3e972210..42b127f730e1c6ba58d9da93fe7653e5f9f7407c 100644 --- a/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h +++ b/src/cpu/LiggghtsCoupling/LiggghtsCoupling.h @@ -26,13 +26,18 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file MultiphasePressureBCStrategy.h -//! \ingroup BoundarConditions -//! \author Hesameddin Safari +//! \file LiggghtsCoupling.h +//! \ingroup LiggghtsCoupling +//! \author Konstantin Kutscher //======================================================================================= -#pragma once +#ifndef LiggghtsCoupling_h +#define LiggghtsCoupling_h #include "LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h" #include "LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h" -#include "LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h" \ No newline at end of file +#include "LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.h" +#include "LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h" +#include "LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.h" + +#endif \ No newline at end of file diff --git a/src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.cpp b/src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..487077f080205cb33ca11748d1f611ca1f1a423d --- /dev/null +++ b/src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.cpp @@ -0,0 +1,82 @@ +#include "LiggghtsPartitioningGridVisitor.h" +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file LiggghtsPartitioningGridVisitor.cpp +//! \ingroup LiggghtsCoupling +//! \author Konstantin Kutscher +//======================================================================================= + +#include <comm.h> +#include "LiggghtsPartitioningGridVisitor.h" +#include "VirtualFluidsCore/Simulation/Grid3D.h" +#include "VirtualFluidsCore/Simulation/Block3D.h" + +LiggghtsPartitioningGridVisitor::LiggghtsPartitioningGridVisitor(int nx, int ny, int nz, LAMMPS_NS::LAMMPS *lmp) : nx(nx), ny(ny), nz(nz), lmp(*lmp) +{ + +} + +LiggghtsPartitioningGridVisitor::~LiggghtsPartitioningGridVisitor() +{ + +} + +void LiggghtsPartitioningGridVisitor::visit(SPtr<Grid3D> grid) +{ + npx = lmp.comm->procgrid[0]; + npy = lmp.comm->procgrid[1]; + npz = lmp.comm->procgrid[2]; + + for (int i = 0; i <= npx; i++) + xVal.push_back(round(lmp.comm->xsplit[i] * (double)nx)); + for (int i = 0; i <= npy; i++) + yVal.push_back(round(lmp.comm->ysplit[i] * (double)ny)); + for (int i = 0; i <= npz; i++) + zVal.push_back(round(lmp.comm->zsplit[i] * (double)nz)); + + UbTupleInt3 blockNX = grid->getBlockNX(); + + for (int iX = 0; iX < xVal.size() - 1; ++iX) { + for (int iY = 0; iY < yVal.size() - 1; ++iY) { + for (int iZ = 0; iZ < zVal.size() - 1; ++iZ) { + + int rank = (int)lmp.comm->grid2proc[iX][iY][iZ]; + int blockX1 = xVal[iX] / val<1>(blockNX); + int blockX2 = yVal[iY] / val<2>(blockNX); + int blockX3 = zVal[iZ] / val<3>(blockNX); + SPtr<Block3D> block = grid->getBlock(blockX1, blockX2, blockX3, 0); + block->setRank(rank); + } + } + } + + xVal.clear(); + yVal.clear(); + zVal.clear(); +} diff --git a/pythonbindings/src/VirtualFluids.cpp b/src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.h similarity index 70% rename from pythonbindings/src/VirtualFluids.cpp rename to src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.h index 91682b79e8125a7513565b28e2e22e74e0b2dac1..6fb5560ad7a93ca13005a24fcf976d4019576dd1 100644 --- a/pythonbindings/src/VirtualFluids.cpp +++ b/src/cpu/LiggghtsCoupling/Parallel/LiggghtsPartitioningGridVisitor.h @@ -26,39 +26,34 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file VirtualFluids.cpp -//! \ingroup src -//! \author Henry Korb +//! \file LiggghtsPartitioningGridVisitor.h +//! \ingroup LiggghtsCoupling +//! \author Konstantin Kutscher //======================================================================================= -#include <pybind11/pybind11.h> -#include "basics/basics.cpp" -#include "lbm/lbm.cpp" -#include "logger/logger.cpp" +#ifndef LiggghtsPartitioningGridVisitor_h +#define LiggghtsPartitioningGridVisitor_h -#ifdef VF_GPU_PYTHONBINDINGS -#include "gpu/gpu.cpp" -#endif -#ifdef VF_CPU_PYTHONBINDINGS -#include "cpu/cpu.cpp" -#endif +#include <lammps.h> +#include <vector> +#include "basics/PointerDefinitions.h" +#include "VirtualFluidsCore/Visitors/Grid3DVisitor.h" +class LiggghtsCouplingWrapper; +class Grid3D; -namespace py_bindings +class LiggghtsPartitioningGridVisitor : public Grid3DVisitor { - namespace py = pybind11; +public: + LiggghtsPartitioningGridVisitor(int nx, int ny, int nz, LAMMPS_NS::LAMMPS *lmp); - PYBIND11_MODULE(bindings, m) - { - // because we do not use the old logger (src/basics/logger) anymore and cout is not passed anymore to the old logger, we probably do not need this anymore - // pybind11::add_ostream_redirect(m, "ostream_redirect"); - basics::makeModule(m); - lbm::makeModule(m); - logging::makeModule(m); -#ifdef VF_GPU_PYTHONBINDINGS - gpu::makeModule(m); -#endif -#ifdef VF_CPU_PYTHONBINDINGS - cpu::makeModule(m); -#endif - } -} + ~LiggghtsPartitioningGridVisitor() override; + + void visit(SPtr<Grid3D> grid) override; + +private: + int nx, ny, nz; + LAMMPS_NS::LAMMPS &lmp; + int npx{ 0 }, npy{ 0 }, npz{ 0 }; + std::vector<int> xVal, yVal, zVal; +}; +#endif \ No newline at end of file diff --git a/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp index 7b7fafd8a653f9a33559d9f569c6add4fba929f9..8d4c069c7d3f93ace398acc60b07a018577a3ec9 100644 --- a/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp +++ b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.cpp @@ -1,6 +1,6 @@ #include "LiggghtsCouplingSimulationObserver.h" #include "GbSphere3D.h" -#include "mpi/MPICommunicator.h" +#include "parallel/MPICommunicator.h" #include "SimulationObserver.h" #include "LiggghtsCoupling/3rdParty/LiggghtsCouplingWrapper.h" #include "Grid3D.h" @@ -9,11 +9,12 @@ #include "DistributionArray3D.h" #include "DataSet3D.h" #include "LiggghtsCoupling/LBM/IBcumulantK17LBMKernel.h" +#include "LiggghtsCoupling/LBM/IBsharpInterfaceLBMKernel.h" #include "LBMUnitConverter.h" #include "fix_lb_coupling_onetoone.h" LiggghtsCouplingSimulationObserver::LiggghtsCouplingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, - SPtr<vf::mpi::Communicator> comm, + SPtr<vf::parallel::Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units) : SimulationObserver(grid, s), comm(comm), wrapper(wrapper), demSteps(demSteps), units(units) @@ -27,8 +28,8 @@ LiggghtsCouplingSimulationObserver::~LiggghtsCouplingSimulationObserver() void LiggghtsCouplingSimulationObserver::update(double actualTimeStep) { - if (comm->getProcessID() == 0) - std::cout << "LiggghtsCouplingSimulationObserver step: " << actualTimeStep << "\n"; + //if (comm->getProcessID() == 0) + // std::cout << "LiggghtsCouplingSimulationObserver step: " << actualTimeStep << "\n"; //comm->barrier(); @@ -98,28 +99,57 @@ void LiggghtsCouplingSimulationObserver::setSingleSphere3D(double *x, double *v, std::vector<SPtr<Block3D>> blocks; grid->getBlocksByCuboid(level, x[0] - r, x[1] - r, x[2] - r, x[0] + r, x[1] + r, x[2] + r, blocks); + //DEBUG + /////////////////////// + if (blocks.size() == 2) + int test = 0; + + /////////////////////// + for (SPtr<Block3D> block : blocks) { if (block) { SPtr<ILBMKernel> kernel = block->getKernel(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData = - dynamicPointerCast<IBcumulantK17LBMKernel>(kernel)->getParticleData(); + dynamicPointerCast<LiggghtsCouplingLBMKernel>(kernel)->getParticleData(); if (!particleData) continue; - int minX1 = 1; - int minX2 = 1; - int minX3 = 1; + int minX1b = 1; + int minX2b = 1; + int minX3b = 1; - int maxX1 = (int)(distributions->getNX1()) - 1; - int maxX2 = (int)(distributions->getNX2()) - 1; - int maxX3 = (int)(distributions->getNX3()) - 1; + int maxX1b = (int)(distributions->getNX1()) - 2; + int maxX2b = (int)(distributions->getNX2()) - 2; + int maxX3b = (int)(distributions->getNX3()) - 2; - for (int ix3 = minX3; ix3 < maxX3; ix3++) { - for (int ix2 = minX2; ix2 < maxX2; ix2++) { - for (int ix1 = minX1; ix1 < maxX1; ix1++) { + real deltax = grid->getDeltaX(block); + + UbTupleInt3 nodesMin = grid->getNodeIndexes(block, x[0] - r - deltax, x[1] - r - deltax, x[2] - r - deltax); + UbTupleInt3 nodesMax = grid->getNodeIndexes(block, x[0] + r + deltax, x[1] + r + deltax, x[2] + r + deltax); + + int minX1 = (val<1>(nodesMin) < minX1b) ? minX1b : val<1>(nodesMin); + int minX2 = (val<2>(nodesMin) < minX2b) ? minX2b : val<2>(nodesMin); + int minX3 = (val<3>(nodesMin) < minX3b) ? minX3b : val<3>(nodesMin); + + int maxX1 = (val<1>(nodesMax) > maxX1b) ? maxX1b : val<1>(nodesMax); + int maxX2 = (val<2>(nodesMax) > maxX2b) ? maxX2b : val<2>(nodesMax); + int maxX3 = (val<3>(nodesMax) > maxX3b) ? maxX3b : val<3>(nodesMax); + + //int minX1 = minX1b; + //int minX2 = minX2b; + //int minX3 = minX3b; + + //int maxX1 = maxX1b; + //int maxX2 = maxX2b; + //int maxX3 = maxX3b; + + + for (int ix3 = minX3; ix3 <= maxX3; ix3++) { + for (int ix2 = minX2; ix2 <= maxX2; ix2++) { + for (int ix1 = minX1; ix1 <= maxX1; ix1++) { //UbTupleInt3 blockNX = grid->getBlockNX(); @@ -334,7 +364,7 @@ void LiggghtsCouplingSimulationObserver::SumForceTorque3D(ParticleData::Particle SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); CbArray3D<SPtr<IBdynamicsParticleData>, IndexerX3X2X1>::CbArray3DPtr particleData = - dynamicPointerCast<IBcumulantK17LBMKernel>(kernel)->getParticleData(); + dynamicPointerCast<LiggghtsCouplingLBMKernel>(kernel)->getParticleData(); if (!particleData) continue; @@ -358,6 +388,8 @@ void LiggghtsCouplingSimulationObserver::SumForceTorque3D(ParticleData::Particle int const ind = wrapper.lmp->atom->map(id); + if (ind < 0) continue; // no particle here + Vector3D worldCoordinates = grid->getNodeCoordinates(block, ix1, ix2, ix3); double dx = (worldCoordinates[0] - x[ind][0]) * units->getFactorLentghWToLb(); diff --git a/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h index 0ae1786dd72346456621f3f4cf584679fca64f42..fb4938328b9d18e8cef614a09cbad8894c5aa497 100644 --- a/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h +++ b/src/cpu/LiggghtsCoupling/SimulationObserver/LiggghtsCouplingSimulationObserver.h @@ -46,7 +46,7 @@ class SimulationObserver; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class LiggghtsCouplingWrapper; class Grid3D; class Block3D; @@ -61,7 +61,7 @@ struct ParticleData { class LiggghtsCouplingSimulationObserver : public SimulationObserver { public: - LiggghtsCouplingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::mpi::Communicator> comm, + LiggghtsCouplingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<vf::parallel::Communicator> comm, LiggghtsCouplingWrapper &wrapper, int demSteps, SPtr<LBMUnitConverter> units); virtual ~LiggghtsCouplingSimulationObserver(); @@ -88,7 +88,7 @@ protected: void addTorque(int const partId, int const coord, double const value, double *torque); private: - SPtr<vf::mpi::Communicator> comm; + SPtr<vf::parallel::Communicator> comm; LiggghtsCouplingWrapper &wrapper; SPtr<LBMUnitConverter> units; int demSteps; diff --git a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp index d2bb9f083fd433d60e0d1f5054b2238e963d9efc..2c0344b232893664f56b6aa48168265c033de044 100644 --- a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphasePressureBCStrategy.cpp @@ -88,19 +88,6 @@ void MultiphasePressureBCStrategy::applyBC() calcMacrosFct(f, p1, vx1, vx2, vx3); p1 = 0.0; - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - - //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(DIR_P00)) { nx1 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_M00)) { nx1 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_0P0)) { nx2 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_0M0)) { nx2 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_00P)) { nx3 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_00M)) { nx3 += 1; } - //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); - phiBC = bcPtr->getBoundaryPhaseField(); LBMReal rhoBC = bcPtr->getBoundaryDensity(); D3Q27System::calcIncompFeq(feq, rhoBC, vx1, vx2, vx3); @@ -109,11 +96,24 @@ void MultiphasePressureBCStrategy::applyBC() for (int fdir = D3Q27System::STARTF; fdir <= D3Q27System::ENDF; fdir++) { if (bcPtr->hasDensityBoundaryFlag(fdir)) { - LBMReal ftemp = -f[D3Q27System::INVDIR[fdir]] + feq[fdir] + feq[D3Q27System::INVDIR[fdir]]; - distributions->setDistributionForDirection(ftemp, x1, x2, x3, D3Q27System::INVDIR[fdir]); + // //if(D3Q27System::DX1[fdir]*vx1+D3Q27System::DX2[fdir]*vx2+D3Q27System::DX3[fdir]*vx3 <= 0) + // if (false)//(phi<0.01) + // { + // LBMReal ftemp = -f[D3Q27System::INVDIR[fdir]] + feq[fdir] + feq[D3Q27System::INVDIR[fdir]]; + // distributions->setDistributionForDirection(ftemp, x1, x2, x3, D3Q27System::INVDIR[fdir]); + + // LBMReal hReturn = 0; + // //h[fdir]; //-h[D3Q27System::INVDIR[fdir]] + htemp[fdir] + + // //htemp[D3Q27System::INVDIR[fdir]]; + // distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, D3Q27System::INVDIR[fdir]); + // } - LBMReal hReturn = -h[D3Q27System::INVDIR[fdir]] + htemp[fdir] + htemp[D3Q27System::INVDIR[fdir]]; - distributionsH->setDistributionForDirection(hReturn, x1, x2, x3, D3Q27System::INVDIR[fdir]); + // else{ + // // //distributions->setDistributionForDirection(rhoBC*D3Q27System::WEIGTH[fdir], x1, x2, x3, D3Q27System::INVDIR[fdir]); + // // //distributionsH->setDistributionForDirection(phiBC*D3Q27System::WEIGTH[fdir], x1, x2, x3, D3Q27System::INVDIR[fdir]); + distributions->setDistributionForDirection(0.7*f[D3Q27System::INVDIR[fdir]], x1, x2, x3, D3Q27System::INVDIR[fdir]); + distributionsH->setDistributionForDirection(0.7*h[D3Q27System::INVDIR[fdir]], x1, x2, x3, D3Q27System::INVDIR[fdir]); + // } } } } diff --git a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp index 26bb0eed80516751da97810b07c6b9caf249f743..80e2922bad07885266f504115fd6c3e0a9b2232b 100644 --- a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.cpp @@ -306,15 +306,15 @@ void MultiphaseVelocityBC::setNodeVelocity( const D3Q27Interactor& interactor, S /*==========================================================*/ UbTupleDouble3 MultiphaseVelocityBC::getVelocity(const real& x1, const real& x2, const real& x3, const real& timeStep) const { - real vx1 = vf::basics::constant::c0o1; - real vx2 = vf::basics::constant::c0o1; - real vx3 = vf::basics::constant::c0o1; + real vx1 = vf::basics::constant::c0o1; + real vx2 = vf::basics::constant::c0o1; + real vx3 = vf::basics::constant::c0o1; this->x1 = x1; this->x2 = x2; this->x3 = x3; this->timeStep = timeStep; - if(tmpVx1Function) vx1 = tmpVx1Function->Eval(); + if(tmpVx1Function) vx1 = tmpVx1Function->Eval(); if(tmpVx2Function) vx2 = tmpVx2Function->Eval(); if(tmpVx3Function) vx3 = tmpVx3Function->Eval(); diff --git a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h index e01237cf96e14bffbbfeac43469d32c907d56dd7..8618d797245a641b8c6ce7fc30fee46a3bfeed22 100644 --- a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBC.h @@ -79,8 +79,8 @@ class UbFileInput; //! \code{.cpp} //! mu::Parser fct; //! fct.SetExpr("max(vmax*(1.0-4.0*((x2-x2_vmax)^2+(x3-x3_vmax)^2)/H^2),0.0)"); //paraboloid (with vmax for -//! (0/x2_vmax/x3_vmax) fct.DefineConst("x2Vmax", 0.0 ); //x2-Pos für vmax fct.DefineConst("x3Vmax", 0.0 -//! ); //x3-Pos für vmax fct.DefineConst("H" , diameterOfPipe); fct.DefineConst("vmax" , vmax ); +//! (0/x2_vmax/x3_vmax) fct.DefineConst("x2Vmax", 0.0 ); //x2-Pos for vmax fct.DefineConst("x3Vmax", 0.0 +//! ); //x3-Pos for vmax fct.DefineConst("H" , diameterOfPipe); fct.DefineConst("vmax" , vmax ); //! VelocityBC velBC(true, false ,false ,fct, 0, BCFunction::INFCONST); //! \endcode diff --git a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp index a9b8391a8296fbbaf2709bb36863880985790a45..a0b334d8ee7a88471ca3e5c640e04a914f4171bd 100644 --- a/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp +++ b/src/cpu/MultiphaseFlow/BoundaryConditions/MultiphaseVelocityBCStrategy.cpp @@ -95,19 +95,6 @@ void MultiphaseVelocityBCStrategy::applyBC() ///// added for phase field ////// - int nx1 = x1; - int nx2 = x2; - int nx3 = x3; - - //flag points in direction of fluid - if (bcPtr->hasVelocityBoundaryFlag(DIR_P00)) { nx1 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_M00)) { nx1 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_0P0)) { nx2 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_0M0)) { nx2 += 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_00P)) { nx3 -= 1; } - else if (bcPtr->hasVelocityBoundaryFlag(DIR_00M)) { nx3 += 1; } - //else UB_THROW(UbException(UB_EXARGS, "Danger...no orthogonal BC-Flag on velocity boundary...")); - phiBC = bcPtr->getBoundaryPhaseField(); D3Q27System::calcMultiphaseHeq(htemp, phiBC, vx1, vx2, vx3); diff --git a/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp index 6e7dd3bd5904e861f401c7405cf65c94a1b254c7..84613be5c0932bdde23bcf35002ec3df9d79d6e4 100644 --- a/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.cpp @@ -190,7 +190,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) int maxX1 = bcArrayMaxX1 - ghostLayerWidth; int maxX2 = bcArrayMaxX2 - ghostLayerWidth; int maxX3 = bcArrayMaxX3 - ghostLayerWidth; - real omegaDRho = 1.0;// 1.25;// 1.3; + //real omegaDRho = 1.0;// 1.25;// 1.3; for (int x3 = minX3 - ghostLayerWidth; x3 < maxX3 + ghostLayerWidth; x3++) { for (int x2 = minX2 - ghostLayerWidth; x2 < maxX2 + ghostLayerWidth; x2++) { for (int x1 = minX1 - ghostLayerWidth; x1 < maxX1 + ghostLayerWidth; x1++) { @@ -229,8 +229,8 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real mfcca = (*this->nonLocalDistributionsH1)(D3Q27System::ET_BNE, x1, x2, x3p); real mfbbb = (*this->zeroDistributionsH1)(x1, x2, x3); - omegaDRho = 2.0;// 1.5; - real phiOld = (*phaseField)(x1, x2, x3); + //omegaDRho = 2.0;// 1.5; + //real phiOld = (*phaseField)(x1, x2, x3); (*phaseField)(x1, x2, x3) = (((mfaaa + mfccc) + (mfaca + mfcac)) + ((mfaac + mfcca) + (mfcaa + mfacc))) + (((mfaab + mfacb) + (mfcab + mfccb)) + ((mfaba + mfabc) + (mfcba + mfcbc)) + @@ -257,9 +257,9 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) for (int x2 = minX2 - ghostLayerWidth+1; x2 < maxX2 + ghostLayerWidth-1; x2++) { for (int x1 = minX1 - ghostLayerWidth+1; x1 < maxX1 + ghostLayerWidth-1; x1++) { if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; + //int x1p = x1 + 1; + //int x2p = x2 + 1; + //int x3p = x3 + 1; //real mfabb = (*this->localDistributionsH1)(D3Q27System::ET_E, x1, x2, x3);//* rho * c1o3; // real mfbab = (*this->localDistributionsH1)(D3Q27System::ET_N, x1, x2, x3);//* rho * c1o3; @@ -474,52 +474,24 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) for (int x2 = minX2 - 1; x2 < maxX2 + 1; x2++) { for (int x1 = minX1 - 1; x1 < maxX1 + 1; x1++) { if (!bcArray->isSolid(x1, x2, x3) && !bcArray->isUndefined(x1, x2, x3)) { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; + //int x1p = x1 + 1; + //int x2p = x2 + 1; + //int x3p = x3 + 1; findNeighbors(phaseFieldOld, x1, x2, x3); findNeighbors2(phaseField, x1, x2, x3); ////////////////////////////////Momentum conservation experiment 06.03.2023 //surfacetension - if ((phi2[DIR_000] <= phiLim) || (phi[DIR_000] <= phiLim) && - ( - (phi[DIR_P00] > phiLim) || - (phi[DIR_M00] > phiLim) || - (phi[DIR_00P] > phiLim) || - (phi[DIR_00M] > phiLim) || - (phi[DIR_0M0] > phiLim) || - (phi[DIR_0P0] > phiLim) || - (phi[DIR_PP0] > phiLim) || - (phi[DIR_PM0] > phiLim) || - (phi[DIR_P0P] > phiLim) || - (phi[DIR_P0M] > phiLim) || - (phi[DIR_MP0] > phiLim) || - (phi[DIR_MM0] > phiLim) || - (phi[DIR_M0P] > phiLim) || - (phi[DIR_M0M] > phiLim) || - (phi[DIR_0PM] > phiLim) || - (phi[DIR_0MM] > phiLim) || - (phi[DIR_0PP] > phiLim) || - (phi[DIR_0MP] > phiLim) || - (phi[DIR_PPP] > phiLim) || - (phi[DIR_PMP] > phiLim) || - (phi[DIR_MPP] > phiLim) || - (phi[DIR_MMP] > phiLim) || - (phi[DIR_PPM] > phiLim) || - (phi[DIR_PMM] > phiLim) || - (phi[DIR_MPM] > phiLim) || - (phi[DIR_MMM] > phiLim) - )) { + if (this->isGas(phiLim, phi, phi2)) { real vx = (*vxNode)(x1, x2, x3); real vy = (*vyNode)(x1, x2, x3); real vz = (*vzNode)(x1, x2, x3); - real rho = (*rhoNode)(x1, x2, x3); + //real rho = (*rhoNode)(x1, x2, x3); findNeighbors(phaseField, x1, x2, x3); - real dX1_phi = gradX1_phi(); - real dX2_phi = gradX2_phi(); - real dX3_phi = gradX3_phi(); + //real dX1_phi = gradX1_phi(); + //real dX2_phi = gradX2_phi(); + //real dX3_phi = gradX3_phi(); //real curv = computeCurvature_phi(); real laplacePressure = c12o1 * sigma * computeCurvature_phi(); findNeighbors(phaseFieldOld, x1, x2, x3); @@ -527,7 +499,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real sigma = c3o1*c2o1*1e-3; - real flowDirection = vx * dX1_phi + vy * dX2_phi + vy * dX3_phi; + //real flowDirection = vx * dX1_phi + vy * dX2_phi + vy * dX3_phi; //16.03.23 c: BB gas side with updated boundary velocity @@ -551,28 +523,28 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neighbor? for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > phiLim)) { - real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //vx = vxBC; //vy = vyBC; //vz = vzBC; - real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real vBC = (fPEQNeighborInv - fPEQNeighbor) / WEIGTH[fdir] * c1o6; //real fPEQHere = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , vx,vy,vz); //real vBC = (fPEQHere - fPEQNeighbor) / WEIGTH[fdir] * c1o6; - real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); - real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + //real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + //real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //vBC = (vBC + vDir) / (c2o1 + vBC - vDir); // real dvDir = vBC - vDir; // 27.04.23 - real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); // real dvDir = (vBC - vIDir) * c1o2; - real dvDir = (vBC - vDir) ; + //real dvDir = (vBC - vDir) ; //// 3.7.23 // vIDir = (vIDir + vDir) * c1o2; @@ -600,7 +572,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); //real fGEQOld = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1, x2, x3), vx, vy, vz); //real fGEQNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); - real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); //real fBC = ( fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); //3.7.23 //real fBC = ((fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - qq)) - c6o1 * WEIGTH[fdir] * (vBC))*c1o2 / (qq + c1o2) + ((fGEQInv - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o2)))*qq/(qq+c1o2); @@ -652,28 +624,28 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) if (phi2[DIR_000] <= phiLim) { // no refill liquid for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > phiLim)) { - real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //vx = vxBC; //vy = vyBC; //vz = vzBC; - real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); - real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + //real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real vBC = (fPEQNeighborInv - fPEQNeighbor) / WEIGTH[fdir] * c1o6; // real fPEQHere = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , vx,vy,vz); // real vBC = (fPEQHere - fPEQNeighbor) / WEIGTH[fdir] * c1o6; - real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + //real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //real dvDir = vBC - vDir; // real dvDir = vBC - vDir; // 27.04.23 - real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); // real dvDir = (vBC - vIDir) * c1o2; - real dvDir = (vBC - vDir) ; + // real dvDir = (vBC - vDir) ; //vBC = (vBC + vDir) / (c2o1 + vBC - vDir); real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); @@ -681,7 +653,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); //real fGInv = distribution->getDistributionInvForDirection(x1, x2, x3, D3Q27System::INVDIR[fdir]); //real fGInvEQ = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); - real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); //real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1) )- c6o1 * WEIGTH[fdir] * (vBC); //// 3.7.23 // vIDir = (vIDir + vDir) * c1o2; @@ -747,8 +719,8 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real vzBC = c1o2 * (vz + (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); - real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); - real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL - (feqG - feqL) * (c1o1 / densityRatio*0 - c1o1) * vBC, x1, x2, x3, fdir);// (vxBC * D3Q27System::DX1[fdir] + vyBC * D3Q27System::DX2[fdir] + vzBC * D3Q27System::DX3[fdir]), x1, x2, x3, fdir); @@ -758,8 +730,8 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); //real number = 666; //distribution->setDistributionForDirection((fBC + fG) / densityRatio * 0 - fL - (feqG - feqL) * (c1o1 / densityRatio * 0 - c1o1) * vBC, x1, x2, x3, fdir); - real eqBC= D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); - real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real eqBC= D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + //real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); @@ -844,24 +816,24 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > phiLim)) { - real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); - real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + // real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + //real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real vBC = (fPEQNeighborInv - fPEQNeighbor) / WEIGTH[fdir] * c1o6; //real fPEQHere = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , vx,vy,vz); //real vBC = (fPEQHere - fPEQNeighbor) / WEIGTH[fdir] * c1o6; - real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + //real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //real dvDir = vBC - vDir; //27.04.23 - real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + // real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); // real dvDir = (vBC - vIDir)*c1o2; - real dvDir = (vBC - vDir) ; + //real dvDir = (vBC - vDir) ; //// 3.7.23 // vIDir = (vIDir + vDir) * c1o2; @@ -884,7 +856,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //alternative way to bounce back by recovering fG from the opiste direction //real fGInv= distribution->getDistributionInvForDirection(x1, x2, x3, D3Q27System::INVDIR[fdir]); //real fGInvEQ = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); - real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); //real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); // 3.7.23 //real fBC = ((fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - qq)) - c6o1 * WEIGTH[fdir] * (vBC))*c1o2 / (qq + c1o2) + ((fGEQInv - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o2))) * qq / (qq + c1o2); @@ -925,8 +897,8 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) if (phi2[fdir] > phiLim) { //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); - real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); - real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqL = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); + //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); //real feqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx * (D3Q27System::DX1[fdir]) * (D3Q27System::DX1[fdir]), vy * (D3Q27System::DX2[fdir]) * (D3Q27System::DX2[fdir]), vz * (D3Q27System::DX3[fdir]) * (D3Q27System::DX3[fdir])); //distribution->setDistributionForDirection((fBC + fG) / densityRatio*0 - fL- (feqG - feqL) * (c1o1 / densityRatio - c1o1) * (vBC), x1, x2, x3, fdir); @@ -937,8 +909,8 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real fLi = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], fdir); real eqBCN = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real eqGN = D3Q27System::getIncompFeqForDirection(fdir, 0, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); - real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); + //real eqBC = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], 0, vx, vy, vz); + //real eqG = D3Q27System::getIncompFeqForDirection(fdir, 0, vx, vy, vz); ////real flNew = (fBC + fG - eqBC - eqG) / densityRatio + eqBC + eqG - fL - (feqG - feqL - 2 * fL + 2 * feqL) * (c1o1 / densityRatio - c1o1) * vBC; //real curvBC; //if ((x1 + D3Q27System::DX1[fdir] > 0) && (x1 + D3Q27System::DX1[fdir] < maxX1 + 1) && (x2 + D3Q27System::DX2[fdir] > 0) && (x2 + D3Q27System::DX2[fdir] < maxX2 + 1) && (x3 + D3Q27System::DX3[fdir] > 0) && (x3 + D3Q27System::DX3[fdir] < maxX3 + 1)) { @@ -1008,16 +980,16 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real sum2 = 1e-100; real sumRho = 0; - real sumVx = 0; - real sumVy = 0; - real sumVz = 0; + // real sumVx = 0; + // real sumVy = 0; + // real sumVz = 0; for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > phiLim)) { sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; - sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); - sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); - sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); sum2 += WEIGTH[fdir]; } } @@ -1040,20 +1012,20 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); - real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighbor = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir],c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + //real fPEQNeighborInv = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real vBC = (fPEQNeighborInv - fPEQNeighbor) / WEIGTH[fdir] * c1o6; //real fPEQHere = D3Q27System::getIncompFeqForDirection(fdir,c0o1 , vx,vy,vz); //real vBC = (fPEQHere - fPEQNeighbor) / WEIGTH[fdir] * c1o6; real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //real dvDir = vBC - vDir; // 27.04.23 - real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); - real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); //real dvDir = (vBC - vIDir) * c1o2; - real dvDir = (vBC - vDir) ; + //real dvDir = (vBC - vDir) ; vBC = (vBC + vDir) / (c2o1 + vBC - vDir); @@ -1073,7 +1045,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); //ff[D3Q27System::INVDIR[fdir]]=(feqNew - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)); //ff[D3Q27System::INVDIR[fdir]] = (feqNew - WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)); - real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); + //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoL, vx, vy, vz); //ff[D3Q27System::INVDIR[fdir]] = (fGEQ - WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); //real vNG = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); //ff[D3Q27System::INVDIR[fdir]] = (fGEQ - WEIGTH[fdir] * dvDir * (c1o1 / collFactorL)) - c6o1 * WEIGTH[fdir] * (vDir) / (c1o1 - vDir + vNG); @@ -2064,34 +2036,34 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) this->swapDistributions(); - for (int x3 = minX3; x3 < maxX3; x3++) { - for (int x2 = minX2; x2 < maxX2; x2++) { - for (int x1 = minX1; x1 < maxX1; x1++) { +// for (int x3 = minX3; x3 < maxX3; x3++) { +// for (int x2 = minX2; x2 < maxX2; x2++) { +// for (int x1 = minX1; x1 < maxX1; x1++) { - int x1p = x1 + 1; - int x2p = x2 + 1; - int x3p = x3 + 1; - findNeighbors(phaseFieldOld, x1, x2, x3); - - //if (((*phaseField)(x1, x2, x3) > c1o2) && (((*phaseFieldOld)(x1, x2, x3) <= c1o2))) - {//Refill liquid - real vx; - real vy; - real vz; - - - distribution->getDistribution(ff, x1, x2, x3); - real rhoL; - D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); - //if (vz != 0) { - - // std::cout << "precol: rhoL=" << rhoL << " vx=" << vx << " vy=" << vy << " vz=" << vz << "ffRest=" << ff[DIR_000] << " x=" << x1 << " y=" << x2 << " z=" << x3 << "\n"; - //} - } +// int x1p = x1 + 1; +// int x2p = x2 + 1; +// int x3p = x3 + 1; +// findNeighbors(phaseFieldOld, x1, x2, x3); + +// //if (((*phaseField)(x1, x2, x3) > c1o2) && (((*phaseFieldOld)(x1, x2, x3) <= c1o2))) +// {//Refill liquid +// real vx; +// real vy; +// real vz; + + +// distribution->getDistribution(ff, x1, x2, x3); +// real rhoL; +// D3Q27System::calcIncompMacroscopicValues(ff, rhoL, vx, vy, vz); +// //if (vz != 0) { + +// // std::cout << "precol: rhoL=" << rhoL << " vx=" << vx << " vy=" << vy << " vz=" << vz << "ffRest=" << ff[DIR_000] << " x=" << x1 << " y=" << x2 << " z=" << x3 << "\n"; +// //} +// } - } - } -} +// } +// } +// } @@ -3376,7 +3348,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real rhoH = 1.0; real rhoL = 1.0/ densityRatio; - real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); + //real rhoToPhi = (rhoH - rhoL) / (phiH - phiL); real dX1_phi = gradX1_phi(); real dX2_phi = gradX2_phi(); @@ -3396,7 +3368,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //collFactorM=(((*phaseField)(x1, x2, x3) > c1o2) && ((*phaseFieldOld)(x1, x2, x3) <= c1o2)) ? 1.8 : collFactorM; real collFactorMInv = phi[DIR_000] > phiLim ? collFactorG : collFactorL; - real mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(); + //real mu = 2 * beta * phi[DIR_000] * (phi[DIR_000] - 1) * (2 * phi[DIR_000] - 1) - kappa * nabla2_phi(); //----------- Calculating Macroscopic Values ------------- real rho = phi[DIR_000] > phiLim ? rhoH : rhoL;//rhoH + rhoToPhi * (phi[DIR_000] - phiH); //Incompressible @@ -3697,7 +3669,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) ///Experimental interface sharpening force 20.06.2022 - real scaleSharpener = 1.0; + //real scaleSharpener = 1.0; //forcingX1 += scaleSharpener * (FdX1_phi - dX1_phi) * fabsf(FdX1_phi - dX1_phi) / rho; //forcingX2 += scaleSharpener * (FdX2_phi - dX2_phi) * fabsf(FdX2_phi - dX2_phi) / rho; //forcingX3 += scaleSharpener * (FdX3_phi - dX3_phi) * fabsf(FdX3_phi - dX3_phi) / rho; @@ -3960,12 +3932,12 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real mxxMzz = mfcaa - mfaac; /// - real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); - real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); - real mmfabb = mfabb; - real mmfbab = mfbab; - real mmfbba = mfbba; + // real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + // real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + // real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + // real mmfabb = mfabb; + // real mmfbab = mfbab; + // real mmfbba = mfbba; /// real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz);// *0; @@ -4030,7 +4002,15 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) /////// // non Newtonian fluid collision factor - if (phi[DIR_000] > phiLim /*- 0.3*/) { + //if (phi[DIR_000] > phiLim /*- 0.3*/) { + //if (phi[DIR_000] > phiLim) { + // real shearRate = sqrt(c2o1 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); + // collFactorM = Rheology::getBinghamCollFactor(collFactorM, shearRate, c1o1); + // collFactorM = (collFactorM < c1o1) ? c1o1 : collFactorM; + //} + + //low viscouse non Newtonian fluid + if (phi[DIR_000] > phiLim) { real shearRate = sqrt(c2o1 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz) + Dxy * Dxy + Dxz * Dxz + Dyz * Dyz); collFactorM = Rheology::getBinghamCollFactor(collFactorM, shearRate, c1o1); collFactorM = (collFactorM < c1o54) ? c1o54 : collFactorM; @@ -4121,6 +4101,7 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) //} } + real mxxMyyh = -c2o1 * (dxux - dyuy) / collFactorMInv * c1o3; real mxxMzzh = -c2o1 * (dxux - dzuz) / collFactorMInv * c1o3; // mfhbba = -Dxy / collFactorMInv*c1o3; @@ -4196,12 +4177,12 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) real mxyyPxzz = mfbca + mfbac; real mxyyMxzz = mfbca - mfbac; - mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); - mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); - mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa); - mmfabb += mfabb; - mmfbab += mfbab; - mmfbba += mfbba; + // mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); + // mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); + // mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa); + // mmfabb += mfabb; + // mmfbab += mfbab; + // mmfbba += mfbba; //relax wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit); @@ -4277,12 +4258,12 @@ void MultiphaseScaleDistributionLBMKernel::calculate(int step) ////////save central moments for the phase field - real MMxx = mfcaa - c1o3 * mfaaa; - real MMyy = mfaca - c1o3 * mfaaa; - real MMzz = mfaac - c1o3 * mfaaa; - real MMxy = mfbba; - real MMxz = mfbab; - real MMyz = mfabb; + //real MMxx = mfcaa - c1o3 * mfaaa; + //real MMyy = mfaca - c1o3 * mfaaa; + //real MMzz = mfaac - c1o3 * mfaaa; + //real MMxy = mfbba; + //real MMxz = mfbab; + //real MMyz = mfabb; //////////////////////////////////////////////////////////////////////////////////// @@ -5439,8 +5420,19 @@ void MultiphaseScaleDistributionLBMKernel::findNeighbors(CbArray3D<real, Indexer if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) { phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); } else { - //phi[k] = (*ph)(x1 , x2, x3 );// neutral wetting - phi[k] = 0.0;//unwetting + //if (bcArray->getBC(x1, x2, x3)->hasVelocityBoundaryFlag(D3Q27System::INVDIR[k])) + // phi[k] = (*ph)(x1, x2, x3); // neutral wetting + //else + // phi[k] = 0.0; // unwetting + //phi[k] = (*ph)(x1, x2, x3) * 0.7; + if (bcArray->getBC(x1, x2, x3)->hasNoSlipBoundaryFlag(D3Q27System::INVDIR[k])) + { + if(bcArray->getBC(x1, x2, x3)->getNoSlipSecondaryOption(D3Q27System::INVDIR[k]) == 0) + phi[k] = (*ph)(x1, x2, x3); // neutral wetting + else + phi[k] = 0.0; // unwetting + } + } } } @@ -5461,8 +5453,11 @@ void MultiphaseScaleDistributionLBMKernel::findNeighbors2(CbArray3D<real, Indexe phi2[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); } else { - phi2[k] = 0.0; - // phi2[k] = (*ph)(x1 , x2, x3 );// neutral wetting + //if (bcArray->getBC(x1, x2, x3)->hasVelocityBoundaryFlag(D3Q27System::INVDIR[k])) + // phi2[k] = (*ph)(x1, x2, x3); // neutral wetting + //else + phi2[k] = 0.0; // unwetting + // phi2[k] = (*ph)(x1, x2, x3) * 0.7; } } } diff --git a/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h index 67a6680bb7d11980e357c0f797c185899618b324..85ada0fc290658fae8d3d92c1b2d8ae8dd0df471 100644 --- a/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseScaleDistributionLBMKernel.h @@ -115,6 +115,7 @@ protected: void computePhasefield(); void findNeighbors(CbArray3D<real,IndexerX3X2X1>::CbArray3DPtr ph /*Phase-Field*/, int x1, int x2, int x3); void findNeighbors2(CbArray3D<real, IndexerX3X2X1>::CbArray3DPtr ph, int x1, int x2, int x3); + bool isGas(real phiLim, real* phi, real* phi2); real nabla2_phi(); @@ -129,4 +130,43 @@ protected: real forcingX3; }; +/// @brief The function computes a fancy expression +/// @param phiLim +/// @param phi +/// @param phi2 +/// @return +inline bool MultiphaseScaleDistributionLBMKernel::isGas(real phiLim, real* phi, real* phi2) +{ + using namespace vf::lbm::dir; + return (phi2[DIR_000] <= phiLim) || ((phi[DIR_000] <= phiLim) && + ( + (phi[DIR_P00] > phiLim) || + (phi[DIR_M00] > phiLim) || + (phi[DIR_00P] > phiLim) || + (phi[DIR_00M] > phiLim) || + (phi[DIR_0M0] > phiLim) || + (phi[DIR_0P0] > phiLim) || + (phi[DIR_PP0] > phiLim) || + (phi[DIR_PM0] > phiLim) || + (phi[DIR_P0P] > phiLim) || + (phi[DIR_P0M] > phiLim) || + (phi[DIR_MP0] > phiLim) || + (phi[DIR_MM0] > phiLim) || + (phi[DIR_M0P] > phiLim) || + (phi[DIR_M0M] > phiLim) || + (phi[DIR_0PM] > phiLim) || + (phi[DIR_0MM] > phiLim) || + (phi[DIR_0PP] > phiLim) || + (phi[DIR_0MP] > phiLim) || + (phi[DIR_PPP] > phiLim) || + (phi[DIR_PMP] > phiLim) || + (phi[DIR_MPP] > phiLim) || + (phi[DIR_MMP] > phiLim) || + (phi[DIR_PPM] > phiLim) || + (phi[DIR_PMM] > phiLim) || + (phi[DIR_MPM] > phiLim) || + (phi[DIR_MMM] > phiLim) + )); +} + #endif diff --git a/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp index af5ba7d63edbf3a8a1866a70d6edc30920664cb1..5d32955a948f9c997832cfd9757a1887d0c58466 100644 --- a/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp +++ b/src/cpu/MultiphaseFlow/LBM/MultiphaseSharpInterfaceLBMKernel.cpp @@ -350,24 +350,32 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) rhoG = sumRho / sumWeight;// uncheck excpetion: what if there is no adequate neighbor? for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > c1o2) ) { + // real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); + + if ((phi[D3Q27System::INVDIR[fdir]] > c1o2)) { real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); - vBC = (vBC + vDir) / (c2o1 + vBC - vDir); - real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); - - if ((phi[D3Q27System::INVDIR[fdir]] > c1o2)) { - ///here we need reconstruction from scrach - real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); - real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + + //27.04.23 + // real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real dvDir = (vBC - vIDir)*c1o2; + real dvDir = (vBC - vDir); + + LBMReal fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + LBMReal fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew; //real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); //real fGEQOld = D3Q27System::getIncompFeqForDirection(fdir, (*rhoNode)(x1, x2, x3), vx, vy, vz); //real fGEQNew = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); - real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew;// fL -feqOLD + feqNew; + //real fBC = (fL - feqOLD) * (c1o1 / collFactorG - c1o1) / (c1o1 / collFactorL - c1o1) + feqNew;// fL -feqOLD + feqNew; //real fBC = fGG - c6o1 * WEIGTH[fdir] * (vBC); distribution->setDistributionForDirection(fBC, x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); ///// other possibility is tor replace the node itself instead of the neighbor (only c1o1 of them is allowed!) @@ -401,13 +409,21 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //real dvDir = vBC - vDir; + //27.04.23 + // real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real dvDir = (vBC - vIDir)*c1o2; + real dvDir = (vBC - vDir); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); - real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); - //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + //real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); - //real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); @@ -482,14 +498,22 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); //real dvDir = vBC - vDir; + //27.04.23 + // real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real dvDir = (vBC - vIDir)*c1o2; + real dvDir = (vBC - vDir); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); real fL = distribution->getDistributionInvForDirection(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); real fG = distribution->getDistributionInvForDirection(x1, x2, x3, fdir); - real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); + //real fBC = fG - c6o1 * WEIGTH[fdir] * (vBC); - //real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); // real fBC = (-fGInv + fGInvEQ + fGEQ - c6o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); - //real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + real fBC = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorG - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); //real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); //real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]), (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); @@ -549,16 +573,16 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real sum2 = 1e-100; real sumRho = 0; - real sumVx = 0; - real sumVy = 0; - real sumVz = 0; + // real sumVx = 0; + // real sumVy = 0; + // real sumVz = 0; for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if ((phi[fdir] > c1o2)) { sumRho += WEIGTH[fdir] * (*rhoNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]);// * tempRho; - sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); - sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); - sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVx += WEIGTH[fdir] * (*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVy += WEIGTH[fdir] * (*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); + // sumVz += WEIGTH[fdir] * (*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir]); sum2 += WEIGTH[fdir]; } } @@ -577,9 +601,27 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if (((phi[fdir] <= c1o2) ))//&& (((*phaseField)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])) > c1o2))) { - real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); - real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); - ff[D3Q27System::INVDIR[fdir]] = (ff[D3Q27System::INVDIR[fdir]] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; + real vxBC = ((*vxNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vyBC = ((*vyNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vzBC = ((*vzNode)(x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir])); + real vBC = (D3Q27System::DX1[fdir] * vxBC + D3Q27System::DX2[fdir] * vyBC + D3Q27System::DX3[fdir] * vzBC); + real vDir = (D3Q27System::DX1[fdir] * vx + D3Q27System::DX2[fdir] * vy + D3Q27System::DX3[fdir] * vz); + vBC = (vBC + vDir) / (c2o1 + vBC - vDir); + + //27.04.23 + // real vxI = ((*vxNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vyI = ((*vyNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + // real vzI = ((*vzNode)(x1 - D3Q27System::DX1[fdir], x2 - D3Q27System::DX2[fdir], x3 - D3Q27System::DX3[fdir])); + //real vIDir = (D3Q27System::DX1[fdir] * vxI + D3Q27System::DX2[fdir] * vyI + D3Q27System::DX3[fdir] * vzI); + //real dvDir = (vBC - vIDir)*c1o2; + real dvDir = (vBC - vDir); + + + real fGEQ = D3Q27System::getIncompFeqForDirection(fdir, rhoG, vx, vy, vz); + ff[D3Q27System::INVDIR[fdir]] = (fGEQ - c3o1 * WEIGTH[fdir] * dvDir * (c1o1 / collFactorL - c1o1)) - c6o1 * WEIGTH[fdir] * (vBC); + // real feqOLD = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoG, vx, vy, vz); + // real feqNew = D3Q27System::getIncompFeqForDirection(D3Q27System::INVDIR[fdir], rhoL, vx, vy, vz); + // ff[D3Q27System::INVDIR[fdir]] = (ff[D3Q27System::INVDIR[fdir]] - feqOLD) * (c1o1 / collFactorL - c1o1) / (c1o1 / collFactorG - c1o1) + feqNew; distribution->setDistributionForDirection(ff[D3Q27System::INVDIR[fdir]], x1 + D3Q27System::DX1[fdir], x2 + D3Q27System::DX2[fdir], x3 + D3Q27System::DX3[fdir], D3Q27System::INVDIR[fdir]); } } @@ -902,12 +944,12 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real mxxMzz = mfcaa - mfaac; /// - real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); - real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); - real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); - real mmfabb = mfabb; - real mmfbab = mfbab; - real mmfbba = mfbba; + // real mmfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); + // real mmfaca = c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz); + // real mmfaac = c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz); + // real mmfabb = mfabb; + // real mmfbab = mfbab; + // real mmfbba = mfbba; /// real dxux = -c1o2 * collFactorM * (mxxMyy + mxxMzz) + c1o2 * OxxPyyPzz * (/*mfaaa*/ -mxxPyyPzz)*0; @@ -918,21 +960,21 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real Dxz = -c3o1 * collFactorM * mfbab; real Dyz = -c3o1 * collFactorM * mfabb; - if (phi[DIR_000] > c1o2) { - /// QR eddyviscosity: - real eddyR = -(Dxy * Dxy + Dxz * Dxz + c1o3 * dxux * dxux) * (dxux) - (Dxy * Dxy + Dyz * Dyz + c1o3 * dyuy * dyuy) * dyuy - (Dxz * Dxz + Dyz * Dyz + c1o3 * dzuz * dzuz) * dzuz - c2o1 * Dxy * Dxz * Dyz; - real eddyQ = Dxy * Dxz + Dxy * Dyz + Dxz * Dyz + c1o2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz); - real nuEddy = 5.0e1 * (eddyR / (eddyQ + 1e-100)) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); - nuEddy = (nuEddy < c1o1 / collFactorM) ? c1o1 / collFactorM : nuEddy; - collFactorM = c1o1 / nuEddy; - // collFactorM = c1o1 / (c1o1 / collFactorM +1.e2*nuEddy*(dX1_phi*dX1_phi+dX2_phi*dX2_phi+dX3_phi*dX3_phi)); - collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; - OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0))); - OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM); - Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0)); - A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); - BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); - } + // if (phi[DIR_000] > c1o2) { + // /// QR eddyviscosity: + // real eddyR = -(Dxy * Dxy + Dxz * Dxz + c1o3 * dxux * dxux) * (dxux) - (Dxy * Dxy + Dyz * Dyz + c1o3 * dyuy * dyuy) * dyuy - (Dxz * Dxz + Dyz * Dyz + c1o3 * dzuz * dzuz) * dzuz - c2o1 * Dxy * Dxz * Dyz; + // real eddyQ = Dxy * Dxz + Dxy * Dyz + Dxz * Dyz + c1o2 * (dxux * dxux + dyuy * dyuy + dzuz * dzuz); + // real nuEddy = 5.0e1 * (eddyR / (eddyQ + 1e-100)) * (dX1_phi * dX1_phi + dX2_phi * dX2_phi + dX3_phi * dX3_phi); + // nuEddy = (nuEddy < c1o1 / collFactorM) ? c1o1 / collFactorM : nuEddy; + // collFactorM = c1o1 / nuEddy; + // // collFactorM = c1o1 / (c1o1 / collFactorM +1.e2*nuEddy*(dX1_phi*dX1_phi+dX2_phi*dX2_phi+dX3_phi*dX3_phi)); + // collFactorM = (collFactorM < 1.8) ? 1.8 : collFactorM; + // OxyyPxzz = 8.0 * (collFactorM - 2.0) * (OxxPyyPzz * (3.0 * collFactorM - 1.0) - 5.0 * collFactorM) / (8.0 * (5.0 - 2.0 * collFactorM) * collFactorM + OxxPyyPzz * (8.0 + collFactorM * (9.0 * collFactorM - 26.0))); + // OxyyMxzz = 8.0 * (collFactorM - 2.0) * (collFactorM + OxxPyyPzz * (3.0 * collFactorM - 7.0)) / (OxxPyyPzz * (56.0 - 42.0 * collFactorM + 9.0 * collFactorM * collFactorM) - 8.0 * collFactorM); + // Oxyz = 24.0 * (collFactorM - 2.0) * (4.0 * collFactorM * collFactorM + collFactorM * OxxPyyPzz * (18.0 - 13.0 * collFactorM) + OxxPyyPzz * OxxPyyPzz * (2.0 + collFactorM * (6.0 * collFactorM - 11.0))) / (16.0 * collFactorM * collFactorM * (collFactorM - 6.0) - 2.0 * collFactorM * OxxPyyPzz * (216.0 + 5.0 * collFactorM * (9.0 * collFactorM - 46.0)) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (3.0 * collFactorM - 10.0) * (15.0 * collFactorM - 28.0) - 48.0)); + // A = (4.0 * collFactorM * collFactorM + 2.0 * collFactorM * OxxPyyPzz * (collFactorM - 6.0) + OxxPyyPzz * OxxPyyPzz * (collFactorM * (10.0 - 3.0 * collFactorM) - 4.0)) / ((collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + // BB = (4.0 * collFactorM * OxxPyyPzz * (9.0 * collFactorM - 16.0) - 4.0 * collFactorM * collFactorM - 2.0 * OxxPyyPzz * OxxPyyPzz * (2.0 + 9.0 * collFactorM * (collFactorM - 2.0))) / (3.0 * (collFactorM - OxxPyyPzz) * (OxxPyyPzz * (2.0 + 3.0 * collFactorM) - 8.0 * collFactorM)); + // } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // non Newtonian fluid collision factor @@ -982,12 +1024,12 @@ void MultiphaseSharpInterfaceLBMKernel::calculate(int step) real mxyyPxzz = mfbca + mfbac; real mxyyMxzz = mfbca - mfbac; - mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); - mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); - mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa); - mmfabb += mfabb; - mmfbab += mfbab; - mmfbba += mfbba; + // mmfcaa += c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); + // mmfaca += c1o3 * (-2. * mxxMyy + mxxMzz + mxxPyyPzz- mfaaa); + // mmfaac += c1o3 * (mxxMyy - 2. * mxxMzz + mxxPyyPzz- mfaaa); + // mmfabb += mfabb; + // mmfbab += mfbab; + // mmfbba += mfbba; //relax wadjust = Oxyz + (1. - Oxyz) * fabs(mfbbb) / (fabs(mfbbb) + qudricLimit); @@ -1616,8 +1658,8 @@ void MultiphaseSharpInterfaceLBMKernel::findNeighbors(CbArray3D<real, IndexerX3X if (!bcArray->isSolid(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k])) { phi[k] = (*ph)(x1 + DX1[k], x2 + DX2[k], x3 + DX3[k]); } else { - phi[k] = (*ph)(x1 , x2, x3 );// neutral wetting - //phi[k] = 0.0;//unwetting + //phi[k] = (*ph)(x1 , x2, x3 );// neutral wetting + phi[k] = 0.0;//unwetting } } } diff --git a/src/cpu/MultiphaseFlow/MultiphaseFlow.h b/src/cpu/MultiphaseFlow/MultiphaseFlow.h index 469a819060f7a06ce6e914ace68cb44f6b83dca1..79c2ce8066414bc3a96457e143c9552d6907b663 100644 --- a/src/cpu/MultiphaseFlow/MultiphaseFlow.h +++ b/src/cpu/MultiphaseFlow/MultiphaseFlow.h @@ -1,4 +1,38 @@ -#pragma once +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file MultiphaseFlow.h +//! \ingroup MultiphaseFlow +//! \author Konstantin Kutscher +//======================================================================================= + +#ifndef MultiphaseFlow_h +#define MultiphaseFlow_h #include "MultiphaseFlow/BoundaryConditions/MultiphaseNoSlipBCStrategy.h" #include "MultiphaseFlow/BoundaryConditions/MultiphaseNonReflectingOutflowBCStrategy.h" @@ -26,3 +60,4 @@ #include "MultiphaseFlow/Visitors/MultiphaseInitDistributionsBlockVisitor.h" #include "MultiphaseFlow/Visitors/MultiphaseVelocityFormInitDistributionsBlockVisitor.h" +#endif \ No newline at end of file diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp index adc6a4f81f77cc57a4030643517cc583b61b3c7d..820c84855c66c695423beec09d1ccfa3953dc4e9 100644 --- a/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.cpp @@ -39,7 +39,7 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "LBMUnitConverter.h" @@ -53,7 +53,7 @@ WriteMultiphaseQuantitiesSimulationObserver::WriteMultiphaseQuantitiesSimulation const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h index 452a06d3bbb23943995f42ce84d712aa3c01b6a4..e5ba399ad57155c332cc2cd8520c51c8e86c441c 100644 --- a/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteMultiphaseQuantitiesSimulationObserver.h @@ -42,7 +42,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -63,7 +63,7 @@ public: //! \param conv is LBMUnitConverter object //! \param comm is Communicator object WriteMultiphaseQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteMultiphaseQuantitiesSimulationObserver() override = default; void update(real step) override; @@ -90,7 +90,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; real gradX1_phi(const real *const &); real gradX2_phi(const real *const &); diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp index 64ef23bcffb2d9b5478b1f57590d7d297ab08f52..7a0ae87b6cb3674557af510089548d7352913cc6 100644 --- a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.cpp @@ -39,7 +39,7 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "LBMUnitConverter.h" @@ -52,7 +52,7 @@ WriteSharpInterfaceQuantitiesSimulationObserver::WriteSharpInterfaceQuantitiesSi const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); diff --git a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h index 8c1e6347862a80cf25ab26a99b1304c731e2e2ee..bf42cbfa46b8c6b080da16b1732bd242674e48c5 100644 --- a/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h +++ b/src/cpu/MultiphaseFlow/SimulationObservers/WriteSharpInterfaceQuantitiesSimulationObserver.h @@ -42,7 +42,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -63,7 +63,7 @@ public: //! \param conv is LBMUnitConverter object //! \param comm is Communicator object WriteSharpInterfaceQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteSharpInterfaceQuantitiesSimulationObserver() override = default; void update(double step) override; @@ -90,7 +90,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; real gradX1_phi(const real *const &); real gradX2_phi(const real *const &); diff --git a/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp index 04590a0d9e6700720bd3addc824ec4eb04fd94a3..71e1aa1f7b25ba996d9b812f24e8958fa2f56b55 100644 --- a/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.cpp @@ -79,6 +79,16 @@ void MultiphaseSetKernelBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> blo block->setKernel(newKernel); } break; + case MultiphaseSetKernelBlockVisitor::AddKernel: + { + if (!block->getKernel()) + { + block->setKernel(newKernel); + } + //else + // std::cout << "block: " << block->getX1() << "," << block->getX2() << ","<< block->getX3() << std::endl; + } + break; } } diff --git a/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h index 566419d7f6f8a1e87a946e748e725ec1624d29ce..cac0b61c8eff491e79129ce2111d2590fb6c1e96 100644 --- a/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h +++ b/src/cpu/MultiphaseFlow/Visitors/MultiphaseSetKernelBlockVisitor.h @@ -40,7 +40,7 @@ class MultiphaseSetKernelBlockVisitor : public Block3DVisitor { public: - enum Action { NewKernel, ChangeKernel, ChangeKernelWithData}; + enum Action { NewKernel, ChangeKernel, ChangeKernelWithData, AddKernel}; public: MultiphaseSetKernelBlockVisitor(SPtr<LBMKernel> kernel, real nuL, real nuG, real availMem, real needMem, MultiphaseSetKernelBlockVisitor::Action action = MultiphaseSetKernelBlockVisitor::NewKernel); diff --git a/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.cpp similarity index 94% rename from src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.cpp rename to src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.cpp index 0a9c380dece3ba90f7d2d3d5d2a84ceadfcf4850..8da8886a42b0a9f9c784eca708618217f06c883a 100644 --- a/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.cpp @@ -26,51 +26,46 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file RheologyInterpolationProcessor.cpp +//! \file RheologyInterpolator.cpp //! \ingroup LBM //! \author Konstantin Kutscher //======================================================================================= -#include "RheologyInterpolationProcessor.h" +#include "RheologyInterpolator.h" #include "D3Q27System.h" #include "Rheology.h" -RheologyInterpolationProcessor::RheologyInterpolationProcessor() +RheologyInterpolator::RheologyInterpolator() : omegaC(0.0), omegaF(0.0), omegaMin(0.0) { } ////////////////////////////////////////////////////////////////////////// -RheologyInterpolationProcessor::RheologyInterpolationProcessor(real omegaC, real omegaF, real omegaMin) +RheologyInterpolator::RheologyInterpolator(real omegaC, real omegaF, real omegaMin) : omegaC(omegaC), omegaF(omegaF), omegaMin(omegaMin) { } ////////////////////////////////////////////////////////////////////////// -RheologyInterpolationProcessor::~RheologyInterpolationProcessor() +InterpolationProcessorPtr RheologyInterpolator::clone() { - -} -////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr RheologyInterpolationProcessor::clone() -{ - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new RheologyInterpolationProcessor(this->omegaC, this->omegaF, this->omegaMin)); + InterpolationProcessorPtr iproc = std::make_shared<RheologyInterpolator>(this->omegaC, this->omegaF, this->omegaMin); return iproc; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::setOmegas( real omegaC, real omegaF ) +void RheologyInterpolator::setOmegas( real omegaC, real omegaF ) { this->omegaC = omegaC; this->omegaF = omegaF; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::setOmegaMin( real omegaMin ) +void RheologyInterpolator::setOmegaMin( real omegaMin ) { this->omegaMin = omegaMin; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) +void RheologyInterpolator::setOffsets(real xoff, real yoff, real zoff) { this->xoff = xoff; this->yoff = yoff; @@ -80,7 +75,7 @@ void RheologyInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) this->zoff_sq = zoff * zoff; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) +void RheologyInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets_intern(icellC, omegaC, 0.5, 0.25, -0.25, -0.25, -1, -1, -1); @@ -101,14 +96,14 @@ void RheologyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, calcInterpolatedNode(icellF.TNE, /*omegaF,*/ 0.25, 0.25, 0.25, calcPressTNE(), 1, 1, 1); } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) +void RheologyInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets_intern(icellF, omegaF, 2.0, 0, 0, 0, 0, 0, 0); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::calcMoments(const real* const f, real omegaInf, real& press, real& vx1, real& vx2, real& vx3, real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) +void RheologyInterpolator::calcMoments(const real* const f, real omegaInf, real& press, real& vx1, real& vx2, real& vx3, real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -129,7 +124,7 @@ void RheologyInterpolationProcessor::calcMoments(const real* const f, real omega kxxMzz = -3./2.*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell, +void RheologyInterpolator::calcInterpolatedCoefficiets_intern(const D3Q27ICell& icell, real omega, real eps_new, real x, @@ -432,7 +427,7 @@ void RheologyInterpolationProcessor::calcInterpolatedCoefficiets_intern(const D3 yz_TNW = 0.0625*eps_new *(( bxyz + cxyz)/(72.*o)); } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::calcInterpolatedNode(real* f, /*real omega,*/ real x, real y, real z, real press, real xs, real ys, real zs) +void RheologyInterpolator::calcInterpolatedNode(real* f, /*real omega,*/ real x, real y, real z, real press, real xs, real ys, real zs) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -475,7 +470,7 @@ void RheologyInterpolationProcessor::calcInterpolatedNode(real* f, /*real omega, } ////////////////////////////////////////////////////////////////////////// //Position SWB -0.25, -0.25, -0.25 -real RheologyInterpolationProcessor::calcPressBSW() +real RheologyInterpolator::calcPressBSW() { return press_SWT * (0.140625 + 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + press_NWT * (0.046875 + 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + @@ -488,7 +483,7 @@ real RheologyInterpolationProcessor::calcPressBSW() } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 -real RheologyInterpolationProcessor::calcPressTSW() +real RheologyInterpolator::calcPressTSW() { return press_SWT * (0.421875 + 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + press_NWT * (0.140625 + 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + @@ -501,7 +496,7 @@ real RheologyInterpolationProcessor::calcPressTSW() } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 -real RheologyInterpolationProcessor::calcPressTSE() +real RheologyInterpolator::calcPressTSE() { return press_SET * (0.421875 - 0.5625 * xoff + 0.5625 * yoff - 0.5625 * zoff) + press_NET * (0.140625 - 0.1875 * xoff - 0.5625 * yoff - 0.1875 * zoff) + @@ -514,7 +509,7 @@ real RheologyInterpolationProcessor::calcPressTSE() } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 -real RheologyInterpolationProcessor::calcPressBSE() +real RheologyInterpolator::calcPressBSE() { return press_SET * (0.140625 - 0.1875 * xoff + 0.1875 * yoff - 0.5625 * zoff) + press_NET * (0.046875 - 0.0625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + @@ -527,7 +522,7 @@ real RheologyInterpolationProcessor::calcPressBSE() } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 -real RheologyInterpolationProcessor::calcPressBNW() +real RheologyInterpolator::calcPressBNW() { return press_NWT * (0.140625 + 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + press_NET * (0.046875 - 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + @@ -540,7 +535,7 @@ real RheologyInterpolationProcessor::calcPressBNW() } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 -real RheologyInterpolationProcessor::calcPressTNW() +real RheologyInterpolator::calcPressTNW() { return press_NWT * (0.421875 + 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + press_NET * (0.140625 - 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + @@ -553,7 +548,7 @@ real RheologyInterpolationProcessor::calcPressTNW() } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 -real RheologyInterpolationProcessor::calcPressTNE() +real RheologyInterpolator::calcPressTNE() { return press_NET * (0.421875 - 0.5625 * xoff - 0.5625 * yoff - 0.5625 * zoff) + press_NWT * (0.140625 + 0.5625 * xoff - 0.1875 * yoff - 0.1875 * zoff) + @@ -566,7 +561,7 @@ real RheologyInterpolationProcessor::calcPressTNE() } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 -real RheologyInterpolationProcessor::calcPressBNE() +real RheologyInterpolator::calcPressBNE() { return press_NET * (0.140625 - 0.1875 * xoff - 0.1875 * yoff - 0.5625 * zoff) + press_NWT * (0.046875 + 0.1875 * xoff - 0.0625 * yoff - 0.1875 * zoff) + @@ -579,7 +574,7 @@ real RheologyInterpolationProcessor::calcPressBNE() } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 -void RheologyInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) +void RheologyInterpolator::calcInterpolatedNodeFC(real* f, real omega) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -664,14 +659,14 @@ void RheologyInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) f[DIR_000] = f_ZERO + feq[DIR_000]; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) +void RheologyInterpolator::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) { vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; } ////////////////////////////////////////////////////////////////////////// -void RheologyInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) +void RheologyInterpolator::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { tauxx=ax+2*axx*x+axy*y+axz*z+axyz*y*z; tauyy=by+2*byy*y+bxy*x+byz*z+bxyz*x*z; diff --git a/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.h similarity index 89% rename from src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h rename to src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.h index 178932204307606b9fc48d2745ebf1353547e3e8..4b9391df278dc3e69a08df8a1400e3871ca7f067 100644 --- a/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyInterpolator.h @@ -26,24 +26,23 @@ // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // -//! \file RheologyInterpolationProcessor.h +//! \file RheologyInterpolator.h //! \ingroup LBM //! \author Konstantin Kutscher //======================================================================================= -#ifndef RheologyInterpolationProcessor_H_ -#define RheologyInterpolationProcessor_H_ +#ifndef RheologyInterpolator_H_ +#define RheologyInterpolator_H_ -#include "InterpolationProcessor.h" +#include "Interpolation/Interpolator.h" #include "D3Q27System.h" //! \brief A class implements an interpolation function of grid refinement for thixotropic fluid. -class RheologyInterpolationProcessor : public InterpolationProcessor +class RheologyInterpolator : public Interpolator { public: - RheologyInterpolationProcessor(); - RheologyInterpolationProcessor(real omegaC, real omegaF, real omegaMin); - virtual ~RheologyInterpolationProcessor(); + RheologyInterpolator(); + RheologyInterpolator(real omegaC, real omegaF, real omegaMin); InterpolationProcessorPtr clone(); void setOmegas(real omegaC, real omegaF); void setOmegaMin(real omegaMin); @@ -94,12 +93,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline void RheologyInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) +inline void RheologyInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) { this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// -inline void RheologyInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) +inline void RheologyInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) { this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); } diff --git a/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp index a9c7a05da6eefb4f44834d1c91f5e5b43d4f5eb4..2981156c4a5f6acc0df336d9d66cc9a9e97d8c1a 100644 --- a/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/RheologyK17LBMKernel.cpp @@ -33,7 +33,7 @@ #include "RheologyK17LBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include "DataSet3D.h" diff --git a/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp index cbfa924405109fa03dfef6532c538fb2917d2d43..a55ee9a28740843a4bf3c8587b3afb5f348c2759 100644 --- a/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.cpp @@ -1,6 +1,6 @@ #include "ThixotropyExpLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include "DataSet3D.h" diff --git a/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp index 368436088dc72bb10677f046aa9e954f9120be42..f764af6f5cd75b67ce51f8644d9f1839894fcdc3 100644 --- a/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp +++ b/src/cpu/NonNewtonianFluids/LBM/ThixotropyLBMKernel.cpp @@ -1,6 +1,6 @@ #include "ThixotropyLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include "DataSet3D.h" diff --git a/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h b/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h index 169082259b203b195b7fc636d84cdd4029ce6ccf..705a07af12b8ad8d32632d28dde5f4cd4b127173 100644 --- a/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h +++ b/src/cpu/NonNewtonianFluids/NonNewtonianFluids.h @@ -1,4 +1,37 @@ -#pragma once +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NonNewtonianFluids.h +//! \ingroup NonNewtonianFluids +//! \author Konstantin Kutscher +//======================================================================================= +#ifndef NonNewtonianFluids_h +#define NonNewtonianFluids_h #include "NonNewtonianFluids/BoundaryConditions/ThixotropyDensityBCStrategy.h" #include "NonNewtonianFluids/BoundaryConditions/ThixotropyNoSlipBCStrategy.h" @@ -18,7 +51,9 @@ #include "NonNewtonianFluids/LBM/ThixotropyExpLBMKernel.h" #include "NonNewtonianFluids/LBM/RheologyBinghamModelLBMKernel.h" #include "NonNewtonianFluids/LBM/RheologyHerschelBulkleyModelLBMKernel.h" -#include "NonNewtonianFluids/LBM/RheologyInterpolationProcessor.h" +#include "NonNewtonianFluids/LBM/RheologyInterpolator.h" #include "NonNewtonianFluids/LBM/Rheology.h" #include "NonNewtonianFluids/LBM/RheologyK17LBMKernel.h" #include "NonNewtonianFluids/LBM/RheologyPowellEyringModelLBMKernel.h" + +#endif \ No newline at end of file diff --git a/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp index 82adf2f0e2e59a36e4585d42d9baadb4e793f55f..7ed670deb9619565e9c11d18041cc522485ba2f6 100644 --- a/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.cpp @@ -1,7 +1,7 @@ #include "CalculateTorqueSimulationObserver.h" #include "BCSet.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "UbScheduler.h" #include "Grid3D.h" @@ -14,7 +14,7 @@ #include "DistributionArray3D.h" #include "NonNewtonianFluids/LBM/Rheology.h" -CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) +CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) { if (comm->getProcessID() == comm->getRoot()) { diff --git a/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h index d0cd9c41d5afc4e127f9be74e106960c86097f96..e1948d95f69daa795fe8ea5e1733b5b8be1f2754 100644 --- a/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h @@ -17,7 +17,7 @@ #include "D3Q27System.h" class ForceCalculator; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class D3Q27Interactor; @@ -29,7 +29,7 @@ class CalculateTorqueSimulationObserver: public SimulationObserver { public: //! Constructor - CalculateTorqueSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + CalculateTorqueSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); virtual ~CalculateTorqueSimulationObserver(); void update(real step); void addInteractor(SPtr<D3Q27Interactor> interactor); @@ -42,7 +42,7 @@ protected: private: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; std::vector<SPtr<D3Q27Interactor> > interactors; real torqueX1global; real torqueX2global; diff --git a/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp index 61f13299d914bb3fd15a8d0a69712c722c91ca6f..bc3eab4fb93581a0184d96cddbd5542fa358e8ee 100644 --- a/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.cpp @@ -49,7 +49,7 @@ using namespace std; WriteThixotropyQuantitiesSimulationObserver::WriteThixotropyQuantitiesSimulationObserver() = default; ////////////////////////////////////////////////////////////////////////// -WriteThixotropyQuantitiesSimulationObserver::WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) +WriteThixotropyQuantitiesSimulationObserver::WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); diff --git a/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h index 3ac9664e595adef9b45edaee662849a3ab63616f..5ef994a08fe36812361903fb02e83be510faa13e 100644 --- a/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h +++ b/src/cpu/NonNewtonianFluids/SimulationObservers/WriteThixotropyQuantitiesSimulationObserver.h @@ -38,14 +38,14 @@ #include "Grid3D.h" #include "Block3D.h" #include "LBMUnitConverter.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "WbWriter.h" class WriteThixotropyQuantitiesSimulationObserver : public SimulationObserver { public: WriteThixotropyQuantitiesSimulationObserver(); - WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + WriteThixotropyQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, WbWriter* const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteThixotropyQuantitiesSimulationObserver() = default; void update(real step) override; @@ -69,7 +69,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; // double ConcentrationSum; }; #endif diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index 6fa9b30bfc0e650f289d00a2970bdff545c71359..81beddf3e059cf76d507d2c20113732945bc5efa 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -40,9 +40,9 @@ #include <omp.h> #endif -#include <mpi/Communicator.h> -#include <mpi/MPICommunicator.h> -#include <mpi/NullCommunicator.h> +#include <parallel/Communicator.h> +#include <parallel/MPICommunicator.h> +#include <parallel/NullCommunicator.h> #include <basics/PointerDefinitions.h> @@ -208,14 +208,11 @@ #include <TimeDependentBCSimulationObserver.h> #include <IntegrateValuesHelper.h> -//#include <LBM/D3Q27CompactInterpolationProcessor.h> -#include <LBM/CompressibleOffsetInterpolationProcessor.h> -#include <LBM/CompressibleOffsetMomentsInterpolationProcessor.h> -#include <LBM/CompressibleOffsetSquarePressureInterpolationProcessor.h> -#include <LBM/IncompressibleOffsetInterpolationProcessor.h> -#include <LBM/InterpolationHelper.h> -#include <LBM/InterpolationProcessor.h> -//#include <LBM/D3Q27OffsetInterpolationProcessor.h> +#include <LBM/Interpolation/CompressibleOffsetInterpolator.h> +#include <LBM/Interpolation/CompressibleOffsetMomentsInterpolator.h> +#include <LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.h> +#include <LBM/Interpolation/IncompressibleOffsetInterpolator.h> +#include <LBM/Interpolation/Interpolator.h> #include <IncompressibleCumulantWithSpongeLayerLBMKernel.h> #include <LBM/CompressibleCumulant4thOrderViscosityLBMKernel.h> #include <LBM/CompressibleCumulantLBMKernel.h> @@ -223,7 +220,6 @@ #include <LBM/ICell.h> #include <LBM/IncompressibleCumulantLBMKernel.h> #include <LBM/InitDensityLBMKernel.h> -#include <LBM/InterpolationProcessor.h> #include <LBM/LBMKernel.h> #include <LBM/LBMKernelETD3Q27BGK.h> #include <LBM/LBMSystem.h> @@ -232,11 +228,6 @@ #include <LBM/CumulantLBMKernel.h> #include <LBM/CumulantK17LBMKernel.h> -//#include <LBM/RheologyModelLBMKernel.h> -//#include <LBM/RheologyModelLBMKernel2.h> - - - #include <geometry3d/CoordinateTransformation3D.h> diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp index 3331f24538f421db95d12da0eb6f287ba858765a..5458fa09c1e98a35d65a4c37a2d760a9188e188b 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCStrategy.cpp @@ -54,18 +54,20 @@ void BCStrategy::setBcPointer(SPtr<BoundaryConditions> bcPtr) { this->bcPtr = bc ////////////////////////////////////////////////////////////////////////// void BCStrategy::setCompressible(bool c) { + using namespace vf::basics::constant; + compressible = c; if (this->compressible) { calcFeqsForDirFct = &D3Q27System::getCompFeqForDirection; calcMacrosFct = &D3Q27System::calcCompMacroscopicValues; calcFeqFct = &D3Q27System::calcCompFeq; - compressibleFactor = 1.0; + compressibleFactor = c1o1; } else { calcFeqsForDirFct = &D3Q27System::getIncompFeqForDirection; calcMacrosFct = &D3Q27System::calcIncompMacroscopicValues; calcFeqFct = &D3Q27System::calcIncompFeq; - compressibleFactor = 0.0; + compressibleFactor = c0o1; } } ////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp index cabd41b30dd31ac8751c60f00f46c899cbfa2334..bb98e499421328abc36f8911a14bcb8c90ebabd1 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCStrategy.cpp @@ -54,23 +54,22 @@ void NoSlipBCStrategy::addDistributions(SPtr<DistributionArray3D> distributions) ////////////////////////////////////////////////////////////////////////// void NoSlipBCStrategy::applyBC() { - real f[D3Q27System::ENDF + 1]; - real feq[D3Q27System::ENDF + 1]; + using namespace vf::basics::constant; + using namespace D3Q27System; + real f[ENDF + 1]; + real feq[ENDF + 1]; distributions->getDistributionInv(f, x1, x2, x3); real rho, vx1, vx2, vx3; calcMacrosFct(f, rho, vx1, vx2, vx3); calcFeqFct(feq, rho, vx1, vx2, vx3); - for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { + for (int fdir = FSTARTDIR; fdir <= FENDDIR; fdir++) { if (bcPtr->hasNoSlipBoundaryFlag(fdir)) { // quadratic bounce back - const int invDir = D3Q27System::INVDIR[fdir]; - real q = bcPtr->getQ(invDir); - real fReturn = ((vf::basics::constant::c1o1 - q) / (vf::basics::constant::c1o1 + q)) * ((f[invDir] - feq[invDir]) / (vf::basics::constant::c1o1 - collFactor) + feq[invDir]) + - ((q / (vf::basics::constant::c1o1 + q)) * (f[invDir] + f[fdir])); - distributions->setDistributionForDirection(fReturn, x1 + D3Q27System::DX1[invDir], - x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], - fdir); + const int invDir = INVDIR[fdir]; + real q = bcPtr->getQ(invDir); + real fReturn = ((c1o1 - q) / (c1o1 + q)) * ((f[invDir] - feq[invDir]) / (c1o1 - collFactor) + feq[invDir]) + ((q / (c1o1 + q)) * (f[invDir] + f[fdir])); + distributions->setDistributionForDirection(fReturn, x1 + DX1[invDir], x2 + DX2[invDir], x3 + DX3[invDir], fdir); } } } diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp index 7f5eaf840c721f65cc030d5e6fad2995858af1b3..b1cf37e4b71ed883410c77098d9fa8d83f56a812 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingInflowBCStrategy.cpp @@ -98,14 +98,14 @@ void NonReflectingInflowBCStrategy::applyBC() LBMReal rho, vx1, vx2, vx3; calcMacrosFct(f, rho, vx1, vx2, vx3); //vx1 = 0.; - LBMReal BCVeloWeight = 0.5; + LBMReal BCVeloWeight = c1o2; // LBMReal velocity = 0.004814077025232405; // LBMReal velocity = 0.00057735; //LBMReal velocity = 0.04; // LBMReal velocity = 0.01; // LBMReal velocity = 1./112.; // LBMReal velocity = 1./126.; - LBMReal velocity = 1./200.; + LBMReal velocity = c1o100/2; // LBMReal velocity = 0.005; //LBMReal delf =(-velocity+vx1)*0.5 ; LBMReal delf; @@ -114,15 +114,15 @@ void NonReflectingInflowBCStrategy::applyBC() case DIR_P00: delf = (-velocity + vx1) * BCVeloWeight; // delf = (-velocity ) * BCVeloWeight; - f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P00] - delf* WEIGTH[DIR_P00]; - f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; - f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; - f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; + f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P00] - delf* WEIGTH[DIR_P00]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; //f[DIR_P00] = (ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P00]) * // (1 - BCVeloWeight) + // (ftemp[DIR_M00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_M00] + @@ -181,23 +181,23 @@ void NonReflectingInflowBCStrategy::applyBC() break; case DIR_M00: delf = (-velocity - vx1) * BCVeloWeight; - f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M00] - + f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M00] - delf * WEIGTH[DIR_M00]; - f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MP0] - + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MP0] - delf * WEIGTH[DIR_MP0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MM0] - + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MM0] - delf * WEIGTH[DIR_MM0]; - f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0P] - + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0P] - delf * WEIGTH[DIR_M0P]; - f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0M] - + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0M] - delf * WEIGTH[DIR_M0M]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPP] - + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPP] - delf * WEIGTH[DIR_MPP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMP] - + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMP] - delf * WEIGTH[DIR_MMP]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPM] - + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPM] - delf * WEIGTH[DIR_MPM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMM] - + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMM] - delf * WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00); @@ -212,23 +212,23 @@ void NonReflectingInflowBCStrategy::applyBC() break; case DIR_0P0: delf = (-velocity + vx2) * BCVeloWeight; - f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0P0] - + f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0P0] - delf * WEIGTH[DIR_0P0]; - f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PP0] - + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PP0] - delf * WEIGTH[DIR_PP0]; - f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MP0] - + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MP0] - delf * WEIGTH[DIR_MP0]; - f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0PP] - + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PP] - delf * WEIGTH[DIR_0PP]; - f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0PM] - + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PM] - delf * WEIGTH[DIR_0PM]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PPP] - + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPP] - delf * WEIGTH[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MPP] - + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPP] - delf * WEIGTH[DIR_MPP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PPM] - + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPM] - delf * WEIGTH[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MPM] - + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPM] - delf * WEIGTH[DIR_MPM]; distributions->setDistributionInvForDirection(f[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0); @@ -243,23 +243,23 @@ void NonReflectingInflowBCStrategy::applyBC() break; case DIR_0M0: delf = (-velocity - vx2) * BCVeloWeight; - f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0M0] - + f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0M0] - delf * WEIGTH[DIR_0M0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PM0] - + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PM0] - delf * WEIGTH[DIR_PM0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MM0] - + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MM0] - delf * WEIGTH[DIR_MM0]; - f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0MP] - + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MP] - delf * WEIGTH[DIR_0MP]; - f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0MM] - + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MM] - delf * WEIGTH[DIR_0MM]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PMP] - + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMP] - delf * WEIGTH[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MMP] - + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMP] - delf * WEIGTH[DIR_MMP]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PMM] - + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMM] - delf * WEIGTH[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MMM] - + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMM] - delf * WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0); @@ -274,23 +274,23 @@ void NonReflectingInflowBCStrategy::applyBC() break; case DIR_00P: delf = (-velocity + vx3) * BCVeloWeight; - f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_00P] - + f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_00P] - delf * WEIGTH[DIR_00P]; - f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_P0P] - + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_P0P] - delf * WEIGTH[DIR_P0P]; - f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_M0P] - + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_M0P] - delf * WEIGTH[DIR_M0P]; - f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_0PP] - + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0PP] - delf * WEIGTH[DIR_0PP]; - f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_0MP] - + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0MP] - delf * WEIGTH[DIR_0MP]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_PPP] - + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PPP] - delf * WEIGTH[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_MPP] - + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MPP] - delf * WEIGTH[DIR_MPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_PMP] - + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PMP] - delf * WEIGTH[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_MMP] - + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MMP] - delf * WEIGTH[DIR_MMP]; distributions->setDistributionInvForDirection(f[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M); @@ -305,23 +305,23 @@ void NonReflectingInflowBCStrategy::applyBC() break; case DIR_00M: delf = (-velocity - vx3) * BCVeloWeight; - f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_00M] - + f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_00M] - delf * WEIGTH[DIR_00M]; - f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_P0M] - + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_P0M] - delf * WEIGTH[DIR_P0M]; - f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_M0M] - + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_M0M] - delf * WEIGTH[DIR_M0M]; - f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_0PM] - + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0PM] - delf * WEIGTH[DIR_0PM]; - f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_0MM] - + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0MM] - delf * WEIGTH[DIR_0MM]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_PPM] - + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PPM] - delf * WEIGTH[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_MPM] - + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MPM] - delf * WEIGTH[DIR_MPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_PMM] - + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PMM] - delf * WEIGTH[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_MMM] - + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MMM] - delf * WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp index 3e10421e59bac7e260e95ccf491d1f749f28c640..f0fb4ccae28c38c13742fc9875acf7f44f545cbc 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NonReflectingOutflowWithRelaxationBCStrategy.cpp @@ -98,18 +98,18 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() LBMReal rho, vx1, vx2, vx3; calcMacrosFct(f, rho, vx1, vx2, vx3); - LBMReal delf = rho*0.01; + LBMReal delf = rho* c1o100; switch (direction) { case DIR_P00: - f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P00] - delf* WEIGTH[DIR_P00]; - f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; - f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; - f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (1.0 - one_over_sqrt3 - vx1) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; + f[DIR_P00] = ftemp[DIR_P00] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P00] - delf* WEIGTH[DIR_P00]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 + vx1) + (c1o1 - one_over_sqrt3 - vx1) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; distributions->setDistributionInvForDirection(f[DIR_P00], x1 + DX1[DIR_M00], x2 + DX2[DIR_M00], x3 + DX3[DIR_M00], DIR_M00); distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0); @@ -122,15 +122,15 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() distributions->setDistributionInvForDirection(f[DIR_PMM], x1 + DX1[DIR_MPP], x2 + DX2[DIR_MPP], x3 + DX3[DIR_MPP], DIR_MPP); break; case DIR_M00: - f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M00]- delf* WEIGTH[DIR_M00]; - f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MP0]- delf* WEIGTH[DIR_MP0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MM0]- delf* WEIGTH[DIR_MM0]; - f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0P]- delf* WEIGTH[DIR_M0P]; - f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_M0M]- delf* WEIGTH[DIR_M0M]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (1.0 - one_over_sqrt3 + vx1) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; + f[DIR_M00] = ftemp[DIR_M00] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M00]- delf* WEIGTH[DIR_M00]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MP0]- delf* WEIGTH[DIR_MP0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MM0]- delf* WEIGTH[DIR_MM0]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0P]- delf* WEIGTH[DIR_M0P]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_M0M]- delf* WEIGTH[DIR_M0M]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx1) + (c1o1 - one_over_sqrt3 + vx1) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_M00], x1 + DX1[DIR_P00], x2 + DX2[DIR_P00], x3 + DX3[DIR_P00], DIR_P00); distributions->setDistributionInvForDirection(f[DIR_MP0], x1 + DX1[DIR_PM0], x2 + DX2[DIR_PM0], x3 + DX3[DIR_PM0], DIR_PM0); @@ -143,15 +143,15 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP); break; case DIR_0P0: - f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0P0]- delf* WEIGTH[DIR_0P0]; - f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; - f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MP0]- delf* WEIGTH[DIR_MP0]; - f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0PP]- delf* WEIGTH[DIR_0PP]; - f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_0PM]- delf* WEIGTH[DIR_0PM]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (1.0 - one_over_sqrt3 - vx2) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; + f[DIR_0P0] = ftemp[DIR_0P0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0P0]- delf* WEIGTH[DIR_0P0]; + f[DIR_PP0] = ftemp[DIR_PP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PP0]- delf* WEIGTH[DIR_PP0]; + f[DIR_MP0] = ftemp[DIR_MP0] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MP0]- delf* WEIGTH[DIR_MP0]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PP]- delf* WEIGTH[DIR_0PP]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_0PM]- delf* WEIGTH[DIR_0PM]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 + vx2) + (c1o1 - one_over_sqrt3 - vx2) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; distributions->setDistributionInvForDirection(f[DIR_0P0], x1 + DX1[DIR_0M0], x2 + DX2[DIR_0M0], x3 + DX3[DIR_0M0], DIR_0M0); distributions->setDistributionInvForDirection(f[DIR_PP0], x1 + DX1[DIR_MM0], x2 + DX2[DIR_MM0], x3 + DX3[DIR_MM0], DIR_MM0); @@ -164,15 +164,15 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() distributions->setDistributionInvForDirection(f[DIR_MPM], x1 + DX1[DIR_PMP], x2 + DX2[DIR_PMP], x3 + DX3[DIR_PMP], DIR_PMP); break; case DIR_0M0: - f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0M0]- delf* WEIGTH[DIR_0M0]; - f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; - f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MM0]- delf* WEIGTH[DIR_MM0]; - f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0MP]- delf* WEIGTH[DIR_0MP]; - f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_0MM]- delf* WEIGTH[DIR_0MM]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (1.0 - one_over_sqrt3 + vx2) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; + f[DIR_0M0] = ftemp[DIR_0M0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0M0]- delf* WEIGTH[DIR_0M0]; + f[DIR_PM0] = ftemp[DIR_PM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PM0]- delf* WEIGTH[DIR_PM0]; + f[DIR_MM0] = ftemp[DIR_MM0] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MM0]- delf* WEIGTH[DIR_MM0]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MP]- delf* WEIGTH[DIR_0MP]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_0MM]- delf* WEIGTH[DIR_0MM]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx2) + (c1o1 - one_over_sqrt3 + vx2) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_0M0], x1 + DX1[DIR_0P0], x2 + DX2[DIR_0P0], x3 + DX3[DIR_0P0], DIR_0P0); distributions->setDistributionInvForDirection(f[DIR_PM0], x1 + DX1[DIR_MP0], x2 + DX2[DIR_MP0], x3 + DX3[DIR_MP0], DIR_MP0); @@ -185,15 +185,15 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() distributions->setDistributionInvForDirection(f[DIR_MMM], x1 + DX1[DIR_PPP], x2 + DX2[DIR_PPP], x3 + DX3[DIR_PPP], DIR_PPP); break; case DIR_00P: - f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_00P]- delf* WEIGTH[DIR_00P]; - f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; - f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_M0P]- delf* WEIGTH[DIR_M0P]; - f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_0PP]- delf* WEIGTH[DIR_0PP]; - f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_0MP]- delf* WEIGTH[DIR_0MP]; - f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; - f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; - f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; - f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (1.0 - one_over_sqrt3 - vx3) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; + f[DIR_00P] = ftemp[DIR_00P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_00P]- delf* WEIGTH[DIR_00P]; + f[DIR_P0P] = ftemp[DIR_P0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_P0P]- delf* WEIGTH[DIR_P0P]; + f[DIR_M0P] = ftemp[DIR_M0P] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_M0P]- delf* WEIGTH[DIR_M0P]; + f[DIR_0PP] = ftemp[DIR_0PP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0PP]- delf* WEIGTH[DIR_0PP]; + f[DIR_0MP] = ftemp[DIR_0MP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_0MP]- delf* WEIGTH[DIR_0MP]; + f[DIR_PPP] = ftemp[DIR_PPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PPP]- delf* WEIGTH[DIR_PPP]; + f[DIR_MPP] = ftemp[DIR_MPP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MPP]- delf* WEIGTH[DIR_MPP]; + f[DIR_PMP] = ftemp[DIR_PMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_PMP]- delf* WEIGTH[DIR_PMP]; + f[DIR_MMP] = ftemp[DIR_MMP] * (one_over_sqrt3 + vx3) + (c1o1 - one_over_sqrt3 - vx3) * f[DIR_MMP]- delf* WEIGTH[DIR_MMP]; distributions->setDistributionInvForDirection(f[DIR_00P], x1 + DX1[DIR_00M], x2 + DX2[DIR_00M], x3 + DX3[DIR_00M], DIR_00M); distributions->setDistributionInvForDirection(f[DIR_P0P], x1 + DX1[DIR_M0M], x2 + DX2[DIR_M0M], x3 + DX3[DIR_M0M], DIR_M0M); @@ -206,15 +206,15 @@ void NonReflectingOutflowWithRelaxationBCStrategy::applyBC() distributions->setDistributionInvForDirection(f[DIR_MMP], x1 + DX1[DIR_PPM], x2 + DX2[DIR_PPM], x3 + DX3[DIR_PPM], DIR_PPM); break; case DIR_00M: - f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_00M]- delf* WEIGTH[DIR_00M]; - f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; - f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_M0M]- delf* WEIGTH[DIR_M0M]; - f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_0PM]- delf* WEIGTH[DIR_0PM]; - f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_0MM]- delf* WEIGTH[DIR_0MM]; - f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; - f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; - f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; - f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (1.0 - one_over_sqrt3 + vx3) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; + f[DIR_00M] = ftemp[DIR_00M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_00M]- delf* WEIGTH[DIR_00M]; + f[DIR_P0M] = ftemp[DIR_P0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_P0M]- delf* WEIGTH[DIR_P0M]; + f[DIR_M0M] = ftemp[DIR_M0M] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_M0M]- delf* WEIGTH[DIR_M0M]; + f[DIR_0PM] = ftemp[DIR_0PM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0PM]- delf* WEIGTH[DIR_0PM]; + f[DIR_0MM] = ftemp[DIR_0MM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_0MM]- delf* WEIGTH[DIR_0MM]; + f[DIR_PPM] = ftemp[DIR_PPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PPM]- delf* WEIGTH[DIR_PPM]; + f[DIR_MPM] = ftemp[DIR_MPM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MPM]- delf* WEIGTH[DIR_MPM]; + f[DIR_PMM] = ftemp[DIR_PMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_PMM]- delf* WEIGTH[DIR_PMM]; + f[DIR_MMM] = ftemp[DIR_MMM] * (one_over_sqrt3 - vx3) + (c1o1 - one_over_sqrt3 + vx3) * f[DIR_MMM]- delf* WEIGTH[DIR_MMM]; distributions->setDistributionInvForDirection(f[DIR_00M], x1 + DX1[DIR_00P], x2 + DX2[DIR_00P], x3 + DX3[DIR_00P], DIR_00P); distributions->setDistributionInvForDirection(f[DIR_P0M], x1 + DX1[DIR_M0P], x2 + DX2[DIR_M0P], x3 + DX3[DIR_M0P], DIR_M0P); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp index 008adefd8196c6d6689316d29bbc2f3fe50b9f9e..eb254160395ce1ba12e22bc6ff6d6e063ce8f316 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.cpp @@ -28,7 +28,7 @@ // //! \file SlipBC.cpp //! \ingroup BoundarConditions -//! \author Sören Freudiger +//! \author Soeren Freudiger //======================================================================================= #include "SlipBC.h" #include "D3Q27Interactor.h" diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h index 98205ba32b2d3ccec85346bd89a199e8e9a9049c..8e8788db8ded7a2f9eb0e47135f9babbc69e37da 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/SlipBC.h @@ -28,7 +28,7 @@ // //! \file SlipBC.h //! \ingroup BoundarConditions -//! \author Sören Freudiger +//! \author Soeren Freudiger //======================================================================================= #ifndef SlipBC_H #define SlipBC_H diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp index 1b579877afa20ac6c3d82cce0ea2b5c6f00aef81..0278ee0954dda41fd028a40d820782bf76b512f8 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityWithDensityBCStrategy.cpp @@ -55,6 +55,8 @@ void VelocityWithDensityBCStrategy::addDistributions(SPtr<DistributionArray3D> d ////////////////////////////////////////////////////////////////////////// void VelocityWithDensityBCStrategy::applyBC() { + using namespace vf::basics::constant; + //velocity bc for non reflecting pressure bc real f[D3Q27System::ENDF+1]; //real feq[D3Q27System::ENDF+1]; @@ -63,7 +65,7 @@ void VelocityWithDensityBCStrategy::applyBC() calcMacrosFct(f, drho, vx1, vx2, vx3); //calcFeqFct(feq, drho, vx1, vx2, vx3); - rho = 1.0+drho*compressibleFactor; + rho = c1o1+drho*compressibleFactor; for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt index 9f3cd96e889097a32ce737e56e3f1fa31dddaee0..3e767e49c6cc0d35c2c8706a20b77f17a625b9a4 100644 --- a/src/cpu/VirtualFluidsCore/CMakeLists.txt +++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt @@ -20,7 +20,7 @@ if(BUILD_USE_OPENMP) list(APPEND VF_LIBRARIES OpenMP::OpenMP_CXX) endif() -vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} PRIVATE_LINK lbm mpi logger) +vf_add_library(BUILDTYPE static PUBLIC_LINK basics muparser ${VF_LIBRARIES} parallel PRIVATE_LINK lbm logger) vf_add_tests() @@ -31,6 +31,7 @@ target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Co target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM/Interpolation) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Simulation) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors) diff --git a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h index d7f9f72c4f86f5d849fa4f2c0cd703333007091a..331e923ea6b94841c2d0c293b9f5680bab4cb400 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/CoarseToFineVectorConnector.h @@ -40,13 +40,14 @@ #include "Block3DConnector.h" #include "D3Q27System.h" #include "Grid3D.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "LBMKernel.h" #include "MathUtil.hpp" #include "basics/container/CbVector.h" #include "basics/transmitter/TbTransmitter.h" #include "basics/transmitter/TbTransmitterLocal.h" #include <PointerDefinitions.h> +#include "basics/constants/NumericConstants.h" #include "BCSet.h" #include "FineToCoarseVectorConnector.h" @@ -829,6 +830,8 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectorExt(SPtr<Dist const int &lMaxX2, const int &lMaxX3, vector_type &data, int &index) { + using namespace vf::basics::constant; + if (data.size() == 0) return; int ix1, ix2, ix3; @@ -845,9 +848,9 @@ void CoarseToFineVectorConnector<VectorTransmitter>::fillSendVectorExt(SPtr<Dist if (howManySolids == 0 || howManySolids == 8) { iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); - xoff = 0.0; - yoff = 0.0; - zoff = 0.0; + xoff = c0o1; + yoff = c0o1; + zoff = c0o1; } else { if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) { @@ -1975,6 +1978,7 @@ void CoarseToFineVectorConnector<VectorTransmitter>::findCFnodes(SPtr<Distributi const int &lMaxX1, const int &lMaxX2, const int &lMaxX3, vector_type &data, int &index) { + using namespace vf::basics::constant; if (data.size() == 0) return; int ix1, ix2, ix3; @@ -1991,9 +1995,9 @@ void CoarseToFineVectorConnector<VectorTransmitter>::findCFnodes(SPtr<Distributi if (howManySolids == 0 || howManySolids == 8) { iprocessor->readICell(fFrom, icellC, ix1, ix2, ix3); - xoff = 0.0; - yoff = 0.0; - zoff = 0.0; + xoff = c0o1; + yoff = c0o1; + zoff = c0o1; } else { if (!iprocessor->findNeighborICell(bcArray, fFrom, icellC, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) { diff --git a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h index ffab5008241e7f8f4457c7385c83872a296ee748..94222fee2940dc13411b4c7520ac64a5ab942478 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/FineToCoarseVectorConnector.h @@ -40,11 +40,12 @@ #include "Block3DConnector.h" #include "D3Q27System.h" #include "Grid3D.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "LBMKernel.h" #include "MathUtil.hpp" #include "basics/transmitter/TbTransmitter.h" #include <PointerDefinitions.h> +#include "basics/constants/NumericConstants.h" #include "BCSet.h" #include "DataSet3D.h" @@ -793,6 +794,8 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVector(SPtr<Distrib const int &lMaxX1, const int &lMaxX2, const int &lMaxX3, vector_type &data, int &index) { + using namespace vf::basics::constant; + int ix1, ix2, ix3; real xoff, yoff, zoff; SPtr<BCArray3D> bcArray = block.lock()->getKernel()->getBCSet()->getBCArray(); @@ -807,9 +810,9 @@ void FineToCoarseVectorConnector<VectorTransmitter>::fillSendVector(SPtr<Distrib if (howManySolids == 0 || howManySolids == 8) { iprocessor->readICell(fFrom, icellF, ix1, ix2, ix3); - xoff = 0.0; - yoff = 0.0; - zoff = 0.0; + xoff = c0o1; + yoff = c0o1; + zoff = c0o1; } else { if (!iprocessor->findNeighborICell(bcArray, fFrom, icellF, bMaxX1, bMaxX2, bMaxX3, ix1, ix2, ix3, xoff, yoff, zoff)) { diff --git a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp index 1bdb92f6b0d51c3bfb8daf6e149be7c1be0fecf0..be66dfb5b0785198e826f3fe2017aa479b92b53a 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp +++ b/src/cpu/VirtualFluidsCore/Connectors/OneDistributionFullVectorConnector.cpp @@ -13,6 +13,7 @@ OneDistributionFullVectorConnector::OneDistributionFullVectorConnector(SPtr<Bloc void OneDistributionFullVectorConnector::init() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; FullVectorConnector::init(); @@ -25,36 +26,36 @@ void OneDistributionFullVectorConnector::init() break; case DIR_P00: case DIR_M00: - sender->getData().resize(maxX2 * maxX3 * anz, 0.0); + sender->getData().resize(maxX2 * maxX3 * anz, c0o1); break; case DIR_0P0: case DIR_0M0: - sender->getData().resize(maxX1 * maxX3 * anz, 0.0); + sender->getData().resize(maxX1 * maxX3 * anz, c0o1); break; case DIR_00P: case DIR_00M: - sender->getData().resize(maxX1 * maxX2 * anz, 0.0); + sender->getData().resize(maxX1 * maxX2 * anz, c0o1); break; case DIR_PP0: case DIR_MM0: case DIR_PM0: case DIR_MP0: - sender->getData().resize(maxX3 * anz, 0.0); + sender->getData().resize(maxX3 * anz, c0o1); break; case DIR_P0P: case DIR_M0M: case DIR_P0M: case DIR_M0P: - sender->getData().resize(maxX2 * anz, 0.0); + sender->getData().resize(maxX2 * anz, c0o1); break; case DIR_0PP: case DIR_0MM: case DIR_0PM: case DIR_0MP: - sender->getData().resize(maxX1 * anz, 0.0); + sender->getData().resize(maxX1 * anz, c0o1); break; case DIR_PPP: @@ -65,7 +66,7 @@ void OneDistributionFullVectorConnector::init() case DIR_MPM: case DIR_PMM: case DIR_MPP: - sender->getData().resize(anz, 0.0); + sender->getData().resize(anz, c0o1); break; default: diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp index 8334b93d21529a54fbe6b29be465d60d2c63e308..a94da62ef440c3f1ff67f48d75d0ba18c34887ec 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp +++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.cpp @@ -51,6 +51,7 @@ ThreeDistributionsDoubleGhostLayerFullVectorConnector::ThreeDistributionsDoubleG void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; FullVectorConnector::init(); @@ -64,26 +65,26 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init() { case DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break; case DIR_P00: - case DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, 0.0); break; + case DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, c0o1); break; case DIR_0P0: - case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, 0.0); break; + case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, c0o1); break; case DIR_00P: - case DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, 0.0); break; + case DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, c0o1); break; case DIR_PP0: case DIR_MM0: case DIR_PM0: - case DIR_MP0: sender->getData().resize(maxX3*anz*4, 0.0); break; + case DIR_MP0: sender->getData().resize(maxX3*anz*4, c0o1); break; case DIR_P0P: case DIR_M0M: case DIR_P0M: - case DIR_M0P: sender->getData().resize(maxX2*anz*4, 0.0); break; + case DIR_M0P: sender->getData().resize(maxX2*anz*4, c0o1); break; case DIR_0PP: case DIR_0MM: case DIR_0PM: - case DIR_0MP: sender->getData().resize(maxX1*anz*4, 0.0); break; + case DIR_0MP: sender->getData().resize(maxX1*anz*4, c0o1); break; case DIR_PPP: case DIR_MMM: @@ -92,7 +93,7 @@ void ThreeDistributionsDoubleGhostLayerFullVectorConnector::init() case DIR_PMP: case DIR_MPM: case DIR_PMM: - case DIR_MPP: sender->getData().resize(anz*8, 0.0); break; + case DIR_MPP: sender->getData().resize(anz*8, c0o1); break; default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir")); } diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h index e124251d8f8be21aa33ccb8dc91f7e9b40356827..c91103481e71979d93830573fe3a27a80c77a337 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsDoubleGhostLayerFullVectorConnector.h @@ -198,7 +198,8 @@ inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::fillData(vect sdata[index++] = (*this->zeroH2distributions)(x1, x2, x3); - sdata[index++] = (*this->pressure)(x1, x2, x3); + if (this->pressure) + sdata[index++] = (*this->pressure)(x1, x2, x3); } ////////////////////////////////////////////////////////////////////////// inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3) @@ -294,7 +295,8 @@ inline void ThreeDistributionsDoubleGhostLayerFullVectorConnector::distributeDat (*this->zeroH2distributions)(x1, x2, x3) = rdata[index++]; - (*this->pressure)(x1, x2, x3) = rdata[index++]; + if (this->pressure) + (*this->pressure)(x1, x2, x3) = rdata[index++]; } diff --git a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp index 1b4f243eeccd39c8bdcc0ac3bf1c8b3510053d58..65315b4f33ea1d64df96cb919d2335f8130e950e 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp +++ b/src/cpu/VirtualFluidsCore/Connectors/ThreeDistributionsFullVectorConnector.cpp @@ -51,6 +51,7 @@ ThreeDistributionsFullVectorConnector::ThreeDistributionsFullVectorConnector(SPt void ThreeDistributionsFullVectorConnector::init() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; FullVectorConnector::init(); @@ -63,26 +64,26 @@ void ThreeDistributionsFullVectorConnector::init() { case DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break; case DIR_P00: - case DIR_M00: sender->getData().resize(maxX2*maxX3*anz, 0.0); break; + case DIR_M00: sender->getData().resize(maxX2*maxX3*anz, c0o1); break; case DIR_0P0: - case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, 0.0); break; + case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, c0o1); break; case DIR_00P: - case DIR_00M: sender->getData().resize(maxX1*maxX2*anz, 0.0); break; + case DIR_00M: sender->getData().resize(maxX1*maxX2*anz, c0o1); break; case DIR_PP0: case DIR_MM0: case DIR_PM0: - case DIR_MP0: sender->getData().resize(maxX3*anz, 0.0); break; + case DIR_MP0: sender->getData().resize(maxX3*anz, c0o1); break; case DIR_P0P: case DIR_M0M: case DIR_P0M: - case DIR_M0P: sender->getData().resize(maxX2*anz, 0.0); break; + case DIR_M0P: sender->getData().resize(maxX2*anz, c0o1); break; case DIR_0PP: case DIR_0MM: case DIR_0PM: - case DIR_0MP: sender->getData().resize(maxX1*anz, 0.0); break; + case DIR_0MP: sender->getData().resize(maxX1*anz, c0o1); break; case DIR_PPP: case DIR_MMM: @@ -91,7 +92,7 @@ void ThreeDistributionsFullVectorConnector::init() case DIR_PMP: case DIR_MPM: case DIR_PMM: - case DIR_MPP: sender->getData().resize(anz, 0.0); break; + case DIR_MPP: sender->getData().resize(anz, c0o1); break; default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir")); } diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp index 8f6b88898a9da1cfca9aee49ae4cb084ee54217a..f8ff7d5c28bb04e41f51a5223dc9a64bcd0cf317 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp +++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.cpp @@ -51,6 +51,7 @@ TwoDistributionsDoubleGhostLayerFullVectorConnector::TwoDistributionsDoubleGhost void TwoDistributionsDoubleGhostLayerFullVectorConnector::init() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; FullVectorConnector::init(); @@ -63,26 +64,26 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::init() { case DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break; case DIR_P00: - case DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, 0.0); break; + case DIR_M00: sender->getData().resize(maxX2*maxX3*anz*2, c0o1); break; case DIR_0P0: - case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, 0.0); break; + case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz*2, c0o1); break; case DIR_00P: - case DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, 0.0); break; + case DIR_00M: sender->getData().resize(maxX1*maxX2*anz*2, c0o1); break; case DIR_PP0: case DIR_MM0: case DIR_PM0: - case DIR_MP0: sender->getData().resize(maxX3*anz*4, 0.0); break; + case DIR_MP0: sender->getData().resize(maxX3*anz*4, c0o1); break; case DIR_P0P: case DIR_M0M: case DIR_P0M: - case DIR_M0P: sender->getData().resize(maxX2*anz*4, 0.0); break; + case DIR_M0P: sender->getData().resize(maxX2*anz*4, c0o1); break; case DIR_0PP: case DIR_0MM: case DIR_0PM: - case DIR_0MP: sender->getData().resize(maxX1*anz*4, 0.0); break; + case DIR_0MP: sender->getData().resize(maxX1*anz*4, c0o1); break; case DIR_PPP: case DIR_MMM: @@ -91,7 +92,7 @@ void TwoDistributionsDoubleGhostLayerFullVectorConnector::init() case DIR_PMP: case DIR_MPM: case DIR_PMM: - case DIR_MPP: sender->getData().resize(anz*8, 0.0); break; + case DIR_MPP: sender->getData().resize(anz*8, c0o1); break; default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir")); } diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h index d5769c726eda127ca603d6984744274abaf2edae..67f896af34c8b7e7d7fa9c918236b5a435156c62 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h +++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsDoubleGhostLayerFullVectorConnector.h @@ -158,7 +158,8 @@ inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::fillData(vector sdata[index++] = (*this->zeroHdistributions)(x1, x2, x3); - sdata[index++] = (*this->pressure)(x1, x2, x3); + if (this->pressure) + sdata[index++] = (*this->pressure)(x1, x2, x3); } ////////////////////////////////////////////////////////////////////////// inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3) @@ -224,7 +225,8 @@ inline void TwoDistributionsDoubleGhostLayerFullVectorConnector::distributeData( (*this->zeroHdistributions)(x1, x2, x3) = rdata[index++]; - (*this->pressure)(x1, x2, x3) = rdata[index++]; + if (this->pressure) + (*this->pressure)(x1, x2, x3) = rdata[index++]; } diff --git a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp index 7987c2f6c8af52fbf897ff6bbcee47add3fc0056..36e34321d0bcaecec63b70d2b059542dc5514b95 100644 --- a/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp +++ b/src/cpu/VirtualFluidsCore/Connectors/TwoDistributionsFullVectorConnector.cpp @@ -51,7 +51,8 @@ TwoDistributionsFullVectorConnector::TwoDistributionsFullVectorConnector(SPtr<Bl void TwoDistributionsFullVectorConnector::init() { using namespace vf::lbm::dir; - + using namespace vf::basics::constant; + FullVectorConnector::init(); fDis = dynamicPointerCast<EsoTwist3D>(block.lock()->getKernel()->getDataSet()->getFdistributions()); @@ -62,26 +63,26 @@ void TwoDistributionsFullVectorConnector::init() { case DIR_000: UB_THROW(UbException(UB_EXARGS, "ZERO not allowed")); break; case DIR_P00: - case DIR_M00: sender->getData().resize(maxX2*maxX3*anz, 0.0); break; + case DIR_M00: sender->getData().resize(maxX2*maxX3*anz, c0o1); break; case DIR_0P0: - case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, 0.0); break; + case DIR_0M0: sender->getData().resize(maxX1*maxX3*anz, c0o1); break; case DIR_00P: - case DIR_00M: sender->getData().resize(maxX1*maxX2*anz, 0.0); break; + case DIR_00M: sender->getData().resize(maxX1*maxX2*anz, c0o1); break; case DIR_PP0: case DIR_MM0: case DIR_PM0: - case DIR_MP0: sender->getData().resize(maxX3*anz, 0.0); break; + case DIR_MP0: sender->getData().resize(maxX3*anz, c0o1); break; case DIR_P0P: case DIR_M0M: case DIR_P0M: - case DIR_M0P: sender->getData().resize(maxX2*anz, 0.0); break; + case DIR_M0P: sender->getData().resize(maxX2*anz, c0o1); break; case DIR_0PP: case DIR_0MM: case DIR_0PM: - case DIR_0MP: sender->getData().resize(maxX1*anz, 0.0); break; + case DIR_0MP: sender->getData().resize(maxX1*anz, c0o1); break; case DIR_PPP: case DIR_MMM: @@ -90,7 +91,7 @@ void TwoDistributionsFullVectorConnector::init() case DIR_PMP: case DIR_MPM: case DIR_PMM: - case DIR_MPP: sender->getData().resize(anz, 0.0); break; + case DIR_MPP: sender->getData().resize(anz, c0o1); break; default: UB_THROW(UbException(UB_EXARGS, "unknown sendDir")); } diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp index 4660e7b8397482683d67e6ba74b466b1857df10c..11119ecbd59f1a4d145fb130b3d0fe2b2a671fac 100644 --- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp +++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp @@ -259,7 +259,7 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(real f, size_t x int direction) { using namespace vf::lbm::dir; - + switch (direction) { case DIR_P00: (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = f; diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp index 02a94f573ed04a5509c71fb7890fe418d230f0fe..d9c605a587c90a96d0e070f9528fefb028307cf6 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp @@ -88,80 +88,81 @@ D3Q27Interactor::~D3Q27Interactor() = default; void D3Q27Interactor::initRayVectors() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; int fdir; real c1oS2 = vf::basics::constant::one_over_sqrt2; real c1oS3 = vf::basics::constant::one_over_sqrt3; fdir = DIR_P00; - rayX1[fdir] = 1.0; - rayX2[fdir] = 0.0; - rayX3[fdir] = 0.0; + rayX1[fdir] = c1o1; + rayX2[fdir] = c0o1; + rayX3[fdir] = c0o1; fdir = DIR_M00; - rayX1[fdir] = -1.0; - rayX2[fdir] = 0.0; - rayX3[fdir] = 0.0; + rayX1[fdir] = -c1o1; + rayX2[fdir] = c0o1; + rayX3[fdir] = c0o1; fdir = DIR_0P0; - rayX1[fdir] = 0.0; - rayX2[fdir] = 1.0; - rayX3[fdir] = 0.0; + rayX1[fdir] = c0o1; + rayX2[fdir] = c1o1; + rayX3[fdir] = c0o1; fdir = DIR_0M0; - rayX1[fdir] = 0.0; - rayX2[fdir] = -1.0; - rayX3[fdir] = 0.0; + rayX1[fdir] = c0o1; + rayX2[fdir] = -c1o1; + rayX3[fdir] = c0o1; fdir = DIR_00P; - rayX1[fdir] = 0.0; - rayX2[fdir] = 0.0; - rayX3[fdir] = 1.0; + rayX1[fdir] = c0o1; + rayX2[fdir] = c0o1; + rayX3[fdir] = c1o1; fdir = DIR_00M; - rayX1[fdir] = 0.0; - rayX2[fdir] = 0.0; - rayX3[fdir] = -1.0; + rayX1[fdir] = c0o1; + rayX2[fdir] = c0o1; + rayX3[fdir] = -c1o1; fdir = DIR_PP0; rayX1[fdir] = c1oS2; rayX2[fdir] = c1oS2; - rayX3[fdir] = 0.0; + rayX3[fdir] = c0o1; fdir = DIR_MM0; rayX1[fdir] = -c1oS2; rayX2[fdir] = -c1oS2; - rayX3[fdir] = 0.0; + rayX3[fdir] = c0o1; fdir = DIR_PM0; rayX1[fdir] = c1oS2; rayX2[fdir] = -c1oS2; - rayX3[fdir] = 0.0; + rayX3[fdir] = c0o1; fdir = DIR_MP0; rayX1[fdir] = -c1oS2; rayX2[fdir] = c1oS2; - rayX3[fdir] = 0.0; + rayX3[fdir] = c0o1; fdir = DIR_P0P; rayX1[fdir] = c1oS2; - rayX2[fdir] = 0.0; + rayX2[fdir] = c0o1; rayX3[fdir] = c1oS2; fdir = DIR_M0M; rayX1[fdir] = -c1oS2; - rayX2[fdir] = 0.0; + rayX2[fdir] = c0o1; rayX3[fdir] = -c1oS2; fdir = DIR_P0M; rayX1[fdir] = c1oS2; - rayX2[fdir] = 0.0; + rayX2[fdir] = c0o1; rayX3[fdir] = -c1oS2; fdir = DIR_M0P; rayX1[fdir] = -c1oS2; - rayX2[fdir] = 0.0; + rayX2[fdir] = c0o1; rayX3[fdir] = c1oS2; fdir = DIR_0PP; - rayX1[fdir] = 0.0; + rayX1[fdir] = c0o1; rayX2[fdir] = c1oS2; rayX3[fdir] = c1oS2; fdir = DIR_0MM; - rayX1[fdir] = 0.0; + rayX1[fdir] = c0o1; rayX2[fdir] = -c1oS2; rayX3[fdir] = -c1oS2; fdir = DIR_0PM; - rayX1[fdir] = 0.0; + rayX1[fdir] = c0o1; rayX2[fdir] = c1oS2; rayX3[fdir] = -c1oS2; fdir = DIR_0MP; - rayX1[fdir] = 0.0; + rayX1[fdir] = c0o1; rayX2[fdir] = -c1oS2; rayX3[fdir] = c1oS2; @@ -285,6 +286,7 @@ void D3Q27Interactor::updateInteractor(const real ×tep) bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) { using namespace vf::lbm::dir; + using namespace vf::basics::constant; if (!block) return false; @@ -297,7 +299,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) solidNodeIndicesMap[block] = set<UbTupleInt3>(); set<UbTupleInt3> &solidNodeIndices = solidNodeIndicesMap[block]; - real timestep = 0; + real timestep = c0o1; bool oneEntryGotBC = false; bool gotQs = false; SPtr<BoundaryConditions> bc; @@ -396,11 +398,11 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) rayX2[fdir], rayX3[fdir]); q /= distNeigh[fdir]; - // assert(UbMath::lessEqual(q, 1.0)); + // assert(UbMath::lessEqual(q, c1o1)); - if (UbMath::inClosedInterval(q, 1.0, 1.0)) - q = 1.0; - if (UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0)) { + if (UbMath::inClosedInterval(q, c1o1, c1o1)) + q = c1o1; + if (UbMath::greater(q, c0o1) && UbMath::lessEqual(q, c1o1)) { //#pragma omp critical (BC_CHANGE) { bc = bcArray->getBC(ix1, ix2, ix3); @@ -410,9 +412,9 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) } if (bc->hasNoSlipBoundary()) { - bc->setBoundaryVelocityX1(0.0); - bc->setBoundaryVelocityX2(0.0); - bc->setBoundaryVelocityX3(0.0); + bc->setBoundaryVelocityX1(c0o1); + bc->setBoundaryVelocityX2(c0o1); + bc->setBoundaryVelocityX3(c0o1); } for (int index = (int)BCs.size() - 1; index >= 0; --index) @@ -499,7 +501,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) GbLine3D *clippedLine = this->geoObject3D->createClippedLine3D(pointA, pointB); if (clippedLine) { - real q = 0.0; + real q = c0o1; if (!this->isInverseSolid()) // A is outside { real distanceAB = pointA.getDistance(&pointB); // pointA to B @@ -518,16 +520,16 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) pointB.getX1Coordinate(), pointB.getX2Coordinate(), pointB.getX3Coordinate(), pointIsOnBoundary) && pointIsOnBoundary) { - // A is definitely inside, B is exactly on ObjectBoundary => q = 1.0 - q = 1.0; + // A is definitely inside, B is exactly on ObjectBoundary => q = c1o1 + q = c1o1; } else { - q = 0.0; + q = c0o1; } } - if (UbMath::inClosedInterval(q, 1.0, 1.0)) - q = 1.0; - if (UbMath::lessEqual(q, 1.0) && UbMath::greater(q, 0.0)) { + if (UbMath::inClosedInterval(q, c1o1, c1o1)) + q = c1o1; + if (UbMath::lessEqual(q, c1o1) && UbMath::greater(q, c0o1)) { { bc = bcArray->getBC(ix1, ix2, ix3); if (!bc) { diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp index e8746ffda6e2b44d004b0d33136779be405b5a28..98906576c44b5abf3895eb429d37ee0a065ae9ec 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27TriFaceMeshInteractor.cpp @@ -77,7 +77,7 @@ bool D3Q27TriFaceMeshInteractor::setDifferencesToGbObject3D(const SPtr<Block3D> SPtr<ILBMKernel> kernel = block->getKernel(); SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); - real internX1, internX2, internX3; + double internX1, internX2, internX3; int startIX1 = 0, startIX2 = 0, startIX3 = 0; int stopIX1 = (int)bcArray->getNX1(), stopIX2 = (int)bcArray->getNX2(), stopIX3 = (int)bcArray->getNX3(); @@ -123,6 +123,7 @@ bool D3Q27TriFaceMeshInteractor::setDifferencesToGbObject3D(const SPtr<Block3D> void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) { using namespace vf::lbm::dir; + using namespace vf::basics::constant; UBLOGML(logDEBUG1, "\nLBMTriFaceMeshInteractor - setQs start "); if (!this->grid.lock()) @@ -168,7 +169,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) // grobe Blocklaengen SPtr<CoordinateTransformation3D> trafo = grid.lock()->getCoordinateTransformator(); double cblockDeltaX1, cblockDeltaX2, cblockDeltaX3, delta; - cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = 1.0 / (double)(1 << coarsestInitLevel); + cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = c1o1 / (double)(1 << coarsestInitLevel); if (trafo) { cblockDeltaX1 = trafo->getX1CoordinateScaling() * delta; cblockDeltaX2 = trafo->getX2CoordinateScaling() * delta; @@ -208,12 +209,12 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) // blockDeltaCalculator->getMinX1Delta(level) -> ein geinlinter wert wird geholt // TODO: set 5.0 as variable parameter in constructor, default 2.0 - deltaMinX1[level] = (float)(5.0 * nodeDeltaX1); // kein minus da unten -deltaMin - deltaMinX2[level] = (float)(5.0 * nodeDeltaX2); - deltaMinX3[level] = (float)(5.0 * nodeDeltaX3); - deltaMaxX1[level] = (float)(5.0 * nodeDeltaX1); - deltaMaxX2[level] = (float)(5.0 * nodeDeltaX2); - deltaMaxX3[level] = (float)(5.0 * nodeDeltaX3); + deltaMinX1[level] = (float)(c5o1 * nodeDeltaX1); // kein minus da unten -deltaMin + deltaMinX2[level] = (float)(c5o1 * nodeDeltaX2); + deltaMinX3[level] = (float)(c5o1 * nodeDeltaX3); + deltaMaxX1[level] = (float)(c5o1 * nodeDeltaX1); + deltaMaxX2[level] = (float)(c5o1 * nodeDeltaX2); + deltaMaxX3[level] = (float)(c5o1 * nodeDeltaX3); } ////////////////////////////////////////////////////////////////////////// @@ -233,12 +234,11 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) // notwendige variablen initialisieren (u.a. blockDeltas des groben levels) float triPoints[3][3]; float vx1 = 0.0, vx2 = 0.0, vx3 = 0.0; - unsigned counterTriBoxOverlap = 0, counterAABBTriFace = 0, counterHalfspace = 0, counterBilligOBB = 0; std::vector<GbTriFaceMesh3D::TriFace> &triangles = *mesh->getTriangles(); std::vector<GbTriFaceMesh3D::Vertex> &nodes = *mesh->getNodes(); std::map<SPtr<Block3D>, std::set<UbTupleInt3>> tmpSolidNodesFromOtherInteractors; - int onePercent = UbMath::integerRounding(triangles.size() * 0.01); + int onePercent = UbMath::integerRounding(triangles.size() * c1o100); if (onePercent == 0) onePercent = 1; UbTimer setQTimer; @@ -331,17 +331,16 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) blockMaxX[1] = (float)(val<2>(coords) + val<2>(deltas) + deltaMaxX2[level]); blockMaxX[2] = (float)(val<3>(coords) + val<3>(deltas) + deltaMaxX3[level]); - boxCenter[0] = (float)(0.5 * (blockMaxX[0] + blockMinX[0])); - boxCenter[1] = (float)(0.5 * (blockMaxX[1] + blockMinX[1])); - boxCenter[2] = (float)(0.5 * (blockMaxX[2] + blockMinX[2])); + boxCenter[0] = (float)(c1o2 * (blockMaxX[0] + blockMinX[0])); + boxCenter[1] = (float)(c1o2 * (blockMaxX[1] + blockMinX[1])); + boxCenter[2] = (float)(c1o2 * (blockMaxX[2] + blockMinX[2])); - halfBoxSize[0] = (float)(0.5 * (blockMaxX[0] - blockMinX[0])); - halfBoxSize[1] = (float)(0.5 * (blockMaxX[1] - blockMinX[1])); - halfBoxSize[2] = (float)(0.5 * (blockMaxX[2] - blockMinX[2])); + halfBoxSize[0] = (float)(c1o2 * (blockMaxX[0] - blockMinX[0])); + halfBoxSize[1] = (float)(c1o2 * (blockMaxX[1] - blockMinX[1])); + halfBoxSize[2] = (float)(c1o2 * (blockMaxX[2] - blockMinX[2])); // wenn dreieck "vergroesserten cube" nicht schneidet/beruehrt -> keine BC moeglich -> continue if (!GbMeshTools3D::triBoxOverlap(boxCenter, halfBoxSize, triPoints)) { - counterTriBoxOverlap++; continue; } @@ -396,7 +395,6 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) bool pointIsOnBoundary = true; if (!boundingCubeTriangle.isPointInGbObject3D(internX1, internX2, internX3, pointIsOnBoundary)) { - counterAABBTriFace++; continue; } // std::cout<<"internX3 "<<internX3<<" internX2"<<internX2<<" internX1 "<<internX1<<"\n"; @@ -408,13 +406,11 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) if (useHalfSpace && UbMath::less(distance, 0.0)) //== !halfSpace.ptInside(internX1,internX2,internX3) ) { - counterHalfspace++; continue; } // BilligOBB-Test: wenn distance > qEinflussDelta -> kein q if (UbMath::greater(fabs(distance), qEinflussDelta)) { - counterBilligOBB++; continue; } @@ -450,11 +446,11 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) a = e1x1 * px1 + e1x2 * px2 + e1x3 * px3; if (fabs(a) < 1.E-10) continue; - f = 1.0 / a; + f = c1o1 / a; // u = f * ( s dot p) u = f * (sx1 * px1 + sx2 * px2 + sx3 * px3); - if (u < -1.E-10 || u > 1.0 + 1.E-10) + if (u < -1.E-10 || u > c1o1 + 1.E-10) continue; // q = s x e1 @@ -464,7 +460,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) // v = f*(e2 dot q) v = f * (this->rayX1[fdir] * qx1 + this->rayX2[fdir] * qx2 + this->rayX3[fdir] * qx3); - if (v < -1.E-10 || (u + v) > 1.0 + 1.E-10) + if (v < -1.E-10 || (u + v) > c1o1 + 1.E-10) continue; // t = f * (e2 dot q) @@ -497,7 +493,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) (z1 - internX3) * (z1 - internX3)); q_ehsan /= nodeDeltaToNeigh[level][fdir]; q = q_ehsan; - if (UbMath::greater(q, 1.0) || UbMath::lessEqual(q, 0.0)) + if (UbMath::greater(q, c1o1) || UbMath::lessEqual(q, 0.0)) continue; // gefundenes q auf gueltigkeit pruefen @@ -512,9 +508,9 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) continue; } - if (UbMath::inClosedInterval(q, 1.0, 1.0)) - q = 1.0; - if (UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0)) { + if (UbMath::inClosedInterval(q, c1o1, c1o1)) + q = c1o1; + if (UbMath::greater(q, 0.0) && UbMath::lessEqual(q, c1o1)) { gotQs = blockGotBCs = true; bc = bcMatrix->getBC(ix1, ix2, ix3); @@ -596,6 +592,7 @@ void D3Q27TriFaceMeshInteractor::setQs(const real &timeStep) void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) { using namespace vf::lbm::dir; + using namespace vf::basics::constant; UBLOGML(logDEBUG1, "\nLBMTriFaceMeshInteractor - initInteractor start "); if (!this->grid.lock()) @@ -647,7 +644,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) // grobe Blocklaengen SPtr<CoordinateTransformation3D> trafo = grid.lock()->getCoordinateTransformator(); double cblockDeltaX1, cblockDeltaX2, cblockDeltaX3, delta; - cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = 1.0 / (double)(1 << coarsestInitLevel); + cblockDeltaX1 = cblockDeltaX2 = cblockDeltaX3 = delta = c1o1 / (double)(1 << coarsestInitLevel); if (trafo) { cblockDeltaX1 = trafo->getX1CoordinateScaling() * delta; cblockDeltaX2 = trafo->getX2CoordinateScaling() * delta; @@ -740,13 +737,13 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) // notwendige variablen initialisieren (u.a. blockDeltas des groben levels) float triPoints[3][3]; - real vx1 = 0.0, vx2 = 0.0, vx3 = 0.0; + real vx1 = c0o1, vx2 = c0o1, vx3 = c0o1; unsigned counterTriBoxOverlap = 0, counterAABBTriFace = 0, counterHalfspace = 0, counterBilligOBB = 0; std::vector<GbTriFaceMesh3D::TriFace> &triangles = *mesh->getTriangles(); std::vector<GbTriFaceMesh3D::Vertex> &nodes = *mesh->getNodes(); std::map<SPtr<Block3D>, std::set<std::vector<int>>> tmpSolidNodesFromOtherInteractors; - int onePercent = UbMath::integerRounding(triangles.size() * 0.01); + int onePercent = UbMath::integerRounding(triangles.size() * c1o100); if (onePercent == 0) onePercent = 1; UbTimer setQTimer; @@ -850,13 +847,13 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) blockMaxX[1] = (float)(val<2>(coords) + val<2>(deltas) + deltaMaxX2[level]); blockMaxX[2] = (float)(val<3>(coords) + val<3>(deltas) + deltaMaxX3[level]); - boxCenter[0] = (float)(0.5 * (blockMaxX[0] + blockMinX[0])); - boxCenter[1] = (float)(0.5 * (blockMaxX[1] + blockMinX[1])); - boxCenter[2] = (float)(0.5 * (blockMaxX[2] + blockMinX[2])); + boxCenter[0] = (float)(c1o2 * (blockMaxX[0] + blockMinX[0])); + boxCenter[1] = (float)(c1o2 * (blockMaxX[1] + blockMinX[1])); + boxCenter[2] = (float)(c1o2 * (blockMaxX[2] + blockMinX[2])); - halfBoxSize[0] = (float)(0.5 * (blockMaxX[0] - blockMinX[0])); - halfBoxSize[1] = (float)(0.5 * (blockMaxX[1] - blockMinX[1])); - halfBoxSize[2] = (float)(0.5 * (blockMaxX[2] - blockMinX[2])); + halfBoxSize[0] = (float)(c1o2 * (blockMaxX[0] - blockMinX[0])); + halfBoxSize[1] = (float)(c1o2 * (blockMaxX[1] - blockMinX[1])); + halfBoxSize[2] = (float)(c1o2 * (blockMaxX[2] - blockMinX[2])); // wenn dreieck "vergroesserten cube" nicht schneidet/beruehrt -> keine BC moeglich -> continue if (!GbMeshTools3D::triBoxOverlap(boxCenter, halfBoxSize, triPoints)) { @@ -892,9 +889,9 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) double qEinflussDelta = 1.1 * sqrt(nodeDx1 * nodeDx1 + nodeDx2 * nodeDx2 + nodeDx3 * nodeDx3); for (int ix3 = indexMinX3; ix3 < indexMaxX3; ix3++) { - internX3 = val<3>(coords) + nodeDx3 * ix3 - 0.5 * nodeDx3; + internX3 = val<3>(coords) + nodeDx3 * ix3 - c1o2 * nodeDx3; for (int ix2 = indexMinX2; ix2 < indexMaxX2; ix2++) { - internX2 = val<2>(coords) + nodeDx2 * ix2 - 0.5 * nodeDx2; + internX2 = val<2>(coords) + nodeDx2 * ix2 - c1o2 * nodeDx2; for (int ix1 = indexMinX1; ix1 < indexMaxX1; ix1++) { // int blx1 =block->getX1(); @@ -935,7 +932,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) } } - internX1 = val<1>(coords) + nodeDx1 * ix1 - 0.5 * nodeDx1; + internX1 = val<1>(coords) + nodeDx1 * ix1 - c1o2 * nodeDx1; ////////////////////////////////////////////////////////////////////////// // Punkt in AABB von Dreieck? @@ -1001,11 +998,11 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) a = e1x1 * px1 + e1x2 * px2 + e1x3 * px3; if (fabs(a) < 1.E-10) continue; - f = 1.0 / a; + f = c1o1 / a; // u = f * ( s dot p) u = f * (sx1 * px1 + sx2 * px2 + sx3 * px3); - if (u < -1.E-10 || u > 1.0 + 1.E-10) + if (u < -1.E-10 || u > c1o1 + 1.E-10) continue; // q = s x e1 @@ -1015,7 +1012,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) // v = f*(e2 dot q) v = f * (this->rayX1[fdir] * qx1 + this->rayX2[fdir] * qx2 + this->rayX3[fdir] * qx3); - if (v < -1.E-10 || (u + v) > 1.0 + 1.E-10) + if (v < -1.E-10 || (u + v) > c1o1 + 1.E-10) continue; // t = f * (e2 dot q) @@ -1034,9 +1031,9 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) continue; } - if (UbMath::inClosedInterval(q, 1.0, 1.0)) - q = 1.0; - if (UbMath::greater(q, 0.0) && UbMath::lessEqual(q, 1.0)) { + if (UbMath::inClosedInterval(q, c1o1, c1o1)) + q = c1o1; + if (UbMath::greater(q, 0.0) && UbMath::lessEqual(q, c1o1)) { // if( !solidFromOtherInteractor ) //--> Knoten schon solid-->BC setzen // ueberfluessig SG changed to if( solidFromOtherInteractor ) //--> Knoten schon // solid-->BC setzen ueberfluessig @@ -1050,7 +1047,6 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) // SG 26.08.2010 if(!bc && !bcMatrix->isSolid()) if (!bc) { bc = SPtr<BoundaryConditions>(new BoundaryConditions); - ; bcMatrix->setBC(ix1, ix2, ix3, bc); } else if (UbMath::less(bc->getQ(fdir), q)) // schon ein kuerzeres q voehanden? { @@ -1120,7 +1116,7 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) UBLOG(logDEBUG1, " * rejected nodes with halfspace test : " << counterHalfspace); UBLOG(logDEBUG1, " * rejected nodes with OBB test : " << counterBilligOBB); - typedef std::map<SPtr<Block3D>, SolidCheckMethod>::iterator BlockSolidCheckMethodIterator; + using BlockSolidCheckMethodIterator = std::map<SPtr<Block3D>, SolidCheckMethod>::iterator; ////////////////////////////////////////////////////////////////////////// // SOLID checks @@ -1217,9 +1213,9 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) // int ride=0; // } if (flagField(bx1, bx2, bx3) == UNDEF_FLAG) { - if (mesh->isPointInGbObject3D(val<1>(coords) + bx1 * nodeDeltaX1 - 0.5 * nodeDeltaX1, - val<2>(coords) + bx2 * nodeDeltaX2 - 0.5 * nodeDeltaX2, - val<3>(coords) + bx3 * nodeDeltaX3 - 0.5 * nodeDeltaX3)) { + if (mesh->isPointInGbObject3D(val<1>(coords) + bx1 * nodeDeltaX1 - c1o2 * nodeDeltaX1, + val<2>(coords) + bx2 * nodeDeltaX2 - c1o2 * nodeDeltaX2, + val<3>(coords) + bx3 * nodeDeltaX3 - c1o2 * nodeDeltaX3)) { (this->*gridFill)(flagField, bx1, bx2, bx3, SOLID_FLAG); } else { (this->*gridFill)(flagField, bx1, bx2, bx3, FLUID_FLAG); @@ -1315,6 +1311,8 @@ void D3Q27TriFaceMeshInteractor::initInteractor2(const real &timeStep) ////////////////////////////////////////////////////////////////////////// void D3Q27TriFaceMeshInteractor::refineBlockGridToLevel(int level, real startDistance, real stopDistance) { + using namespace vf::basics::constant; + UBLOG(logDEBUG1, "D3Q27TriFaceMeshInteractor::refineBlockGridToLevel - start"); // ToDo: evtl checken, ob man noch einen HalbraumCheck für StopDistance einbaut @@ -1371,27 +1369,27 @@ void D3Q27TriFaceMeshInteractor::refineBlockGridToLevel(int level, real startDis // Boundingbox um massgebliches dx erweitern -> zur Bestimmung der zu testenden Bloecke if (triangle.nx > 1.0E-8) { - minX1 = triangle.getMinX(nodes) + 1.05 * triangle.nx * startDistance; - maxX1 = triangle.getMaxX(nodes) + 1.05 * triangle.nx * stopDistance; + minX1 = triangle.getMinX(nodes) + c21o20 * triangle.nx * startDistance; + maxX1 = triangle.getMaxX(nodes) + c21o20 * triangle.nx * stopDistance; } else { - minX1 = triangle.getMinX(nodes) + 1.05 * triangle.nx * stopDistance; - maxX1 = triangle.getMaxX(nodes) + 1.05 * triangle.nx * startDistance; + minX1 = triangle.getMinX(nodes) + c21o20 * triangle.nx * stopDistance; + maxX1 = triangle.getMaxX(nodes) + c21o20 * triangle.nx * startDistance; } if (triangle.ny > 1.0E-8) { - minX2 = triangle.getMinY(nodes) + 1.05 * triangle.ny * startDistance; - maxX2 = triangle.getMaxY(nodes) + 1.05 * triangle.ny * stopDistance; + minX2 = triangle.getMinY(nodes) + c21o20 * triangle.ny * startDistance; + maxX2 = triangle.getMaxY(nodes) + c21o20 * triangle.ny * stopDistance; } else { - minX2 = triangle.getMinY(nodes) + 1.05 * triangle.ny * stopDistance; - maxX2 = triangle.getMaxY(nodes) + 1.05 * triangle.ny * startDistance; + minX2 = triangle.getMinY(nodes) + c21o20 * triangle.ny * stopDistance; + maxX2 = triangle.getMaxY(nodes) + c21o20 * triangle.ny * startDistance; } if (triangle.nz > 1.0E-8) { - minX3 = triangle.getMinZ(nodes) + 1.05 * triangle.nz * startDistance; - maxX3 = triangle.getMaxZ(nodes) + 1.05 * triangle.nz * stopDistance; + minX3 = triangle.getMinZ(nodes) + c21o20 * triangle.nz * startDistance; + maxX3 = triangle.getMaxZ(nodes) + c21o20 * triangle.nz * stopDistance; } else { - minX3 = triangle.getMinZ(nodes) + 1.05 * triangle.nz * stopDistance; - maxX3 = triangle.getMaxZ(nodes) + 1.05 * triangle.nz * startDistance; + minX3 = triangle.getMinZ(nodes) + c21o20 * triangle.nz * stopDistance; + maxX3 = triangle.getMaxZ(nodes) + c21o20 * triangle.nz * startDistance; } int flag = 0; @@ -1441,15 +1439,15 @@ void D3Q27TriFaceMeshInteractor::refineBlockGridToLevel(int level, real startDis // blockseite ermitteln (skalarprodukt dreiecks-normale, vector (midTri->midCub) ) // je nachdem muss für den massgeblichen block start oder stopdistance verwendet werden // liegt block auf pos seite -> stopdistance ansonsten startdistance - double skalarprod = triangle.nx * (0.5 * (x1a + x1b) - triangle.getX1Centroid(nodes)) + - triangle.ny * (0.5 * (x2a + x2b) - triangle.getX2Centroid(nodes)) + - triangle.nz * (0.5 * (x3a + x3b) - triangle.getX3Centroid(nodes)); + double skalarprod = triangle.nx * (c1o2 * (x1a + x1b) - triangle.getX1Centroid(nodes)) + + triangle.ny * (c1o2 * (x2a + x2b) - triangle.getX2Centroid(nodes)) + + triangle.nz * (c1o2 * (x3a + x3b) - triangle.getX3Centroid(nodes)); - double blockdelta = 1.05 * stopDistance; + double blockdelta = c21o20 * stopDistance; if (skalarprod < 1.E-8) - blockdelta = -1.05 * startDistance; // startDistance<0!! + blockdelta = -c21o20 * startDistance; // startDistance<0!! else if (fabs(skalarprod) < 1.E-8) - blockdelta = 1.05 * UbMath::max(-startDistance, stopDistance); + blockdelta = c21o20 * UbMath::max(-startDistance, stopDistance); // block anpassen blockMinX[0] = (float)(val<1>(coords) - blockdelta); @@ -1460,13 +1458,13 @@ void D3Q27TriFaceMeshInteractor::refineBlockGridToLevel(int level, real startDis blockMaxX[1] = (float)(val<2>(coords) + val<2>(deltas) + blockdelta); blockMaxX[2] = (float)(val<3>(coords) + val<3>(deltas) + blockdelta); - boxCenter[0] = (float)(0.5 * (blockMaxX[0] + blockMinX[0])); - boxCenter[1] = (float)(0.5 * (blockMaxX[1] + blockMinX[1])); - boxCenter[2] = (float)(0.5 * (blockMaxX[2] + blockMinX[2])); + boxCenter[0] = (float)(c1o2 * (blockMaxX[0] + blockMinX[0])); + boxCenter[1] = (float)(c1o2 * (blockMaxX[1] + blockMinX[1])); + boxCenter[2] = (float)(c1o2 * (blockMaxX[2] + blockMinX[2])); - halfBoxSize[0] = (float)(0.5 * (blockMaxX[0] - blockMinX[0])); - halfBoxSize[1] = (float)(0.5 * (blockMaxX[1] - blockMinX[1])); - halfBoxSize[2] = (float)(0.5 * (blockMaxX[2] - blockMinX[2])); + halfBoxSize[0] = (float)(c1o2 * (blockMaxX[0] - blockMinX[0])); + halfBoxSize[1] = (float)(c1o2 * (blockMaxX[1] - blockMinX[1])); + halfBoxSize[2] = (float)(c1o2 * (blockMaxX[2] - blockMinX[2])); GbTriFaceMesh3D::Vertex &v1_ = nodes[triangle.v1]; GbTriFaceMesh3D::Vertex &v2_ = nodes[triangle.v2]; @@ -1564,10 +1562,11 @@ UbTupleDouble3 D3Q27TriFaceMeshInteractor::getForces() //} ////return getForcesTriangle(); // this->calculateForces(); + using namespace vf::basics::constant; - real forceX1 = 0.0; - real forceX2 = 0.0; - real forceX3 = 0.0; + real forceX1 = c0o1; + real forceX2 = c0o1; + real forceX3 = c0o1; // double area = 0.0; @@ -1586,9 +1585,11 @@ UbTupleDouble3 D3Q27TriFaceMeshInteractor::getForces() ////////////////////////////////////////////////////////////////////////// UbTupleDouble3 D3Q27TriFaceMeshInteractor::getForcesTriangle() { - real forceX1 = 0.0; - real forceX2 = 0.0; - real forceX3 = 0.0; + using namespace vf::basics::constant; + + real forceX1 = c0o1; + real forceX2 = c0o1; + real forceX3 = c0o1; // D3Q19BlockGrid& grid.lock() = dynamic_cast<D3Q19BlockGrid&>(*this->grid.lock()); //// CoordinateTransformation3D *trafo = this->grid.lock()->getTransformation(); @@ -1835,6 +1836,8 @@ string D3Q27TriFaceMeshInteractor::toString() ////////////////////////////////////////////////////////////////////////// void D3Q27TriFaceMeshInteractor::reinitWithStoredQs(const real & /*timeStep*/) { + using namespace vf::basics::constant; + // alle solid Bloecke wieder solid setzen std::vector<SPtr<Block3D>> &solidBlocks = this->getSolidBlockSet(); for (size_t i = 0; i < solidBlocks.size(); i++) { @@ -1885,9 +1888,9 @@ void D3Q27TriFaceMeshInteractor::reinitWithStoredQs(const real & /*timeStep*/) // es handelt sich un ein statisches Objekt und beim Propeller gibt // es Schwierigkeiten an den Flügelspitzen, dass kann daher kommen, // dass dort zuviel bc-flaggs sind und mit Geschwindigkeit ergibt dies ziemlich grosse Werte - bc->setBoundaryVelocityX1(0.0); - bc->setBoundaryVelocityX2(0.0); - bc->setBoundaryVelocityX3(0.0); + bc->setBoundaryVelocityX1(c0o1); + bc->setBoundaryVelocityX2(c0o1); + bc->setBoundaryVelocityX3(c0o1); // TODO: HACK GEHOERT NICHT HIERHIER!!! - end bool gotQs = false; diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp index 38e5be2e5d35a51f79cb1da8ff7ce9b8b5589656..159d04d9791dd5919e43752f6f8cf9ea97ca1dac 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp @@ -34,7 +34,7 @@ #include "InteractorsHelper.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "SetBcBlocksBlockVisitor.h" #include "SetSolidBlocksBlockVisitor.h" #include <Grid3D.h> @@ -100,6 +100,6 @@ void InteractorsHelper::updateGrid() ids.push_back(block->getGlobalID()); std::vector<int> rids; - vf::mpi::Communicator::getInstance()->allGather(ids, rids); + vf::parallel::Communicator::getInstance()->allGather(ids, rids); grid->deleteBlocks(rids); } diff --git a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp index b50103ff86077ef9079a66600935927d16e0037c..0145e633de3901f407e93b374eaad7380ffac772 100644 --- a/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/BGKLBMKernel.cpp @@ -138,7 +138,7 @@ void BGKLBMKernel::calculate(int step) vx3 = f[DIR_00P] - f[DIR_00M] + f[DIR_P0P] - f[DIR_M0M] - f[DIR_P0M] + f[DIR_M0P] + f[DIR_0PP] - f[DIR_0MM] - f[DIR_0PM] + f[DIR_0MP] + f[DIR_PPP] + f[DIR_MMP] + f[DIR_PMP] + f[DIR_MPP] - f[DIR_PPM] - f[DIR_MMM] - f[DIR_PMM] - f[DIR_MPM]; - real cu_sq = 1.5 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3); + real cu_sq = c3o2 * (vx1 * vx1 + vx2 * vx2 + vx3 * vx3); feq[DIR_000] = c8o27 * (drho - cu_sq); feq[DIR_P00] = c2o27 * (drho + c3o1 * (vx1) + c9o2 * (vx1) * (vx1)-cu_sq); diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp index 421f81a1ac3301d982178a06b4b8c6378f626e57..c6349de8f1d281d31d0be4e684c54da457d3029f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulant4thOrderViscosityLBMKernel.cpp @@ -1,6 +1,6 @@ #include "CompressibleCumulant4thOrderViscosityLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <cmath> #include "DataSet3D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp index 3c0795c21ed41c1f22dc06268e5fc1fa7922c845..ded8dff43910db33bd591cd4546f1dc73cc1110b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CompressibleCumulantLBMKernel.cpp @@ -1,6 +1,6 @@ #include "CompressibleCumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" #include "Block3D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp deleted file mode 100644 index 74527c0c39d5255a4ca3e647a288fffa027373ac..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp +++ /dev/null @@ -1,1292 +0,0 @@ -#include "CompressibleOffsetMomentsInterpolationProcessor.h" -#include "D3Q27System.h" - -//using namespace UbMath; -using namespace vf::basics::constant; - -CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor() - -{ - this->bulkViscosity = c0o1; - this->shearViscosity = c0o1; - this->OxxPyyPzzC = c1o1; - this->OxxPyyPzzF = c1o1; -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(real omegaC, real omegaF) - : omegaC(omegaC), omegaF(omegaF) -{ - this->bulkViscosity = c0o1; - this->shearViscosity = c0o1; - this->OxxPyyPzzC = c1o1; - this->OxxPyyPzzF = c1o1; -} -////////////////////////////////////////////////////////////////////////// -CompressibleOffsetMomentsInterpolationProcessor::~CompressibleOffsetMomentsInterpolationProcessor() -= default; -////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr CompressibleOffsetMomentsInterpolationProcessor::clone() -{ - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolationProcessor(this->omegaC, this->omegaF)); - - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = this->OxxPyyPzzC; - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = this->OxxPyyPzzF; - - return iproc; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( real omegaC, real omegaF ) -{ - this->omegaC = omegaC; - this->omegaF = omegaF; - - real dtC = (c3o1 *shearViscosity)/((c1o1/omegaC)-c1o2); - real dtF = (c3o1 *shearViscosity)/((c1o1/omegaF)-c1o2); - - if (bulkViscosity != 0) - { - this->OxxPyyPzzC = LBMSystem::calcOmega2(bulkViscosity, dtC); - this->OxxPyyPzzF = LBMSystem::calcOmega2(bulkViscosity, dtF); - } - else - { - this->OxxPyyPzzC = c1o1; - this->OxxPyyPzzF = c1o1; - } -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) -{ - this->xoff = xoff; - this->yoff = yoff; - this->zoff = zoff; - this->xoff_sq = xoff * xoff; - this->yoff_sq = yoff * yoff; - this->zoff_sq = zoff * zoff; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellC, omegaC, c1o2); - calcInterpolatedNodeCF(icellF.BSW, omegaF, -c1o4, -c1o4, -c1o4, calcPressBSW(), -c1o1, -c1o1, -c1o1); - calcInterpolatedNodeCF(icellF.BNE, omegaF, c1o4, c1o4, -c1o4, calcPressBNE(), c1o1, c1o1, -c1o1); - calcInterpolatedNodeCF(icellF.TNW, omegaF, -c1o4, c1o4, c1o4, calcPressTNW(), -c1o1, c1o1, c1o1); - calcInterpolatedNodeCF(icellF.TSE, omegaF, c1o4, -c1o4, c1o4, calcPressTSE(), c1o1, -c1o1, c1o1); - calcInterpolatedNodeCF(icellF.BNW, omegaF, -c1o4, c1o4, -c1o4, calcPressBNW(), -c1o1, c1o1, -c1o1); - calcInterpolatedNodeCF(icellF.BSE, omegaF, c1o4, -c1o4, -c1o4, calcPressBSE(), c1o1, -c1o1, -c1o1); - calcInterpolatedNodeCF(icellF.TSW, omegaF, -c1o4, -c1o4, c1o4, calcPressTSW(), -c1o1, -c1o1, c1o1); - calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) -{ - setOffsets(xoff, yoff, zoff); - calcInterpolatedCoefficiets(icellF, omegaF, c2o1); - calcInterpolatedNodeFC(icellC, omegaC); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, - real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) -{ - using namespace D3Q27System; - using namespace vf::lbm::dir; - - real drho = c0o1; - D3Q27System::calcCompMacroscopicValues(f,drho,vx1,vx2,vx3); - - press = drho; //interpolate rho! - - kxy = -c3o1*omega*((((f[DIR_MMP]+f[DIR_PPM])-(f[DIR_MPP]+f[DIR_PMM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_MPM]+f[DIR_PMP])))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_MP0]+f[DIR_PM0]))/(c1o1 + drho)-(vx1*vx2));// might not be optimal MG 25.2.13 - kyz = -c3o1*omega*((((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMP]+f[DIR_MPM]))+((f[DIR_PMM]+f[DIR_MPP])-(f[DIR_MMP]+f[DIR_PPM])))+((f[DIR_0MM]+f[DIR_0PP])-(f[DIR_0MP]+f[DIR_0PM]))/(c1o1 + drho)-(vx2*vx3)); - kxz = -c3o1*omega*((((f[DIR_MPM]+f[DIR_PMP])-(f[DIR_MMP]+f[DIR_PPM]))+((f[DIR_MMM]+f[DIR_PPP])-(f[DIR_PMM]+f[DIR_MPP])))+((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_M0P]+f[DIR_P0M]))/(c1o1 + drho)-(vx1*vx3)); - kxxMyy = -c3o1/c2o1*omega*((((f[DIR_M0M]+f[DIR_P0P])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_M0P]+f[DIR_P0M])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_0M0]+f[DIR_0P0]))/(c1o1 + drho)-(vx1*vx1-vx2*vx2)); - kxxMzz = -c3o1/c2o1*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) -{ - real vx1_SWT,vx2_SWT,vx3_SWT; - real vx1_NWT,vx2_NWT,vx3_NWT; - real vx1_NET,vx2_NET,vx3_NET; - real vx1_SET,vx2_SET,vx3_SET; - real vx1_SWB,vx2_SWB,vx3_SWB; - real vx1_NWB,vx2_NWB,vx3_NWB; - real vx1_NEB,vx2_NEB,vx3_NEB; - real vx1_SEB,vx2_SEB,vx3_SEB; - - real kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT; - real kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT; - real kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET; - real kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET; - real kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB; - real kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB; - real kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB; - real kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB; - - calcMoments(icell.TSW,omega,press_SWT,vx1_SWT,vx2_SWT,vx3_SWT, kxyFromfcNEQ_SWT, kyzFromfcNEQ_SWT, kxzFromfcNEQ_SWT, kxxMyyFromfcNEQ_SWT, kxxMzzFromfcNEQ_SWT); - calcMoments(icell.TNW,omega,press_NWT,vx1_NWT,vx2_NWT,vx3_NWT, kxyFromfcNEQ_NWT, kyzFromfcNEQ_NWT, kxzFromfcNEQ_NWT, kxxMyyFromfcNEQ_NWT, kxxMzzFromfcNEQ_NWT); - calcMoments(icell.TNE,omega,press_NET,vx1_NET,vx2_NET,vx3_NET, kxyFromfcNEQ_NET, kyzFromfcNEQ_NET, kxzFromfcNEQ_NET, kxxMyyFromfcNEQ_NET, kxxMzzFromfcNEQ_NET); - calcMoments(icell.TSE,omega,press_SET,vx1_SET,vx2_SET,vx3_SET, kxyFromfcNEQ_SET, kyzFromfcNEQ_SET, kxzFromfcNEQ_SET, kxxMyyFromfcNEQ_SET, kxxMzzFromfcNEQ_SET); - calcMoments(icell.BSW,omega,press_SWB,vx1_SWB,vx2_SWB,vx3_SWB, kxyFromfcNEQ_SWB, kyzFromfcNEQ_SWB, kxzFromfcNEQ_SWB, kxxMyyFromfcNEQ_SWB, kxxMzzFromfcNEQ_SWB); - calcMoments(icell.BNW,omega,press_NWB,vx1_NWB,vx2_NWB,vx3_NWB, kxyFromfcNEQ_NWB, kyzFromfcNEQ_NWB, kxzFromfcNEQ_NWB, kxxMyyFromfcNEQ_NWB, kxxMzzFromfcNEQ_NWB); - calcMoments(icell.BNE,omega,press_NEB,vx1_NEB,vx2_NEB,vx3_NEB, kxyFromfcNEQ_NEB, kyzFromfcNEQ_NEB, kxzFromfcNEQ_NEB, kxxMyyFromfcNEQ_NEB, kxxMzzFromfcNEQ_NEB); - calcMoments(icell.BSE,omega,press_SEB,vx1_SEB,vx2_SEB,vx3_SEB, kxyFromfcNEQ_SEB, kyzFromfcNEQ_SEB, kxzFromfcNEQ_SEB, kxxMyyFromfcNEQ_SEB, kxxMzzFromfcNEQ_SEB); - - //LBMReal dxRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)+(press_NEB-press_SWT)+(press_SEB-press_NWT)); - //LBMReal dyRho=c1o4*((press_NET-press_SWB)-(press_SET-press_NWB)+(press_NEB-press_SWT)-(press_SEB-press_NWT)); - //LBMReal dzRho=c1o4*((press_NET-press_SWB)+(press_SET-press_NWB)-(press_NEB-press_SWT)-(press_SEB-press_NWT)); - - // kxyFromfcNEQ_SWT+=vx1_SWT*dyRho+vx2_SWT*dxRho; - // kxyFromfcNEQ_NWT+=vx1_NWT*dyRho+vx2_NWT*dxRho; - // kxyFromfcNEQ_NET+=vx1_NET*dyRho+vx2_NET*dxRho; - // kxyFromfcNEQ_SET+=vx1_SET*dyRho+vx2_SET*dxRho; - // kxyFromfcNEQ_SWB+=vx1_SWB*dyRho+vx2_SWB*dxRho; - // kxyFromfcNEQ_NWB+=vx1_NWB*dyRho+vx2_NWB*dxRho; - // kxyFromfcNEQ_NEB+=vx1_NEB*dyRho+vx2_NEB*dxRho; - // kxyFromfcNEQ_SEB+=vx1_SEB*dyRho+vx2_SEB*dxRho; - - // kyzFromfcNEQ_SWT+=vx3_SWT*dyRho+vx2_SWT*dzRho; - // kyzFromfcNEQ_NWT+=vx3_NWT*dyRho+vx2_NWT*dzRho; - // kyzFromfcNEQ_NET+=vx3_NET*dyRho+vx2_NET*dzRho; - // kyzFromfcNEQ_SET+=vx3_SET*dyRho+vx2_SET*dzRho; - // kyzFromfcNEQ_SWB+=vx3_SWB*dyRho+vx2_SWB*dzRho; - // kyzFromfcNEQ_NWB+=vx3_NWB*dyRho+vx2_NWB*dzRho; - // kyzFromfcNEQ_NEB+=vx3_NEB*dyRho+vx2_NEB*dzRho; - // kyzFromfcNEQ_SEB+=vx3_SEB*dyRho+vx2_SEB*dzRho; - - // kxzFromfcNEQ_SWT+=vx1_SWT*dzRho+vx3_SWT*dxRho; - // kxzFromfcNEQ_NWT+=vx1_NWT*dzRho+vx3_NWT*dxRho; - // kxzFromfcNEQ_NET+=vx1_NET*dzRho+vx3_NET*dxRho; - // kxzFromfcNEQ_SET+=vx1_SET*dzRho+vx3_SET*dxRho; - // kxzFromfcNEQ_SWB+=vx1_SWB*dzRho+vx3_SWB*dxRho; - // kxzFromfcNEQ_NWB+=vx1_NWB*dzRho+vx3_NWB*dxRho; - // kxzFromfcNEQ_NEB+=vx1_NEB*dzRho+vx3_NEB*dxRho; - // kxzFromfcNEQ_SEB+=vx1_SEB*dzRho+vx3_SEB*dxRho; - - // kxxMyyFromfcNEQ_SWT+=vx1_SWT*dxRho-vx2_SWT*dyRho; - // kxxMyyFromfcNEQ_NWT+=vx1_NWT*dxRho-vx2_NWT*dyRho; - // kxxMyyFromfcNEQ_NET+=vx1_NET*dxRho-vx2_NET*dyRho; - // kxxMyyFromfcNEQ_SET+=vx1_SET*dxRho-vx2_SET*dyRho; - // kxxMyyFromfcNEQ_SWB+=vx1_SWB*dxRho-vx2_SWB*dyRho; - // kxxMyyFromfcNEQ_NWB+=vx1_NWB*dxRho-vx2_NWB*dyRho; - // kxxMyyFromfcNEQ_NEB+=vx1_NEB*dxRho-vx2_NEB*dyRho; - // kxxMyyFromfcNEQ_SEB+=vx1_SEB*dxRho-vx2_SEB*dyRho; - - // kxxMzzFromfcNEQ_SWT+=vx1_SWT*dxRho-vx3_SWT*dzRho; - // kxxMzzFromfcNEQ_NWT+=vx1_NWT*dxRho-vx3_NWT*dzRho; - // kxxMzzFromfcNEQ_NET+=vx1_NET*dxRho-vx3_NET*dzRho; - // kxxMzzFromfcNEQ_SET+=vx1_SET*dxRho-vx3_SET*dzRho; - // kxxMzzFromfcNEQ_SWB+=vx1_SWB*dxRho-vx3_SWB*dzRho; - // kxxMzzFromfcNEQ_NWB+=vx1_NWB*dxRho-vx3_NWB*dzRho; - // kxxMzzFromfcNEQ_NEB+=vx1_NEB*dxRho-vx3_NEB*dzRho; - // kxxMzzFromfcNEQ_SEB+=vx1_SEB*dxRho-vx3_SEB*dzRho; - - - //kxxMzzFromfcNEQ_SWT=0.0; - //kxxMzzFromfcNEQ_NWT=0.0; - //kxxMzzFromfcNEQ_NET=0.0; - //kxxMzzFromfcNEQ_SET=0.0; - //kxxMzzFromfcNEQ_SWB=0.0; - //kxxMzzFromfcNEQ_NWB=0.0; - //kxxMzzFromfcNEQ_NEB=0.0; - //kxxMzzFromfcNEQ_SEB=0.0; - - - - - - a0 = (-kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET - c2o1*kxyFromfcNEQ_NWB - c2o1*kxyFromfcNEQ_NWT + - c2o1*kxyFromfcNEQ_SEB + c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + - c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB - c2o1*kxzFromfcNEQ_NWT + - c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB - c2o1*kxzFromfcNEQ_SWT + - c8o1*vx1_NEB + c8o1*vx1_NET + c8o1*vx1_NWB + c8o1*vx1_NWT + c8o1*vx1_SEB + - c8o1*vx1_SET + c8o1*vx1_SWB + c8o1*vx1_SWT + c2o1*vx2_NEB + c2o1*vx2_NET - - c2o1*vx2_NWB - c2o1*vx2_NWT - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + - c2o1*vx2_SWT - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; - b0 = (c2o1*kxxMyyFromfcNEQ_NEB + c2o1*kxxMyyFromfcNEQ_NET + c2o1*kxxMyyFromfcNEQ_NWB + c2o1*kxxMyyFromfcNEQ_NWT - - c2o1*kxxMyyFromfcNEQ_SEB - c2o1*kxxMyyFromfcNEQ_SET - c2o1*kxxMyyFromfcNEQ_SWB - c2o1*kxxMyyFromfcNEQ_SWT - - kxxMzzFromfcNEQ_NEB - kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET + kxxMzzFromfcNEQ_SWB + kxxMzzFromfcNEQ_SWT - - c2o1*kxyFromfcNEQ_NEB - c2o1*kxyFromfcNEQ_NET + c2o1*kxyFromfcNEQ_NWB + c2o1*kxyFromfcNEQ_NWT - - c2o1*kxyFromfcNEQ_SEB - c2o1*kxyFromfcNEQ_SET + c2o1*kxyFromfcNEQ_SWB + c2o1*kxyFromfcNEQ_SWT + - c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET + c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + - c2o1*kyzFromfcNEQ_SEB - c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB - c2o1*kyzFromfcNEQ_SWT + - c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT + - c8o1*vx2_NEB + c8o1*vx2_NET + c8o1*vx2_NWB + c8o1*vx2_NWT + - c8o1*vx2_SEB + c8o1*vx2_SET + c8o1*vx2_SWB + c8o1*vx2_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c64o1; - c0 = (kxxMyyFromfcNEQ_NEB - kxxMyyFromfcNEQ_NET + kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB - kxxMyyFromfcNEQ_SET + kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT - - c2o1*kxxMzzFromfcNEQ_NEB + c2o1*kxxMzzFromfcNEQ_NET - c2o1*kxxMzzFromfcNEQ_NWB + c2o1*kxxMzzFromfcNEQ_NWT - - c2o1*kxxMzzFromfcNEQ_SEB + c2o1*kxxMzzFromfcNEQ_SET - c2o1*kxxMzzFromfcNEQ_SWB + c2o1*kxxMzzFromfcNEQ_SWT - - c2o1*kxzFromfcNEQ_NEB - c2o1*kxzFromfcNEQ_NET + c2o1*kxzFromfcNEQ_NWB + c2o1*kxzFromfcNEQ_NWT - - c2o1*kxzFromfcNEQ_SEB - c2o1*kxzFromfcNEQ_SET + c2o1*kxzFromfcNEQ_SWB + c2o1*kxzFromfcNEQ_SWT - - c2o1*kyzFromfcNEQ_NEB - c2o1*kyzFromfcNEQ_NET - c2o1*kyzFromfcNEQ_NWB - c2o1*kyzFromfcNEQ_NWT + - c2o1*kyzFromfcNEQ_SEB + c2o1*kyzFromfcNEQ_SET + c2o1*kyzFromfcNEQ_SWB + c2o1*kyzFromfcNEQ_SWT - - c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT + - c8o1*vx3_NEB + c8o1*vx3_NET + c8o1*vx3_NWB + c8o1*vx3_NWT + - c8o1*vx3_SEB + c8o1*vx3_SET + c8o1*vx3_SWB + c8o1*vx3_SWT)/c64o1; - ax = (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT + vx1_SEB + vx1_SET - vx1_SWB - vx1_SWT)/c4o1; - bx = (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT + vx2_SEB + vx2_SET - vx2_SWB - vx2_SWT)/c4o1; - cx = (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT + vx3_SEB + vx3_SET - vx3_SWB - vx3_SWT)/c4o1; - axx= (kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB - kxxMyyFromfcNEQ_NWT + - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB - kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET - kxxMzzFromfcNEQ_NWB - kxxMzzFromfcNEQ_NWT + - kxxMzzFromfcNEQ_SEB + kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB - c2o1*vx2_NWT - - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB + c2o1*vx2_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; - bxx= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET - kxyFromfcNEQ_NWB - kxyFromfcNEQ_NWT + - kxyFromfcNEQ_SEB + kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - c2o1*vx1_NEB - c2o1*vx1_NET + c2o1*vx1_NWB + c2o1*vx1_NWT + - c2o1*vx1_SEB + c2o1*vx1_SET - c2o1*vx1_SWB - c2o1*vx1_SWT)/c8o1; - cxx= (kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB - kxzFromfcNEQ_NWT + - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB - kxzFromfcNEQ_SWT + - c2o1*vx1_NEB - c2o1*vx1_NET - c2o1*vx1_NWB + c2o1*vx1_NWT + - c2o1*vx1_SEB - c2o1*vx1_SET - c2o1*vx1_SWB + c2o1*vx1_SWT)/c8o1; - ay = (vx1_NEB + vx1_NET + vx1_NWB + vx1_NWT - vx1_SEB - vx1_SET - vx1_SWB - vx1_SWT)/c4o1; - by = (vx2_NEB + vx2_NET + vx2_NWB + vx2_NWT - vx2_SEB - vx2_SET - vx2_SWB - vx2_SWT)/c4o1; - cy = (vx3_NEB + vx3_NET + vx3_NWB + vx3_NWT - vx3_SEB - vx3_SET - vx3_SWB - vx3_SWT)/c4o1; - ayy= (kxyFromfcNEQ_NEB + kxyFromfcNEQ_NET + kxyFromfcNEQ_NWB + kxyFromfcNEQ_NWT - - kxyFromfcNEQ_SEB - kxyFromfcNEQ_SET - kxyFromfcNEQ_SWB - kxyFromfcNEQ_SWT - - c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB - c2o1*vx2_SWT)/c8o1; - byy= (-c2o1*kxxMyyFromfcNEQ_NEB - c2o1*kxxMyyFromfcNEQ_NET - c2o1*kxxMyyFromfcNEQ_NWB - c2o1*kxxMyyFromfcNEQ_NWT + - c2o1*kxxMyyFromfcNEQ_SEB + c2o1*kxxMyyFromfcNEQ_SET + c2o1*kxxMyyFromfcNEQ_SWB + c2o1*kxxMyyFromfcNEQ_SWT + - kxxMzzFromfcNEQ_NEB + kxxMzzFromfcNEQ_NET + kxxMzzFromfcNEQ_NWB + kxxMzzFromfcNEQ_NWT - - kxxMzzFromfcNEQ_SEB - kxxMzzFromfcNEQ_SET - kxxMzzFromfcNEQ_SWB - kxxMzzFromfcNEQ_SWT + - c2o1*vx1_NEB + c2o1*vx1_NET - c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB - c2o1*vx1_SET + c2o1*vx1_SWB + c2o1*vx1_SWT - - c2o1*vx3_NEB + c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET + c2o1*vx3_SWB - c2o1*vx3_SWT)/c16o1; - cyy= (kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET + kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB - kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB - kyzFromfcNEQ_SWT + - c2o1*vx2_NEB - c2o1*vx2_NET + c2o1*vx2_NWB - c2o1*vx2_NWT - - c2o1*vx2_SEB + c2o1*vx2_SET - c2o1*vx2_SWB + c2o1*vx2_SWT)/c8o1; - az = (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT - vx1_SEB + vx1_SET - vx1_SWB + vx1_SWT)/c4o1; - bz = (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT - vx2_SEB + vx2_SET - vx2_SWB + vx2_SWT)/c4o1; - cz = (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT - vx3_SEB + vx3_SET - vx3_SWB + vx3_SWT)/c4o1; - azz= (-kxzFromfcNEQ_NEB + kxzFromfcNEQ_NET - kxzFromfcNEQ_NWB + kxzFromfcNEQ_NWT - - kxzFromfcNEQ_SEB + kxzFromfcNEQ_SET - kxzFromfcNEQ_SWB + kxzFromfcNEQ_SWT + - c2o1*vx3_NEB - c2o1*vx3_NET - c2o1*vx3_NWB + c2o1*vx3_NWT + - c2o1*vx3_SEB - c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; - bzz= (-kyzFromfcNEQ_NEB + kyzFromfcNEQ_NET - kyzFromfcNEQ_NWB + kyzFromfcNEQ_NWT - - kyzFromfcNEQ_SEB + kyzFromfcNEQ_SET - kyzFromfcNEQ_SWB + kyzFromfcNEQ_SWT + - c2o1*vx3_NEB - c2o1*vx3_NET + c2o1*vx3_NWB - c2o1*vx3_NWT - - c2o1*vx3_SEB + c2o1*vx3_SET - c2o1*vx3_SWB + c2o1*vx3_SWT)/c8o1; - czz= (-kxxMyyFromfcNEQ_NEB + kxxMyyFromfcNEQ_NET - kxxMyyFromfcNEQ_NWB + kxxMyyFromfcNEQ_NWT - - kxxMyyFromfcNEQ_SEB + kxxMyyFromfcNEQ_SET - kxxMyyFromfcNEQ_SWB + kxxMyyFromfcNEQ_SWT + - c2o1*kxxMzzFromfcNEQ_NEB - c2o1*kxxMzzFromfcNEQ_NET + c2o1*kxxMzzFromfcNEQ_NWB - c2o1*kxxMzzFromfcNEQ_NWT + - c2o1*kxxMzzFromfcNEQ_SEB - c2o1*kxxMzzFromfcNEQ_SET + c2o1*kxxMzzFromfcNEQ_SWB - c2o1*kxxMzzFromfcNEQ_SWT - - c2o1*vx1_NEB + c2o1*vx1_NET + c2o1*vx1_NWB - c2o1*vx1_NWT - - c2o1*vx1_SEB + c2o1*vx1_SET + c2o1*vx1_SWB - c2o1*vx1_SWT - - c2o1*vx2_NEB + c2o1*vx2_NET - c2o1*vx2_NWB + c2o1*vx2_NWT + - c2o1*vx2_SEB - c2o1*vx2_SET + c2o1*vx2_SWB - c2o1*vx2_SWT)/c16o1; - axy= (vx1_NEB + vx1_NET - vx1_NWB - vx1_NWT - vx1_SEB - vx1_SET + vx1_SWB + vx1_SWT)/c2o1; - bxy= (vx2_NEB + vx2_NET - vx2_NWB - vx2_NWT - vx2_SEB - vx2_SET + vx2_SWB + vx2_SWT)/c2o1; - cxy= (vx3_NEB + vx3_NET - vx3_NWB - vx3_NWT - vx3_SEB - vx3_SET + vx3_SWB + vx3_SWT)/c2o1; - axz= (-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT - vx1_SEB + vx1_SET + vx1_SWB - vx1_SWT)/c2o1; - bxz= (-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT - vx2_SEB + vx2_SET + vx2_SWB - vx2_SWT)/c2o1; - cxz= (-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT - vx3_SEB + vx3_SET + vx3_SWB - vx3_SWT)/c2o1; - ayz= (-vx1_NEB + vx1_NET - vx1_NWB + vx1_NWT + vx1_SEB - vx1_SET + vx1_SWB - vx1_SWT)/c2o1; - byz= (-vx2_NEB + vx2_NET - vx2_NWB + vx2_NWT + vx2_SEB - vx2_SET + vx2_SWB - vx2_SWT)/c2o1; - cyz= (-vx3_NEB + vx3_NET - vx3_NWB + vx3_NWT + vx3_SEB - vx3_SET + vx3_SWB - vx3_SWT)/c2o1; - axyz=-vx1_NEB + vx1_NET + vx1_NWB - vx1_NWT + vx1_SEB - vx1_SET - vx1_SWB + vx1_SWT; - bxyz=-vx2_NEB + vx2_NET + vx2_NWB - vx2_NWT + vx2_SEB - vx2_SET - vx2_SWB + vx2_SWT; - cxyz=-vx3_NEB + vx3_NET + vx3_NWB - vx3_NWT + vx3_SEB - vx3_SET - vx3_SWB + vx3_SWT; - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - kxyAverage = c0o1;//(kxyFromfcNEQ_SWB+ - //kxyFromfcNEQ_SWT+ - //kxyFromfcNEQ_SET+ - //kxyFromfcNEQ_SEB+ - //kxyFromfcNEQ_NWB+ - //kxyFromfcNEQ_NWT+ - //kxyFromfcNEQ_NET+ - //kxyFromfcNEQ_NEB)*c1o8-(ay+bx); - kyzAverage = c0o1;//(kyzFromfcNEQ_SWB+ - //kyzFromfcNEQ_SWT+ - //kyzFromfcNEQ_SET+ - //kyzFromfcNEQ_SEB+ - //kyzFromfcNEQ_NWB+ - //kyzFromfcNEQ_NWT+ - //kyzFromfcNEQ_NET+ - //kyzFromfcNEQ_NEB)*c1o8-(bz+cy); - kxzAverage = c0o1;//(kxzFromfcNEQ_SWB+ - //kxzFromfcNEQ_SWT+ - //kxzFromfcNEQ_SET+ - //kxzFromfcNEQ_SEB+ - //kxzFromfcNEQ_NWB+ - //kxzFromfcNEQ_NWT+ - //kxzFromfcNEQ_NET+ - //kxzFromfcNEQ_NEB)*c1o8-(az+cx); - kxxMyyAverage = c0o1;//(kxxMyyFromfcNEQ_SWB+ - //kxxMyyFromfcNEQ_SWT+ - //kxxMyyFromfcNEQ_SET+ - //kxxMyyFromfcNEQ_SEB+ - //kxxMyyFromfcNEQ_NWB+ - //kxxMyyFromfcNEQ_NWT+ - //kxxMyyFromfcNEQ_NET+ - //kxxMyyFromfcNEQ_NEB)*c1o8-(ax-by); - kxxMzzAverage = c0o1;//(kxxMzzFromfcNEQ_SWB+ - //kxxMzzFromfcNEQ_SWT+ - //kxxMzzFromfcNEQ_SET+ - //kxxMzzFromfcNEQ_SEB+ - //kxxMzzFromfcNEQ_NWB+ - //kxxMzzFromfcNEQ_NWT+ - //kxxMzzFromfcNEQ_NET+ - //kxxMzzFromfcNEQ_NEB)*c1o8-(ax-cz); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Bernd das Brot - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a0 = a0 + xoff * ax + yoff * ay + zoff * az + xoff_sq * axx + yoff_sq * ayy + zoff_sq * azz + xoff*yoff*axy + xoff*zoff*axz + yoff*zoff*ayz + xoff*yoff*zoff*axyz ; - ax = ax + c2o1 * xoff * axx + yoff * axy + zoff * axz + yoff*zoff*axyz; - ay = ay + c2o1 * yoff * ayy + xoff * axy + zoff * ayz + xoff*zoff*axyz; - az = az + c2o1 * zoff * azz + xoff * axz + yoff * ayz + xoff*yoff*axyz; - b0 = b0 + xoff * bx + yoff * by + zoff * bz + xoff_sq * bxx + yoff_sq * byy + zoff_sq * bzz + xoff*yoff*bxy + xoff*zoff*bxz + yoff*zoff*byz + xoff*yoff*zoff*bxyz; - bx = bx + c2o1 * xoff * bxx + yoff * bxy + zoff * bxz + yoff*zoff*bxyz; - by = by + c2o1 * yoff * byy + xoff * bxy + zoff * byz + xoff*zoff*bxyz; - bz = bz + c2o1 * zoff * bzz + xoff * bxz + yoff * byz + xoff*yoff*bxyz; - c0 = c0 + xoff * cx + yoff * cy + zoff * cz + xoff_sq * cxx + yoff_sq * cyy + zoff_sq * czz + xoff*yoff*cxy + xoff*zoff*cxz + yoff*zoff*cyz + xoff*yoff*zoff*cxyz; - cx = cx + c2o1 * xoff * cxx + yoff * cxy + zoff * cxz + yoff*zoff*cxyz; - cy = cy + c2o1 * yoff * cyy + xoff * cxy + zoff * cyz + xoff*zoff*cxyz; - cz = cz + c2o1 * zoff * czz + xoff * cxz + yoff * cyz + xoff*yoff*cxyz; - axy= axy + zoff*axyz; - axz= axz + yoff*axyz; - ayz= ayz + xoff*axyz; - bxy= bxy + zoff*bxyz; - bxz= bxz + yoff*bxyz; - byz= byz + xoff*bxyz; - cxy= cxy + zoff*cxyz; - cxz= cxz + yoff*cxyz; - cyz= cyz + xoff*cxyz; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - const real o = omega; - - f_E = eps_new*((c2o1*(-c2o1*ax + by + cz-kxxMzzAverage-kxxMyyAverage))/(c27o1*o)); - f_N = eps_new*((c2o1*(ax - c2o1*by + cz+c2o1*kxxMyyAverage-kxxMzzAverage))/(c27o1*o)); - f_T = eps_new*((c2o1*(ax + by - c2o1*cz-kxxMyyAverage+c2o1*kxxMzzAverage))/(c27o1*o)); - f_NE = eps_new*(-(ax + c3o1*ay + c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage+c3o1*kxyAverage)/(c54o1*o)); - f_SE = eps_new*(-(ax - c3o1*ay - c3o1*bx + by - c2o1*cz+c2o1*kxxMyyAverage-kxxMyyAverage-c3o1*kxyAverage)/(c54o1*o)); - f_TE = eps_new*(-(ax + c3o1*az - c2o1*by + c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage+c3o1*kxzAverage)/(c54o1*o)); - f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); - f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); - f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); - f_ZERO = 0.; - f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); - f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); - f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); - f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); - - x_E = c1o4*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); - x_N = c1o4*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); - x_T = c1o4*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); - x_NE = c1o4*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); - x_SE = c1o4*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); - x_TE = c1o4*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); - x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); - x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); - x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); - x_ZERO = c0o1; - x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); - x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); - x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); - x_TNW = c1o4*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); - - y_E = c1o4*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); - y_N = c1o4*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); - y_T = c1o4*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); - y_NE = c1o4*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); - y_SE = c1o4*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); - y_TE = c1o4*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); - y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); - y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); - y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); - y_ZERO = c0o1; - y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); - y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); - y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); - y_TNW = c1o4*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); - - z_E = c1o4*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); - z_N = c1o4*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); - z_T = c1o4*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); - z_NE = c1o4*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); - z_SE = c1o4*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); - z_TE = c1o4*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); - z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); - z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); - z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); - z_ZERO = c0o1; - z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); - z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); - z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); - z_TNW = c1o4*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); - - xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); - xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); - xy_T = -(c1o16*eps_new *(( c4o1*cxyz)/(c27o1*o))); - xy_NE = c1o16*eps_new *( cxyz /(c27o1*o)); - xy_SE = c1o16*eps_new *( cxyz /(c27o1*o)); - xy_TE = -(c1o16*eps_new *(( c3o1*axyz + cxyz)/(c54o1*o))); - xy_BE = -(c1o16*eps_new *((-c3o1*axyz + cxyz)/(c54o1*o))); - xy_TN = -(c1o16*eps_new *(( c3o1*bxyz + cxyz)/(c54o1*o))); - xy_BN = -(c1o16*eps_new *(( - c3o1*bxyz + cxyz)/(c54o1*o))); - //xy_ZERO= c1o16*eps_new; - xy_TNE = -(c1o16*eps_new *(( axyz + bxyz )/(c72o1*o))); - xy_TSW = c1o16*eps_new *(( axyz + bxyz )/(c72o1*o)); - xy_TSE = c1o16*eps_new *((- axyz + bxyz )/(c72o1*o)); - xy_TNW = c1o16*eps_new *(( axyz - bxyz )/(c72o1*o)); - - xz_E = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); - xz_N = -(c1o16*eps_new *(( c4o1*bxyz )/(c27o1*o))); - xz_T = c1o16*eps_new *(( c2o1*bxyz )/(c27o1*o)); - xz_NE = -(c1o16*eps_new *(( c3o1*axyz + bxyz )/(c54o1*o))); - xz_SE = -(c1o16*eps_new *((-c3o1*axyz + bxyz )/(c54o1*o))); - xz_TE = c1o16*eps_new *(( bxyz )/(c27o1*o)); - xz_BE = c1o16*eps_new *(( bxyz )/(c27o1*o)); - xz_TN = -(c1o16*eps_new *(( bxyz + c3o1*cxyz)/(c54o1*o))); - xz_BN = -(c1o16*eps_new *(( bxyz - c3o1*cxyz)/(c54o1*o))); - //xz_ZERO= c1o16*eps_new; - xz_TNE = -(c1o16*eps_new *(( axyz + cxyz)/(c72o1*o))); - xz_TSW = c1o16*eps_new *((- axyz + cxyz)/(c72o1*o)); - xz_TSE = c1o16*eps_new *(( axyz + cxyz)/(c72o1*o)); - xz_TNW = c1o16*eps_new *(( axyz - cxyz)/(c72o1*o)); - - yz_E = -(c1o16*eps_new *(( c4o1*axyz )/(c27o1*o))); - yz_N = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); - yz_T = c1o16*eps_new *(( c2o1*axyz )/(c27o1*o)); - yz_NE = -(c1o16*eps_new *(( axyz + c3o1*bxyz )/(c54o1*o))); - yz_SE = -(c1o16*eps_new *(( axyz - c3o1*bxyz )/(c54o1*o))); - yz_TE = -(c1o16*eps_new *(( axyz + c3o1*cxyz)/(c54o1*o))); - yz_BE = -(c1o16*eps_new *(( axyz - c3o1*cxyz)/(c54o1*o))); - yz_TN = c1o16*eps_new *(( axyz )/(c27o1*o)); - yz_BN = c1o16*eps_new *(( axyz )/(c27o1*o)); - //yz_ZERO= c1o16*eps_new; - yz_TNE = -(c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o))); - yz_TSW = c1o16*eps_new *(( - bxyz + cxyz)/(c72o1*o)); - yz_TSE = c1o16*eps_new *(( bxyz - cxyz)/(c72o1*o)); - yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs) -{ - using namespace D3Q27System; - using namespace vf::lbm::dir; - using namespace vf::basics::constant; - - real eps_new = c1o2; - real o = omega; - //bulk viscosity - real oP = OxxPyyPzzF; - -// LBMReal rho = press ;//+ (c2o1*axx*x+axy*y+axz*z+axyz*y*z+ax + c2o1*byy*y+bxy*x+byz*z+bxyz*x*z+by + c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y+cz)/c3o1; - real vx1 = a0 + c1o4*( xs*ax + ys*ay + zs*az) + c1o16*(axx + xs*ys*axy + xs*zs*axz + ayy + ys*zs*ayz + azz) + c1o64*(xs*ys*zs*axyz); - real vx2 = b0 + c1o4*( xs*bx + ys*by + zs*bz) + c1o16*(bxx + xs*ys*bxy + xs*zs*bxz + byy + ys*zs*byz + bzz) + c1o64*(xs*ys*zs*bxyz); - real vx3 = c0 + c1o4*( xs*cx + ys*cy + zs*cz) + c1o16*(cxx + xs*ys*cxy + xs*zs*cxz + cyy + ys*zs*cyz + czz) + c1o64*(xs*ys*zs*cxyz); - - real mfcbb = c0o1; - real mfabb = c0o1; - real mfbcb = c0o1; - real mfbab = c0o1; - real mfbbc = c0o1; - real mfbba = c0o1; - real mfccb = c0o1; - real mfaab = c0o1; - real mfcab = c0o1; - real mfacb = c0o1; - real mfcbc = c0o1; - real mfaba = c0o1; - real mfcba = c0o1; - real mfabc = c0o1; - real mfbcc = c0o1; - real mfbaa = c0o1; - real mfbca = c0o1; - real mfbac = c0o1; - real mfbbb = c0o1; - real mfccc = c0o1; - real mfaac = c0o1; - real mfcac = c0o1; - real mfacc = c0o1; - real mfcca = c0o1; - real mfaaa = c0o1; - real mfcaa = c0o1; - real mfaca = c0o1; - - mfaaa = press; // if drho is interpolated directly - - real vx1Sq = vx1*vx1; - real vx2Sq = vx2*vx2; - real vx3Sq = vx3*vx3; - real oMdrho = c1o1; - - //c2o1f - - // linear combinations - real mxxPyyPzz = mfaaa - c2o3*(ax + by + c2o1 *axx*x + bxy*x + axy*y + c2o1 *byy*y + axz*z + byz*z + bxyz*x*z + axyz*y*z + cz - cxz*x + cyz*y + cxyz*x*y + c2o1 *czz*z)*eps_new / oP* (c1o1 + press); - real mxxMyy = -c2o3*(ax - by + kxxMyyAverage + c2o1 *axx*x - bxy*x + axy*y - c2o1 *byy*y + axz*z - byz*z - bxyz*x*z + axyz*y*z)*eps_new/o * (c1o1 + press); - real mxxMzz = -c2o3*(ax - cz + kxxMzzAverage + c2o1 *axx*x - cxz*x + axy*y - cyz*y - cxyz*x*y + axz*z - c2o1 *czz*z + axyz*y*z)*eps_new/o * (c1o1 + press); - - mfabb = -c1o3 * (bz + cy + kyzAverage + bxz*x + cxy*x + byz*y + c2o1 *cyy*y + bxyz*x*y + c2o1 *bzz*z + cyz*z + cxyz*x*z)*eps_new/o * (c1o1 + press); - mfbab = -c1o3 * (az + cx + kxzAverage + axz*x + c2o1 *cxx*x + ayz*y + cxy*y + axyz*x*y + c2o1 *azz*z + cxz*z + cxyz*y*z)*eps_new/o * (c1o1 + press); - mfbba = -c1o3 * (ay + bx + kxyAverage + axy*x + c2o1 *bxx*x + c2o1 *ayy*y + bxy*y + ayz*z + bxz*z + axyz*x*z + bxyz*y*z)*eps_new/o * (c1o1 + press); - - // linear combinations back - mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz) ; - mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) ; - mfaac = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) ; - - //three - mfbbb = c0o1; - real mxxyPyzz = c0o1; - real mxxyMyzz = c0o1; - real mxxzPyyz = c0o1; - real mxxzMyyz = c0o1; - real mxyyPxzz = c0o1; - real mxyyMxzz = c0o1; - - // linear combinations back - mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4.f - mfacc = mfaaa*c1o9; - mfcac = mfacc; - mfcca = mfacc; - - //5. - - //6. - - mfccc = mfaaa*c1o27; - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - real m0 = mfaac * c1o2 + mfaab * (vx3 - c1o2) + (mfaaa + c1o1 * oMdrho) * (vx3Sq - vx3) * c1o2; - real m1 = -mfaac - c2o1 * mfaab * vx3 + mfaaa * (c1o1 - vx3Sq) - c1o1 * oMdrho * vx3Sq; - real m2 = mfaac * c1o2 + mfaab * (vx3 + c1o2) + (mfaaa + c1o1 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2; - m1 = -mfabc - c2o1 * mfabb * vx3 + mfaba * (c1o1 - vx3Sq); - m2 = mfabc * c1o2 + mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfacc - c2o1 * mfacb * vx3 + mfaca * (c1o1 - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfacc * c1o2 + mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2; - m1 = -mfbac - c2o1 * mfbab * vx3 + mfbaa * (c1o1 - vx3Sq); - m2 = mfbac * c1o2 + mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2; - m1 = -mfbbc - c2o1 * mfbbb * vx3 + mfbba * (c1o1 - vx3Sq); - m2 = mfbbc * c1o2 + mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2; - m1 = -mfbcc - c2o1 * mfbcb * vx3 + mfbca * (c1o1 - vx3Sq); - m2 = mfbcc * c1o2 + mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfcac - c2o1 * mfcab * vx3 + mfcaa * (c1o1 - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfcac * c1o2 + mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2; - m1 = -mfcbc - c2o1 * mfcbb * vx3 + mfcba * (c1o1 - vx3Sq); - m2 = mfcbc * c1o2 + mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfccc - c2o1 * mfccb * vx3 + mfcca * (c1o1 - vx3Sq) - c1o9 * oMdrho * vx3Sq; - m2 = mfccc * c1o2 + mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfaca - c2o1 * mfaba * vx2 + mfaaa * (c1o1 - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfaca * c1o2 + mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacb - c2o1 * mfabb * vx2 + mfaab * (c1o1 - vx2Sq) - c2o3 * oMdrho * vx2Sq; - m2 = mfacb * c1o2 + mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacc - c2o1 * mfabc * vx2 + mfaac * (c1o1 - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfacc * c1o2 + mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2; - m1 = -mfbca - c2o1 * mfbba * vx2 + mfbaa * (c1o1 - vx2Sq); - m2 = mfbca * c1o2 + mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2; - m1 = -mfbcb - c2o1 * mfbbb * vx2 + mfbab * (c1o1 - vx2Sq); - m2 = mfbcb * c1o2 + mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2; - m1 = -mfbcc - c2o1 * mfbbc * vx2 + mfbac * (c1o1 - vx2Sq); - m2 = mfbcc * c1o2 + mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfcca - c2o1 * mfcba * vx2 + mfcaa * (c1o1 - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfcca * c1o2 + mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccb - c2o1 * mfcbb * vx2 + mfcab * (c1o1 - vx2Sq) - c2o9 * oMdrho * vx2Sq; - m2 = mfccb * c1o2 + mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccc - c2o1 * mfcbc * vx2 + mfcac * (c1o1 - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfccc * c1o2 + mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcaa - c2o1 * mfbaa * vx1 + mfaaa * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcaa * c1o2 + mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcba - c2o1 * mfbba * vx1 + mfaba * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcba * c1o2 + mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcca - c2o1 * mfbca * vx1 + mfaca * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcca * c1o2 + mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcab - c2o1 * mfbab * vx1 + mfaab * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcab * c1o2 + mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbb - c2o1 * mfbbb * vx1 + mfabb * (c1o1 - vx1Sq) - c4o9 * oMdrho * vx1Sq; - m2 = mfcbb * c1o2 + mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccb - c2o1 * mfbcb * vx1 + mfacb * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfccb * c1o2 + mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcac - c2o1 * mfbac * vx1 + mfaac * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcac * c1o2 + mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbc - c2o1 * mfbbc * vx1 + mfabc * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcbc * c1o2 + mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccc - c2o1 * mfbcc * vx1 + mfacc * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfccc * c1o2 + mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - f[DIR_P00] = mfcbb; - f[DIR_M00] = mfabb; - f[DIR_0P0] = mfbcb; - f[DIR_0M0] = mfbab; - f[DIR_00P] = mfbbc; - f[DIR_00M] = mfbba; - f[DIR_PP0] = mfccb; - f[DIR_MM0] = mfaab; - f[DIR_PM0] = mfcab; - f[DIR_MP0] = mfacb; - f[DIR_P0P] = mfcbc; - f[DIR_M0M] = mfaba; - f[DIR_P0M] = mfcba; - f[DIR_M0P] = mfabc; - f[DIR_0PP] = mfbcc; - f[DIR_0MM] = mfbaa; - f[DIR_0PM] = mfbca; - f[DIR_0MP] = mfbac; - f[DIR_000] = mfbbb; - f[DIR_PPP] = mfccc; - f[DIR_PMP] = mfcac; - f[DIR_PPM] = mfcca; - f[DIR_PMM] = mfcaa; - f[DIR_MPP] = mfacc; - f[DIR_MMP] = mfaac; - f[DIR_MPM] = mfaca; - f[DIR_MMM] = mfaaa; -} -////////////////////////////////////////////////////////////////////////// -//Position SWB -0.25, -0.25, -0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressBSW() -{ - return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + - press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + - press_SET * (c3o64 - c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + - press_NET * (c1o64 - c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + - press_NEB * (c3o64 - c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + - press_NWB * (c9o64 + c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + - press_SEB * (c9o64 - c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + - press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SWT -0.25, -0.25, 0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressTSW() -{ - return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + - press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + - press_SET * (c9o64 - c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + - press_NET * (c3o64 - c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + - press_NEB * (c1o64 - c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + - press_NWB * (c3o64 + c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + - press_SEB * (c3o64 - c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + - press_SWB * (c9o64 + c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SET 0.25, -0.25, 0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressTSE() -{ - return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + - press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + - press_SWT * (c9o64 + c9o16 * xoff + c3o16 * yoff - c3o16 * zoff) + - press_NWT * (c3o64 + c3o16 * xoff - c3o16 * yoff - c1o16 * zoff) + - press_NWB * (c1o64 + c1o16 * xoff - c1o16 * yoff + c1o16 * zoff) + - press_NEB * (c3o64 - c1o16 * xoff - c3o16 * yoff + c3o16 * zoff) + - press_SWB * (c3o64 + c3o16 * xoff + c1o16 * yoff + c3o16 * zoff) + - press_SEB * (c9o64 - c3o16 * xoff + c3o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position SEB 0.25, -0.25, -0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressBSE() -{ - return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + - press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + - press_SWT * (c3o64 + c3o16 * xoff + c1o16 * yoff - c3o16 * zoff) + - press_NWT * (c1o64 + c1o16 * xoff - c1o16 * yoff - c1o16 * zoff) + - press_NWB * (c3o64 + c3o16 * xoff - c3o16 * yoff + c1o16 * zoff) + - press_NEB * (c9o64 - c3o16 * xoff - c9o16 * yoff + c3o16 * zoff) + - press_SWB * (c9o64 + c9o16 * xoff + c3o16 * yoff + c3o16 * zoff) + - press_SEB * (c27o64 - c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWB -0.25, 0.25, -0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressBNW() -{ - return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + - press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + - press_SWT * (c3o64 + c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + - press_SET * (c1o64 - c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + - press_SEB * (c3o64 - c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + - press_NEB * (c9o64 - c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + - press_SWB * (c9o64 + c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + - press_NWB * (c27o64 + c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NWT -0.25, 0.25, 0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressTNW() -{ - return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + - press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + - press_SWT * (c9o64 + c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + - press_SET * (c3o64 - c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + - press_SEB * (c1o64 - c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + - press_NEB * (c3o64 - c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + - press_SWB * (c3o64 + c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + - press_NWB * (c9o64 + c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NET 0.25, 0.25, 0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressTNE() -{ - return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + - press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + - press_SET * (c9o64 - c3o16 * xoff + c9o16 * yoff - c3o16 * zoff) + - press_SWT * (c3o64 + c3o16 * xoff + c3o16 * yoff - c1o16 * zoff) + - press_SWB * (c1o64 + c1o16 * xoff + c1o16 * yoff + c1o16 * zoff) + - press_NWB * (c3o64 + c3o16 * xoff - c1o16 * yoff + c3o16 * zoff) + - press_SEB * (c3o64 - c1o16 * xoff + c3o16 * yoff + c3o16 * zoff) + - press_NEB * (c9o64 - c3o16 * xoff - c3o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position NEB 0.25, 0.25, -0.25 -real CompressibleOffsetMomentsInterpolationProcessor::calcPressBNE() -{ - return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + - press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + - press_SET * (c3o64 - c1o16 * xoff + c3o16 * yoff - c3o16 * zoff) + - press_SWT * (c1o64 + c1o16 * xoff + c1o16 * yoff - c1o16 * zoff) + - press_SWB * (c3o64 + c3o16 * xoff + c3o16 * yoff + c1o16 * zoff) + - press_NWB * (c9o64 + c9o16 * xoff - c3o16 * yoff + c3o16 * zoff) + - press_SEB * (c9o64 - c3o16 * xoff + c9o16 * yoff + c3o16 * zoff) + - press_NEB * (c27o64 - c9o16 * xoff - c9o16 * yoff + c9o16 * zoff); -} -////////////////////////////////////////////////////////////////////////// -//Position C 0.0, 0.0, 0.0 -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) -{ - using namespace D3Q27System; - using namespace vf::lbm::dir; - - real press = press_NET * (c4o32 - c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + - press_NWT * (c4o32 + c1o4 * xoff - c1o4 * yoff - c1o4 * zoff) + - press_SET * (c4o32 - c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + - press_SWT * (c4o32 + c1o4 * xoff + c1o4 * yoff - c1o4 * zoff) + - press_NEB * (c4o32 - c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + - press_NWB * (c4o32 + c1o4 * xoff - c1o4 * yoff + c1o4 * zoff) + - press_SEB * (c4o32 - c1o4 * xoff + c1o4 * yoff + c1o4 * zoff) + - press_SWB * (c4o32 + c1o4 * xoff + c1o4 * yoff + c1o4 * zoff); - real vx1 = a0; - real vx2 = b0; - real vx3 = c0; - -// LBMReal rho = press ;//+ (ax+by+cz)/c3o1; - - real eps_new = c2o1; - real o = omega; - //bulk viscosity - real oP = OxxPyyPzzC; - - real mfcbb = c0o1; - real mfabb = c0o1; - real mfbcb = c0o1; - real mfbab = c0o1; - real mfbbc = c0o1; - real mfbba = c0o1; - real mfccb = c0o1; - real mfaab = c0o1; - real mfcab = c0o1; - real mfacb = c0o1; - real mfcbc = c0o1; - real mfaba = c0o1; - real mfcba = c0o1; - real mfabc = c0o1; - real mfbcc = c0o1; - real mfbaa = c0o1; - real mfbca = c0o1; - real mfbac = c0o1; - real mfbbb = c0o1; - real mfccc = c0o1; - real mfaac = c0o1; - real mfcac = c0o1; - real mfacc = c0o1; - real mfcca = c0o1; - real mfaaa = c0o1; - real mfcaa = c0o1; - real mfaca = c0o1; - - mfaaa = press; // if drho is interpolated directly - - real vx1Sq = vx1*vx1; - real vx2Sq = vx2*vx2; - real vx3Sq = vx3*vx3; - real oMdrho = c1o1; - //oMdrho = one - mfaaa; - - //2.f - // linear combinations - -///////////////////////// - real mxxPyyPzz = mfaaa -c2o3*(ax+by+cz)*eps_new/oP*(c1o1 +press); - - real mxxMyy = -c2o3*((ax - by)+kxxMyyAverage)*eps_new/o * (c1o1 + press); - real mxxMzz = -c2o3*((ax - cz)+kxxMzzAverage)*eps_new/o * (c1o1 + press); - - mfabb = -c1o3 * ((bz + cy)+kyzAverage)*eps_new/o * (c1o1 + press); - mfbab = -c1o3 * ((az + cx)+kxzAverage)*eps_new/o * (c1o1 + press); - mfbba = -c1o3 * ((ay + bx)+kxyAverage)*eps_new/o * (c1o1 + press); - - //////////////////////// - // linear combinations back - mfcaa = c1o3 * (mxxMyy + mxxMzz + mxxPyyPzz); - mfaca = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz); - mfaac = c1o3 * (mxxMyy - c2o1 * mxxMzz + mxxPyyPzz); - - //three - mfbbb = c0o1; - - real mxxyPyzz = c0o1; - real mxxyMyzz = c0o1; - real mxxzPyyz = c0o1; - real mxxzMyyz = c0o1; - real mxyyPxzz = c0o1; - real mxyyMxzz = c0o1; - - // linear combinations back - mfcba = (mxxyMyzz + mxxyPyzz) * c1o2; - mfabc = (-mxxyMyzz + mxxyPyzz) * c1o2; - mfcab = (mxxzMyyz + mxxzPyyz) * c1o2; - mfacb = (-mxxzMyyz + mxxzPyyz) * c1o2; - mfbca = (mxyyMxzz + mxyyPxzz) * c1o2; - mfbac = (-mxyyMxzz + mxyyPxzz) * c1o2; - - //4.f - mfacc = mfaaa*c1o9; - mfcac = mfacc; - mfcca = mfacc; - //5. - - //6. - mfccc = mfaaa*c1o27; - //////////////////////////////////////////////////////////////////////////////////// - //back - //////////////////////////////////////////////////////////////////////////////////// - //mit 1, 0, 1/3, 0, 0, 0, 1/3, 0, 1/9 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - real m0 = mfaac * c1o2 + mfaab * (vx3 - c1o2) + (mfaaa + c1o1 * oMdrho) * (vx3Sq - vx3) * c1o2; - real m1 = -mfaac - c2o1 * mfaab * vx3 + mfaaa * (c1o1 - vx3Sq) - c1o1 * oMdrho * vx3Sq; - real m2 = mfaac * c1o2 + mfaab * (vx3 + c1o2) + (mfaaa + c1o1 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaaa = m0; - mfaab = m1; - mfaac = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfabc * c1o2 + mfabb * (vx3 - c1o2) + mfaba * (vx3Sq - vx3) * c1o2; - m1 = -mfabc - c2o1 * mfabb * vx3 + mfaba * (c1o1 - vx3Sq); - m2 = mfabc * c1o2 + mfabb * (vx3 + c1o2) + mfaba * (vx3Sq + vx3) * c1o2; - mfaba = m0; - mfabb = m1; - mfabc = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfacb * (vx3 - c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfacc - c2o1 * mfacb * vx3 + mfaca * (c1o1 - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfacc * c1o2 + mfacb * (vx3 + c1o2) + (mfaca + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfaca = m0; - mfacb = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbac * c1o2 + mfbab * (vx3 - c1o2) + mfbaa * (vx3Sq - vx3) * c1o2; - m1 = -mfbac - c2o1 * mfbab * vx3 + mfbaa * (c1o1 - vx3Sq); - m2 = mfbac * c1o2 + mfbab * (vx3 + c1o2) + mfbaa * (vx3Sq + vx3) * c1o2; - mfbaa = m0; - mfbab = m1; - mfbac = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbbc * c1o2 + mfbbb * (vx3 - c1o2) + mfbba * (vx3Sq - vx3) * c1o2; - m1 = -mfbbc - c2o1 * mfbbb * vx3 + mfbba * (c1o1 - vx3Sq); - m2 = mfbbc * c1o2 + mfbbb * (vx3 + c1o2) + mfbba * (vx3Sq + vx3) * c1o2; - mfbba = m0; - mfbbb = m1; - mfbbc = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbcb * (vx3 - c1o2) + mfbca * (vx3Sq - vx3) * c1o2; - m1 = -mfbcc - c2o1 * mfbcb * vx3 + mfbca * (c1o1 - vx3Sq); - m2 = mfbcc * c1o2 + mfbcb * (vx3 + c1o2) + mfbca * (vx3Sq + vx3) * c1o2; - mfbca = m0; - mfbcb = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfcab * (vx3 - c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfcac - c2o1 * mfcab * vx3 + mfcaa * (c1o1 - vx3Sq) - c1o3 * oMdrho * vx3Sq; - m2 = mfcac * c1o2 + mfcab * (vx3 + c1o2) + (mfcaa + c1o3 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcaa = m0; - mfcab = m1; - mfcac = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfcbb * (vx3 - c1o2) + mfcba * (vx3Sq - vx3) * c1o2; - m1 = -mfcbc - c2o1 * mfcbb * vx3 + mfcba * (c1o1 - vx3Sq); - m2 = mfcbc * c1o2 + mfcbb * (vx3 + c1o2) + mfcba * (vx3Sq + vx3) * c1o2; - mfcba = m0; - mfcbb = m1; - mfcbc = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfccb * (vx3 - c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq - vx3) * c1o2; - m1 = -mfccc - c2o1 * mfccb * vx3 + mfcca * (c1o1 - vx3Sq) - c1o9 * oMdrho * vx3Sq; - m2 = mfccc * c1o2 + mfccb * (vx3 + c1o2) + (mfcca + c1o9 * oMdrho) * (vx3Sq + vx3) * c1o2; - mfcca = m0; - mfccb = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/6, 2/3, 1/6, 0, 0, 0, 1/18, 2/9, 1/18 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - m0 = mfaca * c1o2 + mfaba * (vx2 - c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfaca - c2o1 * mfaba * vx2 + mfaaa * (c1o1 - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfaca * c1o2 + mfaba * (vx2 + c1o2) + (mfaaa + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaaa = m0; - mfaba = m1; - mfaca = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacb * c1o2 + mfabb * (vx2 - c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacb - c2o1 * mfabb * vx2 + mfaab * (c1o1 - vx2Sq) - c2o3 * oMdrho * vx2Sq; - m2 = mfacb * c1o2 + mfabb * (vx2 + c1o2) + (mfaab + c2o3 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaab = m0; - mfabb = m1; - mfacb = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfacc * c1o2 + mfabc * (vx2 - c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfacc - c2o1 * mfabc * vx2 + mfaac * (c1o1 - vx2Sq) - c1o6 * oMdrho * vx2Sq; - m2 = mfacc * c1o2 + mfabc * (vx2 + c1o2) + (mfaac + c1o6 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfaac = m0; - mfabc = m1; - mfacc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfbca * c1o2 + mfbba * (vx2 - c1o2) + mfbaa * (vx2Sq - vx2) * c1o2; - m1 = -mfbca - c2o1 * mfbba * vx2 + mfbaa * (c1o1 - vx2Sq); - m2 = mfbca * c1o2 + mfbba * (vx2 + c1o2) + mfbaa * (vx2Sq + vx2) * c1o2; - mfbaa = m0; - mfbba = m1; - mfbca = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcb * c1o2 + mfbbb * (vx2 - c1o2) + mfbab * (vx2Sq - vx2) * c1o2; - m1 = -mfbcb - c2o1 * mfbbb * vx2 + mfbab * (c1o1 - vx2Sq); - m2 = mfbcb * c1o2 + mfbbb * (vx2 + c1o2) + mfbab * (vx2Sq + vx2) * c1o2; - mfbab = m0; - mfbbb = m1; - mfbcb = m2; - /////////b////////////////////////////////////////////////////////////////////////// - m0 = mfbcc * c1o2 + mfbbc * (vx2 - c1o2) + mfbac * (vx2Sq - vx2) * c1o2; - m1 = -mfbcc - c2o1 * mfbbc * vx2 + mfbac * (c1o1 - vx2Sq); - m2 = mfbcc * c1o2 + mfbbc * (vx2 + c1o2) + mfbac * (vx2Sq + vx2) * c1o2; - mfbac = m0; - mfbbc = m1; - mfbcc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfcba * (vx2 - c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfcca - c2o1 * mfcba * vx2 + mfcaa * (c1o1 - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfcca * c1o2 + mfcba * (vx2 + c1o2) + (mfcaa + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcaa = m0; - mfcba = m1; - mfcca = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfcbb * (vx2 - c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccb - c2o1 * mfcbb * vx2 + mfcab * (c1o1 - vx2Sq) - c2o9 * oMdrho * vx2Sq; - m2 = mfccb * c1o2 + mfcbb * (vx2 + c1o2) + (mfcab + c2o9 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcab = m0; - mfcbb = m1; - mfccb = m2; - /////////c////////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfcbc * (vx2 - c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq - vx2) * c1o2; - m1 = -mfccc - c2o1 * mfcbc * vx2 + mfcac * (c1o1 - vx2Sq) - c1o18 * oMdrho * vx2Sq; - m2 = mfccc * c1o2 + mfcbc * (vx2 + c1o2) + (mfcac + c1o18 * oMdrho) * (vx2Sq + vx2) * c1o2; - mfcac = m0; - mfcbc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - //mit 1/36, 1/9, 1/36, 1/9, 4/9, 1/9, 1/36, 1/9, 1/36 Konditionieren - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - m0 = mfcaa * c1o2 + mfbaa * (vx1 - c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcaa - c2o1 * mfbaa * vx1 + mfaaa * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcaa * c1o2 + mfbaa * (vx1 + c1o2) + (mfaaa + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaaa = m0; - mfbaa = m1; - mfcaa = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcba * c1o2 + mfbba * (vx1 - c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcba - c2o1 * mfbba * vx1 + mfaba * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcba * c1o2 + mfbba * (vx1 + c1o2) + (mfaba + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaba = m0; - mfbba = m1; - mfcba = m2; - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcca * c1o2 + mfbca * (vx1 - c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcca - c2o1 * mfbca * vx1 + mfaca * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcca * c1o2 + mfbca * (vx1 + c1o2) + (mfaca + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaca = m0; - mfbca = m1; - mfcca = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcab * c1o2 + mfbab * (vx1 - c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcab - c2o1 * mfbab * vx1 + mfaab * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcab * c1o2 + mfbab * (vx1 + c1o2) + (mfaab + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaab = m0; - mfbab = m1; - mfcab = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfcbb * c1o2 + mfbbb * (vx1 - c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbb - c2o1 * mfbbb * vx1 + mfabb * (c1o1 - vx1Sq) - c4o9 * oMdrho * vx1Sq; - m2 = mfcbb * c1o2 + mfbbb * (vx1 + c1o2) + (mfabb + c4o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabb = m0; - mfbbb = m1; - mfcbb = m2; - ///////////b//////////////////////////////////////////////////////////////////////// - m0 = mfccb * c1o2 + mfbcb * (vx1 - c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccb - c2o1 * mfbcb * vx1 + mfacb * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfccb * c1o2 + mfbcb * (vx1 + c1o2) + (mfacb + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacb = m0; - mfbcb = m1; - mfccb = m2; - //////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - m0 = mfcac * c1o2 + mfbac * (vx1 - c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcac - c2o1 * mfbac * vx1 + mfaac * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfcac * c1o2 + mfbac * (vx1 + c1o2) + (mfaac + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfaac = m0; - mfbac = m1; - mfcac = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfcbc * c1o2 + mfbbc * (vx1 - c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfcbc - c2o1 * mfbbc * vx1 + mfabc * (c1o1 - vx1Sq) - c1o9 * oMdrho * vx1Sq; - m2 = mfcbc * c1o2 + mfbbc * (vx1 + c1o2) + (mfabc + c1o9 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfabc = m0; - mfbbc = m1; - mfcbc = m2; - ///////////c//////////////////////////////////////////////////////////////////////// - m0 = mfccc * c1o2 + mfbcc * (vx1 - c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq - vx1) * c1o2; - m1 = -mfccc - c2o1 * mfbcc * vx1 + mfacc * (c1o1 - vx1Sq) - c1o36 * oMdrho * vx1Sq; - m2 = mfccc * c1o2 + mfbcc * (vx1 + c1o2) + (mfacc + c1o36 * oMdrho) * (vx1Sq + vx1) * c1o2; - mfacc = m0; - mfbcc = m1; - mfccc = m2; - //////////////////////////////////////////////////////////////////////////////////// - - f[DIR_P00] = mfcbb; - f[DIR_M00] = mfabb; - f[DIR_0P0] = mfbcb; - f[DIR_0M0] = mfbab; - f[DIR_00P] = mfbbc; - f[DIR_00M] = mfbba; - f[DIR_PP0] = mfccb; - f[DIR_MM0] = mfaab; - f[DIR_PM0] = mfcab; - f[DIR_MP0] = mfacb; - f[DIR_P0P] = mfcbc; - f[DIR_M0M] = mfaba; - f[DIR_P0M] = mfcba; - f[DIR_M0P] = mfabc; - f[DIR_0PP] = mfbcc; - f[DIR_0MM] = mfbaa; - f[DIR_0PM] = mfbca; - f[DIR_0MP] = mfbac; - f[DIR_000] = mfbbb; - f[DIR_PPP] = mfccc; - f[DIR_PMP] = mfcac; - f[DIR_PPM] = mfcca; - f[DIR_PMM] = mfcaa; - f[DIR_MPP] = mfacc; - f[DIR_MMP] = mfaac; - f[DIR_MPM] = mfaca; - f[DIR_MMM] = mfaaa; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) -{ - vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; - vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; - vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) -{ - tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; - tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; - tauzz=cz+c2o1*czz*z+cxz*x+cyz*y+cxyz*x*y; - tauxy= c1o2*((ay+c2o1*ayy*y+axy*x+ayz*z+axyz*x*z)+(bx+c2o1*bxx*x+bxy*y+bxz*z+bxyz*y*z)); - tauxz= c1o2*((az+c2o1*azz*z+axz*x+ayz*y+axyz*x*y)+(cx+c2o1*cxx*x+cxy*y+cxz*z+cxyz*y*z)); - tauyz= c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); -} -////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setBulkViscosity(real shearViscosity, real bulkViscosity) -{ - this->shearViscosity = shearViscosity; - this->bulkViscosity = bulkViscosity; -} - diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h deleted file mode 100644 index 32ab8cedf89e2e644f2f939f49ed4b0101eb0e32..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CompressibleOffsetMomentsInterpolationProcessor_H_ -#define CompressibleOffsetMomentsInterpolationProcessor_H_ - -#include "InterpolationProcessor.h" -#include "D3Q27System.h" - -////////////////////////////////////////////////////////////////////////// -//it works only for cascaded LBM -//super compact interpolation method by Martin Geier -////////////////////////////////////////////////////////////////////////// - -class CompressibleOffsetMomentsInterpolationProcessor; - -class CompressibleOffsetMomentsInterpolationProcessor : public InterpolationProcessor -{ -public: - CompressibleOffsetMomentsInterpolationProcessor(); - CompressibleOffsetMomentsInterpolationProcessor(real omegaC, real omegaF); - ~CompressibleOffsetMomentsInterpolationProcessor() override; - InterpolationProcessorPtr clone() override; - void setOmegas(real omegaC, real omegaF) override; - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) override; - void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) override; - void interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) override; - void interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) override; - void setBulkViscosity(real shearViscosity, real bulkViscosity); -protected: -private: - real omegaC{0.0}, omegaF{0.0}; - real a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz; - real xoff, yoff, zoff; - real xoff_sq, yoff_sq, zoff_sq; - real press_SWT, press_NWT, press_NET, press_SET, press_SWB, press_NWB, press_NEB, press_SEB; - - real f_E, f_N, f_T, f_NE, f_SE, f_BE, f_TE, f_TN, f_BN, f_TNE, f_TNW, f_TSE, f_TSW, f_ZERO; - real x_E, x_N, x_T, x_NE, x_SE, x_BE, x_TE, x_TN, x_BN, x_TNE, x_TNW, x_TSE, x_TSW, x_ZERO; - real y_E, y_N, y_T, y_NE, y_SE, y_BE, y_TE, y_TN, y_BN, y_TNE, y_TNW, y_TSE, y_TSW, y_ZERO; - real z_E, z_N, z_T, z_NE, z_SE, z_BE, z_TE, z_TN, z_BN, z_TNE, z_TNW, z_TSE, z_TSW, z_ZERO; - real xy_E, xy_N, xy_T, xy_NE, xy_SE, xy_BE, xy_TE, xy_TN, xy_BN, xy_TNE, xy_TNW, xy_TSE, xy_TSW/*, xy_ZERO*/; - real xz_E, xz_N, xz_T, xz_NE, xz_SE, xz_BE, xz_TE, xz_TN, xz_BN, xz_TNE, xz_TNW, xz_TSE, xz_TSW/*, xz_ZERO*/; - real yz_E, yz_N, yz_T, yz_NE, yz_SE, yz_BE, yz_TE, yz_TN, yz_BN, yz_TNE, yz_TNW, yz_TSE, yz_TSW/*, yz_ZERO*/; - - real kxyAverage, kyzAverage, kxzAverage, kxxMyyAverage, kxxMzzAverage; - -// real a,b,c; - - // bulk viscosity - real shearViscosity; - real bulkViscosity; - real OxxPyyPzzC; - real OxxPyyPzzF; - - void setOffsets(real xoff, real yoff, real zoff) override; - void calcMoments(const real* const f, real omega, real& rho, real& vx1, real& vx2, real& vx3, - real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz); - void calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) override; - void calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs); - real calcPressBSW(); - real calcPressTSW(); - real calcPressTSE(); - real calcPressBSE(); - real calcPressBNW(); - real calcPressTNW(); - real calcPressTNE(); - real calcPressBNE(); - void calcInterpolatedNodeFC(real* f, real omega) override; - void calcInterpolatedVelocity(real x, real y, real z,real& vx1, real& vx2, real& vx3) override; - void calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) override; -}; - -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) -{ - this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); -} -////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetMomentsInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) -{ - this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); -} - -#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp index 548339f940d45ab2239ce6cb1cebbfa9bf0082b5..1b8d5a230ddf7a2d9b58c9e7ca8231f5c9d3500f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantLBMKernel.cpp @@ -1,6 +1,6 @@ #include "CumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include <math.h> #include "DataSet3D.h" diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp index 990bb8f89f4b6abb1a0e77b550af4d751ad49a40..39d6fd268a56f4824babaccea3449ea097c85bf2 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/IncompressibleCumulantLBMKernel.cpp @@ -1,6 +1,6 @@ #include "IncompressibleCumulantLBMKernel.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "DataSet3D.h" #include <cmath> diff --git a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp index bf68b4d43930eb431b6cb23f0647266225298165..574014992fe58993aa5720d482b0931293be5d6d 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/InitDensityLBMKernel.cpp @@ -957,7 +957,7 @@ void InitDensityLBMKernel::calculate(int /*step*/) //vx2 = vx2+(vvy-vx2); //vx3 = vx3+(vvz-vx3); - real cu_sq = 1.5*(vx1*vx1+vx2*vx2+vx3*vx3); + real cu_sq = c3o2*(vx1*vx1+vx2*vx2+vx3*vx3); feq[DIR_000] = c8o27*(drho-cu_sq); feq[DIR_P00] = c2o27*(drho+c3o1*(vx1)+c9o2*(vx1)*(vx1)-cu_sq); diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.cpp similarity index 95% rename from src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.cpp index 5cf501e20012804b7e84090243dad466e06ad06c..a5450b3b4b467143e0286ef7f7757a75c2e8457f 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.cpp @@ -1,32 +1,32 @@ -#include "CompressibleOffsetInterpolationProcessor.h" +#include "CompressibleOffsetInterpolator.h" #include "D3Q27System.h" //using namespace UbMath; using namespace vf::basics::constant; ////////////////////////////////////////////////////////////////////////// -CompressibleOffsetInterpolationProcessor::CompressibleOffsetInterpolationProcessor(real omegaC, real omegaF) +CompressibleOffsetInterpolator::CompressibleOffsetInterpolator(real omegaC, real omegaF) : omegaC(omegaC), omegaF(omegaF) { } ////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr CompressibleOffsetInterpolationProcessor::clone() +InterpolationProcessorPtr CompressibleOffsetInterpolator::clone() { - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF)); + InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetInterpolator(this->omegaC, this->omegaF)); //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC; //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF; return iproc; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::setOmegas( real omegaC, real omegaF ) +void CompressibleOffsetInterpolator::setOmegas( real omegaC, real omegaF ) { this->omegaC = omegaC; this->omegaF = omegaF; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) +void CompressibleOffsetInterpolator::setOffsets(real xoff, real yoff, real zoff) { this->xoff = xoff; this->yoff = yoff; @@ -36,7 +36,7 @@ void CompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff, this->zoff_sq = zoff * zoff; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) +void CompressibleOffsetInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets(icellC, omegaC, c1o2); @@ -50,14 +50,14 @@ void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICel calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) +void CompressibleOffsetInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets(icellF, omegaF, c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, +void CompressibleOffsetInterpolator::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) { using namespace D3Q27System; @@ -76,7 +76,7 @@ void CompressibleOffsetInterpolationProcessor::calcMoments(const real* const f, kxxMzz = -c3o1/c2o1*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) +void CompressibleOffsetInterpolator::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) { real vx1_SWT,vx2_SWT,vx3_SWT; real vx1_NWT,vx2_NWT,vx3_NWT; @@ -375,7 +375,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); - x_ZERO = 0.; + x_ZERO = c0o1; x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); @@ -390,7 +390,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); - y_ZERO = 0.; + y_ZERO = c0o1; y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); @@ -405,7 +405,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); - z_ZERO = 0.; + z_ZERO = c0o1; z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); @@ -457,7 +457,7 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) +void CompressibleOffsetInterpolator::calcInterpolatedNodeCF(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -504,8 +504,8 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeCF(real* f, r f[DIR_000] = f_ZERO + xs*x_ZERO + ys*y_ZERO + zs*z_ZERO + feq[DIR_000]; } ////////////////////////////////////////////////////////////////////////// -//Position SWB -c1o4, -c1o4, -c1o4 -real CompressibleOffsetInterpolationProcessor::calcPressBSW() +//Position SWB -0.25, -0.25, -0.25 +real CompressibleOffsetInterpolator::calcPressBSW() { return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -517,8 +517,8 @@ real CompressibleOffsetInterpolationProcessor::calcPressBSW() press_SWB * (c27o64 + c9o16 * xoff + c9o16 * yoff + c9o16 * zoff); } ////////////////////////////////////////////////////////////////////////// -//Position SWT -c1o4, -c1o4, c1o4 -real CompressibleOffsetInterpolationProcessor::calcPressTSW() +//Position SWT -0.25, -0.25, 0.25 +real CompressibleOffsetInterpolator::calcPressTSW() { return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + @@ -531,7 +531,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressTSW() } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 -real CompressibleOffsetInterpolationProcessor::calcPressTSE() +real CompressibleOffsetInterpolator::calcPressTSE() { return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + @@ -544,7 +544,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressTSE() } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 -real CompressibleOffsetInterpolationProcessor::calcPressBSE() +real CompressibleOffsetInterpolator::calcPressBSE() { return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -557,7 +557,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressBSE() } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 -real CompressibleOffsetInterpolationProcessor::calcPressBNW() +real CompressibleOffsetInterpolator::calcPressBNW() { return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + @@ -570,7 +570,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressBNW() } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 -real CompressibleOffsetInterpolationProcessor::calcPressTNW() +real CompressibleOffsetInterpolator::calcPressTNW() { return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -583,7 +583,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressTNW() } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 -real CompressibleOffsetInterpolationProcessor::calcPressTNE() +real CompressibleOffsetInterpolator::calcPressTNE() { return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -596,7 +596,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressTNE() } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 -real CompressibleOffsetInterpolationProcessor::calcPressBNE() +real CompressibleOffsetInterpolator::calcPressBNE() { return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + @@ -609,7 +609,7 @@ real CompressibleOffsetInterpolationProcessor::calcPressBNE() } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 -void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) +void CompressibleOffsetInterpolator::calcInterpolatedNodeFC(real* f, real omega) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -699,14 +699,14 @@ void CompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, r f[DIR_000] = f_ZERO + feq[DIR_000]; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) +void CompressibleOffsetInterpolator::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) { vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) +void CompressibleOffsetInterpolator::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.h similarity index 85% rename from src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.h index fefd6ed1566fe0a4c3c414748a522edbfede48a1..8b295977773ad95c00b36a9ef775d45140fe34df 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetInterpolationProcessor.h +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetInterpolator.h @@ -1,7 +1,7 @@ #ifndef CompressibleOffsetInterpolationProcessor_H_ #define CompressibleOffsetInterpolationProcessor_H_ -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27System.h" ////////////////////////////////////////////////////////////////////////// @@ -9,14 +9,14 @@ //super compact interpolation method by Martin Geier ////////////////////////////////////////////////////////////////////////// -class CompressibleOffsetInterpolationProcessor; +class CompressibleOffsetInterpolator; -class CompressibleOffsetInterpolationProcessor : public InterpolationProcessor +class CompressibleOffsetInterpolator : public Interpolator { public: - CompressibleOffsetInterpolationProcessor() = default; - CompressibleOffsetInterpolationProcessor(real omegaC, real omegaF); - ~CompressibleOffsetInterpolationProcessor() override = default; + CompressibleOffsetInterpolator() = default; + CompressibleOffsetInterpolator(real omegaC, real omegaF); + ~CompressibleOffsetInterpolator() override = default; InterpolationProcessorPtr clone() override; void setOmegas(real omegaC, real omegaF) override; @@ -64,12 +64,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) +inline void CompressibleOffsetInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) { this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) +inline void CompressibleOffsetInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) { this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); } diff --git a/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9003b120688997efbe22d51f4178153a66231e38 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.cpp @@ -0,0 +1,65 @@ +#include "CompressibleOffsetMomentsInterpolator.h" + +#include <algorithm> + +#include <basics/constants/NumericConstants.h> + +#include <lbm/refinement/InterpolationCF.h> +#include <lbm/refinement/InterpolationFC.h> +#include <lbm/refinement/Coefficients.h> + + +void calculateCoefficients(vf::lbm::Coefficients& coefficients, const D3Q27ICell& icell, real omega, real xoff, real yoff, real zoff) +{ + vf::lbm::MomentsOnSourceNodeSet momentsSet; + + momentsSet.calculateMMM(icell.BSW, omega); + momentsSet.calculateMMP(icell.TSW, omega); + momentsSet.calculateMPP(icell.TNW, omega); + momentsSet.calculateMPM(icell.BNW, omega); + momentsSet.calculatePMM(icell.BSE, omega); + momentsSet.calculatePPP(icell.TNE, omega); + momentsSet.calculatePMP(icell.TSE, omega); + momentsSet.calculatePPM(icell.BNE, omega); + + momentsSet.calculateCoefficients(coefficients, xoff, yoff, zoff); +} + +CompressibleOffsetMomentsInterpolator::CompressibleOffsetMomentsInterpolator(real omegaC, real omegaF) + : omegaC(omegaC), omegaF(omegaF) +{ +} + +InterpolationProcessorPtr CompressibleOffsetMomentsInterpolator::clone() +{ + return InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolator(this->omegaC, this->omegaF)); +} + +void CompressibleOffsetMomentsInterpolator::setOmegas(real omegaC, real omegaF) +{ + this->omegaC = omegaC; + this->omegaF = omegaF; +} + +void CompressibleOffsetMomentsInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) +{ + vf::lbm::Coefficients coefficients; + calculateCoefficients(coefficients, icellC, omegaC, xoff, yoff, zoff); + + vf::lbm::interpolateCF(icellF.BSW, omegaF, vf::basics::constant::c1o2, coefficients, -c1o4, -c1o4, -c1o4); + vf::lbm::interpolateCF(icellF.BNE, omegaF, vf::basics::constant::c1o2, coefficients, c1o4, c1o4, -c1o4); + vf::lbm::interpolateCF(icellF.TNW, omegaF, vf::basics::constant::c1o2, coefficients, -c1o4, c1o4, c1o4); + vf::lbm::interpolateCF(icellF.TSE, omegaF, vf::basics::constant::c1o2, coefficients, c1o4, -c1o4, c1o4); + vf::lbm::interpolateCF(icellF.BNW, omegaF, vf::basics::constant::c1o2, coefficients, -c1o4, c1o4, -c1o4); + vf::lbm::interpolateCF(icellF.BSE, omegaF, vf::basics::constant::c1o2, coefficients, c1o4, -c1o4, -c1o4); + vf::lbm::interpolateCF(icellF.TSW, omegaF, vf::basics::constant::c1o2, coefficients, -c1o4, -c1o4, c1o4); + vf::lbm::interpolateCF(icellF.TNE, omegaF, vf::basics::constant::c1o2, coefficients, c1o4, c1o4, c1o4); +} + +void CompressibleOffsetMomentsInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) +{ + vf::lbm::Coefficients coefficients; + calculateCoefficients(coefficients, icellF, omegaF, xoff, yoff, zoff); + + vf::lbm::interpolateFC(icellC, vf::basics::constant::c2o1, omegaC, coefficients); +} diff --git a/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.h b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.h new file mode 100644 index 0000000000000000000000000000000000000000..444170d565fc80cf735cd134f0b46ac54fc38902 --- /dev/null +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetMomentsInterpolator.h @@ -0,0 +1,41 @@ +#ifndef CompressibleOffsetMomentsInterpolationProcessor_H_ +#define CompressibleOffsetMomentsInterpolationProcessor_H_ + +#include "Interpolator.h" +#include "D3Q27System.h" + +////////////////////////////////////////////////////////////////////////// +//it works only for cascaded LBM +//super compact interpolation method by Martin Geier +////////////////////////////////////////////////////////////////////////// + +class CompressibleOffsetMomentsInterpolator : public Interpolator +{ +public: + CompressibleOffsetMomentsInterpolator() = default; + CompressibleOffsetMomentsInterpolator(real omegaC, real omegaF); + InterpolationProcessorPtr clone() override; + + void setOmegas(real omegaC, real omegaF) override; + + void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF) override; + void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF, real xoff, real yoff, real zoff) override; + void interpolateFineToCoarse(D3Q27ICell &icellF, real *icellC) override; + void interpolateFineToCoarse(D3Q27ICell &icellF, real *icellC, real xoff, real yoff, real zoff) override; + +private: + real omegaC{ 0.0 }, omegaF{ 0.0 }; +}; + +////////////////////////////////////////////////////////////////////////// +inline void CompressibleOffsetMomentsInterpolator::interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF) +{ + this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); +} +////////////////////////////////////////////////////////////////////////// +inline void CompressibleOffsetMomentsInterpolator::interpolateFineToCoarse(D3Q27ICell &icellF, real *icellC) +{ + this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); +} + +#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.cpp similarity index 96% rename from src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.cpp index dee6d12a5812e29d91aa1c12c25d61ade0759ef8..3b5d7386ae4e615a6f89d6ed07eb78d02b295799 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.cpp @@ -1,10 +1,10 @@ -#include "CompressibleOffsetSquarePressureInterpolationProcessor.h" +#include "CompressibleOffsetSquarePressureInterpolator.h" #include "D3Q27System.h" //using namespace UbMath; using namespace vf::basics::constant; -CompressibleOffsetSquarePressureInterpolationProcessor::CompressibleOffsetSquarePressureInterpolationProcessor() +CompressibleOffsetSquarePressureInterpolator::CompressibleOffsetSquarePressureInterpolator() { this->bulkOmegaToOmega = false; @@ -12,7 +12,7 @@ CompressibleOffsetSquarePressureInterpolationProcessor::CompressibleOffsetSquare this->OxxPyyPzzF = c1o1; } ////////////////////////////////////////////////////////////////////////// -CompressibleOffsetSquarePressureInterpolationProcessor::CompressibleOffsetSquarePressureInterpolationProcessor(real omegaC, real omegaF) +CompressibleOffsetSquarePressureInterpolator::CompressibleOffsetSquarePressureInterpolator(real omegaC, real omegaF) : omegaC(omegaC), omegaF(omegaF) { this->bulkOmegaToOmega = false; @@ -20,32 +20,32 @@ CompressibleOffsetSquarePressureInterpolationProcessor::CompressibleOffsetSquare this->OxxPyyPzzF = c1o1; } ////////////////////////////////////////////////////////////////////////// -CompressibleOffsetSquarePressureInterpolationProcessor::~CompressibleOffsetSquarePressureInterpolationProcessor() +CompressibleOffsetSquarePressureInterpolator::~CompressibleOffsetSquarePressureInterpolator() = default; ////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr CompressibleOffsetSquarePressureInterpolationProcessor::clone() +InterpolationProcessorPtr CompressibleOffsetSquarePressureInterpolator::clone() { - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetSquarePressureInterpolationProcessor(this->omegaC, this->omegaF)); + InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetSquarePressureInterpolator(this->omegaC, this->omegaF)); if (bulkOmegaToOmega) { - dynamicPointerCast<CompressibleOffsetSquarePressureInterpolationProcessor>(iproc)->OxxPyyPzzC = omegaC; - dynamicPointerCast<CompressibleOffsetSquarePressureInterpolationProcessor>(iproc)->OxxPyyPzzF = omegaF; + dynamicPointerCast<CompressibleOffsetSquarePressureInterpolator>(iproc)->OxxPyyPzzC = omegaC; + dynamicPointerCast<CompressibleOffsetSquarePressureInterpolator>(iproc)->OxxPyyPzzF = omegaF; } else { - dynamicPointerCast<CompressibleOffsetSquarePressureInterpolationProcessor>(iproc)->OxxPyyPzzC = c1o1; - dynamicPointerCast<CompressibleOffsetSquarePressureInterpolationProcessor>(iproc)->OxxPyyPzzF = c1o1; + dynamicPointerCast<CompressibleOffsetSquarePressureInterpolator>(iproc)->OxxPyyPzzC = c1o1; + dynamicPointerCast<CompressibleOffsetSquarePressureInterpolator>(iproc)->OxxPyyPzzF = c1o1; } return iproc; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::setOmegas( real omegaC, real omegaF ) +void CompressibleOffsetSquarePressureInterpolator::setOmegas( real omegaC, real omegaF ) { this->omegaC = omegaC; this->omegaF = omegaF; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) +void CompressibleOffsetSquarePressureInterpolator::setOffsets(real xoff, real yoff, real zoff) { this->xoff = xoff; this->yoff = yoff; @@ -55,7 +55,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::setOffsets(real xof this->zoff_sq = zoff * zoff; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) +void CompressibleOffsetSquarePressureInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets(icellC, omegaC, c1o2); @@ -69,14 +69,14 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateCoarseTo calcInterpolatedNodeCF(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) +void CompressibleOffsetSquarePressureInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets(icellF, omegaF, c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, +void CompressibleOffsetSquarePressureInterpolator::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) { using namespace D3Q27System; @@ -94,7 +94,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcMoments(const r kxxMzz = -c3o1/c2o1*omega*((((f[DIR_MP0]+f[DIR_PM0])-(f[DIR_0MM]+f[DIR_0PP]))+((f[DIR_MM0]+f[DIR_PP0])-(f[DIR_0MP]+f[DIR_0PM])))+((f[DIR_M00]+f[DIR_P00])-(f[DIR_00M]+f[DIR_00P]))/(c1o1 + drho)-(vx1*vx1-vx3*vx3)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) +void CompressibleOffsetSquarePressureInterpolator::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) { real vx1_SWT,vx2_SWT,vx3_SWT; real vx1_NWT,vx2_NWT,vx3_NWT; @@ -475,7 +475,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedCoe yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs) +void CompressibleOffsetSquarePressureInterpolator::calcInterpolatedNodeCF(real* f, real omega, real x, real y, real z, real press, real xs, real ys, real zs) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -812,8 +812,8 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod f[DIR_MMM] = mfaaa; } ////////////////////////////////////////////////////////////////////////// -//Position SWB -c1o4, -c1o4, -c1o4 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSW() +//Position SWB -0.25, -0.25, -0.25 +real CompressibleOffsetSquarePressureInterpolator::calcPressBSW() { return press_SWT * (c9o64 + c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + press_NWT * (c3o64 + c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -826,7 +826,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSW() } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSW() +real CompressibleOffsetSquarePressureInterpolator::calcPressTSW() { return press_SWT * (c27o64 + c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + press_NWT * (c9o64 + c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + @@ -839,7 +839,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSW() } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSE() +real CompressibleOffsetSquarePressureInterpolator::calcPressTSE() { return press_SET * (c27o64 - c9o16 * xoff + c9o16 * yoff - c9o16 * zoff) + press_NET * (c9o64 - c3o16 * xoff - c9o16 * yoff - c3o16 * zoff) + @@ -852,7 +852,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTSE() } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSE() +real CompressibleOffsetSquarePressureInterpolator::calcPressBSE() { return press_SET * (c9o64 - c3o16 * xoff + c3o16 * yoff - c9o16 * zoff) + press_NET * (c3o64 - c1o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -865,7 +865,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBSE() } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNW() +real CompressibleOffsetSquarePressureInterpolator::calcPressBNW() { return press_NWT * (c9o64 + c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + press_NET * (c3o64 - c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + @@ -878,7 +878,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNW() } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNW() +real CompressibleOffsetSquarePressureInterpolator::calcPressTNW() { return press_NWT * (c27o64 + c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + press_NET * (c9o64 - c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -891,7 +891,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNW() } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNE() +real CompressibleOffsetSquarePressureInterpolator::calcPressTNE() { return press_NET * (c27o64 - c9o16 * xoff - c9o16 * yoff - c9o16 * zoff) + press_NWT * (c9o64 + c9o16 * xoff - c3o16 * yoff - c3o16 * zoff) + @@ -904,7 +904,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressTNE() } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 -real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNE() +real CompressibleOffsetSquarePressureInterpolator::calcPressBNE() { return press_NET * (c9o64 - c3o16 * xoff - c3o16 * yoff - c9o16 * zoff) + press_NWT * (c3o64 + c3o16 * xoff - c1o16 * yoff - c3o16 * zoff) + @@ -917,7 +917,7 @@ real CompressibleOffsetSquarePressureInterpolationProcessor::calcPressBNE() } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 -void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) +void CompressibleOffsetSquarePressureInterpolator::calcInterpolatedNodeFC(real* f, real omega) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -1266,14 +1266,14 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedNod f[DIR_MMM] = mfaaa; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) +void CompressibleOffsetSquarePressureInterpolator::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) { vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) +void CompressibleOffsetSquarePressureInterpolator::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { tauxx=ax+c2o1*axx*x+axy*y+axz*z+axyz*y*z; tauyy=by+c2o1*byy*y+bxy*x+byz*z+bxyz*x*z; @@ -1283,7 +1283,7 @@ void CompressibleOffsetSquarePressureInterpolationProcessor::calcInterpolatedShe tauyz=c1o2*((bz+c2o1*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+c2o1*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetSquarePressureInterpolationProcessor::setBulkOmegaToOmega(bool value) +void CompressibleOffsetSquarePressureInterpolator::setBulkOmegaToOmega(bool value) { bulkOmegaToOmega = value; } diff --git a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.h similarity index 84% rename from src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.h rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.h index d9285289f63e7dfca694342df092b6e5f4ecb4d5..8a6308f947f79305079b1fa45edff0fb9c703a55 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CompressibleOffsetSquarePressureInterpolationProcessor.h +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/CompressibleOffsetSquarePressureInterpolator.h @@ -1,7 +1,7 @@ #ifndef CompressibleOffsetSquarePressureInterpolationProcessor_H_ #define CompressibleOffsetSquarePressureInterpolationProcessor_H_ -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27System.h" ////////////////////////////////////////////////////////////////////////// @@ -9,14 +9,14 @@ //super compact interpolation method by Martin Geier ////////////////////////////////////////////////////////////////////////// -class CompressibleOffsetSquarePressureInterpolationProcessor; +class CompressibleOffsetSquarePressureInterpolator; -class CompressibleOffsetSquarePressureInterpolationProcessor : public InterpolationProcessor +class CompressibleOffsetSquarePressureInterpolator : public Interpolator { public: - CompressibleOffsetSquarePressureInterpolationProcessor(); - CompressibleOffsetSquarePressureInterpolationProcessor(real omegaC, real omegaF); - ~CompressibleOffsetSquarePressureInterpolationProcessor() override; + CompressibleOffsetSquarePressureInterpolator(); + CompressibleOffsetSquarePressureInterpolator(real omegaC, real omegaF); + ~CompressibleOffsetSquarePressureInterpolator() override; InterpolationProcessorPtr clone() override; void setOmegas(real omegaC, real omegaF) override; void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) override; @@ -68,12 +68,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) +inline void CompressibleOffsetSquarePressureInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) { this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// -inline void CompressibleOffsetSquarePressureInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) +inline void CompressibleOffsetSquarePressureInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) { this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); } diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.cpp similarity index 90% rename from src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.cpp index 26635dbac5d4b2844e6f0205f30a063c5533d612..a00c266191353e2124d1999b370d5ec6e51ec697 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.cpp @@ -1,31 +1,31 @@ -#include "IncompressibleOffsetInterpolationProcessor.h" +#include "IncompressibleOffsetInterpolator.h" #include "D3Q27System.h" ////////////////////////////////////////////////////////////////////////// -IncompressibleOffsetInterpolationProcessor::IncompressibleOffsetInterpolationProcessor(real omegaC, real omegaF) +IncompressibleOffsetInterpolator::IncompressibleOffsetInterpolator(real omegaC, real omegaF) : omegaC(omegaC), omegaF(omegaF) { } ////////////////////////////////////////////////////////////////////////// -InterpolationProcessorPtr IncompressibleOffsetInterpolationProcessor::clone() +InterpolationProcessorPtr IncompressibleOffsetInterpolator::clone() { - InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new IncompressibleOffsetInterpolationProcessor(this->omegaC, this->omegaF)); + InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new IncompressibleOffsetInterpolator(this->omegaC, this->omegaF)); //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingC = forcingC; //dynamicPointerCast<D3Q27IncompressibleOffsetInterpolationProcessor>(iproc)->forcingF = forcingF; return iproc; } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::setOmegas( real omegaC, real omegaF ) +void IncompressibleOffsetInterpolator::setOmegas( real omegaC, real omegaF ) { this->omegaC = omegaC; this->omegaF = omegaF; } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff, real zoff) +void IncompressibleOffsetInterpolator::setOffsets(real xoff, real yoff, real zoff) { this->xoff = xoff; this->yoff = yoff; @@ -35,7 +35,7 @@ void IncompressibleOffsetInterpolationProcessor::setOffsets(real xoff, real yoff this->zoff_sq = zoff * zoff; } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) +void IncompressibleOffsetInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, real xoff, real yoff, real zoff) { using namespace vf::basics::constant; @@ -51,14 +51,14 @@ void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27IC calcInterpolatedNode(icellF.TNE, omegaF, c1o4, c1o4, c1o4, calcPressTNE(), c1o1, c1o1, c1o1); } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) +void IncompressibleOffsetInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) { setOffsets(xoff, yoff, zoff); calcInterpolatedCoefficiets(icellF, omegaF, vf::basics::constant::c2o1); calcInterpolatedNodeFC(icellC, omegaC); } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, +void IncompressibleOffsetInterpolator::calcMoments(const real* const f, real omega, real& press, real& vx1, real& vx2, real& vx3, real& kxy, real& kyz, real& kxz, real& kxxMyy, real& kxxMzz) { using namespace D3Q27System; @@ -104,7 +104,7 @@ void IncompressibleOffsetInterpolationProcessor::calcMoments(const real* const f //UBLOG(logINFO,"f[TN] = " << f[TN] << " TN = " << TN); } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) +void IncompressibleOffsetInterpolator::calcInterpolatedCoefficiets(const D3Q27ICell& icell, real omega, real eps_new) { using namespace vf::basics::constant; @@ -435,56 +435,56 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con f_BE = eps_new*(-(ax - c3o1*az - c2o1*by - c3o1*cx + cz+c2o1*kxxMyyAverage-kxxMzzAverage-c3o1*kxzAverage)/(c54o1*o)); f_TN = eps_new*(-(-c2o1*ax + by + c3o1*bz + c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage+c3o1*kyzAverage)/(c54o1*o)); f_BN = eps_new*(-(-c2o1*ax + by - c3o1*bz - c3o1*cy + cz-kxxMyyAverage-kxxMzzAverage-c3o1*kyzAverage)/(c54o1*o)); - f_ZERO = 0.; + f_ZERO = c0o1; f_TNE = eps_new*(-(ay + az + bx + bz + cx + cy+kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); f_TSW = eps_new*((-ay + az - bx + bz + cx + cy-kxyAverage+kxzAverage+kyzAverage)/(c72o1*o)); f_TSE = eps_new*((ay - az + bx + bz - cx + cy+kxyAverage-kxzAverage+kyzAverage)/(c72o1*o)); f_TNW = eps_new*((ay + az + bx - bz + cx - cy+kxyAverage+kxzAverage-kyzAverage)/(c72o1*o)); - x_E = 0.25*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); - x_N = 0.25*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); - x_T = 0.25*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); - x_NE = 0.25*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); - x_SE = 0.25*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); - x_TE = 0.25*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); - x_BE = 0.25*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); - x_TN = 0.25*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); - x_BN = 0.25*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); - x_ZERO = 0.; - x_TNE = 0.25*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); - x_TSW = 0.25*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); - x_TSE = 0.25*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); - x_TNW = 0.25*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); - - y_E = 0.25*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); - y_N = 0.25*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); - y_T = 0.25*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); - y_NE = 0.25*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); - y_SE = 0.25*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); - y_TE = 0.25*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); - y_BE = 0.25*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); - y_TN = 0.25*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); - y_BN = 0.25*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); - y_ZERO = 0.; - y_TNE = 0.25*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); - y_TSW = 0.25*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); - y_TSE = 0.25*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); - y_TNW = 0.25*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); - - z_E = 0.25*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); - z_N = 0.25*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); - z_T = 0.25*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); - z_NE = 0.25*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); - z_SE = 0.25*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); - z_TE = 0.25*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); - z_BE = 0.25*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); - z_TN = 0.25*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); - z_BN = 0.25*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); - z_ZERO = 0.; - z_TNE = 0.25*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); - z_TSW = 0.25*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); - z_TSE = 0.25*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); - z_TNW = 0.25*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); + x_E = c1o4*eps_new*((c2o1*(-c4o1*axx + bxy + cxz))/(c27o1*o)); + x_N = c1o4*eps_new*((c2o1*(c2o1*axx - c2o1*bxy + cxz))/(c27o1*o)); + x_T = c1o4*eps_new*((c2o1*(c2o1*axx + bxy - c2o1*cxz))/(c27o1*o)); + x_NE = c1o4*eps_new*(-((c2o1*axx + c3o1*axy + c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_SE = c1o4*eps_new*(-((c2o1*axx - c3o1*axy - c6o1*bxx + bxy - c2o1*cxz))/(c54o1*o)); + x_TE = c1o4*eps_new*(-((c2o1*axx + c3o1*axz - c2o1*bxy + c6o1*cxx + cxz))/(c54o1*o)); + x_BE = c1o4*eps_new*(-((c2o1*axx - c3o1*axz - c2o1*bxy - c6o1*cxx + cxz))/(c54o1*o)); + x_TN = c1o4*eps_new*(-((-c4o1*axx + bxy + c3o1*bxz + c3o1*cxy + cxz))/(c54o1*o)); + x_BN = c1o4*eps_new*(-((-c4o1*axx + bxy - c3o1*bxz - c3o1*cxy + cxz))/(c54o1*o)); + x_ZERO = c0o1; + x_TNE = c1o4*eps_new*(-((axy + axz + c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSW = c1o4*eps_new*(((-axy + axz - c2o1*bxx + bxz + c2o1*cxx + cxy))/(c72o1*o)); + x_TSE = c1o4*eps_new*(((axy - axz + c2o1*bxx + bxz - c2o1*cxx + cxy))/(c72o1*o)); + x_TNW = c1o4*eps_new*(((axy + axz + c2o1*bxx - bxz + c2o1*cxx - cxy))/(c72o1*o)); + + y_E = c1o4*eps_new*(c2o1*(-c2o1*axy + c2o1*byy + cyz))/(c27o1*o); + y_N = c1o4*eps_new*(c2o1*(axy - c4o1*byy + cyz))/(c27o1*o); + y_T = c1o4*eps_new*(c2o1*(axy + c2o1*byy - c2o1*cyz))/(c27o1*o); + y_NE = c1o4*eps_new*(-((axy + c6o1*ayy + c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_SE = c1o4*eps_new*(-((axy - c6o1*ayy - c3o1*bxy + c2o1*byy - c2o1*cyz))/(c54o1*o)); + y_TE = c1o4*eps_new*(-((axy + c3o1*ayz - c4o1*byy + c3o1*cxy + cyz))/(c54o1*o)); + y_BE = c1o4*eps_new*(-((axy - c3o1*ayz - c4o1*byy - c3o1*cxy + cyz))/(c54o1*o)); + y_TN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy + c3o1*byz + c6o1*cyy + cyz))/(c54o1*o)); + y_BN = c1o4*eps_new*(-((-c2o1*axy + c2o1*byy - c3o1*byz - c6o1*cyy + cyz))/(c54o1*o)); + y_ZERO = c0o1; + y_TNE = c1o4*eps_new*(-((c2o1*ayy + ayz + bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSW = c1o4*eps_new*(((-c2o1*ayy + ayz - bxy + byz + cxy + c2o1*cyy))/(c72o1*o)); + y_TSE = c1o4*eps_new*(((c2o1*ayy - ayz + bxy + byz - cxy + c2o1*cyy))/(c72o1*o)); + y_TNW = c1o4*eps_new*(((c2o1*ayy + ayz + bxy - byz + cxy - c2o1*cyy))/(c72o1*o)); + + z_E = c1o4*eps_new*((c2o1*(-c2o1*axz + byz + c2o1*czz))/(c27o1*o)); + z_N = c1o4*eps_new*((c2o1*(axz - c2o1*byz + c2o1*czz))/(c27o1*o)); + z_T = c1o4*eps_new*((c2o1*(axz + byz - c4o1*czz))/(c27o1*o)); + z_NE = c1o4*eps_new*(-((axz + c3o1*ayz + c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_SE = c1o4*eps_new*(-((axz - c3o1*ayz - c3o1*bxz + byz - c4o1*czz))/(c54o1*o)); + z_TE = c1o4*eps_new*(-((axz + c6o1*azz - c2o1*byz + c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_BE = c1o4*eps_new*(-((axz - c6o1*azz - c2o1*byz - c3o1*cxz + c2o1*czz))/(c54o1*o)); + z_TN = c1o4*eps_new*(-((-c2o1*axz + byz + c6o1*bzz + c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_BN = c1o4*eps_new*(-((-c2o1*axz + byz - c6o1*bzz - c3o1*cyz + c2o1*czz))/(c54o1*o)); + z_ZERO = c0o1; + z_TNE = c1o4*eps_new*(-((ayz + c2o1*azz + bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSW = c1o4*eps_new*(((-ayz + c2o1*azz - bxz + c2o1*bzz + cxz + cyz))/(c72o1*o)); + z_TSE = c1o4*eps_new*(((ayz - c2o1*azz + bxz + c2o1*bzz - cxz + cyz))/(c72o1*o)); + z_TNW = c1o4*eps_new*(((ayz + c2o1*azz + bxz - c2o1*bzz + cxz - cyz))/(c72o1*o)); xy_E = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); xy_N = c1o16*eps_new *(( c2o1*cxyz)/(c27o1*o)); @@ -532,7 +532,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedCoefficiets(con yz_TNW = c1o16*eps_new *(( bxyz + cxyz)/(c72o1*o)); } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) +void IncompressibleOffsetInterpolator::calcInterpolatedNode(real* f, real /*omega*/, real /*x*/, real /*y*/, real /*z*/, real press, real xs, real ys, real zs) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -581,7 +581,7 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNode(real* f, r } ////////////////////////////////////////////////////////////////////////// //Position SWB -0.25, -0.25, -0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressBSW() +real IncompressibleOffsetInterpolator::calcPressBSW() { using namespace vf::basics::constant; @@ -596,7 +596,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressBSW() } ////////////////////////////////////////////////////////////////////////// //Position SWT -0.25, -0.25, 0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressTSW() +real IncompressibleOffsetInterpolator::calcPressTSW() { using namespace vf::basics::constant; @@ -611,7 +611,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressTSW() } ////////////////////////////////////////////////////////////////////////// //Position SET 0.25, -0.25, 0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressTSE() +real IncompressibleOffsetInterpolator::calcPressTSE() { using namespace vf::basics::constant; @@ -626,7 +626,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressTSE() } ////////////////////////////////////////////////////////////////////////// //Position SEB 0.25, -0.25, -0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressBSE() +real IncompressibleOffsetInterpolator::calcPressBSE() { using namespace vf::basics::constant; @@ -641,7 +641,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressBSE() } ////////////////////////////////////////////////////////////////////////// //Position NWB -0.25, 0.25, -0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressBNW() +real IncompressibleOffsetInterpolator::calcPressBNW() { using namespace vf::basics::constant; @@ -656,7 +656,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressBNW() } ////////////////////////////////////////////////////////////////////////// //Position NWT -0.25, 0.25, 0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressTNW() +real IncompressibleOffsetInterpolator::calcPressTNW() { using namespace vf::basics::constant; @@ -671,7 +671,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressTNW() } ////////////////////////////////////////////////////////////////////////// //Position NET 0.25, 0.25, 0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressTNE() +real IncompressibleOffsetInterpolator::calcPressTNE() { using namespace vf::basics::constant; @@ -686,7 +686,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressTNE() } ////////////////////////////////////////////////////////////////////////// //Position NEB 0.25, 0.25, -0.25 -real IncompressibleOffsetInterpolationProcessor::calcPressBNE() +real IncompressibleOffsetInterpolator::calcPressBNE() { using namespace vf::basics::constant; @@ -701,7 +701,7 @@ real IncompressibleOffsetInterpolationProcessor::calcPressBNE() } ////////////////////////////////////////////////////////////////////////// //Position C 0.0, 0.0, 0.0 -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, real omega) +void IncompressibleOffsetInterpolator::calcInterpolatedNodeFC(real* f, real omega) { using namespace D3Q27System; using namespace vf::lbm::dir; @@ -792,14 +792,14 @@ void IncompressibleOffsetInterpolationProcessor::calcInterpolatedNodeFC(real* f, f[DIR_000] = f_ZERO + feq[DIR_000]; } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) +void IncompressibleOffsetInterpolator::calcInterpolatedVelocity(real x, real y, real z, real& vx1, real& vx2, real& vx3) { vx1 = a0 + ax*x + ay*y + az*z + axx*x*x + ayy*y*y + azz*z*z + axy*x*y + axz*x*z + ayz*y*z+axyz*x*y*z; vx2 = b0 + bx*x + by*y + bz*z + bxx*x*x + byy*y*y + bzz*z*z + bxy*x*y + bxz*x*z + byz*y*z+bxyz*x*y*z; vx3 = c0 + cx*x + cy*y + cz*z + cxx*x*x + cyy*y*y + czz*z*z + cxy*x*y + cxz*x*z + cyz*y*z+cxyz*x*y*z; } ////////////////////////////////////////////////////////////////////////// -void IncompressibleOffsetInterpolationProcessor::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) +void IncompressibleOffsetInterpolator::calcInterpolatedShearStress(real x, real y, real z,real& tauxx, real& tauyy, real& tauzz,real& tauxy, real& tauxz, real& tauyz) { using namespace vf::basics::constant; diff --git a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.h similarity index 83% rename from src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.h index 866c0f6933e67d66b3b36d65a0f484ba2d8cbf86..2fee5d62c30162e0f2af514e3551c8aa93ca9dab 100644 --- a/src/cpu/VirtualFluidsCore/LBM/IncompressibleOffsetInterpolationProcessor.h +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/IncompressibleOffsetInterpolator.h @@ -1,7 +1,7 @@ #ifndef IncompressibleOffsetInterpolationProcessor_H_ #define IncompressibleOffsetInterpolationProcessor_H_ -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "D3Q27System.h" ////////////////////////////////////////////////////////////////////////// @@ -9,15 +9,15 @@ //super compact interpolation method by Martin Geier ////////////////////////////////////////////////////////////////////////// -class IncompressibleOffsetInterpolationProcessor; -using D3Q27IncompressibleOffsetInterpolationProcessorPtr = SPtr<IncompressibleOffsetInterpolationProcessor>; +class IncompressibleOffsetInterpolator; +using D3Q27IncompressibleOffsetInterpolationProcessorPtr = SPtr<IncompressibleOffsetInterpolator>; -class IncompressibleOffsetInterpolationProcessor : public InterpolationProcessor +class IncompressibleOffsetInterpolator : public Interpolator { public: - IncompressibleOffsetInterpolationProcessor() = default; - IncompressibleOffsetInterpolationProcessor(real omegaC, real omegaF); - ~IncompressibleOffsetInterpolationProcessor() override = default; + IncompressibleOffsetInterpolator() = default; + IncompressibleOffsetInterpolator(real omegaC, real omegaF); + ~IncompressibleOffsetInterpolator() override = default; InterpolationProcessorPtr clone() override; void setOmegas(real omegaC, real omegaF) override; void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) override; @@ -25,7 +25,7 @@ public: void interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) override; void interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC, real xoff, real yoff, real zoff) override; //real forcingC, forcingF; -protected: +protected: private: real omegaC{0.0}, omegaF{0.0}; real a0, ax, ay, az, axx, ayy, azz, axy, axz, ayz, b0, bx, by, bz, bxx, byy, bzz, bxy, bxz, byz, c0, cx, cy, cz, cxx, cyy, czz, cxy, cxz, cyz, axyz, bxyz, cxyz; @@ -64,12 +64,12 @@ private: }; ////////////////////////////////////////////////////////////////////////// -inline void IncompressibleOffsetInterpolationProcessor::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) +inline void IncompressibleOffsetInterpolator::interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF) { this->interpolateCoarseToFine(icellC, icellF, 0.0, 0.0, 0.0); } ////////////////////////////////////////////////////////////////////////// -inline void IncompressibleOffsetInterpolationProcessor::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) +inline void IncompressibleOffsetInterpolator::interpolateFineToCoarse(D3Q27ICell& icellF, real* icellC) { this->interpolateFineToCoarse(icellF, icellC, 0.0, 0.0, 0.0); } diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp b/src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.cpp similarity index 73% rename from src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.cpp index a82f397c9f89d7605d8409b8f32f8d87a8f8a402..f28b1efed4836ca71b09a390078dd2aaf5463710 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.cpp @@ -1,11 +1,22 @@ -#include "InterpolationProcessor.h" +#include "Interpolator.h" + + +struct Range +{ + Range(int maxX1, int maxX2, int maxX3) : m_maxX1(maxX1), m_maxX2(maxX2), m_maxX3(maxX3) {} + inline bool operator()(int x1, int x2, int x3) + { + return x1 >= 0 && x1 < m_maxX1 && x2 >= 0 && x2 < m_maxX2 && x3 >= 0 && x3 < m_maxX3; + } + + int m_maxX1; + int m_maxX2; + int m_maxX3; +}; + ////////////////////////////////////////////////////////////////////////// -InterpolationProcessor::InterpolationProcessor() = default; -////////////////////////////////////////////////////////////////////////// -InterpolationProcessor::~InterpolationProcessor() = default; -////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::readICell(SPtr<DistributionArray3D> f, D3Q27ICell &icell, int x1, int x2, int x3) +void Interpolator::readICell(SPtr<DistributionArray3D> f, D3Q27ICell &icell, int x1, int x2, int x3) { f->getDistribution(icell.BSW, x1, x2, x3); f->getDistribution(icell.BSE, x1 + 1, x2, x3); @@ -17,7 +28,7 @@ void InterpolationProcessor::readICell(SPtr<DistributionArray3D> f, D3Q27ICell & f->getDistribution(icell.TNE, x1 + 1, x2 + 1, x3 + 1); } ////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3) +void Interpolator::writeICell(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3) { f->setDistribution(icell.BSW, x1, x2, x3); f->setDistribution(icell.BSE, x1 + 1, x2, x3); @@ -29,7 +40,7 @@ void InterpolationProcessor::writeICell(SPtr<DistributionArray3D> f, const D3Q27 f->setDistribution(icell.TNE, x1 + 1, x2 + 1, x3 + 1); } ////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3) +void Interpolator::writeICellInv(SPtr<DistributionArray3D> f, const D3Q27ICell &icell, int x1, int x2, int x3) { f->setDistributionInv(icell.BSW, x1, x2, x3); f->setDistributionInv(icell.BSE, x1 + 1, x2, x3); @@ -41,18 +52,18 @@ void InterpolationProcessor::writeICellInv(SPtr<DistributionArray3D> f, const D3 f->setDistributionInv(icell.TNE, x1 + 1, x2 + 1, x3 + 1); } ////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeINode(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, int x3) +void Interpolator::writeINode(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, int x3) { f->setDistribution(inode, x1, x2, x3); } ////////////////////////////////////////////////////////////////////////// -void InterpolationProcessor::writeINodeInv(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, +void Interpolator::writeINodeInv(SPtr<DistributionArray3D> f, const real *const inode, int x1, int x2, int x3) { f->setDistributionInv(inode, x1, x2, x3); } ////////////////////////////////////////////////////////////////////////// -bool InterpolationProcessor::iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) +bool Interpolator::iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) { for (int ix3 = x3; ix3 <= x3 + 1; ix3++) for (int ix2 = x2; ix2 <= x2 + 1; ix2++) @@ -63,13 +74,12 @@ bool InterpolationProcessor::iCellHasSolid(const SPtr<BCArray3D> bcArray, int x1 return false; } ////////////////////////////////////////////////////////////////////////// -bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, +bool Interpolator::findNeighborICell(const SPtr<BCArray3D> bcArray, SPtr<DistributionArray3D> f, D3Q27ICell &icell, int maxX1, int maxX2, int maxX3, int x1, int x2, int x3, real &xoff, real &yoff, real &zoff) { - m_maxX1 = maxX1; - m_maxX2 = maxX2; - m_maxX3 = maxX3; + + Range inRange(maxX1, maxX2, maxX3); // GoWest if (inRange(x1 - 1, x2, x3) && !iCellHasSolid(bcArray, x1 - 1, x2, x3)) { @@ -80,7 +90,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP } // GoEast else if (inRange(x1 + 2, x2, x3) && - !iCellHasSolid(bcArray, x1 + 1, x2, x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + !iCellHasSolid(bcArray, x1 + 1, x2, x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2, x3); xoff = -1; @@ -96,7 +106,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP } // GoNorth else if (inRange(x1, x2 + 2, x3) && - !iCellHasSolid(bcArray, x1, x2 + 1, x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + !iCellHasSolid(bcArray, x1, x2 + 1, x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1, x2 + 1, x3); xoff = 0; @@ -112,7 +122,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP } // GoTop else if (inRange(x1, x2, x3 + 2) && - !iCellHasSolid(bcArray, x1, x2, x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + !iCellHasSolid(bcArray, x1, x2, x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1, x2, x3 + 1); xoff = 0; @@ -122,7 +132,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoNW else if (inRange(x1 - 1, x2 + 2, x3) && !iCellHasSolid(bcArray, x1 - 1, x2 + 1, - x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 + 1, x3); xoff = 1; @@ -132,7 +142,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoNE else if (inRange(x1 + 2, x2 + 2, x3) && !iCellHasSolid(bcArray, x1 + 1, x2 + 1, - x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 + 1, x3); xoff = -1; @@ -142,7 +152,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoSW else if (inRange(x1 - 1, x2 - 1, x3) && !iCellHasSolid(bcArray, x1 - 1, x2 - 1, - x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 - 1, x3); xoff = 1; @@ -152,7 +162,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoSE else if (inRange(x1 + 2, x2 - 1, x3) && !iCellHasSolid(bcArray, x1 + 1, x2 - 1, - x3)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 - 1, x3); xoff = -1; @@ -169,7 +179,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBE else if (inRange(x1 + 2, x2, x3 - 1) && !iCellHasSolid(bcArray, x1 + 1, x2, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2, x3 - 1); xoff = -1; @@ -186,7 +196,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBN else if (inRange(x1, x2 + 2, x3 - 1) && !iCellHasSolid(bcArray, x1, x2 + 1, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1, x2 + 1, x3 - 1); xoff = 0; @@ -203,7 +213,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTE else if (inRange(x1 + 2, x2, x3 + 2) && !iCellHasSolid(bcArray, x1 + 1, x2, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2, x3 + 1); xoff = -1; @@ -220,7 +230,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTN else if (inRange(x1, x2 + 2, x3 + 2) && !iCellHasSolid(bcArray, x1, x2 + 1, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1, x2 + 1, x3 + 1); xoff = 0; @@ -230,7 +240,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTNW else if (inRange(x1 - 1, x2 + 2, x3 + 2) && !iCellHasSolid(bcArray, x1 - 1, x2 + 1, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 + 1, x3 + 1); xoff = 1; @@ -240,7 +250,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTNE else if (inRange(x1 + 2, x2 + 2, x3 + 2) && !iCellHasSolid(bcArray, x1 + 1, x2 + 1, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 + 1, x3 + 1); xoff = -1; @@ -250,7 +260,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTSE else if (inRange(x1 + 2, x2 - 1, x3 + 2) && !iCellHasSolid(bcArray, x1 + 1, x2 - 1, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 - 1, x3 + 1); xoff = -1; @@ -260,7 +270,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoTSW else if (inRange(x1 - 1, x2 - 1, x3 + 2) && !iCellHasSolid(bcArray, x1 - 1, x2 - 1, - x3 + 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 + 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 - 1, x3 + 1); xoff = 1; @@ -270,7 +280,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBNW else if (inRange(x1 - 1, x2 + 2, x3 - 1) && !iCellHasSolid(bcArray, x1 - 1, x2 + 1, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 + 1, x3 - 1); xoff = 1; @@ -280,7 +290,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBNE else if (inRange(x1 + 2, x2 + 2, x3 - 1) && !iCellHasSolid(bcArray, x1 + 1, x2 + 1, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 + 1, x3 - 1); xoff = -1; @@ -290,7 +300,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBSE else if (inRange(x1 + 2, x2 - 1, x3 - 1) && !iCellHasSolid(bcArray, x1 + 1, x2 - 1, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 + 1, x2 - 1, x3 - 1); xoff = -1; @@ -300,7 +310,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP // GoBSW else if (inRange(x1 - 1, x2 - 1, x3 - 1) && !iCellHasSolid(bcArray, x1 - 1, x2 - 1, - x3 - 1)) // ist �bern�chster Knoten auch im Gebiet (Grundknoten bei 0,0,0 + x3 - 1)) // is next but one node in area (base node at 0,0,0) { readICell(f, icell, x1 - 1, x2 - 1, x3 - 1); xoff = 1; @@ -320,7 +330,7 @@ bool InterpolationProcessor::findNeighborICell(const SPtr<BCArray3D> bcArray, SP return true; } ////////////////////////////////////////////////////////////////////////// -int InterpolationProcessor::iCellHowManySolids(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) +int Interpolator::iCellHowManySolids(const SPtr<BCArray3D> bcArray, int x1, int x2, int x3) { int count = 0; for (int ix3 = x3; ix3 <= x3 + 1; ix3++) diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h b/src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.h similarity index 75% rename from src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h rename to src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.h index f298a531b61ca4c4d9ddffc6e2dfeab535be0aa1..81a0d7a363b73a01f079c412b2fd97765841d939 100644 --- a/src/cpu/VirtualFluidsCore/LBM/InterpolationProcessor.h +++ b/src/cpu/VirtualFluidsCore/LBM/Interpolation/Interpolator.h @@ -1,5 +1,7 @@ -#ifndef INTERPOLATIONPROCESSOR_H -#define INTERPOLATIONPROCESSOR_H +#ifndef CPU_INTERPOLATER_H +#define CPU_INTERPOLATER_H + +#include <memory> #include "BCArray3D.h" #include "BoundaryConditions.h" @@ -17,17 +19,16 @@ struct D3Q27ICell { real BSE[27]; }; -class InterpolationProcessor; -using InterpolationProcessorPtr = SPtr<InterpolationProcessor>; +class Interpolator; +using InterpolationProcessorPtr = std::shared_ptr<Interpolator>; -#include "InterpolationHelper.h" -class InterpolationProcessor +class Interpolator { public: - InterpolationProcessor(); - virtual ~InterpolationProcessor(); - virtual InterpolationProcessorPtr clone() = 0; + virtual ~Interpolator() = default; + virtual InterpolationProcessorPtr clone() = 0; + virtual void setOmegas(real omegaC, real omegaF) = 0; virtual void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF) = 0; virtual void interpolateCoarseToFine(D3Q27ICell &icellC, D3Q27ICell &icellF, real xoff, real yoff, @@ -52,21 +53,9 @@ protected: virtual void calcInterpolatedNodeFC(real *f, real omega) {} virtual void calcInterpolatedVelocity(real x, real y, real z, real &vx1, real &vx2, real &vx3) {} virtual void calcInterpolatedShearStress(real x, real y, real z, real &tauxx, real &tauyy, - real &tauzz, real &tauxy, real &tauxz, real &tauyz) - { - } + real &tauzz, real &tauxy, real &tauxz, real &tauyz) {} virtual void setOffsets(real xoff, real yoff, real zoff) {} - friend class InterpolationHelper; -private: - bool inRange(int x1, int x2, int x3); - int m_maxX1, m_maxX2, m_maxX3; }; -////////////////////////////////////////////////////////////////////////// -inline bool InterpolationProcessor::inRange(int x1, int x2, int x3) -{ - return x1 >= 0 && x1 < m_maxX1 && x2 >= 0 && x2 < m_maxX2 && x3 >= 0 && x3 < m_maxX3; -} - #endif diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp deleted file mode 100644 index f4b54988b4c3c20928f93359b22d74cf671c03e6..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "InterpolationHelper.h" - -InterpolationHelper::InterpolationHelper(InterpolationProcessorPtr iProcessor) : iProcessor(iProcessor) {} -////////////////////////////////////////////////////////////////////////// -InterpolationHelper::~InterpolationHelper() = default; -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1(D3Q27ICell &icellF, real *icellC, real /*x1*/, real /*x2*/, - real /*x3*/, real omega) -{ - iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c1o1); - iProcessor->calcInterpolatedNodeFC(icellC, omega); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1WithVelocity(D3Q27ICell &icellF, real x1, real x2, real x3, - real omega, real &vx1, real &vx2, real &vx3) -{ - iProcessor->setOffsets(vf::basics::constant::c0o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c0o1); - iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); -} -////////////////////////////////////////////////////////////////////////// -void InterpolationHelper::interpolate8to1WithVelocityWithShearStress(D3Q27ICell &icellF, real x1, real x2, - real x3, real omega, real &vx1, - real &vx2, real &vx3, real &tauxx, - real &tauyy, real &tauzz, real &tauxy, - real &tauxz, real &tauyz) -{ - iProcessor->setOffsets(vf::basics::constant::c0o1, vf::basics::constant::c0o1, vf::basics::constant::c0o1); - iProcessor->calcInterpolatedCoefficiets(icellF, omega, vf::basics::constant::c0o1); - iProcessor->calcInterpolatedVelocity(x1, x2, x3, vx1, vx2, vx3); - iProcessor->calcInterpolatedShearStress(x1, x2, x3, tauxx, tauyy, tauzz, tauxy, tauxz, tauyz); -} - -////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h b/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h deleted file mode 100644 index b67e8d18ac5c54c775c098aad484d4b5657a917b..0000000000000000000000000000000000000000 --- a/src/cpu/VirtualFluidsCore/LBM/InterpolationHelper.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef D3Q27InterpolationHelper_H_ -#define D3Q27InterpolationHelper_H_ - -#include "InterpolationProcessor.h" - -class InterpolationHelper; -using InterpolationHelperPtr = SPtr<InterpolationHelper>; - -class InterpolationHelper -{ -public: - InterpolationHelper(InterpolationProcessorPtr iProcessor); - ~InterpolationHelper(); - void interpolate8to1(D3Q27ICell &icellF, real *icellC, real x1, real x2, real x3, real omega); - void interpolate8to1WithVelocity(D3Q27ICell &icellF, real x1, real x2, real x3, real omega, real &vx1, - real &vx2, real &vx3); - void interpolate8to1WithVelocityWithShearStress(D3Q27ICell &icellF, real x1, real x2, real x3, real omega, - real &vx1, real &vx2, real &vx3, real &tauxx, - real &tauyy, real &tauzz, real &tauxy, real &tauxz, - real &tauyz); - -protected: -private: - InterpolationProcessorPtr iProcessor; -}; - -#endif diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp index 7a86aaa19ea0f6ae170e4543c27c7cede7a859b4..3b817afff909e587ac4f35c9184076339bde9b2b 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp @@ -234,8 +234,12 @@ real LBMKernel::getPhaseFieldRelaxation() const { return tauH; } ////////////////////////////////////////////////////////////////////////// void LBMKernel::setMobility(real mob) { this->mob = mob; } ////////////////////////////////////////////////////////////////////////// +real LBMKernel::getMobility() const { return mob; } +////////////////////////////////////////////////////////////////////////// void LBMKernel::setInterfaceWidth(real w) { this->interfaceWidth = w; } ////////////////////////////////////////////////////////////////////////// +real LBMKernel::getInterfaceWidth() const { return interfaceWidth; } +////////////////////////////////////////////////////////////////////////// void LBMKernel::setSigma(real sigma){ this->sigma = sigma;} ////////////////////////////////////////////////////////////////////////// real LBMKernel::getSigma() const { return sigma;} diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index fe397429610c6c76e6502a9956584b1cdd05f1cd..74906998dfdbc06536387adfc7f155bbe677368e 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -128,7 +128,9 @@ public: void setPhaseFieldRelaxation(real tauH); real getPhaseFieldRelaxation() const; void setMobility(real mob); + real getMobility() const; void setInterfaceWidth(real w); + real getInterfaceWidth() const; void setSigma(real sigma); real getSigma() const; diff --git a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp index eef54a8625147046c2d8f38e2207e2fe2d20e325..718267be635c95e53d4cd1076e2cefee90fc492b 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp +++ b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.cpp @@ -1,3 +1,3 @@ #include "BlocksDistributor.h" -BlocksDistributor::BlocksDistributor(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm) : grid(grid), comm(comm) {} +BlocksDistributor::BlocksDistributor(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm) : grid(grid), comm(comm) {} diff --git a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h index 85aa52d05e0dd215ac93ca4bb08cc057f84914d0..7db87d0885f53b9651f401f9cbf9502b606efd68 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h +++ b/src/cpu/VirtualFluidsCore/Parallel/BlocksDistributor.h @@ -1,7 +1,7 @@ #ifndef BlocksDistributor_H #define BlocksDistributor_H -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include <PointerDefinitions.h> @@ -9,13 +9,13 @@ class BlocksDistributor { public: - BlocksDistributor(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm); + BlocksDistributor(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm); ~BlocksDistributor(); protected: private: SPtr<Grid3D> grid; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h index e84d4b7cd7e205c5403e57b4f9a737e8007e2ee2..dd5b9935a99e6ad1da05cb48a18b0c5ef12090ac 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h +++ b/src/cpu/VirtualFluidsCore/Parallel/MPIIODataStructures.h @@ -9,8 +9,8 @@ namespace MPIIODataStructures //! \brief Structure describes parameters of the grid //! \details The structure is nessasary to restore the grid correctly struct GridParam { - real trafoParams[33]; - real deltaX; + double trafoParams[33]; // not float!!! + double deltaX; // not float!!! int blockNx1; int blockNx2; int blockNx3; @@ -59,11 +59,11 @@ struct dataSetParam { //! \brief Structure describes parameters of the dataSet in MPIIORestartSimulationObserver format //! \details The structure is used when reading from the file struct DataSetRestart { - real collFactor; - real deltaT; - real collFactorL; // for Multiphase model - real collFactorG; // for Multiphase model - real densityRatio;// for Multiphase model + double collFactor; // not float!!! + double deltaT; // not float!!! + double collFactorL; // for Multiphase model // not float!!! + double collFactorG; // for Multiphase model // not float!!! + double densityRatio;// for Multiphase model // not float!!! int x1; int x2; int x3; @@ -77,11 +77,11 @@ struct DataSetRestart { //! \brief Structure describes parameters of the dataSet in MPIIOMigrationSimulationObserver format //! \details The structure is used to find the needed block in the grid when restoring a dataSet struct DataSetMigration { - real collFactor; - real deltaT; - real collFactorL; // for Multiphase model - real collFactorG; // for Multiphase model - real densityRatio;// for Multiphase model + double collFactor; // not float!!! + double deltaT; // not float!!! + double collFactorL; // for Multiphase model + double collFactorG; // for Multiphase model + double densityRatio;// for Multiphase model int globalID; int ghostLayerWidth; bool compressible; @@ -115,14 +115,14 @@ struct BoundaryCondition { long long densityBoundaryFlags; long long wallModelBoundaryFlags; - real bcVelocityX1; - real bcVelocityX2; - real bcVelocityX3; - real bcDensity; - real bcPhaseField; + float bcVelocityX1; // not double!!! + float bcVelocityX2; // not double!!! + float bcVelocityX3; // not double!!! + float bcDensity; // not double!!! + float bcPhaseField; // not double!!! - real nx1, nx2, nx3; - real q[26]; + float nx1, nx2, nx3; // not double!!! + float q[26]; // not double!!! char algorithmType; }; diff --git a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp index 51d74e3bf1b5d5109904e1fa581bcff366fad505..a2da1904ecbfda60be9139aa9ded1cb1b5efc15f 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp +++ b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.cpp @@ -17,8 +17,6 @@ MetisPartitioner::MetisPartitioner() // options[METIS_OPTION_IPTYPE] = METIS_IPTYPE_GROW; } ////////////////////////////////////////////////////////////////////////// -MetisPartitioner::~MetisPartitioner() = default; -////////////////////////////////////////////////////////////////////////// idx_t *MetisPartitioner::getMetisOptions() { return options; } void MetisPartitioner::setMetisOptions(int option, idx_t value) { options[option] = value; } ////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h index 8fd7a82d52e1ac4c7199d5b2e1a1cbe43ea25369..18e222760bf4a0c93db17ea6fa96a6afdf7f3313 100644 --- a/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h +++ b/src/cpu/VirtualFluidsCore/Parallel/MetisPartitioner.h @@ -10,7 +10,6 @@ #if defined VF_METIS -#include "basics/utilities/UbLogger.h" #include "basics/utilities/UbSystem.h" #include "metis.h" #include <PointerDefinitions.h> @@ -24,7 +23,6 @@ public: public: MetisPartitioner(); - virtual ~MetisPartitioner(); idx_t *getMetisOptions(); void setMetisOptions(int option, idx_t value); int partition(int nofParts, PartType ptype); @@ -47,9 +45,9 @@ public: real_t * ubvec; // This is an array of size ncon that specifies the allowed load imbalance tolerance for each constraint. // For the ith partition and jth constraint the allowed weight is the ubvec[j]*tpwgts[i*ncon+j] fraction - // of the jth’s constraint total weight. The load imbalances must be greater than 1.0. + // of the jths constraint total weight. The load imbalances must be greater than 1.0. // A NULL value can be passed indicating that the load imbalance tolerance for each constraint should - // be 1.001 (for ncon=1) or 1.01 (for ncon¿1). + // be 1.001 (for ncon=1) or 1.01 (for ncon1). std::vector<idx_t> part; // This is a vector of size n that upon successful completion stores the partition vector of the graph. diff --git a/src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp index a214b4bd0137b2bf319925b519f1dcb77fabded4..2cf8a4824c6d7f30bb2b1593ba96da3d952924ad 100644 --- a/src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp +++ b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.cpp @@ -51,7 +51,7 @@ using namespace std; Grid3D::Grid3D() { levelSet.resize(D3Q27System::MAXLEVEL + 1); } ////////////////////////////////////////////////////////////////////////// -Grid3D::Grid3D(std::shared_ptr<vf::mpi::Communicator> comm) +Grid3D::Grid3D(std::shared_ptr<vf::parallel::Communicator> comm) { levelSet.resize(D3Q27System::MAXLEVEL + 1); @@ -59,15 +59,17 @@ Grid3D::Grid3D(std::shared_ptr<vf::mpi::Communicator> comm) rank = comm->getProcessID(); } ////////////////////////////////////////////////////////////////////////// -Grid3D::Grid3D(std::shared_ptr<vf::mpi::Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3) +Grid3D::Grid3D(std::shared_ptr<vf::parallel::Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3) : blockNx1(blockNx1), blockNx2(blockNx2), blockNx3(blockNx2), nx1(gridNx1), nx2(gridNx2), nx3(gridNx3) { + using namespace vf::basics::constant; + levelSet.resize(D3Q27System::MAXLEVEL + 1); bundle = comm->getBundleID(); rank = comm->getProcessID(); - trafo = std::make_shared<CoordinateTransformation3D>(0.0, 0.0, 0.0, (real)blockNx1, (real)blockNx2, + trafo = std::make_shared<CoordinateTransformation3D>(c0o1, c0o1, c0o1, (real)blockNx1, (real)blockNx2, (real)blockNx3); UbTupleInt3 minInd(0, 0, 0); UbTupleInt3 maxInd(gridNx1, gridNx2, gridNx3); @@ -481,7 +483,8 @@ UbTupleDouble3 Grid3D::getBlockLengths(const SPtr<Block3D> block) const trafo->getX3CoordinateScaling() * delta); } ////////////////////////////////////////////////////////////////////////// -UbTupleDouble6 Grid3D::getBlockOversize() const { return makeUbTuple(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); } +using namespace vf::basics::constant; +UbTupleDouble6 Grid3D::getBlockOversize() const { return makeUbTuple(c0o1, c0o1, c0o1, c0o1, c0o1, c0o1); } ////////////////////////////////////////////////////////////////////////// void Grid3D::setCoordinateTransformator(SPtr<CoordinateTransformation3D> trafo) { this->trafo = trafo; } ////////////////////////////////////////////////////////////////////////// @@ -2233,7 +2236,7 @@ int Grid3D::getGhostLayerWidth() const ////////////////////////////////////////////////////////////////////////// void Grid3D::setGhostLayerWidth(int ghostLayerWidth) { - this->offset = static_cast<real>(ghostLayerWidth) - 0.5; + this->offset = static_cast<real>(ghostLayerWidth) - c1o2; } ////////////////////////////////////////////////////////////////////////// void Grid3D::setTimeStep(real step) { timeStep = step; } @@ -2314,7 +2317,7 @@ void Grid3D::renumberBlockIDs() ////////////////////////////////////////////////////////////////////////// -void Grid3D::updateDistributedBlocks(std::shared_ptr<vf::mpi::Communicator> comm) +void Grid3D::updateDistributedBlocks(std::shared_ptr<vf::parallel::Communicator> comm) { std::vector<int> blocks; diff --git a/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h index 821adff473961fafa00be08ca2cf8e2339353b51..50f3ac53a27ca634f6a27a06f5af2ad1a5208884 100644 --- a/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h +++ b/src/cpu/VirtualFluidsCore/Simulation/Grid3D.h @@ -48,7 +48,7 @@ class CoordinateTransformation3D; #include <Block3DVisitor.h> #include <Grid3DVisitor.h> -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Block3D; class Interactor3D; @@ -65,8 +65,8 @@ public: public: Grid3D(); - Grid3D(std::shared_ptr<vf::mpi::Communicator> comm); - Grid3D(std::shared_ptr<vf::mpi::Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3); + Grid3D(std::shared_ptr<vf::parallel::Communicator> comm); + Grid3D(std::shared_ptr<vf::parallel::Communicator> comm, int blockNx1, int blockNx2, int blockNx3, int gridNx1, int gridNx2, int gridNx3); virtual ~Grid3D() = default; ////////////////////////////////////////////////////////////////////////// // blocks control @@ -95,7 +95,7 @@ public: BlockIDMap &getBlockIDs(); void deleteBlockIDs(); void renumberBlockIDs(); - void updateDistributedBlocks(std::shared_ptr<vf::mpi::Communicator> comm); + void updateDistributedBlocks(std::shared_ptr<vf::parallel::Communicator> comm); SPtr<Block3D> getSuperBlock(SPtr<Block3D> block); SPtr<Block3D> getSuperBlock(int ix1, int ix2, int ix3, int level); void getSubBlocks(SPtr<Block3D> block, int levelDepth, std::vector<SPtr<Block3D>> &blocks); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp index 2254b9b02ea383e18c654a7569f0e5b2e973c839..d062f8395ed5d3c26867ef2fc0c1bac1e5f7e7f3 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.cpp @@ -6,7 +6,7 @@ #include <fstream> -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "IntegrateValuesHelper.h" #include "UbScheduler.h" @@ -14,29 +14,31 @@ AdjustForcingSimulationObserver::AdjustForcingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> integrateValues, real vTarged, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), integrateValues(integrateValues), comm(comm), vx1Targed(vTarged) { + using namespace vf::basics::constant; + // cnodes = integrateValues->getCNodes(); root = comm->isRoot(); Ta = scheduler->getMaxStep(); - Kpcrit = 3.0 / Ta; // 0.3; - Tcrit = 3.0 * Ta; // 30.0; - Tn = 0.5 * Tcrit; - Tv = 0.12 * Tcrit; + Kpcrit = c3o1 / Ta; // 0.3; + Tcrit = c3o1 * Ta; // 30.0; + Tn = c1o2 * Tcrit; + Tv = c12o1 / c100o1 * Tcrit; - Kp = 0.6 * Kpcrit; + Kp = c6o1 / c10o1 * Kpcrit; Ki = Kp / Tn; Kd = Kp * Tv; - y = 0; - e = 0; - esum = 0; - eold = 0; - forcing = 0; + y = c0o1; + e = c0o1; + esum = c0o1; + eold = c0o1; + forcing = c0o1; if (root) { std::string fname = path + "/forcing/forcing.csv"; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h index 9e570e34dc43fa025c47c3d3c29c0dad4a262b99..13f88c71162efcca53b913891955b6216b3c943f 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AdjustForcingSimulationObserver.h @@ -7,7 +7,7 @@ #include "SimulationObserver.h" #include "lbm/constants/D3Q27.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class UbScheduler; class Grid3D; class IntegrateValuesHelper; @@ -22,7 +22,7 @@ class AdjustForcingSimulationObserver : public SimulationObserver { public: AdjustForcingSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<IntegrateValuesHelper> integrateValues, real vTarged, std::shared_ptr<vf::mpi::Communicator> comm); + SPtr<IntegrateValuesHelper> integrateValues, real vTarged, std::shared_ptr<vf::parallel::Communicator> comm); //!< calls collect PostprocessData void update(real step) override; @@ -31,7 +31,7 @@ protected: SPtr<IntegrateValuesHelper> integrateValues; //!< compares velocity in integrateValues with target velocity and adjusts forcing accordingly. void collectData(real step); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; private: real vx1Targed; //!< target velocity. diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp index 1adf3ad9944a49c8065756988e95ab837e9f6d15..3724569eb1acd4a96076205a07a7ae393e4924dc 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/AverageValuesSimulationObserver.cpp @@ -7,7 +7,7 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "UbScheduler.h" @@ -78,6 +78,8 @@ void AverageValuesSimulationObserver::update(real step) void AverageValuesSimulationObserver::resetDataRMS(real step) { + using namespace vf::basics::constant; + resetStepRMS = (int)step; for (int level = minInitLevel; level <= maxInitLevel; level++) { @@ -103,13 +105,13 @@ void AverageValuesSimulationObserver::resetDataRMS(real step) ////////////////////////////////////////////////////////////////////////// // compute average values ////////////////////////////////////////////////////////////////////////// - (*av)(AvVxx, ix1, ix2, ix3) = 0.0; - (*av)(AvVyy, ix1, ix2, ix3) = 0.0; - (*av)(AvVzz, ix1, ix2, ix3) = 0.0; - (*av)(AvVxy, ix1, ix2, ix3) = 0.0; - (*av)(AvVxz, ix1, ix2, ix3) = 0.0; - (*av)(AvVyz, ix1, ix2, ix3) = 0.0; - (*av)(AvPrms, ix1, ix2, ix3) = 0.0; + (*av)(AvVxx, ix1, ix2, ix3) = c0o1; + (*av)(AvVyy, ix1, ix2, ix3) = c0o1; + (*av)(AvVzz, ix1, ix2, ix3) = c0o1; + (*av)(AvVxy, ix1, ix2, ix3) = c0o1; + (*av)(AvVxz, ix1, ix2, ix3) = c0o1; + (*av)(AvVyz, ix1, ix2, ix3) = c0o1; + (*av)(AvPrms, ix1, ix2, ix3) = c0o1; ////////////////////////////////////////////////////////////////////////// } } @@ -122,6 +124,8 @@ void AverageValuesSimulationObserver::resetDataRMS(real step) ////////////////////////////////////////////////////////////////////////// void AverageValuesSimulationObserver::resetDataMeans(real step) { + using namespace vf::basics::constant; + resetStepMeans = (int)step; for (int level = minInitLevel; level <= maxInitLevel; level++) { @@ -147,10 +151,10 @@ void AverageValuesSimulationObserver::resetDataMeans(real step) ////////////////////////////////////////////////////////////////////////// // compute average values ////////////////////////////////////////////////////////////////////////// - (*av)(AvVx, ix1, ix2, ix3) = 0.0; - (*av)(AvVy, ix1, ix2, ix3) = 0.0; - (*av)(AvVz, ix1, ix2, ix3) = 0.0; - (*av)(AvP, ix1, ix2, ix3) = 0.0; + (*av)(AvVx, ix1, ix2, ix3) = c0o1; + (*av)(AvVy, ix1, ix2, ix3) = c0o1; + (*av)(AvVz, ix1, ix2, ix3) = c0o1; + (*av)(AvP, ix1, ix2, ix3) = c0o1; ////////////////////////////////////////////////////////////////////////// } } @@ -185,7 +189,7 @@ void AverageValuesSimulationObserver::collectData(real step) piece = subfolder + "/" + piece; vector<string> cellDataNames; - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); vector<string> pieces = comm->gather(piece); if (comm->getProcessID() == comm->getRoot()) { string pname = @@ -333,6 +337,7 @@ void AverageValuesSimulationObserver::addData(const SPtr<Block3D> block) void AverageValuesSimulationObserver::calculateAverageValues(real timeStep) { using namespace D3Q27System; + using namespace vf::basics::constant; // Funktionszeiger calcMacros = NULL; @@ -391,50 +396,50 @@ void AverageValuesSimulationObserver::calculateAverageValues(real timeStep) // mean velocity (*av)(AvVx, ix1, ix2, ix3) = ((*av)(AvVx, ix1, ix2, ix3) * timeStepAfterResetMeans + vx) / - (timeStepAfterResetMeans + 1.0); + (timeStepAfterResetMeans + c1o1); (*av)(AvVy, ix1, ix2, ix3) = ((*av)(AvVy, ix1, ix2, ix3) * timeStepAfterResetMeans + vy) / - (timeStepAfterResetMeans + 1.0); + (timeStepAfterResetMeans + c1o1); (*av)(AvVz, ix1, ix2, ix3) = ((*av)(AvVz, ix1, ix2, ix3) * timeStepAfterResetMeans + vz) / - (timeStepAfterResetMeans + 1.0); + (timeStepAfterResetMeans + c1o1); // rms (*av)(AvVxx, ix1, ix2, ix3) = ((vx - (*av)(AvVx, ix1, ix2, ix3)) * (vx - (*av)(AvVx, ix1, ix2, ix3)) + (*av)(AvVxx, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); (*av)(AvVyy, ix1, ix2, ix3) = ((vy - (*av)(AvVy, ix1, ix2, ix3)) * (vy - (*av)(AvVy, ix1, ix2, ix3)) + (*av)(AvVyy, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); (*av)(AvVzz, ix1, ix2, ix3) = ((vz - (*av)(AvVz, ix1, ix2, ix3)) * (vz - (*av)(AvVz, ix1, ix2, ix3)) + (*av)(AvVzz, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); // cross-correlations (*av)(AvVxy, ix1, ix2, ix3) = ((vx - (*av)(AvVx, ix1, ix2, ix3)) * (vy - (*av)(AvVy, ix1, ix2, ix3)) + (*av)(AvVxy, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); (*av)(AvVxz, ix1, ix2, ix3) = ((vx - (*av)(AvVx, ix1, ix2, ix3)) * (vz - (*av)(AvVz, ix1, ix2, ix3)) + (*av)(AvVxz, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); (*av)(AvVyz, ix1, ix2, ix3) = ((vy - (*av)(AvVy, ix1, ix2, ix3)) * (vz - (*av)(AvVz, ix1, ix2, ix3)) + (*av)(AvVyz, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); // mean and rms press (*av)(AvP, ix1, ix2, ix3) = ((*av)(AvP, ix1, ix2, ix3) * timeStepAfterResetMeans + press) / - (timeStepAfterResetMeans + 1.0); + (timeStepAfterResetMeans + c1o1); (*av)(AvPrms, ix1, ix2, ix3) = ((press - (*av)(AvP, ix1, ix2, ix3)) * (press - (*av)(AvP, ix1, ix2, ix3)) + (*av)(AvPrms, ix1, ix2, ix3) * timeStepAfterResetRMS) / - (timeStepAfterResetRMS + 1.0); + (timeStepAfterResetRMS + c1o1); ////////////////////////////////////////////////////////////////////////// } @@ -448,7 +453,7 @@ void AverageValuesSimulationObserver::calculateAverageValues(real timeStep) //////////////////////////////////////////////////////////////////////////// // void AverageValuesSimulationObserver::initPlotData(double step) //{ -// std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); +// std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); // if (comm->getProcessID() == comm->getRoot()) // { // std::ofstream ostr; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp index 8610c5df9e4b56496c3dc3ba1c25fabfd355f294..cfda41094095255a1b263a0f00ce607e8715bbab 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.cpp @@ -4,7 +4,7 @@ #include "BCArray3D.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "DataSet3D.h" #include "DistributionArray3D.h" @@ -14,7 +14,7 @@ #include "UbScheduler.h" CalculateForcesSimulationObserver::CalculateForcesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm, real v, real a) + std::shared_ptr<vf::parallel::Communicator> comm, real v, real a) : SimulationObserver(grid, s), path(path), comm(comm), v(v), a(a), forceX1global(0), forceX2global(0), forceX3global(0) { if (comm->getProcessID() == comm->getRoot()) { @@ -103,15 +103,17 @@ void CalculateForcesSimulationObserver::collectData(real step) ////////////////////////////////////////////////////////////////////////// void CalculateForcesSimulationObserver::calculateForces() { - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; + using namespace vf::basics::constant; + + forceX1global = c0o1; + forceX2global = c0o1; + forceX3global = c0o1; for (SPtr<D3Q27Interactor> interactor : interactors) { for (BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) { - real forceX1 = 0.0; - real forceX2 = 0.0; - real forceX3 = 0.0; + real forceX1 = c0o1; + real forceX2 = c0o1; + real forceX3 = c0o1; SPtr<Block3D> block = t.first; std::set<std::vector<int>> &transNodeIndicesSet = t.second; @@ -172,9 +174,9 @@ void CalculateForcesSimulationObserver::calculateForces() rvalues = comm->gather(values); if (comm->getProcessID() == comm->getRoot()) { - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; + forceX1global = c0o1; + forceX2global = c0o1; + forceX3global = c0o1; for (int i = 0; i < (int)rvalues.size(); i += 3) { forceX1global += rvalues[i]; @@ -187,7 +189,9 @@ void CalculateForcesSimulationObserver::calculateForces() UbTupleDouble3 CalculateForcesSimulationObserver::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) { - UbTupleDouble3 force(0.0, 0.0, 0.0); + using namespace vf::basics::constant; + + UbTupleDouble3 force(c0o1, c0o1, c0o1); if (bc) { // references to tuple "force" @@ -217,14 +221,16 @@ UbTupleDouble3 CalculateForcesSimulationObserver::getForces(int x1, int x2, int ////////////////////////////////////////////////////////////////////////// void CalculateForcesSimulationObserver::calculateCoefficients() { + using namespace vf::basics::constant; + real F1 = forceX1global; real F2 = forceX2global; real F3 = forceX3global; // return 2*F/(rho*v*v*a); - C1 = 2.0 * F1 / (v * v * a); - C2 = 2.0 * F2 / (v * v * a); - C3 = 2.0 * F3 / (v * v * a); + C1 = c2o1 * F1 / (v * v * a); + C2 = c2o1 * F2 / (v * v * a); + C3 = c2o1 * F3 / (v * v * a); } ////////////////////////////////////////////////////////////////////////// void CalculateForcesSimulationObserver::addInteractor(SPtr<D3Q27Interactor> interactor) { interactors.push_back(interactor); } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h index 02b76e77bc6bfb3ee375e79465f2d548226189cb..e1d376f4c6938b3874cd2a0eebedae294bd502b1 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateForcesSimulationObserver.h @@ -17,7 +17,7 @@ #include "lbm/constants/D3Q27.h" class ForceCalculator; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class D3Q27Interactor; @@ -30,7 +30,7 @@ public: //! Constructor //! \param v - velocity of fluid in LB units //! \param a - area of object in LB units - CalculateForcesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm, + CalculateForcesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm, real v, real a); ~CalculateForcesSimulationObserver() override; void update(real step) override; @@ -46,7 +46,7 @@ protected: private: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; std::vector<SPtr<D3Q27Interactor>> interactors; real forceX1global; real forceX2global; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp index 768fbbb26241edfe5771bf056b6b83be21b02312..01521d043986c3223b87096bcb4898cba1809438 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/CalculateTorqueSimulationObserver.cpp @@ -1,7 +1,7 @@ #include "NonNewtonianFluids/SimulationObservers/CalculateTorqueSimulationObserver.h" #include "BCSet.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "UbScheduler.h" #include "Grid3D.h" @@ -14,7 +14,7 @@ #include "DistributionArray3D.h" #include "NonNewtonianFluids/LBM/Rheology.h" -CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::mpi::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) +CalculateTorqueSimulationObserver::CalculateTorqueSimulationObserver( SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path_, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path_), comm(comm), torqueX1global(0), torqueX2global(0), torqueX3global(0) { if (comm->getProcessID() == comm->getRoot()) { @@ -82,9 +82,11 @@ void CalculateTorqueSimulationObserver::collectData( real step ) ////////////////////////////////////////////////////////////////////////// void CalculateTorqueSimulationObserver::calculateForces() { - torqueX1global = 0.0; - torqueX2global = 0.0; - torqueX3global = 0.0; + using namespace vf::basics::constant; + + torqueX1global = c0o1; + torqueX2global = c0o1; + torqueX3global = c0o1; for(SPtr<D3Q27Interactor> interactor : interactors) { @@ -94,9 +96,9 @@ void CalculateTorqueSimulationObserver::calculateForces() for(BcNodeIndicesMap::value_type t : interactor->getBcNodeIndicesMap()) { - real torqueX1 = 0.0; - real torqueX2 = 0.0; - real torqueX3 = 0.0; + real torqueX1 = c0o1; + real torqueX2 = c0o1; + real torqueX3 = c0o1; SPtr<Block3D> block = t.first; std::set< std::vector<int> >& transNodeIndicesSet = t.second; @@ -167,9 +169,9 @@ void CalculateTorqueSimulationObserver::calculateForces() rvalues = comm->gather(values); if (comm->getProcessID() == comm->getRoot()) { - torqueX1global = 0.0; - torqueX2global = 0.0; - torqueX3global = 0.0; + torqueX1global = c0o1; + torqueX2global = c0o1; + torqueX3global = c0o1; for (int i = 0; i < (int)rvalues.size(); i+=3) { @@ -182,7 +184,9 @@ void CalculateTorqueSimulationObserver::calculateForces() ////////////////////////////////////////////////////////////////////////// UbTupleDouble3 CalculateTorqueSimulationObserver::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc) { - UbTupleDouble3 force(0.0,0.0,0.0); + using namespace vf::basics::constant; + + UbTupleDouble3 force(c0o1,c0o1,c0o1); if(bc) { @@ -217,7 +221,7 @@ UbTupleDouble3 CalculateTorqueSimulationObserver::getForces(int x1, int x2, int UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromMoments(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) { using namespace vf::basics::constant; - UbTupleDouble3 force(0.0, 0.0, 0.0); + UbTupleDouble3 force(c0o1, c0o1, c0o1); if (bc) { @@ -252,7 +256,7 @@ UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromMoments(int x1, i UbTupleDouble3 CalculateTorqueSimulationObserver::getForcesFromStressTensor(int x1, int x2, int x3, SPtr<ILBMKernel> kernel, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, real nx, real ny, real nz) { using namespace vf::basics::constant; - UbTupleDouble3 force(0.0, 0.0, 0.0); + UbTupleDouble3 force(c0o1, c0o1, c0o1); if (bc) { real f[D3Q27System::ENDF + 1]; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp index 0754491767b55e2a6059c8eef160a94a1f087540..ffbfde51ce2d8100cc845364e31038180892f800 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.cpp @@ -10,13 +10,13 @@ #include <vector> #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "LBMKernel.h" #include "UbScheduler.h" DecreaseViscositySimulationObserver::DecreaseViscositySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), nueFunc(nueFunc), comm(comm) { diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h index 2e2c655d223619169e0f3edd3bfa554e924639e0..741b65783c2634d45f6d012f67e1f42283b22d9c 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/DecreaseViscositySimulationObserver.h @@ -11,7 +11,7 @@ class UbScheduler; class Grid3D; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} //! \brief The class sets viscosity/collision factor according to a previously defined function in time. //! \details initialization in test case (example): @@ -28,7 +28,7 @@ namespace vf::mpi {class Communicator;} class DecreaseViscositySimulationObserver : public SimulationObserver { public: - DecreaseViscositySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, std::shared_ptr<vf::mpi::Communicator> comm); + DecreaseViscositySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, mu::Parser *nueFunc, std::shared_ptr<vf::parallel::Communicator> comm); ~DecreaseViscositySimulationObserver() override; //! calls collect PostprocessData. void update(real step) override; @@ -36,7 +36,7 @@ public: protected: //! resets the collision factor depending on the current timestep. void setViscosity(real step); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; private: mutable mu::value_type timeStep; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp index a6826a713b45f74239c603d9a23b946169ac60d5..ea6287ff358bce160791c7ab16568a9cc4a989bb 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.cpp @@ -1,5 +1,5 @@ #include "EmergencyExitSimulationObserver.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "MPIIORestartSimulationObserver.h" #include "UbLogger.h" @@ -8,7 +8,7 @@ #include <basics/utilities/UbFileOutputASCII.h> EmergencyExitSimulationObserver::EmergencyExitSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::mpi::Communicator> comm) + SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), rp(rp), comm(comm) { this->path = path + "/exit"; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h index f4a8e79f6f8b89f1b4e37714f0c42d2be4be1810..f2757d8ed842f14d77b16b7d1aa2821e5a8b8d72 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/EmergencyExitSimulationObserver.h @@ -14,7 +14,7 @@ #include "SimulationObserver.h" class MPIIORestartSimulationObserver; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; @@ -22,7 +22,7 @@ class EmergencyExitSimulationObserver : public SimulationObserver { public: EmergencyExitSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::mpi::Communicator> comm); + SPtr<MPIIORestartSimulationObserver> rp, std::shared_ptr<vf::parallel::Communicator> comm); ~EmergencyExitSimulationObserver() override; void update(real step) override; @@ -35,7 +35,7 @@ protected: private: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; SPtr<MPIIORestartSimulationObserver> rp; std::string metafile; }; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp index 9a39ce11ed15e939e9fc32eaeb15d541675387aa..e3f0816589c4ef758f897b92c25d721ac8837abe 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.cpp @@ -4,13 +4,13 @@ #include "BCArray3D.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "DataSet3D.h" #include "DistributionArray3D.h" #include "LBMKernel.h" -ForceCalculator::ForceCalculator(std::shared_ptr<vf::mpi::Communicator> comm) +ForceCalculator::ForceCalculator(std::shared_ptr<vf::parallel::Communicator> comm) : comm(comm), forceX1global(0), forceX2global(0), forceX3global(0) { } @@ -20,9 +20,11 @@ ForceCalculator::~ForceCalculator() = default; Vector3D ForceCalculator::getForces(int x1, int x2, int x3, SPtr<DistributionArray3D> distributions, SPtr<BoundaryConditions> bc, const Vector3D &boundaryVelocity) const { - real forceX1 = 0; - real forceX2 = 0; - real forceX3 = 0; + using namespace vf::basics::constant; + + real forceX1 = c0o1; + real forceX2 = c0o1; + real forceX3 = c0o1; if (bc) { for (int fdir = D3Q27System::FSTARTDIR; fdir <= D3Q27System::FENDDIR; fdir++) { if (bc->hasNoSlipBoundaryFlag(fdir) || bc->hasVelocityBoundaryFlag(fdir)) { @@ -31,7 +33,7 @@ Vector3D ForceCalculator::getForces(int x1, int x2, int x3, SPtr<DistributionArr const real fnbr = distributions->getDistributionInvForDirection( x1 + D3Q27System::DX1[invDir], x2 + D3Q27System::DX2[invDir], x3 + D3Q27System::DX3[invDir], fdir); - real correction[3] = { 0.0, 0.0, 0.0 }; + real correction[3] = { c0o1, c0o1, c0o1 }; if (bc->hasVelocityBoundaryFlag(fdir)) { const real forceTerm = f - fnbr; correction[0] = forceTerm * boundaryVelocity[0]; @@ -54,15 +56,17 @@ Vector3D ForceCalculator::getForces(int x1, int x2, int x3, SPtr<DistributionArr void ForceCalculator::calculateForces(std::vector<SPtr<D3Q27Interactor>> interactors) { - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; + using namespace vf::basics::constant; + + forceX1global = c0o1; + forceX2global = c0o1; + forceX3global = c0o1; for (const auto &interactor : interactors) { for (const auto &t : interactor->getBcNodeIndicesMap()) { - real forceX1 = 0.0; - real forceX2 = 0.0; - real forceX3 = 0.0; + real forceX1 = c0o1; + real forceX2 = c0o1; + real forceX3 = c0o1; SPtr<Block3D> block = t.first; SPtr<ILBMKernel> kernel = block->getKernel(); @@ -104,6 +108,8 @@ void ForceCalculator::calculateForces(std::vector<SPtr<D3Q27Interactor>> interac void ForceCalculator::gatherGlobalForces() { + using namespace vf::basics::constant; + std::vector<real> values; // intel compiler 17 dasn't support this { forceX1global , forceX2global, forceX3global }; values.push_back(forceX1global); @@ -112,9 +118,9 @@ void ForceCalculator::gatherGlobalForces() std::vector<real> rvalues = comm->gather(values); if (comm->isRoot()) { - forceX1global = 0.0; - forceX2global = 0.0; - forceX3global = 0.0; + forceX1global = c0o1; + forceX2global = c0o1; + forceX3global = c0o1; for (int i = 0; i < (int)rvalues.size(); i += 3) { forceX1global += rvalues[i]; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h index 03b00f3603c3e8aac25567b7f370e81b61d3ef76..6f7266d8e49a0f1e9cce4192712b37f1306ff5e0 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ForceCalculator.h @@ -15,14 +15,14 @@ #include "Vector3D.h" class D3Q27Interactor; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class DistributionArray3D; class BoundaryConditions; class ForceCalculator { public: - ForceCalculator(std::shared_ptr<vf::mpi::Communicator> comm); + ForceCalculator(std::shared_ptr<vf::parallel::Communicator> comm); virtual ~ForceCalculator(); void calculateForces(std::vector<std::shared_ptr<D3Q27Interactor>> interactors); @@ -35,7 +35,7 @@ public: private: void gatherGlobalForces(); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; real forceX1global; real forceX2global; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp index 4e8fd6d5f39fbeb581ace18bf544fa5346719850..07a27f074c7ac9cc9850db90f94fec19687fa4cb 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituCatalystSimulationObserver.cpp @@ -20,7 +20,7 @@ InSituCatalystSimulationObserver::InSituCatalystSimulationObserver() {} InSituCatalystSimulationObserver::InSituCatalystSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, std::string script) : SimulationObserver(grid, s) { - gridRank = vf::mpi::Communicator::getInstance()->getProcessID(); + gridRank = vf::parallel::Communicator::getInstance()->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); maxInitLevel = this->grid->getFinestInitializedLevel(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp index 74c1b653bd4f8b5f2def3492f83fa38677170feb..2dbdcb6373e24a57ebeafe6243db4ccaa083e932 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/InSituVTKSimulationObserver.cpp @@ -30,7 +30,7 @@ InSituVTKSimulationObserver::InSituVTKSimulationObserver(SPtr<Grid3D> grid, SPtr SPtr<LBMUnitConverter> conv) : SimulationObserver(grid, s), conv(conv) { - gridRank = vf::mpi::Communicator::getInstance()->getProcessID(); + gridRank = vf::parallel::Communicator::getInstance()->getProcessID(); minInitLevel = this->grid->getCoarsestInitializedLevel(); maxInitLevel = this->grid->getFinestInitializedLevel(); @@ -269,7 +269,7 @@ void InSituVTKSimulationObserver::readConfigFile(const std::string &configFile) string dummy; int wRank = 0; getline(ifs, dummy); - int np = vf::mpi::Communicator::getInstance()->getNumberOfProcesses(); + int np = vf::parallel::Communicator::getInstance()->getNumberOfProcesses(); while (ifs.good()) { getline(ifs, dummy, ';'); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp index 7eabcd2849f2fca11cb057357492fa1062c46dce..a2d35b6b2883f54b799cc2e5b6aacd1ece5c08bc 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.cpp @@ -10,7 +10,7 @@ #include "LBMKernel.h" ////////////////////////////////////////////////////////////////////////// -IntegrateValuesHelper::IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm, real minX1, real minX2, +IntegrateValuesHelper::IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm, real minX1, real minX2, real minX3, real maxX1, real maxX2, real maxX3) : @@ -21,7 +21,7 @@ IntegrateValuesHelper::IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr< init(-1); } ////////////////////////////////////////////////////////////////////////// -IntegrateValuesHelper::IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm, real minX1, real minX2, +IntegrateValuesHelper::IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm, real minX1, real minX2, real minX3, real maxX1, real maxX2, real maxX3, int level) : @@ -36,6 +36,8 @@ IntegrateValuesHelper::~IntegrateValuesHelper() = default; ////////////////////////////////////////////////////////////////////////// void IntegrateValuesHelper::init(int level) { + using namespace vf::basics::constant; + root = comm->isRoot(); real orgX1, orgX2, orgX3; @@ -49,8 +51,8 @@ void IntegrateValuesHelper::init(int level) maxInitLevel = level; } - real numSolids = 0.0; - real numFluids = 0.0; + real numSolids = c0o1; + real numFluids = c0o1; for (int level_it = minInitLevel; level_it <= maxInitLevel; level_it++) { std::vector<SPtr<Block3D>> blockVector; grid->getBlocks(level_it, gridRank, blockVector); @@ -101,8 +103,8 @@ void IntegrateValuesHelper::init(int level) rvalues = comm->gather(values); if (root) { - numberOfSolidNodes = 0.0; - numberOfFluidsNodes = 0.0; + numberOfSolidNodes = c0o1; + numberOfFluidsNodes = c0o1; int rsize = (int)rvalues.size(); int vsize = (int)values.size(); for (int i = 0; i < rsize; i += vsize) { @@ -172,6 +174,8 @@ void IntegrateValuesHelper::calculateAV() ////////////////////////////////////////////////////////////////////////// void IntegrateValuesHelper::calculateMQ() { + using namespace vf::basics::constant; + real f[D3Q27System::ENDF + 1]; real vx1, vx2, vx3, rho; clearData(); @@ -184,7 +188,7 @@ void IntegrateValuesHelper::calculateMQ() for (CalcNodes cn : cnodes) { SPtr<ILBMKernel> kernel = cn.block->getKernel(); - real dx = 1.0 / (real)(1 << cn.block->getLevel()); + real dx = c1o1 / (real)(1 << cn.block->getLevel()); real cellVolume = dx * dx * dx; if (kernel->getCompressible()) { @@ -230,21 +234,23 @@ void IntegrateValuesHelper::calculateMQ() ////////////////////////////////////////////////////////////////////////// void IntegrateValuesHelper::clearData() { - sRho = 0.0; - sVx1 = 0.0; - sVx2 = 0.0; - sVx3 = 0.0; - sCellVolume = 0.0; + using namespace vf::basics::constant; + + sRho = c0o1; + sVx1 = c0o1; + sVx2 = c0o1; + sVx3 = c0o1; + sCellVolume = c0o1; // sVm = 0.0; // sPress = 0.0; // numberOfFluidsNodes = 0.0; - sAvVx1 = 0.0; - sAvVx2 = 0.0; - sAvVx3 = 0.0; - sTSx1 = 0.0; - sTSx2 = 0.0; - sTSx3 = 0.0; - sTSx1x3 = 0.0; + sAvVx1 = c0o1; + sAvVx2 = c0o1; + sAvVx3 = c0o1; + sTSx1 = c0o1; + sTSx2 = c0o1; + sTSx3 = c0o1; + sTSx1x3 = c0o1; } ////////////////////////////////////////////////////////////////////////// real IntegrateValuesHelper::getNumberOfFluidsNodes() { return this->numberOfFluidsNodes; } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h index c804d74628570c4592c6715b7f76cd450c90ecfb..6404ca7bfab37599c6c833b53798f9048c5e265b 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/IntegrateValuesHelper.h @@ -5,7 +5,7 @@ #include "Block3D.h" #include "CbArray2D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27System.h" #include "GbCuboid3D.h" #include "Grid3D.h" @@ -36,9 +36,9 @@ public: }; public: - IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm, real minX1, real minX2, real minX3, + IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm, real minX1, real minX2, real minX3, real maxX1, real maxX2, real maxX3); - IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::mpi::Communicator> comm, real minX1, real minX2, real minX3, + IntegrateValuesHelper(SPtr<Grid3D> grid, std::shared_ptr<vf::parallel::Communicator> comm, real minX1, real minX2, real minX3, real maxX1, real maxX2, real maxX3, int level); virtual ~IntegrateValuesHelper(); @@ -77,7 +77,7 @@ private: real sAvVx1, sAvVx2, sAvVx3, sTSx1, sTSx2, sTSx3, sTSx1x3; std::vector<CalcNodes> cnodes; GbCuboid3DPtr boundingBox; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; CbArray2D<Node> cnodes2DMatrix; enum Values { AvVx = 0, AvVy = 1, AvVz = 2, AvVxx = 3, AvVyy = 4, AvVzz = 5, AvVxy = 6, AvVyz = 7, AvVxz = 8 }; }; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp index 75350fb6e0904c434519a241228d7662c84ecf22..e312bf2b27aa15b51146aab9559c201ed88bbd7e 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.cpp @@ -3,7 +3,7 @@ #include "WbWriterVtkXmlASCII.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CompressibleCumulantLBMKernel.h" #include "CoordinateTransformation3D.h" #include "DataSet3D.h" @@ -13,7 +13,7 @@ #include "UbScheduler.h" LineTimeSeriesSimulationObserver::LineTimeSeriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - SPtr<GbLine3D> line, int level, std::shared_ptr<vf::mpi::Communicator> comm) + SPtr<GbLine3D> line, int level, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), length(0), ix1(0), ix2(0), ix3(0), level(level), line(line) { root = comm->isRoot(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h index 0f8a9ab44ac60e16708be7453e65809ec0505155..db4fea82f2aecfd87a4c90cdea36cc310b73aabe 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/LineTimeSeriesSimulationObserver.h @@ -9,7 +9,7 @@ #include "SimulationObserver.h" #include "LBMSystem.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class GbLine3D; @@ -27,7 +27,7 @@ public: public: LineTimeSeriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<GbLine3D> line, - int level, std::shared_ptr<vf::mpi::Communicator> comm); + int level, std::shared_ptr<vf::parallel::Communicator> comm); ~LineTimeSeriesSimulationObserver() override = default; void update(real step) override; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp index ef220856838baabadb3b8cf40270d0e505147069..456c92eb08414655764bcd41f90c6f1973aa4fc8 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.cpp @@ -3,7 +3,7 @@ #include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CoordinateTransformation3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "D3Q27System.h" @@ -25,7 +25,7 @@ using namespace MPIIODataStructures; #define MESSAGE_TAG 80 #define SEND_BLOCK_SIZE 100000 -MPIIOMigrationBESimulationObserver::MPIIOMigrationBESimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) +MPIIOMigrationBESimulationObserver::MPIIOMigrationBESimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm) : MPIIOSimulationObserver(grid, s, path, comm), nue(-999.999), nuL(-999.999), nuG(-999.999), densityRatio(-999.999) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); @@ -130,7 +130,6 @@ void MPIIOMigrationBESimulationObserver::writeDataSet(int step) DSArraysPresence arrPresence; bool firstBlock = true; int doubleCountInBlock = 0; - int ic = 0; SPtr<D3Q27EsoTwist3DSplittedVector> D3Q27EsoTwist3DSplittedVectorPtrF = 0, D3Q27EsoTwist3DSplittedVectorPtrH1 = 0, D3Q27EsoTwist3DSplittedVectorPtrH2 = 0; CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr localDistributionsF = 0, localDistributionsH1 = 0, localDistributionsH2 = 0; CbArray4D<real, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributionsF = 0, nonLocalDistributionsH1 = 0, nonLocalDistributionsH2 = 0; @@ -280,8 +279,6 @@ void MPIIOMigrationBESimulationObserver::writeDataSet(int step) if (zeroDistributionsH2 && (dataSetParamStr3.nx[0] > 0) && (dataSetParamStr3.nx[1] > 0) && (dataSetParamStr3.nx[2] > 0)) doubleValuesArrayH2.insert(doubleValuesArrayH2.end(), zeroDistributionsH2->getDataVector().begin(), zeroDistributionsH2->getDataVector().end()); } - - ic++; } } @@ -431,7 +428,6 @@ void MPIIOMigrationBESimulationObserver::write4DArray(int step, Arrays arrayType dataSetParam dataSetParamStr; bool firstBlock = true; int doubleCountInBlock = 0; - int ic = 0; SPtr<CbArray4D<real, IndexerX4X3X2X1>> ___Array; if (comm->isRoot()) @@ -482,8 +478,6 @@ void MPIIOMigrationBESimulationObserver::write4DArray(int step, Arrays arrayType if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0) && (dataSetParamStr.nx[3] > 0)) doubleValuesArray.insert(doubleValuesArray.end(), ___Array->getDataVector().begin(), ___Array->getDataVector().end()); - - ic++; } } @@ -550,7 +544,6 @@ void MPIIOMigrationBESimulationObserver::write3DArray(int step, Arrays arrayType dataSetParam dataSetParamStr; bool firstBlock = true; int doubleCountInBlock = 0; - int ic = 0; SPtr<CbArray3D<real, IndexerX3X2X1>> ___Array; if (comm->isRoot()) @@ -599,8 +592,6 @@ void MPIIOMigrationBESimulationObserver::write3DArray(int step, Arrays arrayType if ((dataSetParamStr.nx[0] > 0) && (dataSetParamStr.nx[1] > 0) && (dataSetParamStr.nx[2] > 0)) doubleValuesArray.insert(doubleValuesArray.end(), ___Array->getDataVector().begin(), ___Array->getDataVector().end()); - - ic++; } } @@ -659,8 +650,6 @@ void MPIIOMigrationBESimulationObserver::writeBoundaryConds(int step) int blocksCount = 0; // quantity of blocks, that belong to this process size_t allBytesCount = 0; // quantity of bytes, that one process writes to the file - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks std::vector<SPtr<Block3D>> blocksVector[25]; int minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -706,22 +695,21 @@ void MPIIOMigrationBESimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector[ic].push_back(*bouCond); bcAddArray[ic].boundCond_count++; - count_boundCond++; bytesCount[ic] += sizeof(BoundaryCondition); } @@ -738,7 +726,6 @@ void MPIIOMigrationBESimulationObserver::writeBoundaryConds(int step) indexContainerVector[ic].insert(indexContainerVector[ic].begin(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; bytesCount[ic] += bcAddArray[ic].indexContainer_count * sizeof(int); allBytesCount += bytesCount[ic]; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h index fa55ea17a350ec9a1de215892258526142f6d19b..cec360a7300e07909c0b5b6bc14a7969f8686264 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationBESimulationObserver.h @@ -10,7 +10,7 @@ class Grid3D; class UbScheduler; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class BCSet; class LBMKernel; class Grid3DVisitor; @@ -33,7 +33,7 @@ class MPIIOMigrationBESimulationObserver : public MPIIOSimulationObserver public: MPIIOMigrationBESimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); ~MPIIOMigrationBESimulationObserver() override; //! Each timestep writes the grid into the files void update(real step) override; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp index 32e6ba5188626c0a37fba8e9db0ad4447502d001..590a2812be5ad2a211200023dc14da17ecae1619 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.cpp @@ -3,7 +3,7 @@ #include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CoordinateTransformation3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "D3Q27System.h" @@ -22,7 +22,7 @@ using namespace MPIIODataStructures; -MPIIOMigrationSimulationObserver::MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) +MPIIOMigrationSimulationObserver::MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm) : MPIIOSimulationObserver(grid, s, path, comm) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); @@ -730,8 +730,6 @@ void MPIIOMigrationSimulationObserver::writeBoundaryConds(int step) int blocksCount = 0; // quantity of blocks, that belong to this process size_t allBytesCount = 0; // quantity of bytes, that one process writes to the file - size_t count_boundCond = 0; // how many BoundaryConditions in all blocks - int count_indexContainer = 0; // how many indexContainer-values in all blocks std::vector<SPtr<Block3D>> blocksVector[25]; int minInitLevel = this->grid->getCoarsestInitializedLevel(); @@ -778,24 +776,23 @@ void MPIIOMigrationSimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } bcVector[ic].push_back(*bouCond); bcAddArray[ic].boundCond_count++; - count_boundCond++; bytesCount[ic] += sizeof(BoundaryCondition); - } + } if (bcindexmatrixCountNotInit) { @@ -810,7 +807,6 @@ void MPIIOMigrationSimulationObserver::writeBoundaryConds(int step) indexContainerVector[ic].insert(indexContainerVector[ic].begin(), bcArr->indexContainer.begin(), bcArr->indexContainer.end()); bcAddArray[ic].indexContainer_count = static_cast<int>(bcArr->indexContainer.size()); - count_indexContainer += bcAddArray[ic].indexContainer_count; bytesCount[ic] += bcAddArray[ic].indexContainer_count * sizeof(int); allBytesCount += bytesCount[ic]; @@ -1158,7 +1154,7 @@ void MPIIOMigrationSimulationObserver::readDataSet(int step) kernel->setCollisionFactorMultiphase(dataSetArray[n].collFactorL, dataSetArray[n].collFactorG); kernel->setDensityRatio(dataSetArray[n].densityRatio); - SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D()); + SPtr<DataSet3D> dataSetPtr = SPtr<DataSet3D>(new DataSet3D()); dataSetPtr->setFdistributions(mFdistributions); if (multiPhase1) dataSetPtr->setHdistributions(mH1distributions); @@ -1505,8 +1501,8 @@ void MPIIOMigrationSimulationObserver::readBoundaryConds(int step) block1->getKernel()->setBCSet(bcProc); - delete bcArray; - delete intArray1; + delete[] bcArray; + delete[] intArray1; ic++; } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h index 588366a6498c107600d377a65819e11100aa6702..4e7d1ba44644cef527a623ea8b94cb28ac9474ac 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOMigrationSimulationObserver.h @@ -9,7 +9,7 @@ class Grid3D; class UbScheduler; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class BCSet; class LBMKernel; class Grid3DVisitor; @@ -25,13 +25,13 @@ public: AverageFluktuations = 3, AverageTriple = 4, ShearStressVal = 5, - RelaxationFactor = 6, - PhaseField1 = 7, - PhaseField2 = 8, - PressureField = 9 + RelaxationFactor = 6, + PhaseField1 = 7, + PhaseField2 = 8, + PressureField = 9 }; - MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + MPIIOMigrationSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<Grid3DVisitor> mV, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); ~MPIIOMigrationSimulationObserver() override; //! Each timestep writes the grid into the files void update(real step) override; @@ -82,6 +82,7 @@ private: SPtr<LBMKernel> lbmKernel; SPtr<BCSet> bcSet; SPtr<Grid3DVisitor> metisVisitor; + }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp index fdc3f4d4347f56d52c2b8a4952da3309ca90fe19..07a63a48bee9d81d467af672c290a7528008a7eb 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.cpp @@ -3,7 +3,7 @@ #include "BCSet.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CoordinateTransformation3D.h" #include "D3Q27EsoTwist3DSplittedVector.h" #include "D3Q27System.h" @@ -25,7 +25,7 @@ using namespace MPIIODataStructures; -MPIIORestartSimulationObserver::MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) +MPIIORestartSimulationObserver::MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm) : MPIIOSimulationObserver(grid, s, path, comm) { memset(&boundCondParamStr, 0, sizeof(boundCondParamStr)); @@ -849,16 +849,16 @@ void MPIIORestartSimulationObserver::writeBoundaryConds(int step) bouCond->velocityBoundaryFlags = bcArr->bcvector[bc]->getVelocityBoundary(); bouCond->densityBoundaryFlags = bcArr->bcvector[bc]->getDensityBoundary(); bouCond->wallModelBoundaryFlags = bcArr->bcvector[bc]->getWallModelBoundary(); - bouCond->bcVelocityX1 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX1(); - bouCond->bcVelocityX2 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX2(); - bouCond->bcVelocityX3 = (real)bcArr->bcvector[bc]->getBoundaryVelocityX3(); - bouCond->bcDensity = (real)bcArr->bcvector[bc]->getBoundaryDensity(); - bouCond->bcPhaseField = (real)bcArr->bcvector[bc]->getBoundaryPhaseField(); - bouCond->nx1 = (real)bcArr->bcvector[bc]->nx1; - bouCond->nx2 = (real)bcArr->bcvector[bc]->nx2; - bouCond->nx3 = (real)bcArr->bcvector[bc]->nx3; + bouCond->bcVelocityX1 = bcArr->bcvector[bc]->getBoundaryVelocityX1(); + bouCond->bcVelocityX2 = bcArr->bcvector[bc]->getBoundaryVelocityX2(); + bouCond->bcVelocityX3 = bcArr->bcvector[bc]->getBoundaryVelocityX3(); + bouCond->bcDensity = bcArr->bcvector[bc]->getBoundaryDensity(); + bouCond->bcPhaseField = bcArr->bcvector[bc]->getBoundaryPhaseField(); + bouCond->nx1 = bcArr->bcvector[bc]->nx1; + bouCond->nx2 = bcArr->bcvector[bc]->nx2; + bouCond->nx3 = bcArr->bcvector[bc]->nx3; for (int iq = 0; iq < 26; iq++) - bouCond->q[iq] = (real)bcArr->bcvector[bc]->getQ(iq); + bouCond->q[iq] = bcArr->bcvector[bc]->getQ(iq); bouCond->algorithmType = bcArr->bcvector[bc]->getBCStrategyType(); } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h index 5681d9886e3a6f9a4b8d1cf1b8d32e9970fb8855..d07bf6b77b8a4f56da0d4a6c88139f4d01bca104 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIORestartSimulationObserver.h @@ -11,7 +11,7 @@ class Grid3D; class UbScheduler; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class BCSet; class LBMKernel; @@ -32,7 +32,7 @@ public: PressureField = 9 }; - MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + MPIIORestartSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); ~MPIIORestartSimulationObserver() override; //! Each timestep writes the grid into the files void update(real step) override; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp index adb47a75a2fbd7fc0e8242ef9b013f6324ae066b..19ea0482a1528a2c8a0e64d4d9f7c85e1a8ed612 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.cpp @@ -1,6 +1,6 @@ #include "MPIIOSimulationObserver.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CoordinateTransformation3D.h" #include "Grid3D.h" #include "MPIIODataStructures.h" @@ -13,7 +13,7 @@ using namespace MPIIODataStructures; MPIIOSimulationObserver::MPIIOSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), comm(comm) { UbSystem::makeDirectory(path + "/mpi_io_cp"); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h index c04938a71e62db4753689ad35160a7f980c0c0cb..9ecaf89a74d2f42db7d35349b27389f0f1cfc796 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MPIIOSimulationObserver.h @@ -8,14 +8,14 @@ class Grid3D; class UbScheduler; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} //! \class MPIWriteBlocksBESimulationObserver //! \brief Writes the grid each timestep into the files and reads the grip from the files before regenerating class MPIIOSimulationObserver : public SimulationObserver { public: - MPIIOSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + MPIIOSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); ~MPIIOSimulationObserver() override; //! Each timestep writes the grid into the files @@ -37,7 +37,7 @@ public: protected: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; MPI_Datatype gridParamType, block3dType, dataSetParamType, boundCondType, arrayPresenceType; }; #endif // ! _MPIIOSimulationObserver_H_ diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp index 2979c841c9c07e44b5a22998897d5665c67b51dc..10749b5130e387205f01e57f4c71c90c90f46e02 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.cpp @@ -2,7 +2,7 @@ #include "BCArray3D.h" #include "BCSet.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27System.h" #include "DataSet3D.h" #include "DistributionArray3D.h" @@ -13,7 +13,7 @@ #include <sstream> MicrophoneArraySimulationObserver::MicrophoneArraySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), comm(comm) { count = 0; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h index e87954fa2902df3c27833729869a70abac348508..f95b435ba8b784c9e7d25ac80399239460144c9b 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/MicrophoneArraySimulationObserver.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class Vector3D; @@ -23,7 +23,7 @@ class MicrophoneArraySimulationObserver : public SimulationObserver { public: MicrophoneArraySimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); ~MicrophoneArraySimulationObserver() override; //! calls collectData. @@ -38,7 +38,7 @@ protected: private: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; struct Mic { unsigned int id; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp index 3bd0bd6f888e64da0db8f492c872c4b15a518b4a..81d7217c4b848ae3a6510fc1920c7621ee71c0aa 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.cpp @@ -33,12 +33,12 @@ #include "NUPSCounterSimulationObserver.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "UbScheduler.h" NUPSCounterSimulationObserver::NUPSCounterSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), numOfThreads(numOfThreads), nup(0), nup_t(0), nupsStep(0.0), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h index fdce1c4d67519b6d0a109e3cbd13e23b69d0fb19..f0585bbdb911e3dd33262d1a790a10b97da789de 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/NUPSCounterSimulationObserver.h @@ -39,7 +39,7 @@ #include "SimulationObserver.h" #include "basics/utilities/UbTiming.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; @@ -54,7 +54,7 @@ public: //! \param s is UbScheduler object for scheduling of observer //! \param numOfThreads is number of threads //! \param comm is Communicator object - NUPSCounterSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, std::shared_ptr<vf::mpi::Communicator> comm); + NUPSCounterSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, std::shared_ptr<vf::parallel::Communicator> comm); ~NUPSCounterSimulationObserver() override; void update(real step) override; @@ -70,7 +70,7 @@ protected: real nup; real nup_t; real nupsStep; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp index 7c9cd4b85e1404339b2c180bef93eafedff38c23..f36997c05dc92970b743a57d1fc9b79f92a2df51 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.cpp @@ -4,7 +4,7 @@ #include "BCArray3D.h" #include "BCSet.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "DataSet3D.h" #include "GbCuboid3D.h" @@ -14,7 +14,7 @@ PressureCoefficientSimulationObserver::PressureCoefficientSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, GbCuboid3DPtr plane, const std::string &path, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), plane(plane), path(path), comm(comm) { maxStep = scheduler->getMaxEnd(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h index bfb56a65dd31fd6f434462471c6a236340b05db0..16e14af6420c5b1f634bb3f7988ba9c3f8595881 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureCoefficientSimulationObserver.h @@ -11,7 +11,7 @@ class GbCuboid3D; class D3Q27Interactor; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; @@ -19,7 +19,7 @@ class PressureCoefficientSimulationObserver : public SimulationObserver { public: PressureCoefficientSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbCuboid3D> plane, - const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); ~PressureCoefficientSimulationObserver() override; void update(real step) override; @@ -35,7 +35,7 @@ protected: private: SPtr<GbCuboid3D> plane; std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; std::vector<SPtr<D3Q27Interactor>> interactors; int numberOfSteps; real maxStep; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp index 9b3c63f407b9fac00de6177a369fec2cb3e74a82..3576349e3ac9b9f421c4dbf7476a5869a0fb9930 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.cpp @@ -9,7 +9,7 @@ #include <fstream> -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "IntegrateValuesHelper.h" #include "LBMUnitConverter.h" @@ -18,10 +18,12 @@ PressureDifferenceSimulationObserver::PressureDifferenceSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, real rhoReal, - real uReal, real uLB, std::shared_ptr<vf::mpi::Communicator> comm) + real uReal, real uLB, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), h1(h1), h2(h2), comm(comm) { + using namespace vf::basics::constant; + if (comm->getProcessID() == comm->getRoot()) { std::ofstream ostr; std::string fname = path; @@ -64,7 +66,7 @@ PressureDifferenceSimulationObserver::PressureDifferenceSimulationObserver(SPtr< ostr << std::endl; ostr.close(); - factor1 = (1.0 / 3.0) * rhoReal * (uReal / uLB) * (uReal / uLB); + factor1 = (c1o1 / c3o1) * rhoReal * (uReal / uLB) * (uReal / uLB); factor2 = rhoReal * (uReal / uLB) * (uReal / uLB); } } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h index 35356d25f9fa941500188fc75850d1bb7c8f86fb..df9d5364bf68921ebf1c567f0cdfd4c4ed76a92a 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/PressureDifferenceSimulationObserver.h @@ -14,7 +14,7 @@ #include "SimulationObserver.h" #include "LBMSystem.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -26,7 +26,7 @@ public: PressureDifferenceSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, SPtr<IntegrateValuesHelper> h1, SPtr<IntegrateValuesHelper> h2, real rhoReal, real uReal, real uLB, - /*const SPtr<LBMUnitConverter> conv,*/ std::shared_ptr<vf::mpi::Communicator> comm); + /*const SPtr<LBMUnitConverter> conv,*/ std::shared_ptr<vf::parallel::Communicator> comm); ~PressureDifferenceSimulationObserver() override; void update(real step) override; @@ -36,7 +36,7 @@ protected: std::string path; SPtr<LBMUnitConverter> conv; void collectData(real step); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; real factor1; //= (1/3)*rhoReal*(uReal/uLB)^2 for calculation pReal = rhoLB * (1/3)*rhoReal*(uReal/uLB)^2, //rhoReal and uReal in SI real factor2; //= rhoReal*(uReal/uLB)^2 for calculation pReal = press * rhoReal*(uReal/uLB)^2, rhoReal and diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp index 010d9ff664e22519ceb169c549ecc05307655ed4..ccd4025235dd636b0654ea14ad307f3a256c58a9 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.cpp @@ -7,11 +7,11 @@ #include "basics/writer/WbWriterVtkXmlASCII.h" #include "BCArray3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "UbScheduler.h" QCriterionSimulationObserver::QCriterionSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, - SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm) + SPtr<UbScheduler> s, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), comm(comm), writer(writer) { init(); @@ -89,6 +89,8 @@ void QCriterionSimulationObserver::clearData() ////////////////////////////////////////////////////////////////////////// void QCriterionSimulationObserver::addData(const SPtr<Block3D> block) { + using namespace vf::basics::constant; + UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); // UbTupleDouble3 blockLengths = grid->getBlockLengths(block); UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); @@ -147,16 +149,16 @@ void QCriterionSimulationObserver::addData(const SPtr<Block3D> block) getNeighborVelocities(0, 0, 1, ix1, ix2, ix3, block, vT, vB); ////////////////////////////////// // derivatives - real duxdy = (vN[xdir] - vS[xdir]) * 0.5; - real duydx = (vE[ydir] - vW[ydir]) * 0.5; - real duxdz = (vT[xdir] - vB[xdir]) * 0.5; - real duzdx = (vE[zdir] - vW[zdir]) * 0.5; - real duydz = (vT[ydir] - vB[ydir]) * 0.5; - real duzdy = (vN[zdir] - vS[zdir]) * 0.5; + real duxdy = (vN[xdir] - vS[xdir]) * c1o2; + real duydx = (vE[ydir] - vW[ydir]) * c1o2; + real duxdz = (vT[xdir] - vB[xdir]) * c1o2; + real duzdx = (vE[zdir] - vW[zdir]) * c1o2; + real duydz = (vT[ydir] - vB[ydir]) * c1o2; + real duzdy = (vN[zdir] - vS[zdir]) * c1o2; - real duxdx = (vE[xdir] - vW[xdir]) * 0.5; - real duydy = (vN[ydir] - vS[ydir]) * 0.5; - real duzdz = (vT[zdir] - vB[zdir]) * 0.5; + real duxdx = (vE[xdir] - vW[xdir]) * c1o2; + real duydy = (vN[ydir] - vS[ydir]) * c1o2; + real duzdz = (vT[zdir] - vB[zdir]) * c1o2; real scaleFactor = (real)(1 @@ -203,7 +205,9 @@ void QCriterionSimulationObserver::addData(const SPtr<Block3D> block) void QCriterionSimulationObserver::getNeighborVelocities(int offx, int offy, int offz, int ix1, int ix2, int ix3, const SPtr<Block3D> block, real *vE, real *vW) { - SPtr<ILBMKernel> kernel = block->getKernel(); + using namespace vf::basics::constant; + + SPtr<ILBMKernel> kernel = block->getKernel(); SPtr<BCArray3D> bcArray = kernel->getBCSet()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); @@ -214,13 +218,13 @@ void QCriterionSimulationObserver::getNeighborVelocities(int offx, int offy, int // int minX3 = 0; int maxX1 = (int)(distributions->getNX1()); - int maxX2 = (int)(distributions->getNX2()); - int maxX3 = (int)(distributions->getNX3()); + // int maxX2 = (int)(distributions->getNX2()); + // int maxX3 = (int)(distributions->getNX3()); if (maxX1 < 3) throw UbException(UB_EXARGS, "QCriterionSimulationObserver: NX1 too small for FD stencils!"); maxX1 -= 2; - maxX2 -= 2; - maxX3 -= 2; + // maxX2 -= 2; + // maxX3 -= 2; bool checkInterpolation = true; bool neighNodeIsBC = false; SPtr<BoundaryConditions> bcPtr; @@ -306,9 +310,9 @@ void QCriterionSimulationObserver::getNeighborVelocities(int offx, int offy, int computeVelocity(fW2, vW2, compressible); computeVelocity(f0, v0, compressible); // second order non-symetric interpolation - vW[0] = v0[0] * 1.5 - vW[0] + 0.5 * vW2[0]; - vW[1] = v0[1] * 1.5 - vW[1] + 0.5 * vW2[1]; - vW[2] = v0[2] * 1.5 - vW[2] + 0.5 * vW2[2]; + vW[0] = v0[0] * c3o2 - vW[0] + c1o2 * vW2[0]; + vW[1] = v0[1] * c3o2 - vW[1] + c1o2 * vW2[1]; + vW[2] = v0[2] * c3o2 - vW[2] + c1o2 * vW2[2]; // throw UbException(UB_EXARGS,"Parallel or Non-Uniform Simulation -- not yet implemented"); } else { SPtr<ILBMKernel> kernelW = blockNeighW->getKernel(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h index 1d5aec23f9d4af9d9e232dd215fbde060a7c6f7c..45eddf04a2b838cfa52a64b10fd5fb4cfed88c29 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/QCriterionSimulationObserver.h @@ -13,7 +13,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -29,7 +29,7 @@ class QCriterionSimulationObserver : public SimulationObserver { public: QCriterionSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); //! Make update if timestep is write-timestep specified in SPtr<UbScheduler> s void update(real step) override; @@ -58,7 +58,7 @@ private: int gridRank; // comm-Rank des aktuellen prozesses std::string path; WbWriter *writer; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; enum Values { xdir = 0, ydir = 1, zdir = 2 }; // labels for the different components }; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp index 92c8f5f60344019cff472851104b86e5838302a8..8a2b90698ee7f48dce5eea8f738bd69651d8b059 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/ShearStressSimulationObserver.cpp @@ -4,11 +4,11 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27Interactor.h" #include "DataSet3D.h" #include "Grid3D.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "LBMKernel.h" #include "UbScheduler.h" @@ -16,7 +16,7 @@ ShearStressSimulationObserver::ShearStressSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<UbScheduler> rs) : SimulationObserver(grid, s), Resetscheduler(rs), path(path), writer(writer) { - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); normals.push_back(0); normals.push_back(0); normals.push_back(1); @@ -30,7 +30,7 @@ ShearStressSimulationObserver::ShearStressSimulationObserver(SPtr<Grid3D> grid, for (SPtr<Block3D> block : blockVector[level]) { UbTupleInt3 nx = grid->getBlockNX(); SPtr<ShearStressValuesArray3D> shearStressValues = SPtr<ShearStressValuesArray3D>( - new ShearStressValuesArray3D(14, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, 0.0)); + new ShearStressValuesArray3D(14, val<1>(nx) + 1, val<2>(nx) + 1, val<3>(nx) + 1, vf::basics::constant::c0o1)); block->getKernel()->getDataSet()->setShearStressValues(shearStressValues); } } @@ -62,7 +62,7 @@ void ShearStressSimulationObserver::collectData(real step) // vector<string> cellDataNames; - // std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); + // std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); // vector<string> pieces = comm->gatherStrings(piece); // if (comm->getProcessID() == comm->getRoot()) //{ @@ -94,7 +94,7 @@ void ShearStressSimulationObserver::collectData(real step) piece = subfolder + "/" + piece; vector<string> cellDataNames; - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); vector<string> pieces = comm->gather(piece); if (comm->getProcessID() == comm->getRoot()) { string pname = @@ -126,6 +126,7 @@ void ShearStressSimulationObserver::calculateShearStress(real timeStep) { using namespace vf::lbm::dir; using namespace D3Q27System; + using namespace vf::basics::constant; real f[27]; real vx, vy, vz, sxx, syy, szz, sxy, syz, sxz; @@ -182,23 +183,23 @@ void ShearStressSimulationObserver::calculateShearStress(real timeStep) vz = ((((f[DIR_PPP] - f[DIR_MMM]) + (f[DIR_PMP] - f[DIR_MPM])) + ((f[DIR_MPP] - f[DIR_PMM]) + (f[DIR_MMP] - f[DIR_PPM]))) + (((f[DIR_0MP] - f[DIR_0PM]) + (f[DIR_0PP] - f[DIR_0MM])) + ((f[DIR_M0P] - f[DIR_P0M]) + (f[DIR_P0P] - f[DIR_M0M]))) + (f[DIR_00P] - f[DIR_00M])); - sxy = 3.0 * collFactor / (collFactor - 1.0) * + sxy = c3o1 * collFactor / (collFactor - c1o1) * (((f[DIR_PPP] + f[DIR_MMM]) - (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) + (f[DIR_MMP] + f[DIR_PPM])) + (((f[DIR_PP0] + f[DIR_MM0]) - (f[DIR_PM0] + f[DIR_MP0]))) - vx * vy); - sxz = 3.0 * collFactor / (collFactor - 1.0) * + sxz = c3o1 * collFactor / (collFactor - c1o1) * (((f[DIR_PPP] + f[DIR_MMM]) + (f[DIR_PMP] + f[DIR_MPM])) + (-(f[DIR_PMM] + f[DIR_MPP]) - (f[DIR_MMP] + f[DIR_PPM])) + ((f[DIR_P0P] + f[DIR_M0M]) - (f[DIR_P0M] + f[DIR_M0P])) - vx * vz); - syz = 3.0 * collFactor / (collFactor - 1.0) * + syz = c3o1 * collFactor / (collFactor - c1o1) * (((f[DIR_PPP] + f[DIR_MMM]) - (f[DIR_PMP] + f[DIR_MPM])) + ((f[DIR_PMM] + f[DIR_MPP]) - (f[DIR_MMP] + f[DIR_PPM])) + (-(f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM])) - vy * vz); - real dxxMyy = 3.0 / 2.0 * collFactor / (collFactor - 1.0) * + real dxxMyy = c3o1 / c2o1 * collFactor / (collFactor - c1o1) * (((f[DIR_P0P] + f[DIR_M0M]) + (f[DIR_P0M] + f[DIR_M0P])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM])) + ((f[DIR_P00] + f[DIR_M00]) - (f[DIR_0P0] + f[DIR_0M0])) - vx * vx + vy * vy); - real dxxMzz = 3.0 / 2.0 * collFactor / (collFactor - 1.0) * + real dxxMzz = c3o1 / c2o1 * collFactor / (collFactor - c1o1) * ((((f[DIR_PP0] + f[DIR_MM0]) + (f[DIR_PM0] + f[DIR_MP0])) - ((f[DIR_0PM] + f[DIR_0MP]) + (f[DIR_0PP] + f[DIR_0MM]))) + ((f[DIR_P00] + f[DIR_M00]) - (f[DIR_00P] + f[DIR_00M])) - vx * vx + vz * vz); @@ -206,25 +207,25 @@ void ShearStressSimulationObserver::calculateShearStress(real timeStep) // f[NW]))-((f[TE] + f[BW])+(f[BE]+ f[TW]))) // +((f[N] + f[S])-(f[T] + f[B])) -vy*vy +vz*vz); - sxx = (dxxMyy + dxxMzz) / 3.0; // weil dxxPyyPzz=0 + sxx = (dxxMyy + dxxMzz) / c3o1; // weil dxxPyyPzz=0 - syy = (dxxMzz - 2 * dxxMyy) / 3.0; + syy = (dxxMzz - c2o1 * dxxMyy) / c3o1; - szz = (dxxMyy - 2 * dxxMzz) / 3.0; + szz = (dxxMyy - c2o1 * dxxMzz) / c3o1; ////////////////////////////////////////////////////////////////////////// // compute average values ////////////////////////////////////////////////////////////////////////// - (*ssv)(AvVx, ix1, ix2, ix3) = ((*ssv)(AvVx, ix1, ix2, ix3) * timeStep + vx) / (timeStep + 1.0); - (*ssv)(AvVy, ix1, ix2, ix3) = ((*ssv)(AvVy, ix1, ix2, ix3) * timeStep + vy) / (timeStep + 1.0); - (*ssv)(AvVz, ix1, ix2, ix3) = ((*ssv)(AvVz, ix1, ix2, ix3) * timeStep + vz) / (timeStep + 1.0); - - (*ssv)(AvSxx, ix1, ix2, ix3) = ((*ssv)(AvSxx, ix1, ix2, ix3) * timeStep + sxx) / (timeStep + 1.0); - (*ssv)(AvSyy, ix1, ix2, ix3) = ((*ssv)(AvSyy, ix1, ix2, ix3) * timeStep + syy) / (timeStep + 1.0); - (*ssv)(AvSzz, ix1, ix2, ix3) = ((*ssv)(AvSzz, ix1, ix2, ix3) * timeStep + szz) / (timeStep + 1.0); - (*ssv)(AvSxy, ix1, ix2, ix3) = ((*ssv)(AvSxy, ix1, ix2, ix3) * timeStep + sxy) / (timeStep + 1.0); - (*ssv)(AvSyz, ix1, ix2, ix3) = ((*ssv)(AvSyz, ix1, ix2, ix3) * timeStep + syz) / (timeStep + 1.0); - (*ssv)(AvSxz, ix1, ix2, ix3) = ((*ssv)(AvSxz, ix1, ix2, ix3) * timeStep + sxz) / (timeStep + 1.0); + (*ssv)(AvVx, ix1, ix2, ix3) = ((*ssv)(AvVx, ix1, ix2, ix3) * timeStep + vx) / (timeStep + c1o1); + (*ssv)(AvVy, ix1, ix2, ix3) = ((*ssv)(AvVy, ix1, ix2, ix3) * timeStep + vy) / (timeStep + c1o1); + (*ssv)(AvVz, ix1, ix2, ix3) = ((*ssv)(AvVz, ix1, ix2, ix3) * timeStep + vz) / (timeStep + c1o1); + + (*ssv)(AvSxx, ix1, ix2, ix3) = ((*ssv)(AvSxx, ix1, ix2, ix3) * timeStep + sxx) / (timeStep + c1o1); + (*ssv)(AvSyy, ix1, ix2, ix3) = ((*ssv)(AvSyy, ix1, ix2, ix3) * timeStep + syy) / (timeStep + c1o1); + (*ssv)(AvSzz, ix1, ix2, ix3) = ((*ssv)(AvSzz, ix1, ix2, ix3) * timeStep + szz) / (timeStep + c1o1); + (*ssv)(AvSxy, ix1, ix2, ix3) = ((*ssv)(AvSxy, ix1, ix2, ix3) * timeStep + sxy) / (timeStep + c1o1); + (*ssv)(AvSyz, ix1, ix2, ix3) = ((*ssv)(AvSyz, ix1, ix2, ix3) * timeStep + syz) / (timeStep + c1o1); + (*ssv)(AvSxz, ix1, ix2, ix3) = ((*ssv)(AvSxz, ix1, ix2, ix3) * timeStep + sxz) / (timeStep + c1o1); } } } @@ -233,6 +234,8 @@ void ShearStressSimulationObserver::calculateShearStress(real timeStep) ////////////////////////////////////////////////////////////////////////// void ShearStressSimulationObserver::addData() { + using namespace vf::basics::constant; + // Diese Daten werden geschrieben: datanames.resize(0); datanames.emplace_back("y^plus"); @@ -322,16 +325,16 @@ void ShearStressSimulationObserver::addData() real nvty = vty / normVt; real nvtz = vtz / normVt; - real sx = 0.5 * ((*ssv)(AvSxx, ix1, ix2, ix3) * nvtx + (*ssv)(AvSxy, ix1, ix2, ix3) * nvty + + real sx = c1o2 * ((*ssv)(AvSxx, ix1, ix2, ix3) * nvtx + (*ssv)(AvSxy, ix1, ix2, ix3) * nvty + (*ssv)(AvSxz, ix1, ix2, ix3) * nvtz); - real sy = 0.5 * ((*ssv)(AvSxy, ix1, ix2, ix3) * nvtx + (*ssv)(AvSyy, ix1, ix2, ix3) * nvty + + real sy = c1o2 * ((*ssv)(AvSxy, ix1, ix2, ix3) * nvtx + (*ssv)(AvSyy, ix1, ix2, ix3) * nvty + (*ssv)(AvSyz, ix1, ix2, ix3) * nvtz); - real sz = 0.5 * ((*ssv)(AvSxz, ix1, ix2, ix3) * nvtx + (*ssv)(AvSyz, ix1, ix2, ix3) * nvty + + real sz = c1o2 * ((*ssv)(AvSxz, ix1, ix2, ix3) * nvtx + (*ssv)(AvSyz, ix1, ix2, ix3) * nvty + (*ssv)(AvSzz, ix1, ix2, ix3) * nvtz); real sabs = sqrt(sx * sx + sy * sy + sz * sz); - real viscosity = (1.0 / 3.0) * (1.0 / collFactor - 0.5); - real rho = 1.0; + real viscosity = (c1o1 / c3o1) * (c1o1 / collFactor - c1o2); + real rho = c1o1; real utau = sqrt(viscosity / rho * sabs); // double q=(*av)(ix1,ix2,ix3,normalq) ; @@ -355,6 +358,8 @@ void ShearStressSimulationObserver::reset(real step) ////////////////////////////////////////////////////////////////////////// void ShearStressSimulationObserver::resetData(real /*step*/) { + using namespace vf::basics::constant; + for (int level = minInitLevel; level <= maxInitLevel; level++) { for (const auto &block : blockVector[level]) { if (block) { @@ -383,16 +388,16 @@ void ShearStressSimulationObserver::resetData(real /*step*/) ////////////////////////////////////////////////////////////////////////// // compute average values ////////////////////////////////////////////////////////////////////////// - (*ssv)(AvVx, ix1, ix2, ix3) = 0.0; - (*ssv)(AvVy, ix1, ix2, ix3) = 0.0; - (*ssv)(AvVz, ix1, ix2, ix3) = 0.0; - - (*ssv)(AvSxx, ix1, ix2, ix3) = 0.0; - (*ssv)(AvSyy, ix1, ix2, ix3) = 0.0; - (*ssv)(AvSzz, ix1, ix2, ix3) = 0.0; - (*ssv)(AvSxy, ix1, ix2, ix3) = 0.0; - (*ssv)(AvSyz, ix1, ix2, ix3) = 0.0; - (*ssv)(AvSxz, ix1, ix2, ix3) = 0.0; + (*ssv)(AvVx, ix1, ix2, ix3) = c0o1; + (*ssv)(AvVy, ix1, ix2, ix3) = c0o1; + (*ssv)(AvVz, ix1, ix2, ix3) = c0o1; + + (*ssv)(AvSxx, ix1, ix2, ix3) = c0o1; + (*ssv)(AvSyy, ix1, ix2, ix3) = c0o1; + (*ssv)(AvSzz, ix1, ix2, ix3) = c0o1; + (*ssv)(AvSxy, ix1, ix2, ix3) = c0o1; + (*ssv)(AvSyz, ix1, ix2, ix3) = c0o1; + (*ssv)(AvSxz, ix1, ix2, ix3) = c0o1; ////////////////////////////////////////////////////////////////////////// } } @@ -409,10 +414,11 @@ void ShearStressSimulationObserver::findPlane(int ix1, int ix2, int ix3, SPtr<Gr real &B, real &C, real &D, real &ii) { using namespace vf::lbm::dir; + using namespace vf::basics::constant; - real x1plane = 0.0, y1plane = 0.0, z1plane = 0.0; - real x2plane = 0.0, y2plane = 0.0, z2plane = 0.0; - real x3plane = 0.0, y3plane = 0.0, z3plane = 0.0; + real x1plane = c0o1, y1plane = c0o1, z1plane = c0o1; + real x2plane = c0o1, y2plane = c0o1, z2plane = c0o1; + real x3plane = c0o1, y3plane = c0o1, z3plane = c0o1; SPtr<BoundaryConditions> bcPtr; real dx = grid->getDeltaX(block); SPtr<ILBMKernel> kernel = block->getKernel(); @@ -421,139 +427,139 @@ void ShearStressSimulationObserver::findPlane(int ix1, int ix2, int ix3, SPtr<Gr bcPtr = bcArray->getBC(ix1, ix2, ix3); int x, y, z; - if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2, ix3)) { + if (Interpolator::iCellHasSolid(bcArray, ix1, ix2, ix3)) { x = ix1; y = ix2; z = ix3; - } else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2 - 1, ix3)) { + } else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2 - 1, ix3)) { x = ix1 + 0; y = ix2 - 1; z = ix3 + 0; } // S - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2, ix3 - 1)) { x = ix1 + 0; y = ix2 + 0; z = ix3 - 1; } // B - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3)) { x = ix1 - 1; y = ix2 + 0; z = ix3 + 0; } // w - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2 - 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2 - 1, ix3 - 1)) { x = ix1 + 0; y = ix2 - 1; z = ix3 - 1; } // BS - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3 - 1)) { x = ix1 - 1; y = ix2 + 0; z = ix3 - 1; } // BW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3)) { x = ix1 - 1; y = ix2 - 1; z = ix3 + 0; } // SW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3 - 1)) { x = ix1 - 1; y = ix2 - 1; z = ix3 - 1; } // BSW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3)) { x = ix1 + 1; y = ix2 + 0; z = ix3 + 0; } // E - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2 + 1, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2 + 1, ix3)) { x = ix1 + 0; y = ix2 + 1; z = ix3 + 0; } // N - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2, ix3 + 1)) { x = ix1 + 0; y = ix2 + 0; z = ix3 + 1; } // T - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3)) { x = ix1 + 1; y = ix2 + 1; z = ix3 + 0; } // NE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3 + 1)) { x = ix1 + 1; y = ix2 + 0; z = ix3 + 1; } // TE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1, ix2 + 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1, ix2 + 1, ix3 + 1)) { x = ix1 + 0; y = ix2 + 1; z = ix3 + 1; } // TN - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3 + 1)) { x = ix1 + 1; y = ix2 + 1; z = ix3 + 1; } // TNE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3)) { x = ix1 + 1; y = ix2 - 1; z = ix3 + 0; } // SE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3)) { x = ix1 - 1; y = ix2 + 1; z = ix3 + 0; } // NW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2, ix3 - 1)) { x = ix1 + 1; y = ix2 + 0; z = ix3 - 1; } // BE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2, ix3 + 1)) { x = ix1 - 1; y = ix2 + 0; z = ix3 + 1; } // TW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 0, ix2 + 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 0, ix2 + 1, ix3 - 1)) { x = ix1 + 0; y = ix2 + 1; z = ix3 - 1; } // BN - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 0, ix2 - 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 0, ix2 - 1, ix3 + 1)) { x = ix1 + 0; y = ix2 - 1; z = ix3 + 1; } // TS - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3 + 1)) { x = ix1 - 1; y = ix2 + 1; z = ix3 + 1; } // TNW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3 + 1)) { x = ix1 + 1; y = ix2 - 1; z = ix3 + 1; } // TSE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3 + 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 - 1, ix3 + 1)) { x = ix1 - 1; y = ix2 - 1; z = ix3 + 1; } // TSW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 + 1, ix3 - 1)) { x = ix1 + 1; y = ix2 + 1; z = ix3 - 1; } // BNE - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 - 1, ix2 + 1, ix3 - 1)) { x = ix1 - 1; y = ix2 + 1; z = ix3 - 1; } // BNW - else if (InterpolationProcessor::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3 - 1)) { + else if (Interpolator::iCellHasSolid(bcArray, ix1 + 1, ix2 - 1, ix3 - 1)) { x = ix1 + 1; y = ix2 - 1; z = ix3 - 1; @@ -594,7 +600,7 @@ void ShearStressSimulationObserver::findPlane(int ix1, int ix2, int ix3, SPtr<Gr } } - if (InterpolationProcessor::iCellHasSolid(bcArray, x, y, z)) { + if (Interpolator::iCellHasSolid(bcArray, x, y, z)) { for (int i = x; i <= x + 1; i++) { for (int j = y; j <= y + 1; j++) { for (int k = z; k <= z + 1; k++) { @@ -839,6 +845,7 @@ bool ShearStressSimulationObserver::checkUndefindedNodes(SPtr<BCArray3D> bcArray void ShearStressSimulationObserver::initDistance() { using namespace vf::lbm::dir; + using namespace vf::basics::constant; for (const auto &interactor : interactors) { // typedef std::map<SPtr<Block3D>, std::set< std::vector<int> > > TransNodeIndicesMap; @@ -906,7 +913,7 @@ void ShearStressSimulationObserver::initDistance() continue; //////get normal and distance////// - real A, B, C, D, ii = 0.0; + real A, B, C, D, ii = c0o1; findPlane(ix1, ix2, ix3, grid, block, A, B, C, D, ii); Vector3D pointplane1 = grid->getNodeCoordinates(block, ix1, ix2, ix3); real ix1ph = pointplane1[0]; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp index ebd65f625600a1c68f48d00c33a79976ea6d1a5a..7f915be1a931fb61a4c59ab9d20677f4d3be97ad 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.cpp @@ -4,7 +4,7 @@ #include "LBMKernel.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "UbScheduler.h" @@ -16,7 +16,7 @@ TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver() = d ////////////////////////////////////////////////////////////////////////// TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, - std::shared_ptr<vf::mpi::Communicator> comm, int options) + std::shared_ptr<vf::parallel::Communicator> comm, int options) : SimulationObserver(grid, s), path(path), writer(writer), comm(comm), options(options) { init(); @@ -26,7 +26,7 @@ TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver(SPtr< ////////////////////////////////////////////////////////////////////////// TimeAveragedValuesSimulationObserver::TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, - std::shared_ptr<vf::mpi::Communicator> comm, int options, + std::shared_ptr<vf::parallel::Communicator> comm, int options, std::vector<int> levels, std::vector<real> &levelCoords, std::vector<real> &bounds, bool timeAveraging) : SimulationObserver(grid, s), path(path), writer(writer), comm(comm), options(options), levels(levels), @@ -354,6 +354,8 @@ void TimeAveragedValuesSimulationObserver::addData(const SPtr<Block3D> block) ////////////////////////////////////////////////////////////////////////// void TimeAveragedValuesSimulationObserver::calculateAverageValues(real timeSteps) { + using namespace vf::basics::constant; + for (int level = minInitLevel; level <= maxInitLevel; level++) { int i; const int block_size = (int) blockVector[level].size(); @@ -433,25 +435,25 @@ void TimeAveragedValuesSimulationObserver::calculateAverageValues(real timeSteps if ((options & Triplecorrelations) == Triplecorrelations) { // mean triple-correlations (*at)(Vxxx, ix1, ix2, ix3) = - (*at)(Vxxx, ix1, ix2, ix3) / timeSteps - 3.0 * uxx * ux + 2.0 * ux * ux * ux; + (*at)(Vxxx, ix1, ix2, ix3) / timeSteps - c3o1 * uxx * ux + c2o1 * ux * ux * ux; (*at)(Vxxy, ix1, ix2, ix3) = (*at)(Vxxy, ix1, ix2, ix3) / timeSteps - - 2.0 * uxy * ux - uxx * uy + 2.0 * ux * ux * uy; + c2o1 * uxy * ux - uxx * uy + c2o1 * ux * ux * uy; (*at)(Vxxz, ix1, ix2, ix3) = (*at)(Vxxz, ix1, ix2, ix3) / timeSteps - - 2.0 * uxz * ux - uxx * uz + 2.0 * ux * ux * uz; + c2o1 * uxz * ux - uxx * uz + c2o1 * ux * ux * uz; (*at)(Vyyy, ix1, ix2, ix3) = - (*at)(Vyyy, ix1, ix2, ix3) / timeSteps - 3.0 * uyy * uy + 2.0 * uy * uy * uy; + (*at)(Vyyy, ix1, ix2, ix3) / timeSteps - c3o1 * uyy * uy + c2o1 * uy * uy * uy; (*at)(Vyyx, ix1, ix2, ix3) = (*at)(Vyyx, ix1, ix2, ix3) / timeSteps - - 2.0 * uxy * uy - uyy * ux + 2.0 * uy * uy * ux; + c2o1 * uxy * uy - uyy * ux + c2o1 * uy * uy * ux; (*at)(Vyyz, ix1, ix2, ix3) = (*at)(Vyyz, ix1, ix2, ix3) / timeSteps - - 2.0 * uyz * uy - uyy * uz + 2.0 * uy * uy * uz; + c2o1 * uyz * uy - uyy * uz + c2o1 * uy * uy * uz; (*at)(Vzzz, ix1, ix2, ix3) = - (*at)(Vzzz, ix1, ix2, ix3) / timeSteps - 3.0 * uzz * uz + 2.0 * uz * uz * uz; + (*at)(Vzzz, ix1, ix2, ix3) / timeSteps - c3o1 * uzz * uz + c2o1 * uz * uz * uz; (*at)(Vzzx, ix1, ix2, ix3) = (*at)(Vzzx, ix1, ix2, ix3) / timeSteps - - 2.0 * uxz * uz - uzz * ux + 2.0 * uz * uz * ux; + c2o1 * uxz * uz - uzz * ux + c2o1 * uz * uz * ux; (*at)(Vzzy, ix1, ix2, ix3) = (*at)(Vzzy, ix1, ix2, ix3) / timeSteps - - 2.0 * uyz * uz - uzz * uy + 2.0 * uz * uz * uy; + c2o1 * uyz * uz - uzz * uy + c2o1 * uz * uz * uy; (*at)(Vxyz, ix1, ix2, ix3) = (*at)(Vxyz, ix1, ix2, ix3) / timeSteps - uxy * uz - - uxz * uy - uyz * ux + 2.0 * ux * uy * uz; + uxz * uy - uyz * ux + c2o1 * ux * uy * uz; } ////////////////////////////////////////////////////////////////////////// } @@ -577,6 +579,7 @@ void TimeAveragedValuesSimulationObserver::calculateSubtotal(real step) void TimeAveragedValuesSimulationObserver::planarAverage(real step) { std::ofstream ostr; + using namespace vf::basics::constant; if (root) { int istep = int(step); @@ -642,7 +645,7 @@ void TimeAveragedValuesSimulationObserver::planarAverage(real step) if (root) { real numberOfFluidsNodes = intValHelp.getNumberOfFluidsNodes(); if (numberOfFluidsNodes > 0) { - ostr << j + 0.5 * dx << std::setprecision(15); + ostr << j + c1o2 * dx << std::setprecision(15); // mean density if ((options & Density) == Density) { diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h index 14a1f6354aa57ca588361299caf7a1d336001f9e..a9f78137b8452f476dc37f8dfac711c9a414e889 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeAveragedValuesSimulationObserver.h @@ -9,7 +9,7 @@ #include "IntegrateValuesHelper.h" #include "LBMSystem.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -41,9 +41,9 @@ public: public: TimeAveragedValuesSimulationObserver(); TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, - SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options); + SPtr<UbScheduler> s, std::shared_ptr<vf::parallel::Communicator> comm, int options); TimeAveragedValuesSimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, - SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm, int options, std::vector<int> levels, + SPtr<UbScheduler> s, std::shared_ptr<vf::parallel::Communicator> comm, int options, std::vector<int> levels, std::vector<real> &levelCoords, std::vector<real> &bounds, bool timeAveraging = true); //! Make update @@ -70,7 +70,7 @@ protected: void calculateAverageValuesForPlane(std::vector<IntegrateValuesHelper::CalcNodes> &cnodes); private: - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; std::vector<UbTupleFloat3> nodes; std::vector<UbTupleUInt8> cells; std::vector<std::string> datanames; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp index e0560e2767b70dcc51db08f807a29e467efa6a2d..5245c51d9cb8b01324388d5cbfc61db5dc5ce5a1 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.cpp @@ -9,14 +9,14 @@ #include <fstream> -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "IntegrateValuesHelper.h" #include "LBMUnitConverter.h" #include "UbScheduler.h" TimeseriesSimulationObserver::TimeseriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, - const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) + const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), h1(h1), path(path), comm(comm) { if (comm->getProcessID() == comm->getRoot()) { diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h index db41bd2ecea38ac86e97740310ba9501f94caa4a..d467b2301688d716ffb0b879fd8d0fab7353b077 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TimeseriesSimulationObserver.h @@ -13,7 +13,7 @@ #include "SimulationObserver.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class IntegrateValuesHelper; @@ -27,7 +27,7 @@ class TimeseriesSimulationObserver : public SimulationObserver { public: TimeseriesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<IntegrateValuesHelper> h1, - const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); ~TimeseriesSimulationObserver() override; //! calls collectData. @@ -38,7 +38,7 @@ protected: //! object that can compute spacial average values in 3D-subdomain. SPtr<IntegrateValuesHelper> h1; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; private: std::string path; //! output filename, e.g. pathname + "/steps/timeseries" diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp index 47b865ed7b80fd1c420d59fa54144d5afa1471f5..d5a0ccb593488f4e992fef0fc7591c0672fc24ed 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.cpp @@ -3,7 +3,7 @@ #include "BCArray3D.h" #include "BCSet.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "LBMKernel.h" @@ -14,7 +14,7 @@ TurbulenceIntensitySimulationObserver::TurbulenceIntensitySimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, SPtr<UbScheduler> s, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), comm(comm), writer(writer) { init(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h index c615bbda5cb58a522e6853fcf3f8475bc3320b52..cffaf49ede459093bae2e0709da27a244f74ad5a 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/TurbulenceIntensitySimulationObserver.h @@ -8,7 +8,7 @@ #include "SimulationObserver.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -18,7 +18,7 @@ class TurbulenceIntensitySimulationObserver : public SimulationObserver { public: TurbulenceIntensitySimulationObserver(SPtr<Grid3D> grid, const std::string &path, WbWriter *const writer, - SPtr<UbScheduler> s, std::shared_ptr<vf::mpi::Communicator> comm); + SPtr<UbScheduler> s, std::shared_ptr<vf::parallel::Communicator> comm); void update(real step) override; protected: @@ -39,7 +39,7 @@ private: int gridRank; std::string path; WbWriter *writer; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; enum Values { AvVx = 0, AvVy = 1, AvVz = 2, AvVxxyyzz = 3 }; }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp index fd983bd02bd0bf3a7ae0cd0af96b2f169180f31b..15a1c39cf268659d8cc8dec4b7633636049a019d 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.cpp @@ -36,13 +36,13 @@ #include <logger/Logger.h> #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27System.h" #include "Grid3D.h" #include "UbScheduler.h" WriteBlocksSimulationObserver::WriteBlocksSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm) + WbWriter *const writer, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h index 805605b64564272c6a327545a4b01bc89926da38..636dc9f18d9b232f0a777232b3d69f26a545a477 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBlocksSimulationObserver.h @@ -39,7 +39,7 @@ #include "SimulationObserver.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -57,7 +57,7 @@ public: //! \param writer is WbWriter object //! \param comm is Communicator object WriteBlocksSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); ~WriteBlocksSimulationObserver() override; void update(real step) override; @@ -69,7 +69,7 @@ protected: std::string path; WbWriter *writer; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp index 9d09db9e2c839f5db6bdd4c95e348e3ade094759..3154cc815d24915769d63ac5c222c82b340162b9 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.cpp @@ -42,7 +42,7 @@ #include "BCArray3D.h" #include "Block3D.h" #include "CbArray3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3D.h" #include "LBMUnitConverter.h" #include "UbScheduler.h" @@ -55,7 +55,7 @@ WriteBoundaryConditionsSimulationObserver::WriteBoundaryConditionsSimulationObse ////////////////////////////////////////////////////////////////////////// WriteBoundaryConditionsSimulationObserver::WriteBoundaryConditionsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { gridRank = comm->getProcessID(); @@ -132,6 +132,8 @@ void WriteBoundaryConditionsSimulationObserver::clearData() ////////////////////////////////////////////////////////////////////////// void WriteBoundaryConditionsSimulationObserver::addDataGeo(SPtr<Block3D> block) { + using namespace vf::basics::constant; + UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); real dx = grid->getDeltaX(block); @@ -178,22 +180,22 @@ void WriteBoundaryConditionsSimulationObserver::addDataGeo(SPtr<Block3D> block) float(val<3>(org) - val<3>(nodeOffset) + ix3 * dx))); if (!bcArray->hasBC(ix1, ix2, ix3)) { - data[0].push_back(0.0); + data[0].push_back(c0o1); } else if (bcArray->getBC(ix1, ix2, ix3)->hasNoSlipBoundary()) - data[0].push_back(1.0); + data[0].push_back(c1o1); else if (bcArray->getBC(ix1, ix2, ix3)->hasVelocityBoundary()) - data[0].push_back(2.0); + data[0].push_back(c2o1); else if (bcArray->getBC(ix1, ix2, ix3)->hasDensityBoundary()) - data[0].push_back(3.0); + data[0].push_back(c3o1); else if (bcArray->getBC(ix1, ix2, ix3)->hasSlipBoundary()) - data[0].push_back(4.0); + data[0].push_back(c4o1); // else // data[0].push_back(5.0); if (bcArray->isSolid(ix1, ix2, ix3)) { - data[1].push_back(1.0); + data[1].push_back(c1o1); } else { - data[1].push_back(0.0); + data[1].push_back(c0o1); } data[2].push_back(level); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h index ad5b20df942748e065cebe926ba346581b9bf30b..aff7893432dfbd99f9ceae5d407e26c39e16304d 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteBoundaryConditionsSimulationObserver.h @@ -41,7 +41,7 @@ #include "SimulationObserver.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -61,7 +61,7 @@ public: //! \param writer is WbWriter object //! \param comm is Communicator object WriteBoundaryConditionsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm); + WbWriter *const writer, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteBoundaryConditionsSimulationObserver() override = default; void update(real step) override; @@ -84,6 +84,6 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp index 62178444f92abffebe8ce5d2ad1bd8a1f54960f0..7ad8c2dc113e2b5b8f9aba6e173efc3dd6817f05 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.cpp @@ -1,5 +1,5 @@ #include "WriteGbObjectsSimulationObserver.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "GbObject3D.h" #include "UbScheduler.h" #include "WbWriterVtkXmlASCII.h" @@ -7,7 +7,7 @@ #include <vector> WriteGbObjectsSimulationObserver::WriteGbObjectsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, std::shared_ptr<vf::mpi::Communicator> comm) + WbWriter *const writer, std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), comm(comm) { } diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h index 50f88c65ddbf87bb9960f2be61e380e9ad2d570b..44e466ee95713675dd507643c8fa0b7194b0f612 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteGbObjectsSimulationObserver.h @@ -7,7 +7,7 @@ #include <vector> class GbObject3D; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class WbWriter; @@ -21,7 +21,7 @@ class WriteGbObjectsSimulationObserver : public SimulationObserver { public: WriteGbObjectsSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, WbWriter *const writer, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); ~WriteGbObjectsSimulationObserver() override; //! calls collectData. void update(real step) override; @@ -35,7 +35,7 @@ private: std::vector<SPtr<GbObject3D>> objects; std::string path; WbWriter *writer; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif // WriteGbObjectsSimulationObserver_h__ \ No newline at end of file diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp index caf1e8c1ed2d4c43a219e1fd7a09b3a96e0e2370..945058c8e94b2d7780c4a03444c0848267b4b8f7 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.cpp @@ -6,7 +6,7 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "GbObject3D.h" #include "Grid3D.h" @@ -19,7 +19,7 @@ WriteMQFromSelectionSimulationObserver::WriteMQFromSelectionSimulationObserver() WriteMQFromSelectionSimulationObserver::WriteMQFromSelectionSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbObject3D> gbObject, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), gbObject(gbObject), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); @@ -80,7 +80,7 @@ void WriteMQFromSelectionSimulationObserver::collectData(real step) piece = subfolder + "/" + piece; std::vector<std::string> cellDataNames; - std::shared_ptr<vf::mpi::Communicator> comm = vf::mpi::Communicator::getInstance(); + std::shared_ptr<vf::parallel::Communicator> comm = vf::parallel::Communicator::getInstance(); std::vector<std::string> pieces = comm->gather(piece); if (comm->getProcessID() == comm->getRoot()) { std::string pname = diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h index e91fc369e1ddb33af68629d6aab75cf5b3756290..107d49720faed3f4fb1e5478b2bb75047f48ddb5 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMQFromSelectionSimulationObserver.h @@ -10,7 +10,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -24,7 +24,7 @@ public: WriteMQFromSelectionSimulationObserver(); WriteMQFromSelectionSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, SPtr<GbObject3D> gbObject, const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm); + std::shared_ptr<vf::parallel::Communicator> comm); ~WriteMQFromSelectionSimulationObserver() override = default; void update(real step) override; @@ -47,7 +47,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; SPtr<GbObject3D> gbObject; using CalcMacrosFct = void (*)(const real *const &, real &, real &, real &, real &); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp index 142bcc52b053f0be71c8a1ca41eaf0dfeaf24f1b..f098a21f536ba9ee1c8786007fe5ef272fb674af 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.cpp @@ -52,7 +52,7 @@ WriteMacroscopicQuantitiesPlusMassSimulationObserver::WriteMacroscopicQuantities const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h index ce6946528269adec3374dff655991b4a8cb0aaf7..ee892f41a597325fc1d6cfb5515d5f333e94cf21 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesPlusMassSimulationObserver.h @@ -42,7 +42,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -63,7 +63,7 @@ public: //! \param conv is LBMUnitConverter object //! \param comm is Communicator object WriteMacroscopicQuantitiesPlusMassSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteMacroscopicQuantitiesPlusMassSimulationObserver() override = default; void update(real step) override; @@ -90,7 +90,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; using CalcMacrosFct = void (*)(const real *const &, real &, real &, real &, real &); CalcMacrosFct calcMacros; diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp index b87b5cfcfc5b10b3fc97d54b135a745c811f9e0e..d5c80b4df56bc303361572e9114ab57efe995ecc 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.cpp @@ -39,7 +39,7 @@ #include "BCArray3D.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "DataSet3D.h" #include "Grid3D.h" #include "LBMUnitConverter.h" @@ -52,7 +52,7 @@ WriteMacroscopicQuantitiesSimulationObserver::WriteMacroscopicQuantitiesSimulati const std::string &path, WbWriter *const writer, SPtr<LBMUnitConverter> conv, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : SimulationObserver(grid, s), path(path), writer(writer), conv(conv), comm(comm) { gridRank = comm->getProcessID(); diff --git a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h index 85de0336487a71774d63c86f4c6ba1b65b15fe2a..279f9dfba3cc41c0a06ef4cc66b06e6b841f4259 100644 --- a/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h +++ b/src/cpu/VirtualFluidsCore/SimulationObservers/WriteMacroscopicQuantitiesSimulationObserver.h @@ -42,7 +42,7 @@ #include "LBMSystem.h" #include "UbTuple.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class UbScheduler; class LBMUnitConverter; @@ -63,7 +63,7 @@ public: //! \param conv is LBMUnitConverter object //! \param comm is Communicator object WriteMacroscopicQuantitiesSimulationObserver(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string &path, - WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::mpi::Communicator> comm); + WbWriter *const writer, SPtr<LBMUnitConverter> conv, std::shared_ptr<vf::parallel::Communicator> comm); ~WriteMacroscopicQuantitiesSimulationObserver() override = default; void update(real step) override; @@ -90,7 +90,7 @@ private: int minInitLevel; int maxInitLevel; int gridRank; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; using CalcMacrosFct = void (*)(const real *const &, real &, real &, real &, real &); CalcMacrosFct calcMacros; diff --git a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp index dbfb8907dacdad96849812a1cf5b01ccb52e1483..0c0f84b27f55d194b155688cdcae29c3e8397d83 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp +++ b/src/cpu/VirtualFluidsCore/Utilities/ChangeRandomQs.hpp @@ -27,10 +27,10 @@ namespace Utilities if (bc->hasNoSlipBoundaryFlag(fdir)) { const int invDir = D3Q27System::INVDIR[fdir]; - real q = (real) bc->getQ(invDir); + float q = bc->getQ(invDir); //double r = (double)UbRandom::rand(-50, 50); - real r = (real)UbRandom::rand(-10, 10); - real q_temp = q + q/r; + float r = (float)UbRandom::rand(-10, 10); + float q_temp = q + q/r; if (q_temp < 0.0) { q_temp = 0.0001f; diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp index 358dabf437fb69325a905d968e8dc6547127fd8f..0f41364ad614cf8ffb511461d713336e58fd0d1c 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp +++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.cpp @@ -1,7 +1,7 @@ #include "CheckpointConverter.h" #include "Block3D.h" #include "BoundaryConditions.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "CoordinateTransformation3D.h" #include "DataSet3D.h" #include "Grid3D.h" @@ -12,7 +12,7 @@ using namespace MPIIODataStructures; -CheckpointConverter::CheckpointConverter(SPtr<Grid3D> grid, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm) +CheckpointConverter::CheckpointConverter(SPtr<Grid3D> grid, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm) : grid(grid), path(path), comm(comm) { UbSystem::makeDirectory(path + "/mpi_io_cp"); diff --git a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h index bab67ae662c10e31158b47e1725788dc38794560..a2902b366cc1c4c06ccdc0513ed329757f22a558 100644 --- a/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h +++ b/src/cpu/VirtualFluidsCore/Utilities/CheckpointConverter.h @@ -8,14 +8,14 @@ #include <vector> class Grid3D; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} //! \class UtilConvertor //! \brief Converts timestep data from MPIIORestartSimulationObserver format into MPIIOMigrationSimulationObserver format class CheckpointConverter { public: - CheckpointConverter(SPtr<Grid3D> grid, const std::string &path, std::shared_ptr<vf::mpi::Communicator> comm); + CheckpointConverter(SPtr<Grid3D> grid, const std::string &path, std::shared_ptr<vf::parallel::Communicator> comm); virtual ~CheckpointConverter(); void convert(int step, int procCount); @@ -26,7 +26,7 @@ public: protected: std::string path; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; SPtr<Grid3D> grid; private: diff --git a/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h index 0c3adfb893bef12351c686e88bf907ecf6e12d99..2996ceeece9710079e898d02b0cceff447479d39 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/Block3DVisitor.h @@ -34,7 +34,7 @@ #ifndef Block3DVisitor_h #define Block3DVisitor_h -#include <PointerDefinitions.h> +#include <basics/PointerDefinitions.h> class Block3D; class Grid3D; diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp index b931cbbbda004f7b2057943222d4523c5fb0916b..35816e3d5770ebfba348ad29e9a45ba0e0d72910 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.cpp @@ -50,7 +50,7 @@ CreateTransmittersHelper::CreateTransmittersHelper() = default; ////////////////////////////////////////////////////////////////////////// void CreateTransmittersHelper::createTransmitters(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir, IBlock ib, TransmitterPtr &sender, TransmitterPtr &receiver, - std::shared_ptr<vf::mpi::Communicator> comm, TransmitterType tType) + std::shared_ptr<vf::parallel::Communicator> comm, TransmitterType tType) { // SourceBlock int srcLevel = sblock->getLevel(); diff --git a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h index af60de0a2e2b9e06488df3011584b8448594bf85..1a52078fa081b17ffc7e30c8f3cb154e9d698657 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h +++ b/src/cpu/VirtualFluidsCore/Visitors/CreateTransmittersHelper.h @@ -35,7 +35,7 @@ #define CREATETRANSMITTERSHELPER_H #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "LBMSystem.h" @@ -61,7 +61,7 @@ public: public: CreateTransmittersHelper(); void createTransmitters(const SPtr<Block3D> sblock, const SPtr<Block3D> tblock, int dir, IBlock ib, - TransmitterPtr &sender, TransmitterPtr &receiver, std::shared_ptr<vf::mpi::Communicator> comm, + TransmitterPtr &sender, TransmitterPtr &receiver, std::shared_ptr<vf::parallel::Communicator> comm, TransmitterType tType); protected: diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp index 2e24a2e26d1709b5c1af33d2210f269ca59f2e40..0cc445b303b29897076080aa0146ae64cba11e28 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp @@ -43,10 +43,12 @@ InitDistributionsBlockVisitor::InitDistributionsBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL) { - this->setVx1(0.0); - this->setVx2(0.0); - this->setVx3(0.0); - this->setRho(0.0); + using namespace vf::basics::constant; + + this->setVx1(c0o1); + this->setVx2(c0o1); + this->setVx3(c0o1); + this->setRho(c0o1); } ////////////////////////////////////////////////////////////////////////// void InitDistributionsBlockVisitor::setVx1(const mu::Parser &parser) @@ -125,6 +127,7 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> { using namespace D3Q27System; using namespace vf::lbm::dir; + using namespace vf::basics::constant; if(!block) UB_THROW( UbException(UB_EXARGS,"block is not exist") ); @@ -179,7 +182,7 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> rho = muRho.Eval(); //x-derivative - real deltaX=dx*0.5; + real deltaX=dx*c1o2; x1 = coords[0]+deltaX; real vx1Plusx1 = muVx1.Eval(); real vx2Plusx1 = muVx2.Eval(); @@ -214,38 +217,38 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> real vx2Minusx3 = muVx2.Eval(); real vx3Minusx3 = muVx3.Eval(); - real ax=(vx1Plusx1-vx1Minusx1)/(2.0*deltaX)*dx; - real bx=(vx2Plusx1-vx2Minusx1)/(2.0*deltaX)*dx; - real cx=(vx3Plusx1-vx3Minusx1)/(2.0*deltaX)*dx; + real ax=(vx1Plusx1-vx1Minusx1)/(c2o1*deltaX)*dx; + real bx=(vx2Plusx1-vx2Minusx1)/(c2o1*deltaX)*dx; + real cx=(vx3Plusx1-vx3Minusx1)/(c2o1*deltaX)*dx; - real ay=(vx1Plusx2-vx1Minusx2)/(2.0*deltaX)*dx; - real by=(vx2Plusx2-vx2Minusx2)/(2.0*deltaX)*dx; - real cy=(vx3Plusx2-vx3Minusx2)/(2.0*deltaX)*dx; + real ay=(vx1Plusx2-vx1Minusx2)/(c2o1*deltaX)*dx; + real by=(vx2Plusx2-vx2Minusx2)/(c2o1*deltaX)*dx; + real cy=(vx3Plusx2-vx3Minusx2)/(c2o1*deltaX)*dx; - real az=(vx1Plusx3-vx1Minusx3)/(2.0*deltaX)*dx; - real bz=(vx2Plusx3-vx2Minusx3)/(2.0*deltaX)*dx; - real cz=(vx3Plusx3-vx3Minusx3)/(2.0*deltaX)*dx; - real eps_new=1.0; - real op = 1.; + real az=(vx1Plusx3-vx1Minusx3)/(c2o1*deltaX)*dx; + real bz=(vx2Plusx3-vx2Minusx3)/(c2o1*deltaX)*dx; + real cz=(vx3Plusx3-vx3Minusx3)/(c2o1*deltaX)*dx; + real eps_new=c1o1; + real op = c1o1; real feq[27]; calcFeqsFct(feq,rho,vx1,vx2,vx3); - real f_E = eps_new *((5.*ax*o + 5.*by*o + 5.*cz*o - 8.*ax*op + 4.*by*op + 4.*cz*op)/(54.*o*op)); - real f_N = f_E + eps_new *((2.*(ax - by))/(9.*o)); - real f_T = f_E + eps_new *((2.*(ax - cz))/(9.*o)); - real f_NE = eps_new *(-(5.*cz*o + 3.*(ay + bx)*op - 2.*cz*op + ax*(5.*o + op) + by*(5.*o + op))/(54.*o*op)); - real f_SE = f_NE + eps_new *(( ay + bx )/(9.*o)); - real f_TE = eps_new *(-(5.*cz*o + by*(5.*o - 2.*op) + 3.*(az + cx)*op + cz*op + ax*(5.*o + op))/(54.*o*op)); - real f_BE = f_TE + eps_new *(( az + cx )/(9.*o)); - real f_TN = eps_new *(-(5.*ax*o + 5.*by*o + 5.*cz*o - 2.*ax*op + by*op + 3.*bz*op + 3.*cy*op + cz*op)/(54.*o*op)); - real f_BN = f_TN + eps_new *(( bz + cy )/(9.*o)); - real f_ZERO = eps_new *((5.*(ax + by + cz))/(9.*op)); - real f_TNE = eps_new *(-(ay + az + bx + bz + cx + cy)/(72.*o)); - real f_TSW = - eps_new *((ay + bx)/(36.*o)) - f_TNE; - real f_TSE = - eps_new *((az + cx)/(36.*o)) - f_TNE; - real f_TNW = - eps_new *((bz + cy)/(36.*o)) - f_TNE; + real f_E = eps_new *((c5o1*ax*o + c5o1*by*o + c5o1*cz*o - c8o1*ax*op + c4o1*by*op + c4o1*cz*op)/(c54o1*o*op)); + real f_N = f_E + eps_new *((c2o1*(ax - by))/(c9o1*o)); + real f_T = f_E + eps_new *((c2o1*(ax - cz))/(c9o1*o)); + real f_NE = eps_new *(-(c5o1*cz*o + c3o1*(ay + bx)*op - c2o1*cz*op + ax*(c5o1*o + op) + by*(c5o1*o + op))/(c54o1*o*op)); + real f_SE = f_NE + eps_new *(( ay + bx )/(c9o1*o)); + real f_TE = eps_new *(-(c5o1*cz*o + by*(c5o1*o - c2o1*op) + c3o1*(az + cx)*op + cz*op + ax*(c5o1*o + op))/(c54o1*o*op)); + real f_BE = f_TE + eps_new *(( az + cx )/(c9o1*o)); + real f_TN = eps_new *(-(c5o1*ax*o + c5o1*by*o + c5o1*cz*o - c2o1*ax*op + by*op + c3o1*bz*op + c3o1*cy*op + cz*op)/(c54o1*o*op)); + real f_BN = f_TN + eps_new *(( bz + cy )/(c9o1*o)); + real f_ZERO = eps_new *((c5o1*(ax + by + cz))/(c9o1*op)); + real f_TNE = eps_new *(-(ay + az + bx + bz + cx + cy)/(c72o1*o)); + real f_TSW = - eps_new *((ay + bx)/(c36o1*o)) - f_TNE; + real f_TSE = - eps_new *((az + cx)/(c36o1*o)) - f_TNE; + real f_TNW = - eps_new *((bz + cy)/(c36o1*o)) - f_TNE; f[DIR_P00] = f_E + feq[DIR_P00]; @@ -298,7 +301,9 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> ////////////////////////////////////////////////////////////////////////// void InitDistributionsBlockVisitor::checkFunction(mu::Parser fct) { - real x1 = 1.0, x2 = 1.0, x3 = 1.0; + using namespace vf::basics::constant; + + real x1 = c1o1, x2 = c1o1, x3 = c1o1; fct.DefineVar("x1", &x1); fct.DefineVar("x2", &x2); fct.DefineVar("x3", &x3); diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp index 660363e22e7c315a40df596aa95137f5589fff72..e6ab0193cdbc417c28fa90fa83fa897570048ae3 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.cpp @@ -8,7 +8,7 @@ #include "DataSet3D.h" #include "Grid3D.h" #include "D3Q27System.h" -#include "InterpolationProcessor.h" +#include "Interpolator.h" #include "LBMKernel.h" #include <CbArray2D.h> #include <basics/utilities/UbFileInputASCII.h> @@ -163,6 +163,8 @@ void InitDistributionsWithInterpolationGridVisitor::copyRemoteBlock(SPtr<Block3D void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock) { + using namespace vf::basics::constant; + D3Q27ICell icellC; D3Q27ICell icellF; real xoff, yoff, zoff; @@ -225,14 +227,14 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseT iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); } else { for (int i = 0; i < 27; i++) { - icellF.BSW[i] = 0.0; - icellF.BSE[i] = 0.0; - icellF.BNW[i] = 0.0; - icellF.BNE[i] = 0.0; - icellF.TSW[i] = 0.0; - icellF.TSE[i] = 0.0; - icellF.TNW[i] = 0.0; - icellF.TNE[i] = 0.0; + icellF.BSW[i] = c0o1; + icellF.BSE[i] = c0o1; + icellF.BNW[i] = c0o1; + icellF.BNE[i] = c0o1; + icellF.TSW[i] = c0o1; + icellF.TSE[i] = c0o1; + icellF.TNW[i] = c0o1; + icellF.TNE[i] = c0o1; } // std::string err = "For "+oldBlock->toString()+ // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ @@ -254,6 +256,8 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockCoarseT void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarseToFine(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock) { + using namespace vf::basics::constant; + int newGridRank = newGrid->getRank(); int oldBlockRank = oldBlock->getRank(); int newBlockRank = newBlock->getRank(); @@ -363,14 +367,14 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarse iProcessor->interpolateCoarseToFine(icellC, icellF, xoff, yoff, zoff); } else { for (int i = 0; i < 27; i++) { - icellF.BSW[i] = 0.0; - icellF.BSE[i] = 0.0; - icellF.BNW[i] = 0.0; - icellF.BNE[i] = 0.0; - icellF.TSW[i] = 0.0; - icellF.TSE[i] = 0.0; - icellF.TNW[i] = 0.0; - icellF.TNE[i] = 0.0; + icellF.BSW[i] = c0o1; + icellF.BSE[i] = c0o1; + icellF.BNW[i] = c0o1; + icellF.BNE[i] = c0o1; + icellF.TSW[i] = c0o1; + icellF.TSE[i] = c0o1; + icellF.TNW[i] = c0o1; + icellF.TNE[i] = c0o1; } // std::string err = "For "+oldBlock->toString()+ // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ @@ -393,6 +397,8 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockCoarse void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock) { + using namespace vf::basics::constant; + real icellC[27]; D3Q27ICell icellF; real xoff, yoff, zoff; @@ -456,14 +462,14 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToC iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff); } else { for (int i = 0; i < 27; i++) { - icellF.BSW[i] = 0.0; - icellF.BSE[i] = 0.0; - icellF.BNW[i] = 0.0; - icellF.BNE[i] = 0.0; - icellF.TSW[i] = 0.0; - icellF.TSE[i] = 0.0; - icellF.TNW[i] = 0.0; - icellF.TNE[i] = 0.0; + icellF.BSW[i] = c0o1; + icellF.BSE[i] = c0o1; + icellF.BNW[i] = c0o1; + icellF.BNE[i] = c0o1; + icellF.TSW[i] = c0o1; + icellF.TSE[i] = c0o1; + icellF.TNW[i] = c0o1; + icellF.TNE[i] = c0o1; } // std::string err = "For "+oldBlock->toString()+ // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ @@ -485,6 +491,8 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateLocalBlockFineToC void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineToCoarse(SPtr<Block3D> oldBlock, SPtr<Block3D> newBlock) { + using namespace vf::basics::constant; + int newGridRank = newGrid->getRank(); int oldBlockRank = oldBlock->getRank(); int newBlockRank = newBlock->getRank(); @@ -594,14 +602,14 @@ void InitDistributionsWithInterpolationGridVisitor::interpolateRemoteBlockFineTo iProcessor->interpolateFineToCoarse(icellF, icellC, xoff, yoff, zoff); } else { for (int i = 0; i < 27; i++) { - icellF.BSW[i] = 0.0; - icellF.BSE[i] = 0.0; - icellF.BNW[i] = 0.0; - icellF.BNE[i] = 0.0; - icellF.TSW[i] = 0.0; - icellF.TSE[i] = 0.0; - icellF.TNW[i] = 0.0; - icellF.TNE[i] = 0.0; + icellF.BSW[i] = c0o1; + icellF.BSE[i] = c0o1; + icellF.BNW[i] = c0o1; + icellF.BNE[i] = c0o1; + icellF.TSW[i] = c0o1; + icellF.TSE[i] = c0o1; + icellF.TNW[i] = c0o1; + icellF.TNE[i] = c0o1; } // std::string err = "For "+oldBlock->toString()+ // " x1="+UbSystem::toString(val<1>(oldGridIndexMin))+ diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h index a143ab6b0b40a8b35023a4916ffcbd20ae4b726c..eab801e448b4c797c7260274af66ea50a4677def 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsWithInterpolationGridVisitor.h @@ -8,12 +8,12 @@ class Grid3D; class Block3D; -class InterpolationProcessor; +class Interpolator; class InitDistributionsWithInterpolationGridVisitor : public Grid3DVisitor { public: - InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, SPtr<InterpolationProcessor> iProcessor, + InitDistributionsWithInterpolationGridVisitor(SPtr<Grid3D> oldGrid, SPtr<Interpolator> iProcessor, real nu); ~InitDistributionsWithInterpolationGridVisitor() override; void visit(SPtr<Grid3D> grid) override; @@ -30,7 +30,7 @@ private: SPtr<Grid3D> oldGrid; real nu; - SPtr<InterpolationProcessor> iProcessor; + SPtr<Interpolator> iProcessor; }; #endif // InitDistributionsWithVelocityProfileBlockVisitor_h__ diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp index be0c694bc733ff3b9ebd808d533757f98eefe73c..79c354e5f28724279447a4751ba81c3b6eba0958 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitThixotropyBlockVisitor.cpp @@ -1,4 +1,4 @@ -//======================================================================================= + //======================================================================================= // ____ ____ __ ______ __________ __ __ __ __ // \ \ | | | | | _ \ |___ ___| | | | | / \ | | // \ \ | | | | | |_) | | | | | | | / \ | | @@ -44,6 +44,8 @@ InitThixotropyBlockVisitor::InitThixotropyBlockVisitor() : Block3DVisitor(0, D3Q27System::MAXLEVEL) { + using namespace vf::basics::constant; + //this->setVx1(0.0); //this->setVx2(0.0); //this->setVx3(0.0); @@ -52,7 +54,7 @@ InitThixotropyBlockVisitor::InitThixotropyBlockVisitor() //this->setf2(0.0); //this->setf3(0.0); //this->setConcentration(0.0); - this->setLambda(0.0); + this->setLambda(c0o1); } ////////////////////////////////////////////////////////////////////////// //InitThixotropyBlockVisitor::InitThixotropyBlockVisitor(LBMReal lambda /*LBMReal nu, LBMReal D, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3, LBMReal c, LBMReal f1, LBMReal f2, LBMReal f3*/) @@ -218,6 +220,7 @@ void InitThixotropyBlockVisitor::setLambda(real lambda) void InitThixotropyBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) { using namespace D3Q27System; + using namespace vf::basics::constant; if(!block) UB_THROW( UbException(UB_EXARGS,"block is not exist") ); @@ -283,7 +286,7 @@ void InitThixotropyBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) real lambda = muLambda.Eval(); - calcFeqsFct(h,lambda,0.0,0.0,0.0); + calcFeqsFct(h,lambda,c0o1,c0o1,c0o1); distributions->setDistribution(h, ix1, ix2, ix3); distributions->setDistributionInv(h, ix1, ix2, ix3); diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp index 1e62e0a2c35367fb6189822bcdbf96b611d75bb9..30708d664deb405954f95a4aac58cd6c01d17153 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.cpp @@ -2,14 +2,14 @@ #include "MetisPartitioningGridVisitor.h" #include "Block3D.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "D3Q27System.h" #include "Grid3D.h" #include <cmath> using namespace std; -MetisPartitioningGridVisitor::MetisPartitioningGridVisitor(std::shared_ptr<vf::mpi::Communicator> comm, GraphType graphType, int numOfDirs, +MetisPartitioningGridVisitor::MetisPartitioningGridVisitor(std::shared_ptr<vf::parallel::Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType, bool threads, int numberOfThreads) : Grid3DVisitor(), numberOfThreads(numberOfThreads), numOfDirs(numOfDirs), comm(comm), threads(threads), diff --git a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h index c270d3ce389cc2697c1ac54178984ffa2f4d07a9..d4e29060932b61abeaa68d03e3e0fd566d45a927 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/MetisPartitioningGridVisitor.h @@ -9,7 +9,7 @@ #include "Grid3DVisitor.h" #include "MetisPartitioner.h" -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} //////////////////////////////////////////////////////////////////////// //! \brief The class implements domain decomposition with METIS library @@ -32,7 +32,7 @@ public: //! \param numOfDirs - maximum number of neighbors for each process //! \param threads - on/off decomposition for threads //! \param numberOfThreads - number of threads - MetisPartitioningGridVisitor(std::shared_ptr<vf::mpi::Communicator> comm, GraphType graphType, int numOfDirs, + MetisPartitioningGridVisitor(std::shared_ptr<vf::parallel::Communicator> comm, GraphType graphType, int numOfDirs, MetisPartitioner::PartType partType = MetisPartitioner::KWAY, bool threads = false, int numberOfThreads = 0); ~MetisPartitioningGridVisitor() override; @@ -52,7 +52,7 @@ protected: int numOfDirs; std::vector<int> blockID; std::vector<idx_t> parts; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; int bundleRoot; int processRoot; int bundleID; diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp index a73965641237c804cd094f399e582336e6be8e04..b2eefc859d26ef92d43bb7701a1eb96e6a7a6f4a 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.cpp @@ -1,5 +1,5 @@ #include "RefineAroundGbObjectHelper.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "OverlapBlockVisitor.h" #include "RatioBlockVisitor.h" #include "RatioSmoothBlockVisitor.h" @@ -11,7 +11,7 @@ RefineAroundGbObjectHelper::RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int refineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, real startDistance, real stopDistance, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : grid(grid), refineLevel(refineLevel), objectIter(objectIter), startDistance(startDistance), stopDistance(stopDistance), comm(comm) { diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h index 76874ce767294efa318bb7e8b9f8b4d2e2a348eb..c5cc4d6fc426566770bdfbfd4637f32e1ecd411d 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h +++ b/src/cpu/VirtualFluidsCore/Visitors/RefineAroundGbObjectHelper.h @@ -5,7 +5,7 @@ #include "lbm/constants/D3Q27.h" class Grid3D; -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class D3Q27TriFaceMeshInteractor; //! \brief Refine blocks on base of bounding boxes. @@ -21,7 +21,7 @@ public: //! \param startDistance start distance from geometry for refinement //! \param stopDistance stop distance from geometry for refinement RefineAroundGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, SPtr<D3Q27TriFaceMeshInteractor> objectIter, - real startDistance, real stopDistance, std::shared_ptr<vf::mpi::Communicator> comm); + real startDistance, real stopDistance, std::shared_ptr<vf::parallel::Communicator> comm); virtual ~RefineAroundGbObjectHelper(); //! start refinement void refine(); @@ -31,7 +31,7 @@ private: SPtr<D3Q27TriFaceMeshInteractor> objectIter; int refineLevel; real startDistance, stopDistance; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp index 52c7c3ac1204a96fe7db3089ef2eb3ecc93ac143..f11e8e5ce1bc04af79775be7bfdd14201febbc3f 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.cpp @@ -1,6 +1,6 @@ #include "RefineCrossAndInsideGbObjectHelper.h" #include "CheckRatioBlockVisitor.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "OverlapBlockVisitor.h" #include "RatioBlockVisitor.h" #include "RatioSmoothBlockVisitor.h" @@ -11,7 +11,7 @@ #include <Grid3D.h> RefineCrossAndInsideGbObjectHelper::RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, - std::shared_ptr<vf::mpi::Communicator> comm) + std::shared_ptr<vf::parallel::Communicator> comm) : grid(grid), maxRefineLevel(maxRefineLevel), comm(comm) { } diff --git a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h index d0a9ac44891519b3fd583f98a56e33dfd1e42122..28caf212afa50d8d07979e137c863f9554543adf 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h +++ b/src/cpu/VirtualFluidsCore/Visitors/RefineCrossAndInsideGbObjectHelper.h @@ -4,7 +4,7 @@ #include <PointerDefinitions.h> #include <vector> -namespace vf::mpi {class Communicator;} +namespace vf::parallel {class Communicator;} class Grid3D; class GbObject3D; @@ -17,7 +17,7 @@ public: //! Constructor //! \param grid a smart pointer to the grid object //! \param maxRefineLevel an integer for maximal refinement level - RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, std::shared_ptr<vf::mpi::Communicator> comm); + RefineCrossAndInsideGbObjectHelper(SPtr<Grid3D> grid, int maxRefineLevel, std::shared_ptr<vf::parallel::Communicator> comm); virtual ~RefineCrossAndInsideGbObjectHelper(); //! add geometric object //! \param object a smart pointer to bounding box @@ -31,7 +31,7 @@ private: std::vector<SPtr<GbObject3D>> objects; std::vector<int> levels; int maxRefineLevel; - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; }; #endif diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp index ed9a3ee59c87ab755416eecd5468a4cc763837e4..a21b8b8a61575eedbacdc76fdd55ef89c4318173 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.cpp @@ -4,7 +4,7 @@ #include "D3Q27System.h" //#include <mpi.h> -RenumberGridVisitor::RenumberGridVisitor(std::shared_ptr<vf::mpi::Communicator> com) : comm(com) {} +RenumberGridVisitor::RenumberGridVisitor(std::shared_ptr<vf::parallel::Communicator> com) : comm(com) {} ////////////////////////////////////////////////////////////////////////// void RenumberGridVisitor::visit(SPtr<Grid3D> grid) diff --git a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.h index 993bccd1034d0fb648c2e05d77da380916816967..aa56b469107dc2be3332622b747e0c0f3e3b9fe7 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/RenumberGridVisitor.h @@ -8,7 +8,7 @@ #ifndef RenumberGridVisitor_h #define RenumberGridVisitor_h -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3DVisitor.h" class Grid3D; @@ -19,14 +19,14 @@ class Grid3D; class RenumberGridVisitor : public Grid3DVisitor { public: - RenumberGridVisitor(std::shared_ptr<vf::mpi::Communicator> com); + RenumberGridVisitor(std::shared_ptr<vf::parallel::Communicator> com); ~RenumberGridVisitor() override = default; void visit(SPtr<Grid3D> grid) override; private: - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; // static int counter; }; diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h index ae214c77ca425dde4ecde31f7dc88d19a1616555..fcf2c93d233a5168f0ff4586244ee2088a7bf627 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/SetConnectorsBlockVisitor.h @@ -41,7 +41,7 @@ #include "D3Q27System.h" #include "Grid3D.h" #include "CreateTransmittersHelper.h" -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "OneDistributionFullDirectConnector.h" #include "OneDistributionFullVectorConnector.h" #include "TwoDistributionsFullDirectConnector.h" @@ -62,19 +62,19 @@ public: using LocalConnector = T1; using RemoteConnector = T2; public: - SetConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm); + SetConnectorsBlockVisitor(std::shared_ptr<vf::parallel::Communicator> comm); ~SetConnectorsBlockVisitor() override; void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; ////////////////////////////////////////////////////////////////////////// protected: void setSameLevelConnectors(SPtr<Grid3D> grid, SPtr<Block3D> block); void setRemoteConnectors(SPtr<Block3D> sblock, SPtr<Block3D> tblock, int dir); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; int gridRank{0}; }; template <class T1, class T2> -SetConnectorsBlockVisitor<T1, T2>::SetConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm) +SetConnectorsBlockVisitor<T1, T2>::SetConnectorsBlockVisitor(std::shared_ptr<vf::parallel::Communicator> comm) : Block3DVisitor(0, D3Q27System::MAXLEVEL), comm(comm) { } diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp index 7ff7d20b9fcd85b6939f3184fcde86c6fdaae77d..bdf851025d380daa93db2477217a513002591ebb 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.cpp @@ -39,10 +39,10 @@ #include "D3Q27System.h" #include <basics/transmitter/TbTransmitterLocal.h> -#include <mpi/Communicator.h> -#include "InterpolationProcessor.h" +#include <parallel/Communicator.h> +#include "Interpolator.h" -SetInterpolationConnectorsBlockVisitor::SetInterpolationConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm, real nue, SPtr<InterpolationProcessor> iProcessor) : +SetInterpolationConnectorsBlockVisitor::SetInterpolationConnectorsBlockVisitor(std::shared_ptr<vf::parallel::Communicator> comm, real nue, SPtr<Interpolator> iProcessor) : Block3DVisitor(0, D3Q27System::MAXLEVEL), comm(comm), nue(nue), diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h index c30d87ecaa042a30d931e29ba185fdd5230e2a68..4e4b205397842bc1218b5a0ec5555b527f989377 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/SetInterpolationConnectorsBlockVisitor.h @@ -43,14 +43,14 @@ class Grid3D; class Block3D; -namespace vf::mpi {class Communicator;} -class InterpolationProcessor; +namespace vf::parallel {class Communicator;} +class Interpolator; //! \brief A class sets connectors between blocks. class SetInterpolationConnectorsBlockVisitor : public Block3DVisitor { public: - SetInterpolationConnectorsBlockVisitor(std::shared_ptr<vf::mpi::Communicator> comm, real nue, SPtr<InterpolationProcessor> iProcessor); + SetInterpolationConnectorsBlockVisitor(std::shared_ptr<vf::parallel::Communicator> comm, real nue, SPtr<Interpolator> iProcessor); ~SetInterpolationConnectorsBlockVisitor() override; void visit(SPtr<Grid3D> grid, SPtr<Block3D> block) override; ////////////////////////////////////////////////////////////////////////// @@ -63,10 +63,10 @@ protected: CreateTransmittersHelper::TransmitterPtr &receiverCF, CreateTransmittersHelper::TransmitterPtr &senderFC, CreateTransmittersHelper::TransmitterPtr &receiverFC); - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; int gridRank; real nue; - SPtr<InterpolationProcessor> iProcessor; + SPtr<Interpolator> iProcessor; }; #endif // SetInterpolationConnectorsBlockVisitor_H diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp index fed80000c562b8aafdefd83ff2791781a8907f7a..1111429442829adca999bf6c587819419c8bd9fb 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SetKernelBlockVisitor.cpp @@ -124,6 +124,8 @@ void SetKernelBlockVisitor::throwExceptionIfNotEnoughMemory(const SPtr<Grid3D> & real SetKernelBlockVisitor::getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) const { + using namespace vf::basics::constant; + unsigned long long numberOfNodesPerBlockWithGhostLayer; auto numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); auto blockNx = grid->getBlockNX(); @@ -133,7 +135,7 @@ real SetKernelBlockVisitor::getRequiredPhysicalMemory(const SPtr<Grid3D> &grid) (val<2>(blockNx) + ghostLayer) * (val<3>(blockNx) + ghostLayer); auto needMemAll = - real(numberOfNodesPerBlockWithGhostLayer * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4)); + real(numberOfNodesPerBlockWithGhostLayer * (c27o1 * sizeof(real) + sizeof(int) + sizeof(float) * c4o1)); return needMemAll / real(numberOfProcesses); } diff --git a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h index 329662ec8aeb6405c8f8f4b06645c9d1500a59e6..17fa5b2ebb2b7230955e9ce4209a3cb341369326 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/SetUndefinedNodesBlockVisitor.h @@ -1,7 +1,7 @@ #ifndef SetUndefinedNodesBlockVisitor_h #define SetUndefinedNodesBlockVisitor_h -#include <PointerDefinitions.h> +#include <basics/PointerDefinitions.h> #include "Block3DVisitor.h" diff --git a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp index 4cdcfb80bb4aa3119f1e2ca4dfcd19c2abf381dd..520c7cfa30f582438b188643d8f913fd6ce2bd0b 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/SpongeLayerBlockVisitor.cpp @@ -24,6 +24,7 @@ SpongeLayerBlockVisitor::~SpongeLayerBlockVisitor() = default; void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) { using namespace vf::lbm::dir; + using namespace vf::basics::constant; if (!boundingBox) { UB_THROW(UbException(UB_EXARGS, "The bounding box isn't set!")); @@ -78,22 +79,22 @@ void SpongeLayerBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> block) int ibX1 = block->getX1(); int ibMax = val<1>(ixMax) - val<1>(ixMin) + 1; real index = (real)(ibX1 - val<1>(ixMin) + 1); - newCollFactor = oldCollFactor - (oldCollFactor - 1.0) / (real)(ibMax)*index; + newCollFactor = oldCollFactor - (oldCollFactor - c1o1) / (real)(ibMax)*index; } else if (dir == DIR_M00) { int ibX1 = block->getX1(); int ibMax = val<1>(ixMax) - val<1>(ixMin) + 1; real index = (real)(ibX1 - val<1>(ixMin) + 1); - newCollFactor = (oldCollFactor - 1.0) / (real)(ibMax)*index; + newCollFactor = (oldCollFactor - c1o1) / (real)(ibMax)*index; } else if (dir == DIR_00P) { int ibX3 = block->getX3(); int ibMax = val<3>(ixMax) - val<3>(ixMin) + 1; real index = (real)(ibX3 - val<3>(ixMin) + 1); - newCollFactor = oldCollFactor - (oldCollFactor - 1.0) / (real)(ibMax)*index; + newCollFactor = oldCollFactor - (oldCollFactor - c1o1) / (real)(ibMax)*index; } else if (dir == DIR_00M) { int ibX3 = block->getX3(); int ibMax = val<3>(ixMax) - val<3>(ixMin) + 1; real index = (real)(ibX3 - val<3>(ixMin) + 1); - newCollFactor = (oldCollFactor - 1.0) / (real)(ibMax)*index; + newCollFactor = (oldCollFactor - c1o1) / (real)(ibMax)*index; } else UB_THROW(UbException(UB_EXARGS, "Problem: no orthogonal sponge layer!")); diff --git a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp index 7d9f5e8d4e233c6f18aa5e95818b71143c3d3442..c168cd664d5de94fab8039a79c79b5e38c53adb8 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.cpp @@ -9,7 +9,7 @@ using namespace std; -ZoltanPartitioningGridVisitor::ZoltanPartitioningGridVisitor(std::shared_ptr<vf::mpi::Communicator> comm, int numOfDirs, +ZoltanPartitioningGridVisitor::ZoltanPartitioningGridVisitor(std::shared_ptr<vf::parallel::Communicator> comm, int numOfDirs, int numOfLocalParts) : comm(comm), numOfDirs(numOfDirs), numOfLocalParts(numOfLocalParts) { diff --git a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h index aeaf4d705c0b91cad482f87dff36ad6347363504..1f02c5efa3e7566d1407952024d358597bdb9e30 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h +++ b/src/cpu/VirtualFluidsCore/Visitors/ZoltanPartitioningGridVisitor.h @@ -10,14 +10,14 @@ #if defined VF_ZOLTAN && defined VF_MPI -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include "Grid3DVisitor.h" #include "ZoltanPartitioner.h" class ZoltanPartitioningGridVisitor : public Grid3DVisitor { public: - ZoltanPartitioningGridVisitor(std::shared_ptr<vf::mpi::Communicator> comm, int numOfDirs, int numOfLocalParts = 1); + ZoltanPartitioningGridVisitor(std::shared_ptr<vf::parallel::Communicator> comm, int numOfDirs, int numOfLocalParts = 1); ~ZoltanPartitioningGridVisitor(); void visit(SPtr<Grid3D> grid); @@ -26,7 +26,7 @@ protected: void repartGrid(SPtr<Grid3D> grid, ZoltanPartitioner &zp); private: - std::shared_ptr<vf::mpi::Communicator> comm; + std::shared_ptr<vf::parallel::Communicator> comm; int numOfDirs; int numOfLocalParts; ZoltanGraph *graph; diff --git a/src/cpu/simulationconfig/Simulation.cpp b/src/cpu/simulationconfig/Simulation.cpp index ec8773515ce49bdb8c0680152924605203ba9405..4b7d52286995ed9b5eadd5827d586b49e9f222a4 100644 --- a/src/cpu/simulationconfig/Simulation.cpp +++ b/src/cpu/simulationconfig/Simulation.cpp @@ -26,10 +26,10 @@ #include <Simulation/Simulation.h> #include <Simulation/Grid3D.h> #include <Interactors/InteractorsHelper.h> -#include <LBM/CompressibleOffsetMomentsInterpolationProcessor.h> +#include <LBM/Interpolation/CompressibleOffsetMomentsInterpolator.h> #include <LBM/LBMKernel.h> #include <LBM/LBMUnitConverter.h> -#include <mpi/MPICommunicator.h> +#include <parallel/MPICommunicator.h> #include <Visitors/GenBlocksGridVisitor.h> #include <Visitors/InitDistributionsBlockVisitor.h> #include <Visitors/MetisPartitioningGridVisitor.h> @@ -45,7 +45,7 @@ CPUSimulation::CPUSimulation() { - this->communicator = vf::mpi::MPICommunicator::getInstance(); + this->communicator = vf::parallel::MPICommunicator::getInstance(); this->grid = std::make_shared<Grid3D>(communicator); } diff --git a/src/cpu/simulationconfig/Simulation.h b/src/cpu/simulationconfig/Simulation.h index ee8fc911c684b55d0f624ab8db960d225e24790b..be29539187338cdadb5df2d102c90d03ee342434 100644 --- a/src/cpu/simulationconfig/Simulation.h +++ b/src/cpu/simulationconfig/Simulation.h @@ -5,7 +5,7 @@ #include <memory> #include <set> -#include <mpi/Communicator.h> +#include <parallel/Communicator.h> #include <geometry3d/GbPoint3D.h> #include <Interactors/Interactor3D.h> @@ -78,7 +78,7 @@ private: std::shared_ptr<LBMKernel> lbmKernel; std::shared_ptr<AbstractLBMSystem> lbmSystem; - std::shared_ptr<vf::mpi::Communicator> communicator; + std::shared_ptr<vf::parallel::Communicator> communicator; std::shared_ptr<Grid3D> grid; std::vector<std::shared_ptr<Interactor3D>> interactors; diff --git a/src/cuda/CMakeLists.txt b/src/cuda/CMakeLists.txt deleted file mode 100644 index 4d49cfedc903f3578b64916966405ea48bf28901..0000000000000000000000000000000000000000 --- a/src/cuda/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -project(cuda LANGUAGES CUDA CXX) - -vf_add_library(NAME vf_cuda PUBLIC_LINK logger) diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp index 571796d503a1a73b3eccf631a347884c7522b533..15efa9d3204cc37d4c4ccd8778ea13769ef655b8 100644 --- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp +++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.cpp @@ -49,16 +49,16 @@ std::vector<T> readStringToVector(std::string s) std::string readElement(std::string line) { - size_t elemStart = line.find("<")+1; + const size_t elemStart = line.find('<')+1; // size_t elemEnd = line.find("/>", elemStart); - size_t nameLen = line.find(" ", elemStart)-elemStart; + const size_t nameLen = line.find(' ', elemStart)-elemStart; return line.substr(elemStart, nameLen); } std::string readAttribute(std::string line, std::string attributeName) { - size_t attributeStart = line.find(attributeName)+attributeName.size() + 2; // add 2 for '="' - size_t attributeLen = line.find("\"", attributeStart)-attributeStart; + const size_t attributeStart = line.find(attributeName)+attributeName.size() + 2; // add 2 for '="' + const size_t attributeLen = line.find("\"", attributeStart)-attributeStart; return line.substr(attributeStart, attributeLen); } @@ -94,7 +94,7 @@ void VTKFile::readHeader() getline(file, line); // </ImageData getline(file, line); // AppendedData - int offset = int(file.tellg())+sizeof(char)+4; // skip underscore and bytesPerVal + const int offset = int(file.tellg())+sizeof(char)+4; // skip underscore and bytesPerVal for(auto& quantity: this->quantities) { @@ -118,7 +118,7 @@ void VTKFile::readHeader() } -bool VTKFile::markNANs(std::vector<uint> readIndices) +bool VTKFile::markNANs(const std::vector<uint>& readIndices) const { std::ifstream buf(fileName.c_str(), std::ios::in | std::ios::binary); @@ -126,7 +126,7 @@ bool VTKFile::markNANs(std::vector<uint> readIndices) tmp.reserve(readIndices.size()); buf.seekg(this->quantities[0].offset); buf.read((char*) tmp.data(), sizeof(double)*readIndices.size()); - auto firstNAN = std::find_if(tmp.begin(), tmp.end(), [](auto it){ return isnan(it); }); + const auto firstNAN = std::find_if(tmp.begin(), tmp.end(), [](auto it){ return isnan(it); }); return firstNAN != tmp.end(); } @@ -161,7 +161,7 @@ void VTKFile::getData(real *data, uint numberOfNodes, const std::vector<uint> &r { if(!this->loaded) loadFile(); - size_t nPoints = writeIndices.size(); + const size_t nPoints = writeIndices.size(); for(size_t j=0; j<this->quantities.size(); j++) { @@ -177,7 +177,7 @@ void VTKFile::printFileInfo() { printf("file %s with \n nx %i ny %i nz %i \n origin %f %f %f \n spacing %f %f %f \n", fileName.c_str(), nx, ny, nz, minX, minY, minZ, deltaX, deltaY, deltaZ); - for(auto quantity: this->quantities) + for(const auto& quantity: this->quantities) { printf("\t quantity %s offset %i \n", quantity.name.c_str(), quantity.offset); } @@ -199,8 +199,8 @@ void VTKFileCollection::findFiles() std::vector<VTKFile> filesWithThisId; while (!foundLastPart) { - std::string fname = makeFileName((int)files.size(), (int)filesOnThisLevel.size(), (int)filesWithThisId.size()); - std::ifstream f(fname); + const std::string fname = makeFileName((int)files.size(), (int)filesOnThisLevel.size(), (int)filesWithThisId.size()); + const std::ifstream f(fname); if(f.good()) filesWithThisId.emplace_back(fname); else @@ -223,7 +223,7 @@ void VTKFileCollection::findFiles() } if(files.empty()) - VF_LOG_CRITICAL("VTKFileCollection found no files!"); + throw std::runtime_error("VTKFileCollection found no files!"); } void TransientBCInputFileReader::getNeighbors(uint* neighbor0PP, uint* neighbor0PM, uint* neighbor0MP, uint* neighbor0MM) @@ -260,8 +260,8 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords { this->nPoints = (uint)coordsY.size(); this->initializeIndexVectors(); - real max_diff = 1e-4; // maximum distance between point on grid and precursor plane to count as exact match - real eps = 1e-7; // small number to avoid division by zero + const real max_diff = 1e-4; // maximum distance between point on grid and precursor plane to count as exact match + const real eps = 1e-7; // small number to avoid division by zero bool perfect_match = true; this->weights0PP.reserve(this->nPoints); @@ -277,11 +277,11 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords for(uint i=0; i<nPoints; i++) { - real posY = coordsY[i]; - real posZ = coordsZ[i]; + const real posY = coordsY[i]; + const real posZ = coordsZ[i]; bool found0PP = false, found0PM = false, found0MP = false, found0MM = false, foundAll = false; - uint level = this->readLevel; + const uint level = this->readLevel; for(int fileId=0; fileId<(int)this->fileCollection->files[level].size(); fileId++) { @@ -290,7 +290,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords // y in simulation is x in precursor/file, z in simulation is y in precursor/file // simulation -> file: N -> E, S -> W, T -> N, B -> S - int idx = file.findNeighborMMM(posY, posZ, 0.f); //!> index of nearest WSB neighbor on precursor file + const int idx = file.findNeighborMMM(posY, posZ, 0.f); //!> index of nearest WSB neighbor on precursor file if(idx!=-1) { @@ -301,7 +301,7 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords this->weights0PM.emplace_back(0.f); this->weights0MP.emplace_back(0.f); this->weights0MM.emplace_back(0.f); - uint writeIdx = this->getWriteIndex(level, fileId, idx); //!> writeIdx: index on host/device array where precursor value will be written to after loading from file + const uint writeIdx = this->getWriteIndex(level, fileId, idx); //!> writeIdx: index on host/device array where precursor value will be written to after loading from file this->planeNeighbor0PP.push_back(writeIdx); //!> neighbor lists mapping where BC kernel should read from on host/device array this->planeNeighbor0PM.push_back(writeIdx); this->planeNeighbor0MP.push_back(writeIdx); @@ -319,8 +319,8 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords if(!found0MM) { found0MM = true; - real dy = file.getX(idx)-posY; - real dz = file.getY(idx)-posZ; + const real dy = file.getX(idx)-posY; + const real dz = file.getY(idx)-posZ; this->weights0MM.emplace_back(1.f/(dy*dy+dz*dz+eps)); this->planeNeighbor0MM.emplace_back(getWriteIndex(level, fileId, idx)); } @@ -329,12 +329,12 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords if(!found0PP) //NT in simulation is EN in precursor { - int index = file.findNeighborPPM(posY, posZ, 0.f); + const int index = file.findNeighborPPM(posY, posZ, 0.f); if(index!=-1) { found0PP = true; - real dy = file.getX(index)-posY; - real dz = file.getY(index)-posZ; + const real dy = file.getX(index)-posY; + const real dz = file.getY(index)-posZ; this->weights0PP.emplace_back(1.f/(dy*dy+dz*dz+eps)); this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, index)); } @@ -342,12 +342,12 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords if(!found0PM) //NB in simulation is ES in precursor { - int index = file.findNeighborPMM(posY, posZ, 0.f); + const int index = file.findNeighborPMM(posY, posZ, 0.f); if(index!=-1) { found0PM = true; - real dy = file.getX(index)-posY; - real dz = file.getY(index)-posZ; + const real dy = file.getX(index)-posY; + const real dz = file.getY(index)-posZ; this->weights0PM.emplace_back(1.f/(dy*dy+dz*dz+eps)); this->planeNeighbor0PP.emplace_back(getWriteIndex(level, fileId, index)); } @@ -355,12 +355,12 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords if(!found0MP) //ST in simulation is WN in precursor { - int index = file.findNeighborMPM(posY, posZ, 0.f); + const int index = file.findNeighborMPM(posY, posZ, 0.f); if(index!=-1) { found0MP = true; - real dy = file.getX(index)-posY; - real dz = file.getY(index)-posZ; + const real dy = file.getX(index)-posY; + const real dz = file.getY(index)-posZ; this->weights0MP.emplace_back(1.f/(dy*dy+dz*dz+eps)); this->planeNeighbor0MP.emplace_back(getWriteIndex(level, fileId, index)); } @@ -391,8 +391,8 @@ void VTKReader::fillArrays(std::vector<real>& coordsY, std::vector<real>& coords uint VTKReader::getWriteIndex(int level, int id, int linearIndex) { - auto it = std::find(this->writeIndices[level][id].begin(), this->writeIndices[level][id].end(), linearIndex); - uint idx = it-this->writeIndices[level][id].begin(); + const auto it = std::find(this->writeIndices[level][id].begin(), this->writeIndices[level][id].end(), linearIndex); + const uint idx = it-this->writeIndices[level][id].begin(); if(it==this->writeIndices[level][id].end()) { this->writeIndices[level][id].push_back(this->nPointsRead); //!> index on host/device array where value from file will be written to @@ -407,17 +407,16 @@ void VTKReader::getNextData(real* data, uint numberOfNodes, real time) { // for(size_t level=0; level<this->fileCollection->files.size(); level++) // { - uint level = this->readLevel; + const uint level = this->readLevel; for(size_t id=0; id<this->fileCollection->files[level].size(); id++) { size_t numberOfFiles = this->nFile[level][id]; - if(!this->fileCollection->files[level][id][numberOfFiles].inZBounds(time)) { numberOfFiles++; - VF_LOG_INFO("PrecursorBC on level {}: switching to file no. {}\n", level, numberOfFiles); + VF_LOG_INFO("PrecursorBC on level {}: switching to file no. {}", level, numberOfFiles); if(numberOfFiles == this->fileCollection->files[level][id].size()) throw std::runtime_error("Not enough Precursor Files to read"); @@ -433,10 +432,9 @@ void VTKReader::getNextData(real* data, uint numberOfNodes, real time) } } - VTKFile* file = &this->fileCollection->files[level][id][numberOfFiles]; - int off = file->getClosestIdxZ(time)*file->getNumberOfPointsInXYPlane(); + const int off = file->getClosestIdxZ(time)*file->getNumberOfPointsInXYPlane(); file->getData(data, numberOfNodes, this->readIndices[level][id], this->writeIndices[level][id], off, this->writingOffset); this->nFile[level][id] = numberOfFiles; } diff --git a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h index bdf29745a0a60473d0454c33dcb10a193ca10780..5b9ea91a831da4d9bf189418e0e3eaaf8abd7357 100644 --- a/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h +++ b/src/gpu/GridGenerator/TransientBCSetter/TransientBCSetter.h @@ -41,7 +41,7 @@ public: }; void getData(real* data, uint numberOfNodes, const std::vector<uint>& readIndices, const std::vector<uint>& writeIndices, uint offsetRead, uint offsetWrite); - bool markNANs(std::vector<uint> readIndices); + bool markNANs(const std::vector<uint>& readIndices) const; bool inBoundingBox(real posX, real posY, real posZ){return inXBounds(posX) && inYBounds(posY) && inZBounds(posZ); }; bool inXBounds(real posX){ return posX<=maxX && posX>=minX; }; bool inYBounds(real posY){ return posY<=maxY && posY>=minY; }; @@ -183,7 +183,7 @@ public: void getNextData(real* data, uint numberOfNodes, real time) override; void fillArrays(std::vector<real>& coordsY, std::vector<real>& coordsZ) override; private: - uint getWriteIndex(int level, int id, int linearIdx); + uint getWriteIndex(int level, int id, int linearIndex); void initializeIndexVectors(); private: diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp index f66b216525253d26d0402c08ec89131130245ca0..6d12a19cc097c0b8e98c59a938380be97dc0b15c 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp @@ -124,10 +124,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe } } - - - int counter = 0; - // Test line intersection for (z = minZ; z <= maxZ; z += grid->getDelta()) { @@ -135,7 +131,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { for (x = minX; x <= maxX; x += grid->getDelta()) { - counter++; if (mesh->intersectLine((x - grid->getDelta()), y, z, x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); @@ -152,7 +147,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { if (!grid->isNode(grid->transCoordToIndex(x, y, z), OuterType)) { - counter++; if (mesh->intersectLine((x + grid->getDelta()), y, z, x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); @@ -170,7 +164,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { if (!grid->isNode(grid->transCoordToIndex(x, y, z), OuterType)) { - counter++; if (mesh->intersectLine(x, (y - grid->getDelta()), z, x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); @@ -188,7 +181,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { if (!grid->isNode(grid->transCoordToIndex(x, y, z), OuterType)) { - counter++; if (mesh->intersectLine(x, (y + grid->getDelta()), z, x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); @@ -206,7 +198,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { if (!grid->isNode(grid->transCoordToIndex(x, y, z), OuterType)) { - counter++; if (mesh->intersectLine(x, y, (z - grid->getDelta()), x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); @@ -224,7 +215,6 @@ void RayCastingDiscretizationStrategy::doDiscretize(TriangularMesh* triangularMe { if (!grid->isNode(grid->transCoordToIndex(x, y, z), OuterType)) { - counter++; if (mesh->intersectLine(x, y, (z + grid->getDelta()), x, y, z)) break; grid->setNodeTo(grid->transCoordToIndex(x, y, z), OuterType); diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index 4924432dbf05ca2213e5fa08cf16a28ea75f8c9e..fddcc7f790142e6ae5fae2eb07b78e0c18aa5d60 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -50,7 +50,7 @@ using namespace vf::basics::constant; struct Vertex; -class Grid; +class Grid; class Transformator; class ArrowTransformator; class PolyDataWriterWrapper; diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index e45ad99d8a63c332aa3723eb682b61dbc267f4db..7febc828f6d479b315d160e6c3db6e2bffaeb473 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -49,14 +49,11 @@ #include "io/GridVTKWriter/GridVTKWriter.h" #include "io/STLReaderWriter/STLWriter.h" -MultipleGridBuilder::MultipleGridBuilder(SPtr<GridFactory> gridFactory) : LevelGridBuilder(), gridFactory(gridFactory), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) -{ - -} -SPtr<MultipleGridBuilder> MultipleGridBuilder::makeShared(SPtr<GridFactory> gridFactory) +MultipleGridBuilder::MultipleGridBuilder() : LevelGridBuilder(), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) { - return SPtr<MultipleGridBuilder>(new MultipleGridBuilder(gridFactory)); + gridFactory = GridFactory::make(); + gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); } void MultipleGridBuilder::addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta) @@ -112,7 +109,6 @@ void MultipleGridBuilder::addGrid(SPtr<Object> gridShape, uint levelFine) for( uint level = this->getNumberOfLevels(); level <= levelFine; level++ ){ const auto grid = makeGrid(gridShape, level, levelFine); - if(level != levelFine){ grid->setInnerRegionFromFinerGrid(true); grid->setNumberOfLayers( this->numberOfLayersBetweenLevels ); diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h index 8d94edd0f42b237ef4e45e5a4f4246d739a51b46..0c90c90a6479187ac3b18c880a94da51b1ba7cbf 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h @@ -47,11 +47,8 @@ class BoundingBox; class MultipleGridBuilder : public LevelGridBuilder { -private: - GRIDGENERATOR_EXPORT MultipleGridBuilder(SPtr<GridFactory> gridFactory); - public: - GRIDGENERATOR_EXPORT static SPtr<MultipleGridBuilder> makeShared(SPtr<GridFactory> gridFactory); + MultipleGridBuilder(); GRIDGENERATOR_EXPORT void addCoarseGrid(real startX, real startY, real startZ, real endX, real endY, real endZ, real delta); GRIDGENERATOR_EXPORT void addGrid(SPtr<Object> gridShape); diff --git a/src/gpu/GridGenerator/grid/GridImpTest.cpp b/src/gpu/GridGenerator/grid/GridImpTest.cpp index 07b2a03f429ad8baf0badd0c966dd88235644c0a..fcbf7cc92a97bcea7ca72525dc1981cd7b95dfee 100644 --- a/src/gpu/GridGenerator/grid/GridImpTest.cpp +++ b/src/gpu/GridGenerator/grid/GridImpTest.cpp @@ -172,9 +172,7 @@ protected: void SetUp() override { - auto gridFactory = GridFactory::make(); - gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); - gridBuilder = MultipleGridBuilder::makeShared(gridFactory); + gridBuilder = std::make_shared<MultipleGridBuilder>(); } }; diff --git a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp index d73adc73eeffce56397829c115def5bfd1d8bc59..669d7fb258759266b06a5cc214befdb3f1a6ec29 100644 --- a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp +++ b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp @@ -217,7 +217,7 @@ std::vector<Triangle> STLReader::readBinarySTL(const std::string& name) char nTri[4]; sizef = fread(nTri, sizeof(char), 4, file); - unsigned long nTriLong = *((unsigned long*)nTri); + unsigned int nTriLong = *((unsigned int*)nTri); VF_LOG_INFO("Number of Triangles: {}" , nTriLong); std::vector<Triangle> triangles; @@ -309,7 +309,7 @@ std::vector<Triangle> STLReader::readBinarySTL(const BoundingBox &box, const std sizef = fread(nTri, sizeof(char), 4, file); - nTriLong = *((unsigned long*)nTri); + nTriLong = *((unsigned int*)nTri); VF_LOG_INFO("Number of Triangles complete geometry: {}", nTriLong); std::vector<Triangle> triangles; diff --git a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp index eb7e6b22e160de4fedb5832be807dabf36531c9c..d3a467b0511f7f4b40d06b4c6d9b57ff09b9694a 100644 --- a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp +++ b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp @@ -479,8 +479,8 @@ void SimulationFileWriter::addShortQsToVector(int index, std::vector<std::vector } } if (qKey > 0) { - real transportKey = *((real*)&qKey); - qNode.push_back(transportKey); + float transportKey = *((float*)&qKey); + qNode.push_back((real)transportKey); qNode.push_back((real)index); qs[GEOMQS].push_back(qNode); } @@ -522,8 +522,8 @@ void SimulationFileWriter::fillRBForNode(int index, int direction, int direction qNode.push_back(0.5f); } if (qKey > 0) { - real transportKey = *((real*)&qKey); - qNode.push_back(transportKey); + float transportKey = *((float*)&qKey); + qNode.push_back((real)transportKey); qNode.push_back((real)index); qs[rb].push_back(qNode); } diff --git a/src/gpu/VirtualFluids_GPU/CMakeLists.txt b/src/gpu/VirtualFluids_GPU/CMakeLists.txt index d7e4a776271c5bc243a4ed663ffecd23dec5cebb..4cd0d1df5db24385c2b528294bb665d405e73937 100644 --- a/src/gpu/VirtualFluids_GPU/CMakeLists.txt +++ b/src/gpu/VirtualFluids_GPU/CMakeLists.txt @@ -1,11 +1,7 @@ project(VirtualFluids_GPU LANGUAGES CUDA CXX) -set(additional_libraries "") -if(MSVC) - set(additional_libraries ws2_32 Traffic) # ws_32 throws an error on Phoenix -endif() -vf_add_library(PUBLIC_LINK basics lbm PRIVATE_LINK ${additional_libraries} GridGenerator MPI::MPI_CXX vf_cuda) +vf_add_library(PUBLIC_LINK basics lbm parallel PRIVATE_LINK GridGenerator cuda_helper) #SET(TPN_WIN32 "/EHsc") #https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake @@ -13,10 +9,15 @@ vf_add_library(PUBLIC_LINK basics lbm PRIVATE_LINK ${additional_libraries} GridG set_target_properties(VirtualFluids_GPU PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON) + +if(MSVC) + set_target_properties(VirtualFluids_GPU PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) +endif() + vf_add_tests() if(BUILD_VF_UNIT_TESTS) - set_target_properties(VirtualFluids_GPUTests PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + # set_target_properties(VirtualFluids_GPUTests PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_include_directories(VirtualFluids_GPUTests PRIVATE "${VF_THIRD_DIR}/cuda_samples/") target_include_directories(VirtualFluids_GPUTests PRIVATE "${VF_ROOT_DIR}/src/gpu/GridGenerator/") set_source_files_properties(Communication/ExchangeData27Test.cpp PROPERTIES LANGUAGE CUDA) @@ -26,4 +27,5 @@ if(BUILD_VF_UNIT_TESTS) set_source_files_properties(Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17Test.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(Kernel/Utilities/DistributionHelperTests.cpp PROPERTIES LANGUAGE CUDA) set_source_files_properties(Parameter/ParameterTest.cpp PROPERTIES LANGUAGE CUDA) + set_source_files_properties(PreCollisionInteractor/ActuatorFarmInlinesTest.cpp PROPERTIES LANGUAGE CUDA) endif() diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp index 3956bcbee4478e7c780559ef2dc74b2bd1fc79f7..2bb2bd943f6f24a8b904f949a43e75426e497ba1 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp @@ -463,7 +463,6 @@ void printGeoFile(Parameter* para, bool fileFormat) } else //Binary: { - int tempX = 0; ////////////////////////////////////////////////////////////////////////// std::ofstream ostr; ostr.open(fname, std::ios::out | std::ios::binary); @@ -491,10 +490,8 @@ void printGeoFile(Parameter* para, bool fileFormat) { tempCoord = (para->getParH((int)lev)->coordinateX[para->getParH((int)lev)->cpTopIndex[i]] * para->getScaleLBMtoSI().at(0) + para->getTranslateLBMtoSI().at(0)); writeFloatToFile(tempCoord, ostr); - tempX++; } } - //std::cout << "tempX in geo: " << tempX << endl; } ////////////////////////////////////////////////////////////////////////// // Y diff --git a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp index f220c9a811486d14977ac9e55527c9e3e60c2478..c498721e56ff3aea1eab6258b26bfd2c4d95e33a 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp @@ -1,4 +1,4 @@ -#include "Calculation/ForceCalculations.h" +#include "ForceCalculations.h" ////////////////////////////////////////////////////////////////////////// #include "GPU/GPU_Interface.h" @@ -35,18 +35,12 @@ ForceCalculations::ForceCalculations(Parameter* para) isPID = true; } -ForceCalculations::~ForceCalculations() -{ -} - - - void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaMemoryManager) { ////////////////////////////////////////////////////////////////////////// - double tempVeloX = 0.0, tempVeloY = 0.0, tempVeloZ = 0.0; - double veloAverageX = 0.0; //, veloAverageY = 0.0, veloAverageZ = 0.0; - double levelVeloAverageX = 0.0, levelVeloAverageY = 0.0, levelVeloAverageZ = 0.0; + double tempVeloX = 0.0; + double veloAverageX = 0.0; + double levelVeloAverageX = 0.0; int counter = 0; ////////////////////////////////////////////////////////////////////////// for (int lev = para->getCoarse(); lev <= para->getFine(); lev++) @@ -72,21 +66,14 @@ void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryMan getLastCudaError("CalcMacSP27 execution failed"); ////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyPrint(lev); -// para->cudaCopyForceVelo(i,numberOfElements); ////////////////////////////////////////////////////////////////// for (size_t pos = 0; pos < numberOfElements; pos++) { tempVeloX += (double)para->getParH(lev)->velocityX[pos]; - tempVeloY += (double)para->getParH(lev)->velocityY[pos]; - tempVeloZ += (double)para->getParH(lev)->velocityZ[pos]; } tempVeloX /= (double)numberOfElements; - tempVeloY /= (double)numberOfElements; - tempVeloZ /= (double)numberOfElements; ////////////////////////////////////////////////////////////////// levelVeloAverageX += tempVeloX; - levelVeloAverageY += tempVeloY; - levelVeloAverageZ += tempVeloZ; ////////////////////////////////////////////////////////////////// counter++; ////////////////////////////////////////////////////////////////// @@ -94,8 +81,6 @@ void ForceCalculations::calcPIDControllerForForce(Parameter* para, CudaMemoryMan } ////////////////////////////////////////////////////////////////////////// veloAverageX = levelVeloAverageX / (double)counter; - //veloAverageY = levelVeloAverageY / (double)counter; - //veloAverageZ = levelVeloAverageZ / (double)counter; ////////////////////////////////////////////////////////////////////////// if (isPID) { diff --git a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h index 4506d23abd7068697a089c926d684406af789aef..867e1327d1a6e2fefaa049f9e3d8e3dd6eb19666 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.h @@ -13,7 +13,6 @@ class ForceCalculations { public: ForceCalculations(Parameter* para); - ~ForceCalculations(); void calcPIDControllerForForce(Parameter* para, CudaMemoryManager* cudaMemoryManager); void printForcing(Parameter* para); @@ -34,9 +33,4 @@ private: bool isPID; }; - -//void calcVeloForce(Parameter* para); -//void allocVeloForForcing(Parameter* para); -//void printForcing(Parameter* para); - #endif /* FORCE_CALCULATIONS_H */ diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp index a2b1039afca4eaa3fcd75e28cae16cb5f68f6c9b..cf1aaa3988e0809dd0995a18139ab7dcef75989f 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.cpp @@ -13,6 +13,8 @@ #include "CollisionStrategy.h" #include "RefinementStrategy.h" +#include <parallel/Communicator.h> + void UpdateGrid27::updateGrid(int level, unsigned int t) { ////////////////////////////////////////////////////////////////////////// @@ -381,7 +383,7 @@ void UpdateGrid27::exchangeData(int level) exchangeMultiGPU_noStreams_withPrepare(level, false); } -UpdateGrid27::UpdateGrid27(SPtr<Parameter> para, vf::gpu::Communicator &comm, SPtr<CudaMemoryManager> cudaMemoryManager, +UpdateGrid27::UpdateGrid27(SPtr<Parameter> para, vf::parallel::Communicator &comm, SPtr<CudaMemoryManager> cudaMemoryManager, std::vector<std::shared_ptr<PorousMedia>> &pm, std::vector<SPtr<Kernel>> &kernels , BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory) : para(para), comm(comm), cudaMemoryManager(cudaMemoryManager), pm(pm), kernels(kernels), tmFactory(tmFactory) { diff --git a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h index 9c6ff48725f4e17121de0a1a8681d0bafcfb58ee..9de7e73ec03a0f00542dd5b718ed6f210399a18a 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/UpdateGrid27.h @@ -1,13 +1,17 @@ #ifndef UPDATEGRID27_H #define UPDATEGRID27_H -#include "LBM/LB.h" +#include "Calculation/PorousMedia.h" +#include "GPU/CudaMemoryManager.h" #include "GPU/GPU_Interface.h" -#include "Parameter/Parameter.h" +#include "LBM/LB.h" #include "Parameter/CudaStreamManager.h" -#include "GPU/CudaMemoryManager.h" -#include "Communication/Communicator.h" -#include "Calculation/PorousMedia.h" +#include "Parameter/Parameter.h" + +namespace vf::parallel +{ +class Communicator; +} class BCKernelManager; class ADKernelManager; @@ -24,7 +28,7 @@ using RefinementStrategy = std::function<void (UpdateGrid27* updateGrid, Paramet class UpdateGrid27 { public: - UpdateGrid27(SPtr<Parameter> para, vf::gpu::Communicator &comm, SPtr<CudaMemoryManager> cudaMemoryManager, + UpdateGrid27(SPtr<Parameter> para, vf::parallel::Communicator& comm, SPtr<CudaMemoryManager> cudaMemoryManager, std::vector<std::shared_ptr<PorousMedia>> &pm, std::vector<SPtr<Kernel>> &kernels, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory); void updateGrid(int level, unsigned int t); void exchangeData(int level); @@ -72,7 +76,7 @@ private: private: SPtr<Parameter> para; - vf::gpu::Communicator& comm; + vf::parallel::Communicator& comm; SPtr<CudaMemoryManager> cudaMemoryManager; std::vector<std::shared_ptr<PorousMedia>> pm; std::vector<SPtr<Kernel>> kernels; diff --git a/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h b/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h deleted file mode 100644 index 26c017f939b0795457d74008a21cb9e7a4b75bd0..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Communication/CommunicationRoutine.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef INDEX_EXCHANGE -#define INDEX_EXCHANGE - -#include <basics/DataTypes.h> - -namespace vf::gpu -{ -class CommunicationRoutine -{ -public: - virtual ~CommunicationRoutine() = default; - - virtual void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, - int size_buffer_send, int neighbor_rank_send) const = 0; - virtual int getPID() const = 0; -}; -} // namespace vf::gpu - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/Communicator.h b/src/gpu/VirtualFluids_GPU/Communication/Communicator.h deleted file mode 100644 index c52d5af9cacb4d5ae4e46090a263f67d4e63f12d..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Communication/Communicator.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef COMMUNICATOR_GPU_H -#define COMMUNICATOR_GPU_H - -#include <vector> -#include <basics/DataTypes.h> - -#include "VirtualFluids_GPU_export.h" -#include "CommunicationRoutine.h" - -namespace vf::gpu -{ - -class VIRTUALFLUIDS_GPU_EXPORT Communicator : public CommunicationRoutine -{ -public: - virtual void waitAll() = 0; - virtual int getPID() const override = 0; - virtual int getNumberOfProcess() const = 0; - virtual void exchngData(float *sbuf_t, float *rbuf_t, float *sbuf_b, float *rbuf_b, int count) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void exchngDataGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank) = 0; - virtual void nbRecvDataGPU(real *rbuf, int count_r, int nb_rank) = 0; - virtual void nbSendDataGPU(real *sbuf, int count_s, int nb_rank) = 0; - virtual void waitallGPU() = 0; - virtual void sendDataGPU(real *sbuf, int count_s, int nb_rank) = 0; - virtual void waitGPU(int id) = 0; - virtual void resetRequest() = 0; - ////////////////////////////////////////////////////////////////////////// - virtual int mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, const int &maxdev) = 0; - virtual double reduceSum(double quantityPerProcess) = 0; - ////////////////////////////////////////////////////////////////////////// - virtual void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, - int size_buffer_send, int neighbor_rank_send) const override = 0; - -}; - -} // namespace vf::gpu - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp index 48a27efa674e5fa85d47cb9439c52d0c558dac44..ff5e39c707d0e836440e40d33e3b261262d83b6d 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp @@ -1,9 +1,11 @@ -#include <helper_cuda.h> #include <cuda_runtime.h> +#include <helper_cuda.h> #include "Communication/ExchangeData27.h" #include "Parameter/CudaStreamManager.h" +#include <parallel/Communicator.h> + using namespace vf::lbm::dir; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,22 +54,20 @@ void scatterNodesFromRecvBufferGPU(Parameter *para, int level, CudaStreamIndex s } } -void startBlockingMpiSend(unsigned int numberOfSendProcessNeighbors, vf::gpu::Communicator &comm, +void startBlockingMpiSend(unsigned int numberOfSendProcessNeighbors, vf::parallel::Communicator &comm, std::vector<ProcessNeighbor27> *sendProcessNeighborHost) { for (unsigned int i = 0; i < numberOfSendProcessNeighbors; i++) { - comm.sendDataGPU((*sendProcessNeighborHost)[i].f[0], - (*sendProcessNeighborHost)[i].numberOfFs, - (*sendProcessNeighborHost)[i].rankNeighbor); + comm.send((*sendProcessNeighborHost)[i].f[0], (*sendProcessNeighborHost)[i].numberOfFs, + (*sendProcessNeighborHost)[i].rankNeighbor); } } -void startNonBlockingMpiReceive(unsigned int numberOfSendProcessNeighbors, vf::gpu::Communicator &comm, +void startNonBlockingMpiReceive(unsigned int numberOfSendProcessNeighbors, vf::parallel::Communicator &comm, std::vector<ProcessNeighbor27> *recvProcessNeighborHost) { for (unsigned int i = 0; i < numberOfSendProcessNeighbors; i++) { - comm.nbRecvDataGPU((*recvProcessNeighborHost)[i].f[0], - (*recvProcessNeighborHost)[i].numberOfFs, + comm.receiveNonBlocking((*recvProcessNeighborHost)[i].f[0], (*recvProcessNeighborHost)[i].numberOfFs, (*recvProcessNeighborHost)[i].rankNeighbor); } } @@ -117,7 +117,7 @@ void prepareExchangeCollDataXGPU27AfterFtoC(Parameter *para, int level, CudaStre (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); } -void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::parallel::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataXGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -127,7 +127,7 @@ void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm ¶->getParH(level)->recvProcessNeighborX); } -void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataXGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -149,7 +149,7 @@ void scatterNodesFromRecvBufferXGPU27AfterFtoC(Parameter *para, int level, CudaS (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))); } -void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataXGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, @@ -158,7 +158,7 @@ void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe { cudaStream_t stream = para->getStreamManager()->getStream(streamIndex); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //! \details steps: + //! \details steps: //! 1. copy data from device to host for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) cudaMemoryManager->cudaCopyProcessNeighborXFsDH(level, i, (*sendProcessNeighborDev)[i].memsizeFs); @@ -174,10 +174,10 @@ void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //! 5. wait for until data is received - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) comm.waitGPU(i); + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //! 6. reset the request array, which was used for the mpi communication - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) comm.resetRequest(); + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) comm.resetRequests(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //! 7. copy received data from host to device for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) @@ -201,7 +201,7 @@ void prepareExchangeCollDataYGPU27AfterFtoC(Parameter *para, int level, CudaStre (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); } -void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataYGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -211,7 +211,7 @@ void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm ¶->getParH(level)->recvProcessNeighborY); } -void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataYGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -233,7 +233,7 @@ void scatterNodesFromRecvBufferYGPU27AfterFtoC(Parameter *para, int level, CudaS (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))); } -void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, +void exchangeCollDataYGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, @@ -270,10 +270,10 @@ void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) comm.waitGPU(i); + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) comm.resetRequest(); + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) comm.resetRequests(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // copy Host to Device for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { @@ -298,7 +298,7 @@ void prepareExchangeCollDataZGPU27AfterFtoC(Parameter *para, int level, CudaStre (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))); } -void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::parallel::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataZGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -307,7 +307,7 @@ void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm ¶->getParH(level)->sendProcessNeighborZ, ¶->getParH(level)->recvProcessNeighborZ); } -void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex) { exchangeCollDataZGPU27(para, comm, cudaMemoryManager, level, streamIndex, @@ -330,7 +330,7 @@ void scatterNodesFromRecvBufferZGPU27AfterFtoC(Parameter *para, int level, CudaS } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, +void exchangeCollDataZGPU27(Parameter *para, vf::parallel::Communicator &comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, @@ -380,10 +380,10 @@ void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe startBlockingMpiSend((unsigned int)(*sendProcessNeighborHost).size(), comm, sendProcessNeighborHost); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) comm.waitGPU(i); + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // reset the request array - if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) comm.resetRequest(); + if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) comm.resetRequests(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // copy Host to Device for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) @@ -416,7 +416,7 @@ void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //1D domain decomposition //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePreCollDataGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) { @@ -434,7 +434,7 @@ void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cuda ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyProcessNeighborFsDH(level, i); ////////////////////////////////////////////////////////////////////////// - comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], + comm.receiveSend(para->getParH(level)->sendProcessNeighbor[i].f[0], para->getParH(level)->sendProcessNeighbor[i].numberOfFs, para->getParH(level)->recvProcessNeighbor[i].f[0], para->getParH(level)->recvProcessNeighbor[i].numberOfFs, @@ -461,7 +461,7 @@ void exchangePreCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cuda //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePostCollDataGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighbors(level, "send")); i++) { @@ -479,7 +479,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaCopyProcessNeighborFsDH(level, i); ////////////////////////////////////////////////////////////////////////// - comm.exchngDataGPU(para->getParH(level)->sendProcessNeighbor[i].f[0], + comm.receiveSend(para->getParH(level)->sendProcessNeighbor[i].f[0], para->getParH(level)->sendProcessNeighbor[i].numberOfFs, para->getParH(level)->recvProcessNeighbor[i].f[0], para->getParH(level)->recvProcessNeighbor[i].numberOfFs, @@ -502,7 +502,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePostCollDataXGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) +//void exchangePostCollDataXGPU27(Parameter* para, vf::parallel::Communicator& comm, int level) //{ // for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) // { @@ -520,7 +520,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // ////////////////////////////////////////////////////////////////////////// // para->cudaCopyProcessNeighborXFsDH(level, i); // ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborX[i].f[0], +// comm.receiveSend(para->getParH(level)->sendProcessNeighborX[i].f[0], // para->getParH(level)->sendProcessNeighborX[i].numberOfFs, // para->getParH(level)->recvProcessNeighborX[i].f[0], // para->getParH(level)->recvProcessNeighborX[i].numberOfFs, @@ -549,7 +549,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Y ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePreCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) +//void exchangePreCollDataYGPU27(Parameter* para, vf::parallel::Communicator& comm, int level) //{ // for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) // { @@ -567,7 +567,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // ////////////////////////////////////////////////////////////////////////// // para->cudaCopyProcessNeighborYFsDH(level, i); // ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], +// comm.receiveSend(para->getParH(level)->sendProcessNeighborY[i].f[0], // para->getParH(level)->sendProcessNeighborY[i].numberOfFs, // para->getParH(level)->recvProcessNeighborY[i].f[0], // para->getParH(level)->recvProcessNeighborY[i].numberOfFs, @@ -589,7 +589,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePostCollDataYGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) +//void exchangePostCollDataYGPU27(Parameter* para, vf::parallel::Communicator& comm, int level) //{ // for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) // { @@ -607,7 +607,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // ////////////////////////////////////////////////////////////////////////// // para->cudaCopyProcessNeighborYFsDH(level, i); // ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborY[i].f[0], +// comm.receiveSend(para->getParH(level)->sendProcessNeighborY[i].f[0], // para->getParH(level)->sendProcessNeighborY[i].numberOfFs, // para->getParH(level)->recvProcessNeighborY[i].f[0], // para->getParH(level)->recvProcessNeighborY[i].numberOfFs, @@ -636,7 +636,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Z ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePreCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) +//void exchangePreCollDataZGPU27(Parameter* para, vf::parallel::Communicator& comm, int level) //{ // for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) // { @@ -654,7 +654,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // ////////////////////////////////////////////////////////////////////////// // para->cudaCopyProcessNeighborZFsDH(level, i); // ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], +// comm.receiveSend(para->getParH(level)->sendProcessNeighborZ[i].f[0], // para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, // para->getParH(level)->recvProcessNeighborZ[i].f[0], // para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, @@ -676,7 +676,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // } //} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//void exchangePostCollDataZGPU27(Parameter* para, vf::gpu::Communicator& comm, int level) +//void exchangePostCollDataZGPU27(Parameter* para, vf::parallel::Communicator& comm, int level) //{ // for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) // { @@ -694,7 +694,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud // ////////////////////////////////////////////////////////////////////////// // para->cudaCopyProcessNeighborZFsDH(level, i); // ////////////////////////////////////////////////////////////////////////// -// comm.exchngDataGPU(para->getParH(level)->sendProcessNeighborZ[i].f[0], +// comm.receiveSend(para->getParH(level)->sendProcessNeighborZ[i].f[0], // para->getParH(level)->sendProcessNeighborZ[i].numberOfFs, // para->getParH(level)->recvProcessNeighborZ[i].f[0], // para->getParH(level)->recvProcessNeighborZ[i].numberOfFs, @@ -771,7 +771,7 @@ void exchangePostCollDataGPU27(Parameter* para, vf::gpu::Communicator& comm, Cud //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // X //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePreCollDataADXGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -794,7 +794,7 @@ void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADX[i].f[0], para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); } @@ -816,21 +816,18 @@ void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADX[i].f[0], para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -852,7 +849,7 @@ void exchangePreCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, C /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePostCollDataADXGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -875,7 +872,7 @@ void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADX[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADX[i].f[0], para->getParH(level)->recvProcessNeighborADX[i].numberOfFs, para->getParH(level)->recvProcessNeighborADX[i].rankNeighbor); } @@ -897,21 +894,18 @@ void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADX[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADX[i].f[0], para->getParH(level)->sendProcessNeighborADX[i].numberOfFs, para->getParH(level)->sendProcessNeighborADX[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -940,7 +934,7 @@ void exchangePostCollDataADXGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Y //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePreCollDataADYGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -963,7 +957,7 @@ void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADY[i].f[0], para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); } @@ -985,21 +979,18 @@ void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADY[i].f[0], para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1021,7 +1012,7 @@ void exchangePreCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, C /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePostCollDataADYGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1044,7 +1035,7 @@ void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADY[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADY[i].f[0], para->getParH(level)->recvProcessNeighborADY[i].numberOfFs, para->getParH(level)->recvProcessNeighborADY[i].rankNeighbor); } @@ -1066,21 +1057,18 @@ void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADY[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADY[i].f[0], para->getParH(level)->sendProcessNeighborADY[i].numberOfFs, para->getParH(level)->sendProcessNeighborADY[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1109,7 +1097,7 @@ void exchangePostCollDataADYGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Z //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePreCollDataADZGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1132,7 +1120,7 @@ void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADZ[i].f[0], para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); } @@ -1154,21 +1142,18 @@ void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, C //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADZ[i].f[0], para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1190,7 +1175,7 @@ void exchangePreCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, C /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangePostCollDataADZGPU27(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1213,7 +1198,7 @@ void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.nbRecvDataGPU(para->getParH(level)->recvProcessNeighborADZ[i].f[0], + comm.receiveNonBlocking(para->getParH(level)->recvProcessNeighborADZ[i].f[0], para->getParH(level)->recvProcessNeighborADZ[i].numberOfFs, para->getParH(level)->recvProcessNeighborADZ[i].rankNeighbor); } @@ -1235,21 +1220,18 @@ void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.sendDataGPU(para->getParH(level)->sendProcessNeighborADZ[i].f[0], + comm.send(para->getParH(level)->sendProcessNeighborADZ[i].f[0], para->getParH(level)->sendProcessNeighborADZ[i].numberOfFs, para->getParH(level)->sendProcessNeighborADZ[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1325,7 +1307,7 @@ void exchangePostCollDataADZGPU27(Parameter* para, vf::gpu::Communicator& comm, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // X //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangeCollDataF3XGPU(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1349,7 +1331,7 @@ void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.nbRecvDataGPU( + comm.receiveNonBlocking( para->getParH(level)->recvProcessNeighborF3X[i].g[0], para->getParH(level)->recvProcessNeighborF3X[i].numberOfGs, para->getParH(level)->recvProcessNeighborF3X[i].rankNeighbor); @@ -1358,22 +1340,19 @@ void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) { - comm.sendDataGPU( + comm.send( para->getParH(level)->sendProcessNeighborF3X[i].g[0], para->getParH(level)->sendProcessNeighborF3X[i].numberOfGs, para->getParH(level)->sendProcessNeighborF3X[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsX(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1403,7 +1382,7 @@ void exchangeCollDataF3XGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Y //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangeCollDataF3YGPU(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1427,7 +1406,7 @@ void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.nbRecvDataGPU( + comm.receiveNonBlocking( para->getParH(level)->recvProcessNeighborF3Y[i].g[0], para->getParH(level)->recvProcessNeighborF3Y[i].numberOfGs, para->getParH(level)->recvProcessNeighborF3Y[i].rankNeighbor); @@ -1436,22 +1415,19 @@ void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) { - comm.sendDataGPU( + comm.send( para->getParH(level)->sendProcessNeighborF3Y[i].g[0], para->getParH(level)->sendProcessNeighborF3Y[i].numberOfGs, para->getParH(level)->sendProcessNeighborF3Y[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsY(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device @@ -1481,7 +1457,7 @@ void exchangeCollDataF3YGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Z //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void exchangeCollDataF3ZGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) +void exchangeCollDataF3ZGPU(Parameter* para, vf::parallel::Communicator& comm, CudaMemoryManager* cudaMemoryManager, int level) { /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Device to Host @@ -1505,7 +1481,7 @@ void exchangeCollDataF3ZGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start non blocking MPI receive for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.nbRecvDataGPU( + comm.receiveNonBlocking( para->getParH(level)->recvProcessNeighborF3Z[i].g[0], para->getParH(level)->recvProcessNeighborF3Z[i].numberOfGs, para->getParH(level)->recvProcessNeighborF3Z[i].rankNeighbor); @@ -1514,22 +1490,19 @@ void exchangeCollDataF3ZGPU(Parameter* para, vf::gpu::Communicator& comm, CudaMe //start blocking MPI send for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) { - comm.sendDataGPU( + comm.send( para->getParH(level)->sendProcessNeighborF3Z[i].g[0], para->getParH(level)->sendProcessNeighborF3Z[i].numberOfGs, para->getParH(level)->sendProcessNeighborF3Z[i].rankNeighbor); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Wait - for (unsigned int i = 0; i < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send")); i++) - { - comm.waitGPU(i); - } + comm.waitAll(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //reset the request array if (0 < (unsigned int)(para->getNumberOfProcessNeighborsZ(level, "send"))) { - comm.resetRequest(); + comm.resetRequests(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //copy Host to Device diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h index 8302ffdc47bfa012c47df00f90c2491039f4eaee..8b03b2b100fe8a039f9199c9141a434f481da3d0 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.h @@ -1,13 +1,17 @@ #ifndef EXCHANGEDATA27_H #define EXCHANGEDATA27_H -#include "Communication/Communicator.h" #include "GPU/CudaMemoryManager.h" #include "GPU/GPU_Interface.h" #include "LBM/LB.h" #include "Parameter/Parameter.h" #include "Parameter/CudaStreamManager.h" +namespace vf::parallel +{ +class Communicator; +} + //! \file ExchangeData27.h //! \ingroup GPU //! \author Martin Schoenherr, Anna Wellmann @@ -15,9 +19,9 @@ ////////////////////////////////////////////////////////////////////////// // 1D domain decomposition -void exchangePreCollDataGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangePreCollDataGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePostCollDataGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangePostCollDataGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); ////////////////////////////////////////////////////////////////////////// // 3D domain decomposition @@ -62,7 +66,7 @@ void prepareExchangeCollDataXGPU27AfterFtoC(Parameter *para, int level, CudaStre //! \param CudaMemoryManager is needed for moving the data between host and device //! \param sendProcessNeighborDev, recvProcessNeighborDev, sendProcessNeighborHost, recvProcessNeighborHost are pointers //! to the send and receive arrays, both on the device and the host -void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataXGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, @@ -70,14 +74,14 @@ void exchangeCollDataXGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMe std::vector<ProcessNeighbor27> *recvProcessNeighborHost); //! \brief Calls exchangeCollDataXGPU27() for exchanging all nodes //! \details Used in the communication after collision step -void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataXGPU27AllNodes(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); //! \brief Calls exchangeCollDataXGPU27() for exchanging the nodes, which are part of the communication between the two //! interpolation processes on refined grids //! \details Only exchange nodes which are part of the interpolation process on //! refined grids. This function is used in the exchange which takes place after the interpolation fine to coarse and //! before the interpolation coarse to fine. See [master thesis of Anna Wellmann] -void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataXGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); //! \brief Distribute the receive nodes (x direction) from the buffer on the gpu //! \details Needed to exchange all nodes, used in the communication after collision step @@ -94,15 +98,15 @@ void scatterNodesFromRecvBufferXGPU27AfterFtoC(Parameter *para, int level, CudaS void prepareExchangeCollDataYGPU27AllNodes(Parameter *para, int level, CudaStreamIndex streamIndex); void prepareExchangeCollDataYGPU27AfterFtoC(Parameter *para, int level, CudaStreamIndex streamIndex); -void exchangeCollDataYGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataYGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level,CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, std::vector<ProcessNeighbor27> *sendProcessNeighborHost, std::vector<ProcessNeighbor27> *recvProcessNeighborHos); -void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataYGPU27AllNodes(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); -void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataYGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); void scatterNodesFromRecvBufferYGPU27AllNodes(Parameter *para, int level, CudaStreamIndex streamIndex); void scatterNodesFromRecvBufferYGPU27AfterFtoC(Parameter *para, int level, CudaStreamIndex streamIndex); @@ -111,15 +115,15 @@ void scatterNodesFromRecvBufferYGPU27AfterFtoC(Parameter *para, int level, CudaS void prepareExchangeCollDataZGPU27AllNodes(Parameter *para, int level, CudaStreamIndex streamIndex); void prepareExchangeCollDataZGPU27AfterFtoC(Parameter *para, int level, CudaStreamIndex streamIndex); -void exchangeCollDataZGPU27(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataZGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex, std::vector<ProcessNeighbor27> *sendProcessNeighborDev, std::vector<ProcessNeighbor27> *recvProcessNeighborDev, std::vector<ProcessNeighbor27> *sendProcessNeighborHost, std::vector<ProcessNeighbor27> *recvProcessNeighborHost); -void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataZGPU27AllNodes(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); -void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::gpu::Communicator &comm, +void exchangeCollDataZGPU27AfterFtoC(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level, CudaStreamIndex streamIndex); void scatterNodesFromRecvBufferZGPU27AllNodes(Parameter *para, int level, CudaStreamIndex streamIndex); @@ -127,28 +131,25 @@ void scatterNodesFromRecvBufferZGPU27AfterFtoC(Parameter *para, int level, CudaS ////////////////////////////////////////////////////////////////////////// // 3D domain decomposition convection diffusion -void exchangePreCollDataADXGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePreCollDataADXGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePreCollDataADYGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePreCollDataADYGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePreCollDataADZGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePreCollDataADZGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePostCollDataADXGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePostCollDataADXGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePostCollDataADYGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePostCollDataADYGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangePostCollDataADZGPU27(Parameter *para, vf::gpu::Communicator &comm, +void exchangePostCollDataADZGPU27(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); ////////////////////////////////////////////////////////////////////////// // 3D domain decomposition F3 - K18/K20 -void exchangeCollDataF3XGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataF3XGPU(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangeCollDataF3YGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataF3YGPU(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -void exchangeCollDataF3ZGPU(Parameter *para, vf::gpu::Communicator &comm, CudaMemoryManager *cudaMemoryManager, +void exchangeCollDataF3ZGPU(Parameter *para, vf::parallel::Communicator& comm, CudaMemoryManager *cudaMemoryManager, int level); -////////////////////////////////////////////////////////////////////////// -void barrierGPU(vf::gpu::Communicator &comm); -////////////////////////////////////////////////////////////////////////// #endif diff --git a/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.cpp b/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.cpp deleted file mode 100644 index 8af5931ce92b6fa4904ab3aea7c901773f61a6b3..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include "MpiCommunicator.h" - -#include <mpi.h> -#include <vector> - -#include <logger/Logger.h> - -#if defined (_WIN32) || defined (_WIN64) - #include <Winsock2.h> -#elif defined (__unix__) - #include <unistd.h> -#endif -//lib for windows Ws2_32.lib - -namespace vf::gpu -{ - - -MpiCommunicator::MpiCommunicator() -{ - int mpiInitialized = 0; // false - MPI_Initialized(&mpiInitialized); - if (!mpiInitialized) { - MPI_Init(NULL, NULL); - VF_LOG_TRACE("vf::gpu::MpiCommunicator(): MPI_Init"); - } - - MPI_Comm_rank(MPI_COMM_WORLD, &PID); - MPI_Comm_size(MPI_COMM_WORLD, &numprocs); - - commGPU = MPI_COMM_WORLD; - requestGPU.resize(0); - rcount = 0; - - // Get a new communicator for a decomposition of the domain - int isperiodic[1] = { 0 }; - MPI_Cart_create(MPI_COMM_WORLD, 1, &numprocs, isperiodic, 1, &comm1d); - - // Get my position in this communicator, and my neighbors - MPI_Cart_shift(comm1d, 0, 1, &nbrbottom, &nbrtop); -} - -MpiCommunicator::~MpiCommunicator() -{ - // proof if MPI is finalized - int _mpiFinalized = 0; // false - MPI_Finalized(&_mpiFinalized); - if (!_mpiFinalized) { - MPI_Finalize(); - VF_LOG_TRACE("vf::gpu::~MpiCommunicator(): MPI_Finalize"); - } -} - - -// C++11 thread safe singelton implementation: -// https://stackoverflow.com/questions/1661529/is-meyers-implementation-of-the-singleton-pattern-thread-safe -MpiCommunicator& MpiCommunicator::getInstance() -{ - static MpiCommunicator comm; - return comm; -} - -void MpiCommunicator::exchngBottomToTop(float *sbuf, float *rbuf, int count) -{ - MPI_Sendrecv(sbuf, count, MPI_FLOAT, nbrtop, 0, rbuf, count, MPI_FLOAT, nbrbottom, 0, comm1d, status); -} -void MpiCommunicator::exchngTopToBottom(float *sbuf, float *rbuf, int count) -{ - MPI_Sendrecv(sbuf, count, MPI_FLOAT, nbrbottom, 0, rbuf, count, MPI_FLOAT, nbrtop, 0, comm1d, status); -} -void MpiCommunicator::waitAll() { MPI_Waitall(4, request, status); } -void MpiCommunicator::exchngData(float *sbuf_t, float *rbuf_t, float *sbuf_b, float *rbuf_b, int count) -{ - MPI_Sendrecv(sbuf_t, count, MPI_FLOAT, nbrtop, 0, rbuf_t, count, MPI_FLOAT, nbrbottom, 0, comm1d, status); - MPI_Sendrecv(sbuf_b, count, MPI_FLOAT, nbrbottom, 0, rbuf_b, count, MPI_FLOAT, nbrtop, 0, comm1d, status); -} -void MpiCommunicator::exchngDataNB(float *sbuf_t, int count_st, float *rbuf_t, int count_rt, float *sbuf_b, int count_sb, - float *rbuf_b, int count_rb) -{ - MPI_Irecv(rbuf_t, count_rt, MPI_FLOAT, nbrbottom, 0, comm1d, &request[0]); - MPI_Irecv(rbuf_b, count_rb, MPI_FLOAT, nbrtop, 0, comm1d, &request[1]); - MPI_Isend(sbuf_t, count_st, MPI_FLOAT, nbrtop, 0, comm1d, &request[2]); - MPI_Isend(sbuf_b, count_sb, MPI_FLOAT, nbrbottom, 0, comm1d, &request[3]); - MPI_Waitall(4, request, status); -} -////////////////////////////////////////////////////////////////////////// -// Crap by Martin Sch. -void MpiCommunicator::exchngDataGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank) -{ - MPI_Status MSstatus; - MPI_Send(sbuf, count_s, MPI_Type_GPU, nb_rank, 0, commGPU); - MPI_Recv(rbuf, count_r, MPI_Type_GPU, nb_rank, 0, commGPU, &MSstatus); - ////test only - please don't use - // MPI_Sendrecv(sbuf, count_s, MPI_Type_GPU, nb_rank, 0, rbuf, count_r, MPI_Type_GPU, nb_rank, 0, comm1d, - // MPI_STATUSES_IGNORE); -} -void MpiCommunicator::sendRecvGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank) -{ - // test only - please don't use - MPI_Sendrecv(sbuf, count_s, MPI_Type_GPU, nb_rank, 0, rbuf, count_r, MPI_Type_GPU, nb_rank, 0, commGPU, - MPI_STATUSES_IGNORE); -} -void MpiCommunicator::nbRecvDataGPU(real *rbuf, int count_r, int nb_rank) -{ - // printf("\n Start Recv Rank: %d, neighbor Rank: %d, request = %d \n", PID, nb_rank, (int)requestGPU.size()); - // fflush(stdout); - - requestGPU.push_back(0); - MPI_Irecv(rbuf, count_r, MPI_Type_GPU, nb_rank, 0, commGPU, &requestGPU[rcount]); - rcount++; - - // printf("\n End Recv - Rank: %d , neighbor Rank: %d \n", PID, nb_rank); - // fflush(stdout); -} -void MpiCommunicator::nbSendDataGPU(real *sbuf, int count_s, int nb_rank) -{ - // printf("\n Start Send Rank: %d, neighbor Rank: %d, request = %d \n", PID, nb_rank, (int)requestGPU.size()); - // fflush(stdout); - - requestGPU.push_back(0); - MPI_Isend(sbuf, count_s, MPI_Type_GPU, nb_rank, 0, commGPU, &requestGPU[rcount]); - rcount++; - - // printf("\n End Send - Rank: %d , neighbor Rank: %d \n", PID, nb_rank); - // fflush(stdout); -} -void MpiCommunicator::waitallGPU() -{ - // printf("\n Start Waitall Rank: %d, request = %d \n", PID, (int)requestGPU.size()); - // fflush(stdout); - if (requestGPU.size() > 0) { - MPI_Waitall(static_cast<int>(requestGPU.size()), &requestGPU[0], MPI_STATUSES_IGNORE); - requestGPU.resize(0); - rcount = 0; - } - // printf("\n End Waitall \n"); - // fflush(stdout); -} -void MpiCommunicator::sendDataGPU(real *sbuf, int count_s, int nb_rank) -{ - MPI_Send(sbuf, count_s, MPI_Type_GPU, nb_rank, 0, commGPU); -} -void MpiCommunicator::waitGPU(int id) { MPI_Wait(&requestGPU[id], MPI_STATUSES_IGNORE); } -void MpiCommunicator::resetRequest() -{ - if (requestGPU.size() > 0) { - requestGPU.resize(0); - rcount = 0; - } -} -void MpiCommunicator::barrierGPU() -{ - // printf("\n Start Waitall Rank: %d, request = %d \n", PID, (int)requestGPU.size()); - // fflush(stdout); - if (requestGPU.size() > 0) { - MPI_Barrier(commGPU); - } - // printf("\n End Waitall \n"); - // fflush(stdout); -} -void MpiCommunicator::barrier() { MPI_Barrier(commGPU); } - -////////////////////////////////////////////////////////////////////////// -void MpiCommunicator::exchngDataGeo(int *sbuf_t, int *rbuf_t, int *sbuf_b, int *rbuf_b, int count) -{ - MPI_Irecv(rbuf_t, count, MPI_INT, nbrbottom, 0, comm1d, &request[0]); - MPI_Irecv(rbuf_b, count, MPI_INT, nbrtop, 0, comm1d, &request[1]); - MPI_Isend(sbuf_t, count, MPI_INT, nbrtop, 0, comm1d, &request[2]); - MPI_Isend(sbuf_b, count, MPI_INT, nbrbottom, 0, comm1d, &request[3]); - MPI_Waitall(4, request, status); -} -int MpiCommunicator::getPID() const { return PID; } -int MpiCommunicator::getNumberOfProcess() const { return numprocs; } -int MpiCommunicator::getNeighbourTop() { return nbrtop; } -int MpiCommunicator::getNeighbourBottom() { return nbrbottom; } -MPI_Comm MpiCommunicator::getMpiCommunicator() { return comm1d; } -void MpiCommunicator::distributeGeometry(unsigned int *dataRoot, unsigned int *dataNode, int dataSizePerNode) -{ - MPI_Scatter(dataRoot, dataSizePerNode, MPI_UNSIGNED, dataNode, dataSizePerNode, MPI_UNSIGNED, 0, MPI_COMM_WORLD); -} -int MpiCommunicator::mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, - const int &maxdev) -{ - int device = -1; - char *host = (char *)malloc(sizeof(char) * size * 255); - unsigned int *map = (unsigned int *)malloc(sizeof(unsigned int) * size); - - char hostname[255]; - gethostname(hostname, 254); - hostname[254] = 0; - - MPI_Gather(hostname, 255, MPI_BYTE, host, 255, MPI_BYTE, 0, MPI_COMM_WORLD); - - int i, j; - if (rank == 0) { - for (i = 0; i < size; i++) { - int counter = 0; - for (j = 0; j < i; j++) { - if (strcmp(&host[i * 255], &host[j * 255]) == 0) - counter++; - } - if (counter >= maxdev) { - VF_LOG_CRITICAL("More processes than GPUs!"); - exit(1); - } - map[i] = devices[counter]; - } - } - - MPI_Scatter(map, 1, MPI_UNSIGNED, &device, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD); - - VF_LOG_INFO("Rank: {} runs on host: {} with GPU: {}", rank, hostname, device); - - free(map); - free(host); - return device; -} - -double MpiCommunicator::reduceSum(double quantityPerProcess) -{ - double *buffer_send = &quantityPerProcess; - double *buffer_recv = (double *)malloc(sizeof(double)); - - MPI_Reduce(buffer_send, buffer_recv, 1, MPI_DOUBLE, MPI_SUM, 0, commGPU); - - return *buffer_recv; -} - -void MpiCommunicator::receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, - int size_buffer_send, int neighbor_rank_send) const -{ - MPI_Request recv_request; - MPI_Irecv(buffer_receive, size_buffer_recv, MPI_UNSIGNED, neighbor_rank_recv, 0, commGPU, &recv_request); - //printf("receive_send PID: %i, nbRev: nb_rank_recv: %i", this->getPID(), nb_rank_r); - //fflush(stdout); - MPI_Send(buffer_send, size_buffer_send, MPI_UNSIGNED, neighbor_rank_send, 0, commGPU); - //printf("receive_send PID: %i, sendUintGPU: nb_rank_send: %i", this->getPID(), nb_rank_s); - //fflush(stdout); - MPI_Wait(&recv_request, MPI_STATUSES_IGNORE); -} - -} // namespace vf::gpu diff --git a/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.h b/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.h deleted file mode 100644 index c6a71c0bf2e292133db90f5a1e2110cb1c484c31..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Communication/MpiCommunicator.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef MPIMpiCommunicator_GPU_H -#define MPIMpiCommunicator_GPU_H - -#include <vector> - -#include <mpi.h> - -#include "VirtualFluids_GPU_export.h" - -#include "Communicator.h" -#include <basics/DataTypes.h> - -////////////////////////////////// -#ifdef VF_DOUBLE_ACCURACY -#define MPI_Type_GPU MPI_DOUBLE -#else -#define MPI_Type_GPU MPI_FLOAT -#endif -////////////////////////////////// - -namespace vf::gpu -{ - -class VIRTUALFLUIDS_GPU_EXPORT MpiCommunicator : public Communicator -{ -public: - static MpiCommunicator &getInstance(); - MpiCommunicator(const MpiCommunicator &) = delete; - MpiCommunicator &operator=(const MpiCommunicator &) = delete; - ~MpiCommunicator() override; - - void exchngBottomToTop(float *sbuf, float *rbuf, int count); - void exchngTopToBottom(float *sbuf, float *rbuf, int count); - void waitAll() override; - void distributeGeometry(unsigned int *dataRoot, unsigned int *dataNode, int dataSizePerNode); - int getPID() const override; - int getNumberOfProcess() const override; - int getNeighbourTop(); - int getNeighbourBottom(); - void exchngData(float *sbuf_t, float *rbuf_t, float *sbuf_b, float *rbuf_b, int count) override; - void exchngDataNB(float *sbuf_t, int count_st, float *rbuf_t, int count_rt, float *sbuf_b, int count_sb, - float *rbuf_b, int count_rb); - ////////////////////////////////////////////////////////////////////////// - void exchngDataGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank) override; - void sendRecvGPU(real *sbuf, int count_s, real *rbuf, int count_r, int nb_rank); - void nbRecvDataGPU(real *rbuf, int count_r, int nb_rank) override; - void nbSendDataGPU(real *sbuf, int count_s, int nb_rank) override; - void waitallGPU() override; - void sendDataGPU(real *sbuf, int count_s, int nb_rank) override; - void waitGPU(int id) override; - void resetRequest() override; - void barrierGPU(); - void barrier(); - ////////////////////////////////////////////////////////////////////////// - void exchngDataGeo(int *sbuf_t, int *rbuf_t, int *sbuf_b, int *rbuf_b, int count); - MPI_Comm getMpiCommunicator(); - int mapCudaDevice(const int &rank, const int &size, const std::vector<unsigned int> &devices, const int &maxdev) override; - double reduceSum(double quantityPerProcess) override; - ////////////////////////////////////////////////////////////////////////// - void receive_send(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, - int size_buffer_send, int neighbor_rank_send) const override; - -private: - int numprocs, PID; - int nbrbottom, nbrtop; - MPI_Comm comm1d, commGPU; - MPI_Status status[4]; - MPI_Request request[4]; - ////////////////////////////////////////////////////////////////////////// - std::vector<MPI_Request> requestGPU; - int rcount; - ////////////////////////////////////////////////////////////////////////// - MpiCommunicator(); -}; - -} // namespace vf::gpu - -#endif diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp index 3b511264e9c7edc80bbe367cac4a9b6d8725674b..e96c96ec2f38c4d27f7c51177e4a3c21f37579e8 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.cpp @@ -9,7 +9,7 @@ #include <GPU/CudaMemoryManager.h> -std::shared_ptr<GridProvider> GridProvider::makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator) +std::shared_ptr<GridProvider> GridProvider::makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator& communicator) { return std::shared_ptr<GridProvider>(new GridGenerator(builder, para, cudaMemoryManager, communicator)); } @@ -35,7 +35,7 @@ void GridProvider::setNumberOfTaggedFluidNodes(uint numberOfNodes, CollisionTemp para->getParD(level)->numberOfTaggedFluidNodes[tag] = numberOfNodes; } -void GridProvider::setInitalNodeValues(uint numberOfNodes, int level) const +void GridProvider::setInitialNodeValues(uint numberOfNodes, int level) const { for (uint pos = 1; pos <= numberOfNodes; pos++) { diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h index 007db1e0d8e27b3810aa38c089bae8069bbe5813..28d2f39e8b469f83672c6cbce162e867686d14ed 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridProvider.h @@ -9,7 +9,7 @@ #include "PointerDefinitions.h" #include "VirtualFluids_GPU_export.h" #include "gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.h" -namespace vf::gpu +namespace vf::parallel { class Communicator; } @@ -21,7 +21,7 @@ class CudaMemoryManager; class VIRTUALFLUIDS_GPU_EXPORT GridProvider { public: - static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator); + static std::shared_ptr<GridProvider> makeGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator& communicator); static std::shared_ptr<GridProvider> makeGridReader(FILEFORMAT format, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager); virtual void allocArrays_CoordNeighborGeo() = 0; @@ -48,7 +48,7 @@ public: protected: void setNumberOfNodes(uint numberOfNodes, int level) const; void setNumberOfTaggedFluidNodes(uint numberOfNodes, CollisionTemplate tag, int level) const; - virtual void setInitalNodeValues(uint numberOfNodes, int level) const; + virtual void setInitialNodeValues(uint numberOfNodes, int level) const; void setPressSizePerLevel(int level, int sizePerLevel) const; void setVelocitySizePerLevel(int level, int sizePerLevel) const; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp index c126b2f79e02272a0bd86bfe0f76fe5efe09a5a7..000e97e9a14e51d140dfa30cb325d2a04cd83f50 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp @@ -94,7 +94,7 @@ void GridReader::allocArrays_CoordNeighborGeo() neighWSB->initalNeighbors(para->getParH(level)->neighborInverse, level); geoV.initalNeighbors( para->getParH(level)->typeOfGridNode, level); rearrangeGeometry(para.get(), level); - setInitalNodeValues(numberOfNodesPerLevel, level); + setInitialNodeValues(numberOfNodesPerLevel, level); cudaMemoryManager->cudaCopyNeighborWSB(level); cudaMemoryManager->cudaCopySP(level); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 15bb8a43375bda7a90ef61548c1c68bafa9d1af5..db07322dd4158cb9f66aa15248f38ed4c43d383c 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -4,6 +4,7 @@ #include "Parameter/Parameter.h" #include "GridGenerator/grid/GridBuilder/GridBuilder.h" #include "GPU/CudaMemoryManager.h" +#include "Parameter/CudaStreamManager.h" #include "IndexRearrangementForStreams.h" #include "InterpolationCellGrouper.h" @@ -14,15 +15,16 @@ #include "GridGenerator/TransientBCSetter/TransientBCSetter.h" #include "utilities/communication.h" -#include "Communication/Communicator.h" + +#include <parallel/Communicator.h> #include <logger/Logger.h> using namespace vf::lbm::dir; GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, - std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator &communicator) - : mpiProcessID(communicator.getPID()), builder(builder) + std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator &communicator) + : mpiProcessID(communicator.getProcessID()), builder(builder) { this->para = para; this->cudaMemoryManager = cudaMemoryManager; @@ -31,7 +33,7 @@ GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_p std::make_unique<InterpolationCellGrouper>(para->getParHallLevels(), para->getParDallLevels(), builder); } -GridGenerator::~GridGenerator() {} +GridGenerator::~GridGenerator() = default; void GridGenerator::setIndexRearrangementForStreams(std::unique_ptr<IndexRearrangementForStreams> &&indexRearrangement) { @@ -92,7 +94,7 @@ void GridGenerator::allocArrays_CoordNeighborGeo() para->getParH(level)->typeOfGridNode, level); - setInitalNodeValues(numberOfNodesPerLevel, level); + setInitialNodeValues(numberOfNodesPerLevel, level); cudaMemoryManager->cudaCopyNeighborWSB(level); cudaMemoryManager->cudaCopySP(level); @@ -364,6 +366,8 @@ void GridGenerator::allocArrays_BoundaryValues() cudaMemoryManager->cudaCopyPrecursorBC(level); cudaMemoryManager->cudaAllocPrecursorData(level); + para->getParD(level)->precursorBC.streamIndex = para->getStreamManager()->registerAndLaunchStream(CudaStreamIndex::Precursor); + // read first timestep of precursor into next and copy to next on device for(auto reader : para->getParH(level)->transientBCInputFileReader) diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h index 157eb5c37660f4de5f5d547b7bac2bbc5c749fc8..9c0d50a06e587c2776c63d164f1d46c4ac910eab 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.h @@ -45,6 +45,10 @@ class Parameter; class GridBuilder; class IndexRearrangementForStreams; class InterpolationCellGrouper; +namespace vf::parallel +{ +class Communicator; +} //! \class GridGenerator derived class of GridProvider //! \brief mapping the grid of grid generator to data structure for simulation @@ -63,7 +67,7 @@ private: const uint mpiProcessID; public: - VIRTUALFLUIDS_GPU_EXPORT GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator& communicator); + VIRTUALFLUIDS_GPU_EXPORT GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator& communicator); ~GridGenerator() override; //! \brief overwrites the default IndexRearrangementForStreams void setIndexRearrangementForStreams(std::unique_ptr<IndexRearrangementForStreams>&& indexRearrangement); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp index 1d3fb8220c9085b07708809e05814c960d52e61d..8fc0f78d1f964339258dbeae1658445bc4547e4f 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp @@ -1,15 +1,17 @@ #include "GridGenerator.h" #include <gmock/gmock.h> -#include "Communication/MpiCommunicator.h" #include "DataTypes.h" #include "GPU/CudaMemoryManager.h" #include "IndexRearrangementForStreams.h" +#include "NullCommunicator.h" #include "Parameter/Parameter.h" #include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "gpu/GridGenerator/grid/GridImp.h" #include "gpu/GridGenerator/utilities/communication.h" +#include <parallel/NullCommunicator.h> + namespace GridGeneratorTest { @@ -69,7 +71,7 @@ class IndexRearrangementForStreamsDouble : public IndexRearrangementForStreams { public: IndexRearrangementForStreamsDouble(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, - vf::gpu::Communicator &communicator) + vf::parallel::Communicator &communicator) : IndexRearrangementForStreams(para, builder, communicator){}; void initCommunicationArraysForCommAfterFinetoCoarseX(uint level, int indexOfProcessNeighbor, @@ -113,7 +115,7 @@ private: para->setNumprocs(2); builder = std::make_shared<LevelGridBuilderStub>(nullptr); - vf::gpu::Communicator &communicator = vf::gpu::MpiCommunicator::getInstance(); + vf::parallel::NullCommunicator communicator; gridGenerator = std::make_shared<GridGenerator>(builder, para, std::make_shared<CudaMemoryManagerDouble>(para), communicator); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp index d59fa8d017069b665bd6b91f6cf1e685782fab24..bfd112b7c03afba459b8bef7919bc839ac200f2e 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.cpp @@ -1,17 +1,18 @@ #include "IndexRearrangementForStreams.h" -#include "Communication/Communicator.h" #include "Logger.h" #include "Parameter/Parameter.h" #include <GridGenerator/grid/Grid.h> #include <GridGenerator/grid/GridBuilder/GridBuilder.h> +#include <parallel/Communicator.h> + #include <algorithm> #include <iostream> IndexRearrangementForStreams::IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, - vf::gpu::CommunicationRoutine &communicator) + vf::parallel::Communicator &communicator) : para(para), builder(builder), communicator(communicator) { } @@ -108,7 +109,7 @@ std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCX std::vector<uint> recvIndicesForCommAfterFtoCPositions( (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCX[indexOfProcessNeighbor].numberOfNodes * 2, 0); - communicator.receive_send( + communicator.receiveSend( recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), para->getParH(level)->recvProcessNeighborX[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), @@ -135,7 +136,7 @@ std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCY std::vector<uint> recvIndicesForCommAfterFtoCPositions( (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCY[indexOfProcessNeighbor].numberOfNodes * 2, 0); - communicator.receive_send( + communicator.receiveSend( recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), para->getParH(level)->recvProcessNeighborY[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), @@ -162,7 +163,7 @@ std::vector<uint> IndexRearrangementForStreams::exchangeIndicesForCommAfterFtoCZ std::vector<uint> recvIndicesForCommAfterFtoCPositions( (size_t)para->getParH(level)->sendProcessNeighborsAfterFtoCZ[indexOfProcessNeighbor].numberOfNodes * 2, 0); - communicator.receive_send( + communicator.receiveSend( recvIndicesForCommAfterFtoCPositions.data(), (int)recvIndicesForCommAfterFtoCPositions.size(), para->getParH(level)->recvProcessNeighborZ[indexOfProcessNeighbor].rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(), (int)sendIndicesForCommAfterFtoCPositions.size(), @@ -368,7 +369,7 @@ void IndexRearrangementForStreams::reorderSendIndicesForCommAfterFtoC( for (uint i = 0; i < (uint)sendIndicesOther.size(); i++) sendIndices[i + numberOfSendNodesAfterFtoC] = sendIndicesOther[i]; - VF_LOG_INFO("Reorder send indices: process {}, numberOfSendNodesAfterFtoC {}", communicator.getPID(), + VF_LOG_INFO("Reorder send indices: process {}, numberOfSendNodesAfterFtoC {}", communicator.getProcessID(), numberOfSendNodesAfterFtoC); if (numberOfSendNodesAfterFtoC + sendIndicesOther.size() != numberOfSendIndices) { @@ -514,7 +515,7 @@ void IndexRearrangementForStreams::reorderRecvIndicesForCommAfterFtoC( for (uint i = 0; i < (uint)recvIndicesOther.size(); i++) recvIndices[i + numberOfRecvNodesAfterFtoC] = recvIndicesOther[i]; - VF_LOG_INFO("Reorder send indices: process {}, numberOfRecvNodesAfterFtoC {}", communicator.getPID(), + VF_LOG_INFO("Reorder send indices: process {}, numberOfRecvNodesAfterFtoC {}", communicator.getProcessID(), numberOfRecvNodesAfterFtoC); if (numberOfRecvNodesAfterFtoC + recvIndicesOther.size() != numberOfRecvIndices) { diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h index 0b0401d3424f7a953bf2fa92d0382fd9256a635a..421e5aa4cb69cf56df79d9d4c2f0beb4504ce2c3 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h @@ -13,16 +13,16 @@ class Parameter; class GridBuilder; -namespace vf::gpu +namespace vf::parallel { -class CommunicationRoutine; +class Communicator; } class IndexRearrangementForStreams { public: //! \brief Construct IndexRearrangementForStreams object - IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, vf::gpu::CommunicationRoutine& communicator); + IndexRearrangementForStreams(std::shared_ptr<Parameter> para, std::shared_ptr<GridBuilder> builder, vf::parallel::Communicator& communicator); virtual ~IndexRearrangementForStreams() = default; @@ -133,7 +133,7 @@ protected: private: std::shared_ptr<GridBuilder> builder; std::shared_ptr<Parameter> para; - vf::gpu::CommunicationRoutine& communicator; + vf::parallel::Communicator &communicator; // used for tests friend class IndexRearrangementForStreamsTest_reorderSendIndices; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp index 081986add72b21314d0095c7da9df047e860f0d2..bcdb22b9ce04cc2164feb6d0ed45ac23f569712e 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp @@ -6,14 +6,14 @@ #include "Utilities/testUtilitiesGPU.h" -#include "Communication/Communicator.h" #include "DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreams.h" #include "Parameter/Parameter.h" #include "basics/config/ConfigurationFile.h" #include "gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h" #include "gpu/GridGenerator/grid/GridImp.h" #include "gpu/GridGenerator/utilities/communication.h" -#include "gpu/VirtualFluids_GPU/Communication/MpiCommunicator.cpp" + +#include <parallel/NullCommunicator.h> namespace indexRearrangementTests { @@ -148,8 +148,10 @@ private: para->initProcessNeighborsAfterFtoCX(sendIndices.level); testSubject = std::make_unique<IndexRearrangementForStreams>( - IndexRearrangementForStreams(para, builder, vf::gpu::MpiCommunicator::getInstance())); + IndexRearrangementForStreams(para, builder, communicator)); }; + + vf::parallel::NullCommunicator communicator; }; TEST_F(IndexRearrangementForStreamsTest_reorderSendIndices, reorderSendIndicesForCommAfterFtoCX) @@ -171,19 +173,19 @@ TEST_F(IndexRearrangementForStreamsTest_reorderSendIndices, reorderSendIndicesFo // Test exchangeIndicesForCommAfterFtoC ////////////////////////////////////////////////////////////////////////// -class CommunicationRoutineDouble : public vf::gpu::CommunicationRoutine +class CommunicatorDouble : public vf::parallel::NullCommunicator { public: - void receive_send(uint *buffer_receive, int, int, uint *, int, int) const override + void receiveSend(uint *buffer_receive, int, int, uint *, int, int) const override { for (int i = 0; i < (int)receivedIndices.size(); ++i) { *(buffer_receive + i) = receivedIndices[i]; } } - int getPID() const override + void receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const override { - return 0; } void setReceivedIndices(const std::vector<uint>& receivedIndices) @@ -199,9 +201,9 @@ class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX : public { public: - void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + void createTestSubject(vf::parallel::Communicator &Communicator) { - sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, Communicator); } protected: @@ -240,7 +242,7 @@ private: TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, emptyRecvInX) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices(std::vector<uint>()); createTestSubject(communicator); @@ -250,7 +252,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, emptyR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, zeroRecvIndexX) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices({ 0 }); createTestSubject(communicator); @@ -260,7 +262,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, zeroRe TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, oneRecvIndexX) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10 }; std::vector<uint> receivedIndicesByComm(4, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -274,7 +276,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, oneRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, threeRecvIndicesX) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30 }; std::vector<uint> receivedIndicesByComm(5, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -289,7 +291,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, threeR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, sixRecvIndicesX) { // this test shows the limits of the current approach. The last index is always deleted - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30, 40, 50 }; std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; communicator.setReceivedIndices(receivedIndicesByComm); @@ -302,7 +304,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, sixRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCX, recvIndicesXContainZero) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 0, 20, 30, 40 }; std::vector<uint> receivedIndicesByComm(6, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -318,9 +320,9 @@ class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY : public { public: - void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + void createTestSubject(vf::parallel::Communicator &Communicator) { - sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, Communicator); } protected: @@ -359,7 +361,7 @@ private: TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, emptyRecvInY) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices(std::vector<uint>()); createTestSubject(communicator); @@ -369,7 +371,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, emptyR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, zeroRecvIndexY) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices({ 0 }); createTestSubject(communicator); @@ -379,7 +381,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, zeroRe TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, oneRecvIndexY) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10 }; std::vector<uint> receivedIndicesByComm(4, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -393,7 +395,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, oneRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, threeRecvIndicesY) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30 }; std::vector<uint> receivedIndicesByComm(5, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -408,7 +410,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, threeR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, sixRecvIndicesY) { // this test shows the limits of the current approach. The last index is always deleted - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30, 40, 50 }; std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; communicator.setReceivedIndices(receivedIndicesByComm); @@ -421,7 +423,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, sixRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCY, recvIndicesYContainZero) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 0, 20, 30, 40 }; std::vector<uint> receivedIndicesByComm(6, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -437,9 +439,9 @@ class IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ : public { public: - void createTestSubject(vf::gpu::CommunicationRoutine &CommunicationRoutine) + void createTestSubject(vf::parallel::Communicator &Communicator) { - sut = std::make_unique<IndexRearrangementForStreams>(para, builder, CommunicationRoutine); + sut = std::make_unique<IndexRearrangementForStreams>(para, builder, Communicator); } protected: @@ -478,7 +480,7 @@ private: TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, emptyRecvInZ) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices(std::vector<uint>()); createTestSubject(communicator); @@ -488,7 +490,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, emptyR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, zeroRecvIndexZ) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; communicator.setReceivedIndices({ 0 }); createTestSubject(communicator); @@ -498,7 +500,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, zeroRe TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, oneRecvIndexZ) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10 }; std::vector<uint> receivedIndicesBZComm(4, 0); std::copy(expected.begin(), expected.end(), receivedIndicesBZComm.begin()); @@ -512,7 +514,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, oneRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, threeRecvIndicesZ) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30 }; std::vector<uint> receivedIndicesBZComm(5, 0); std::copy(expected.begin(), expected.end(), receivedIndicesBZComm.begin()); @@ -527,7 +529,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, threeR TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, sixRecvIndicesYZ) { // this test shows the limits of the current approach. The last index is always deleted - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 10, 20, 30, 40, 50 }; std::vector<uint> receivedIndicesByComm = { 10, 20, 30, 40, 50, 60 }; communicator.setReceivedIndices(receivedIndicesByComm); @@ -540,7 +542,7 @@ TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, sixRec TEST_F(IndexRearrangementForStreamsTest_exchangeIndicesForCommAfterFtoCZ, recvIndicesZContainZero) { - CommunicationRoutineDouble communicator; + CommunicatorDouble communicator; std::vector<uint> expected = { 0, 20, 30, 40 }; std::vector<uint> receivedIndicesByComm(6, 0); std::copy(expected.begin(), expected.end(), receivedIndicesByComm.begin()); @@ -608,8 +610,10 @@ private: para = testingVF::createParameterForLevel(ri.level); testSubject = std::make_unique<IndexRearrangementForStreams>( - IndexRearrangementForStreams(para, builder, vf::gpu::MpiCommunicator::getInstance())); + IndexRearrangementForStreams(para, builder, communicator)); }; + + vf::parallel::NullCommunicator communicator; }; TEST_F(IndexRearrangementForStreamsTest_reorderRecvIndicesX, noSendIndicesForCommunicationAfterScalingFineToCoarse_receiveIndicesAreUnchanged) diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp index 14e090ff3f02eaec87a9f709fc0e0ac8df711189..64943d19ff54bfaa174d0728a96c517f6605d565 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp +++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.cpp @@ -1740,11 +1740,11 @@ void CudaMemoryManager::cudaCopyPrecursorBC(int lev) } void CudaMemoryManager::cudaCopyPrecursorData(int lev) { - auto prec = ¶meter->getParH(lev)->precursorBC; - auto precStream = parameter->getStreamManager()->getStream(CudaStreamIndex::Precursor); - size_t memSize = prec->numberOfPrecursorNodes*sizeof(real)*prec->numberOfQuantities; - checkCudaErrors( cudaStreamSynchronize(precStream) ); - checkCudaErrors( cudaMemcpyAsync(parameter->getParD(lev)->precursorBC.next, prec->next, memSize, cudaMemcpyHostToDevice, precStream) ); + auto precurser = ¶meter->getParH(lev)->precursorBC; + auto precurserStream = parameter->getStreamManager()->getStream(CudaStreamIndex::Precursor, precurser->streamIndex); + size_t memSize = precurser->numberOfPrecursorNodes*sizeof(real)*precurser->numberOfQuantities; + checkCudaErrors( cudaStreamSynchronize(precurserStream) ); + checkCudaErrors( cudaMemcpyAsync(parameter->getParD(lev)->precursorBC.next, precurser->next, memSize, cudaMemcpyHostToDevice, precurserStream) ); } @@ -3399,14 +3399,17 @@ void CudaMemoryManager::cudaAllocProbeIndices(Probe* probe, int level) checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->pointIndicesD, tmp) ); setMemsizeGPU(1.f*tmp, false); } + void CudaMemoryManager::cudaCopyProbeIndicesHtoD(Probe* probe, int level) { checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesD, probe->getProbeStruct(level)->pointIndicesH, sizeof(int)*probe->getProbeStruct(level)->nIndices, cudaMemcpyHostToDevice) ); } + void CudaMemoryManager::cudaCopyProbeIndicesDtoH(Probe* probe, int level) { checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->pointIndicesH, probe->getProbeStruct(level)->pointIndicesD, sizeof(int)*probe->getProbeStruct(level)->nIndices, cudaMemcpyDeviceToHost) ); } + void CudaMemoryManager::cudaFreeProbeIndices(Probe* probe, int level) { checkCudaErrors( cudaFreeHost(probe->getProbeStruct(level)->pointIndicesH) ); @@ -3415,25 +3418,28 @@ void CudaMemoryManager::cudaFreeProbeIndices(Probe* probe, int level) void CudaMemoryManager::cudaAllocProbeQuantityArray(Probe* probe, int level) { - size_t tmp = sizeof(real)*probe->getProbeStruct(level)->nArrays*probe->getProbeStruct(level)->nPoints; + auto probeStruct = probe->getProbeStruct(level); + size_t tmp = sizeof(real)*probeStruct->nArrays*probeStruct->nPoints*probeStruct->nTimesteps; - checkCudaErrors( cudaMallocHost((void**) &probe->getProbeStruct(level)->quantitiesArrayH, tmp) ); + checkCudaErrors( cudaMallocHost((void**) &probeStruct->quantitiesArrayH, tmp) ); if(probe->getHasDeviceQuantityArray()) { - checkCudaErrors( cudaMalloc ((void**) &probe->getProbeStruct(level)->quantitiesArrayD, tmp) ); + checkCudaErrors( cudaMalloc ((void**) &probeStruct->quantitiesArrayD, tmp) ); setMemsizeGPU(1.f*tmp, false); } } void CudaMemoryManager::cudaCopyProbeQuantityArrayHtoD(Probe* probe, int level) { - checkCudaErrors( cudaMemcpy(probe->getProbeStruct(level)->quantitiesArrayD, probe->getProbeStruct(level)->quantitiesArrayH, probe->getProbeStruct(level)->nArrays*sizeof(real)*probe->getProbeStruct(level)->nPoints, cudaMemcpyHostToDevice) ); + auto probeStruct = probe->getProbeStruct(level); + size_t tmp = sizeof(real)*probeStruct->nArrays*probeStruct->nPoints*probeStruct->nTimesteps; + checkCudaErrors( cudaMemcpy(probeStruct->quantitiesArrayD, probeStruct->quantitiesArrayH, tmp, cudaMemcpyHostToDevice) ); } void CudaMemoryManager::cudaCopyProbeQuantityArrayDtoH(Probe* probe, int level) { auto probeStruct = probe->getProbeStruct(level); - - checkCudaErrors( cudaMemcpy(probeStruct->quantitiesArrayH, probeStruct->quantitiesArrayD, probeStruct->nArrays*sizeof(real)*probeStruct->nPoints, cudaMemcpyDeviceToHost) ); + size_t tmp = sizeof(real)*probeStruct->nArrays*probeStruct->nPoints*probeStruct->nTimesteps; + checkCudaErrors( cudaMemcpy(probeStruct->quantitiesArrayH, probeStruct->quantitiesArrayD, tmp, cudaMemcpyDeviceToHost) ); } void CudaMemoryManager::cudaFreeProbeQuantityArray(Probe* probe, int level) diff --git a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h index e2f2e8658b6ef7a9453546454dd8e1f643574e17..1d01c227e780ec564b9eb1506f1a0183769d64b9 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h +++ b/src/gpu/VirtualFluids_GPU/GPU/CudaMemoryManager.h @@ -14,7 +14,15 @@ #include <helper_cuda.h> #include <curand.h> +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#pragma clang diagnostic ignored "-Wunused-but-set-parameter" +#endif #include <curand_kernel.h> +#ifdef __clang__ +#pragma clang diagnostic pop +#endif class Parameter; class PorousMedia; diff --git a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu index e447062d292908c02800c4559cc4444476290629..242038afcea351c0d9187a606d82d5bcd16c214c 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu @@ -13,7 +13,7 @@ #include <iomanip> -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> #include "Parameter/Parameter.h" // includes, kernels diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h b/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h index 78e6bf8ecf0588eaf6e216916505ec0cbab6c215..b449bcca404b54469b52f7b383f0615632c4d06d 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h +++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Interface.h @@ -10,9 +10,19 @@ #include "LBM/LB.h" +#include <cuda.h> #include <cuda_runtime.h> #include <curand.h> + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#pragma clang diagnostic ignored "-Wunused-but-set-parameter" +#endif #include <curand_kernel.h> +#ifdef __clang__ +#pragma clang diagnostic pop +#endif struct LBMSimulationParameter; class Parameter; diff --git a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh index 877390c822b4828b0007249be524d2534a2482f0..74ebf3bea73c221207d3dda7a6a2f29de083ffde 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh +++ b/src/gpu/VirtualFluids_GPU/GPU/GPU_Kernels.cuh @@ -64,16 +64,17 @@ __global__ void LB_Kernel_Kum_New_Comp_SRT_SP_27( real* forces, bool EvenOrOdd); -__global__ void LB_Kernel_Cumulant_D3Q27All4(real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - unsigned long long numberOfLBnodes, - int level, - real* forces, - bool EvenOrOdd); +__global__ void K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + unsigned long long numberOfLBnodes, + int level, + real* forces, + bool EvenOrOdd); __global__ void LB_Kernel_Kum_AA2016_Comp_Bulk_SP_27(real omega, diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu index ec1c8207bdd38666f4222270be81b91960142e62..528bbfc7a9584b2c5dedb17098324cbeab9ee1f6 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleCF_compressible.cu @@ -36,862 +36,27 @@ #include "LBM/GPUHelperFunctions/ChimeraTransformation.h" #include "LBM/GPUHelperFunctions/ScalingUtilities.h" -using namespace vf::basics::constant; -using namespace vf::lbm::dir; -using namespace vf::gpu; +#include <lbm/refinement/InterpolationCF.h> +#include <lbm/refinement/Coefficients.h> -////////////////////////////////////////////////////////////////////////// -//! \brief Calculate the interpolated distributions on the fine destination nodes -//! \details Used in scaling from coarse to fine -//! The function is executed in the following steps: -//! -__device__ __inline__ void interpolateDistributions( - const real& x, const real& y, const real& z, - real& m_000, - real& m_100, real& m_010, real& m_001, - real& m_011, real& m_101, real& m_110, real& m_200, real& m_020, real& m_002, - real& m_111, real& m_210, real& m_012, real& m_201, real& m_021, real& m_120, real& m_102, - real& m_022, real& m_202, real& m_220, real& m_211, real& m_121, real& m_112, - real& m_122, real& m_212, real& m_221, - real& m_222, - const real& a_000, const real& a_100, const real& a_010, const real& a_001, const real& a_200, const real& a_020, const real& a_002, const real& a_110, const real& a_101, const real& a_011, const real& a_111, - const real& b_000, const real& b_100, const real& b_010, const real& b_001, const real& b_200, const real& b_020, const real& b_002, const real& b_110, const real& b_101, const real& b_011, const real& b_111, - const real& c_000, const real& c_100, const real& c_010, const real& c_001, const real& c_200, const real& c_020, const real& c_002, const real& c_110, const real& c_101, const real& c_011, const real& c_111, - const real& d_000, const real& d_100, const real& d_010, const real& d_001, const real& d_110, const real& d_101, const real& d_011, const real& d_111, - const real& LaplaceRho, const real& eps_new, const real& omegaF, - const real& kxxMyyAverage, const real& kxxMzzAverage, const real& kyzAverage, const real& kxzAverage, const real& kxyAverage -) -{ - real useNEQ = c1o1;//zero;//one; //.... one = on ..... zero = off - - ////////////////////////////////////////////////////////////////////////// - // - Reset all moments to zero - // - m_111 = c0o1; - m_211 = c0o1; - m_011 = c0o1; - m_121 = c0o1; - m_101 = c0o1; - m_112 = c0o1; - m_110 = c0o1; - m_221 = c0o1; - m_001 = c0o1; - m_201 = c0o1; - m_021 = c0o1; - m_212 = c0o1; - m_010 = c0o1; - m_210 = c0o1; - m_012 = c0o1; - m_122 = c0o1; - m_100 = c0o1; - m_120 = c0o1; - m_102 = c0o1; - m_222 = c0o1; - m_022 = c0o1; - m_202 = c0o1; - m_002 = c0o1; - m_220 = c0o1; - m_020 = c0o1; - m_200 = c0o1; - m_000 = c0o1; - - //////////////////////////////////////////////////////////////////////////////// - //! - Set macroscopic values on destination node (zeroth and first order moments) - //! - real press = d_000 + x * d_100 + y * d_010 + z * d_001 + - x * y * d_110 + x * z * d_101 + y * z * d_011 + x * y * z * d_111 + c3o1 * x * x * LaplaceRho; - real vvx = a_000 + x * a_100 + y * a_010 + z * a_001 + - x * x * a_200 + y * y * a_020 + z * z * a_002 + - x * y * a_110 + x * z * a_101 + y * z * a_011 + x * y * z * a_111; - real vvy = b_000 + x * b_100 + y * b_010 + z * b_001 + - x * x * b_200 + y * y * b_020 + z * z * b_002 + - x * y * b_110 + x * z * b_101 + y * z * b_011 + x * y * z * b_111; - real vvz = c_000 + x * c_100 + y * c_010 + z * c_001 + - x * x * c_200 + y * y * c_020 + z * z * c_002 + - x * y * c_110 + x * z * c_101 + y * z * c_011 + x * y * z * c_111; - - m_000 = press; // m_000 is press, if drho is interpolated directly - - //////////////////////////////////////////////////////////////////////////////// - //! - Set moments (second to sixth order) on destination node - //! - // linear combinations for second order moments - real mxxPyyPzz = m_000; - - real mxxMyy = -c2o3 * (a_100 - b_010 + kxxMyyAverage + c2o1 * a_200 * x - b_110 * x + a_110 * y - -c2o1 * b_020 * y + a_101 * z - b_011 * z - b_111 * x * z + a_111 * y * z) * eps_new/ omegaF * (c1o1 + press); - real mxxMzz = -c2o3 * (a_100 - c_001 + kxxMzzAverage + c2o1 * a_200 * x - c_101 * x + a_110 * y - -c_011 * y - c_111 * x * y + a_101 * z - c2o1 * c_002 * z + a_111 * y * z) * eps_new/ omegaF * (c1o1 + press); - - m_011 = -c1o3 * (b_001 + c_010 + kyzAverage + b_101 * x + c_110 * x + b_011 * y + c2o1 * c_020 * y - + b_111 * x * y + c2o1 * b_002 * z + c_011 * z + c_111 * x * z) * eps_new / omegaF * (c1o1 + press); - m_101 = -c1o3 * (a_001 + c_100 + kxzAverage + a_101 * x + c2o1 * c_200 * x + a_011 * y + c_110 * y - + a_111 * x * y + c2o1 * a_002 * z + c_101 * z + c_111 * y * z) * eps_new / omegaF * (c1o1 + press); - m_110 = -c1o3 * (a_010 + b_100 + kxyAverage + a_110 * x + c2o1 * b_200 * x + c2o1 * a_020 * y - + b_110 * y + a_011 * z + b_101 * z + a_111 * x * z + b_111 * y * z) * eps_new / omegaF * (c1o1 + press); - - m_200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; - m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; - m_002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; - - // linear combinations for third order moments - m_111 = c0o1; - - real mxxyPyzz = c0o1; - real mxxyMyzz = c0o1; - real mxxzPyyz = c0o1; - real mxxzMyyz = c0o1; - real mxyyPxzz = c0o1; - real mxyyMxzz = c0o1; - - m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; - m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; - m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; - m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; - m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; - m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; - - // fourth order moments - m_022 = m_000 * c1o9; - m_202 = m_022; - m_220 = m_022; - - // fifth order moments - - // sixth order moment - m_222 = m_000 * c1o27; - - real vx_sq = vvx * vvx; - real vy_sq = vvy * vvy; - real vz_sq = vvz * vvz; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in - //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), - //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a - //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 - //! ]</b></a> - //! - - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx_sq, c1o1, c1o1); - backwardChimera( m_010, m_110, m_210, vvx, vx_sq); - backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx_sq, c3o1, c1o3); - backwardChimera( m_001, m_101, m_201, vvx, vx_sq); - backwardChimera( m_011, m_111, m_211, vvx, vx_sq); - backwardChimera( m_021, m_121, m_221, vvx, vx_sq); - backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx_sq, c3o1, c1o3); - backwardChimera( m_012, m_112, m_212, vvx, vx_sq); - backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx_sq, c9o1, c1o9); - - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy_sq, c6o1, c1o6); - backwardChimera( m_001, m_011, m_021, vvy, vy_sq); - backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy_sq, c18o1, c1o18); - backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy_sq, c3o2, c2o3); - backwardChimera( m_101, m_111, m_121, vvy, vy_sq); - backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy_sq, c9o2, c2o9); - backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy_sq, c6o1, c1o6); - backwardChimera( m_201, m_211, m_221, vvy, vy_sq); - backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy_sq, c18o1, c1o18); - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz_sq, c9o4, c4o9); - backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz_sq, c36o1, c1o36); -} - -////////////////////////////////////////////////////////////////////////// -//! \brief Interpolate from coarse to fine nodes -//! \details This scaling function is designed for the Cumulant K17 Kernel chimera collision kernel. -//! -//! The function is executed in the following steps: -//! -// based on scaleCF_RhoSq_comp_27 -template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( - real* distributionsCoarse, +template <bool hasTurbulentViscosity> __device__ void interpolate( + vf::lbm::Coefficients& coefficients, + const unsigned int nodeIndex, real* distributionsFine, - unsigned int* neighborXcoarse, - unsigned int* neighborYcoarse, - unsigned int* neighborZcoarse, unsigned int* neighborXfine, unsigned int* neighborYfine, unsigned int* neighborZfine, - unsigned long long numberOfLBnodesCoarse, - unsigned long long numberOfLBnodesFine, - bool isEvenTimestep, - unsigned int* indicesCoarseMMM, - unsigned int* indicesFineMMM, - unsigned int numberOfInterfaceNodes, - real omegaCoarse, - real omegaFine, - real* turbulentViscosityCoarse, - real* turbulentViscosityFine, - ICellNeigh neighborCoarseToFine) + unsigned long long numberOfLBnodesFine, + unsigned int* indicesFineMMM, + real omegaFine, + real* turbulentViscosityFine) { - //////////////////////////////////////////////////////////////////////////////// - //! - Get the node index coordinates from threadId_100, blockId_100, blockDim and gridDim. - //! - const unsigned nodeIndex = getNodeIndex(); - - ////////////////////////////////////////////////////////////////////////// - //! - Return for non-interface node - if (nodeIndex >= numberOfInterfaceNodes) - return; - - ////////////////////////////////////////////////////////////////////////// - //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on - //! timestep is based on the esoteric twist algorithm \ref <a - //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), - //! DOI:10.3390/computation5020019 ]</b></a> - //! - Distributions27 distFine, distCoarse; - getPointersToDistributions(distFine, distributionsFine, numberOfLBnodesFine, true); - getPointersToDistributions(distCoarse, distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); - - //////////////////////////////////////////////////////////////////////////////// - //! - declare local variables for source nodes - //! - real eps_new = c1o2; // ratio of grid resolutions - real omegaC = omegaCoarse; - real omegaF = omegaFine; - - // zeroth and first order moments at the source nodes - real drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP; - real drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP; - real drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP; - real drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP; - real drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM; - real drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM; - real drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM; - real drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM; - - // second order moments at the source nodes - real kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP; - real kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP; - real kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP; - real kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP; - real kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM; - real kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM; - real kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM; - real kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM; - - //////////////////////////////////////////////////////////////////////////////// - //! - Calculate moments for each source node - //! - //////////////////////////////////////////////////////////////////////////////// - // source node BSW = MMM - //////////////////////////////////////////////////////////////////////////////// - // index of the base node and its neighbors - unsigned int k_base_000 = indicesCoarseMMM[nodeIndex]; - unsigned int k_base_M00 = neighborXcoarse [k_base_000]; - unsigned int k_base_0M0 = neighborYcoarse [k_base_000]; - unsigned int k_base_00M = neighborZcoarse [k_base_000]; - unsigned int k_base_MM0 = neighborYcoarse [k_base_M00]; - unsigned int k_base_M0M = neighborZcoarse [k_base_M00]; - unsigned int k_base_0MM = neighborZcoarse [k_base_0M0]; - unsigned int k_base_MMM = neighborZcoarse [k_base_MM0]; - //////////////////////////////////////////////////////////////////////////////// - // Set neighbor indices - unsigned int k_000 = k_base_000; - unsigned int k_M00 = k_base_M00; - unsigned int k_0M0 = k_base_0M0; - unsigned int k_00M = k_base_00M; - unsigned int k_MM0 = k_base_MM0; - unsigned int k_M0M = k_base_M0M; - unsigned int k_0MM = k_base_0MM; - unsigned int k_MMM = k_base_MMM; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM, - kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM); - - ////////////////////////////////////////////////////////////////////////// - // source node TSW = MMP - ////////////////////////////////////////////////////////////////////////// - // Set neighbor indices - has to be recalculated for the new source node - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZcoarse[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZcoarse[k_M0M]; - k_0MM = neighborZcoarse[k_0MM]; - k_MMM = neighborZcoarse[k_MMM]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP, - kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP); - - ////////////////////////////////////////////////////////////////////////// - // source node TSE = PMP - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_M00; - k_M00 = neighborXcoarse[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXcoarse[k_MM0]; - k_M0M = neighborXcoarse[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXcoarse[k_MMM]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP, - kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP); - - ////////////////////////////////////////////////////////////////////////// - // source node BSE = PMM - ////////////////////////////////////////////////////////////////////////// - // index - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXcoarse[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXcoarse[k_base_MM0]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM, - kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM); - - ////////////////////////////////////////////////////////////////////////// - // source node BNW = MPM - ////////////////////////////////////////////////////////////////////////// - // index of the base node and its neighbors --> indices of all source nodes - k_base_000 = k_base_0M0; - k_base_M00 = k_base_MM0; - k_base_0M0 = neighborYcoarse[k_base_0M0]; - k_base_00M = k_base_0MM; - k_base_MM0 = neighborYcoarse[k_base_MM0]; - k_base_M0M = k_base_MMM; - k_base_0MM = neighborYcoarse[k_base_0MM]; - k_base_MMM = neighborYcoarse[k_base_MMM]; - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_base_000; - k_M00 = k_base_M00; - k_0M0 = k_base_0M0; - k_00M = k_base_00M; - k_MM0 = k_base_MM0; - k_M0M = k_base_M0M; - k_0MM = k_base_0MM; - k_MMM = k_base_MMM; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM, - kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM); - - ////////////////////////////////////////////////////////////////////////// - // source node TNW = MPP - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZcoarse[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZcoarse[k_M0M]; - k_0MM = neighborZcoarse[k_0MM]; - k_MMM = neighborZcoarse[k_MMM]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP, - kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP); - - ////////////////////////////////////////////////////////////////////////// - // source node TNE = PPP - ////////////////////////////////////////////////////////////////////////// - // index - // index - k_000 = k_M00; - k_M00 = neighborXcoarse[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXcoarse[k_MM0]; - k_M0M = neighborXcoarse[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXcoarse[k_MMM]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP, - kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP); - - ////////////////////////////////////////////////////////////////////////// - // source node BNE = PPM - ////////////////////////////////////////////////////////////////////////// - // index - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXcoarse[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXcoarse[k_base_MM0]; - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - calculateMomentsOnSourceNodes( distCoarse, omegaC, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM, - kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM); - - ////////////////////////////////////////////////////////////////////////// - //! - Calculate coefficients for polynomial interpolation - //! - // example: a_110: derivation in x and y direction - real a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111; - real b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111; - real c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111; - real d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111; - - // a_000 = (-kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - - // kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP - - // kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP + kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - - // kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP + kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - - // c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP - c2o1 * kxyFromfcNEQ_MPM - c2o1 * kxyFromfcNEQ_MPP + - // c2o1 * kxyFromfcNEQ_PMM + c2o1 * kxyFromfcNEQ_PMP + c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + - // c2o1 * kxzFromfcNEQ_PPM - c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM - c2o1 * kxzFromfcNEQ_MPP + - // c2o1 * kxzFromfcNEQ_PMM - c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM - c2o1 * kxzFromfcNEQ_MMP + - // c8o1 * vx1_PPM + c8o1 * vx1_PPP + c8o1 * vx1_MPM + c8o1 * vx1_MPP + c8o1 * vx1_PMM + c8o1 * vx1_PMP + - // c8o1 * vx1_MMM + c8o1 * vx1_MMP + c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - - // c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + - // c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / - // c64o1; - a_000 = - c1o64 * (c2o1 * (((kxyFromfcNEQ_MMM - kxyFromfcNEQ_PPP) + (kxyFromfcNEQ_MMP - kxyFromfcNEQ_PPM)) + - ((kxyFromfcNEQ_PMM - kxyFromfcNEQ_MPP) + (kxyFromfcNEQ_PMP - kxyFromfcNEQ_MPM)) + - ((kxzFromfcNEQ_MMM - kxzFromfcNEQ_PPP) + (kxzFromfcNEQ_PPM - kxzFromfcNEQ_MMP)) + - ((kxzFromfcNEQ_PMM - kxzFromfcNEQ_MPP) + (kxzFromfcNEQ_MPM - kxzFromfcNEQ_PMP)) + - ((vx2_PPP + vx2_MMM) + (vx2_PPM + vx2_MMP)) - ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_PMP + vx3_MPM) - (vx3_MPP + vx3_PMM))) + - c8o1 * (((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) + ((vx1_MPP + vx1_PMM) + (vx1_PMP + vx1_MPM))) + - ((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP)) + - ((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP))); - - // b_000 = (c2o1 * kxxMyyFromfcNEQ_PPM + c2o1 * kxxMyyFromfcNEQ_PPP + c2o1 * kxxMyyFromfcNEQ_MPM + - // c2o1 * kxxMyyFromfcNEQ_MPP - c2o1 * kxxMyyFromfcNEQ_PMM - c2o1 * kxxMyyFromfcNEQ_PMP - - // c2o1 * kxxMyyFromfcNEQ_MMM - c2o1 * kxxMyyFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_PPP - - // kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP + - // kxxMzzFromfcNEQ_MMM + kxxMzzFromfcNEQ_MMP - c2o1 * kxyFromfcNEQ_PPM - c2o1 * kxyFromfcNEQ_PPP + - // c2o1 * kxyFromfcNEQ_MPM + c2o1 * kxyFromfcNEQ_MPP - c2o1 * kxyFromfcNEQ_PMM - c2o1 * kxyFromfcNEQ_PMP + - // c2o1 * kxyFromfcNEQ_MMM + c2o1 * kxyFromfcNEQ_MMP + c2o1 * kyzFromfcNEQ_PPM - c2o1 * kyzFromfcNEQ_PPP + - // c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM - c2o1 * kyzFromfcNEQ_PMP + - // c2o1 * kyzFromfcNEQ_MMM - c2o1 * kyzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - - // c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP + c8o1 * vx2_PPM + - // c8o1 * vx2_PPP + c8o1 * vx2_MPM + c8o1 * vx2_MPP + c8o1 * vx2_PMM + c8o1 * vx2_PMP + c8o1 * vx2_MMM + - // c8o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - - // c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / - // c64o1; - b_000 = - c1o64 * (c2o1 * (((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP)) + - ((kxyFromfcNEQ_MMM - kxyFromfcNEQ_PPP) + (kxyFromfcNEQ_MMP - kxyFromfcNEQ_PPM)) + - ((kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM) + (kxyFromfcNEQ_MPM - kxyFromfcNEQ_PMP)) + - ((kyzFromfcNEQ_MMM - kyzFromfcNEQ_PPP) + (kyzFromfcNEQ_PPM - kyzFromfcNEQ_MMP)) + - ((kyzFromfcNEQ_PMM - kyzFromfcNEQ_MPP) + (kyzFromfcNEQ_MPM - kyzFromfcNEQ_PMP)) + - ((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) - ((vx1_MPM + vx1_MPP) + (vx1_PMM + vx1_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_MPP + vx3_PMM) - (vx3_MPM + vx3_PMP))) + - c8o1 * (((vx2_PPP + vx2_MMM) + (vx2_PPM + vx2_MMP)) + ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP))) + - ((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM))); - - // c_000 = (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_PPP + kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + - // kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_PMP + kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP - - // c2o1 * kxxMzzFromfcNEQ_PPM + c2o1 * kxxMzzFromfcNEQ_PPP - c2o1 * kxxMzzFromfcNEQ_MPM + - // c2o1 * kxxMzzFromfcNEQ_MPP - c2o1 * kxxMzzFromfcNEQ_PMM + c2o1 * kxxMzzFromfcNEQ_PMP - - // c2o1 * kxxMzzFromfcNEQ_MMM + c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * kxzFromfcNEQ_PPM - - // c2o1 * kxzFromfcNEQ_PPP + c2o1 * kxzFromfcNEQ_MPM + c2o1 * kxzFromfcNEQ_MPP - c2o1 * kxzFromfcNEQ_PMM - - // c2o1 * kxzFromfcNEQ_PMP + c2o1 * kxzFromfcNEQ_MMM + c2o1 * kxzFromfcNEQ_MMP - c2o1 * kyzFromfcNEQ_PPM - - // c2o1 * kyzFromfcNEQ_PPP - c2o1 * kyzFromfcNEQ_MPM - c2o1 * kyzFromfcNEQ_MPP + c2o1 * kyzFromfcNEQ_PMM + - // c2o1 * kyzFromfcNEQ_PMP + c2o1 * kyzFromfcNEQ_MMM + c2o1 * kyzFromfcNEQ_MMP - c2o1 * vx1_PPM + - // c2o1 * vx1_PPP + c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - - // c2o1 * vx1_MMP - c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - - // c2o1 * vx2_PMP + c2o1 * vx2_MMM - c2o1 * vx2_MMP + c8o1 * vx3_PPM + c8o1 * vx3_PPP + c8o1 * vx3_MPM + - // c8o1 * vx3_MPP + c8o1 * vx3_PMM + c8o1 * vx3_PMP + c8o1 * vx3_MMM + c8o1 * vx3_MMP) / - // c64o1; - c_000 = - c1o64 * (c2o1 * (((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM)) + - ((kxzFromfcNEQ_MMM - kxzFromfcNEQ_PPP) + (kxzFromfcNEQ_MMP - kxzFromfcNEQ_PPM)) + - ((kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM) + (kxzFromfcNEQ_MPM - kxzFromfcNEQ_PMP)) + - ((kyzFromfcNEQ_MMM - kyzFromfcNEQ_PPP) + (kyzFromfcNEQ_MMP - kyzFromfcNEQ_PPM)) + - ((kyzFromfcNEQ_PMM - kyzFromfcNEQ_MPP) + (kyzFromfcNEQ_PMP - kyzFromfcNEQ_MPM)) + - ((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_MPP + vx1_PMM)) + - ((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_MPP + vx2_PMM) - (vx2_MPM + vx2_PMP))) + - c8o1 * (((vx3_PPP + vx3_MMM) + (vx3_PPM + vx3_MMP)) + ((vx3_PMM + vx3_MPP) + (vx3_PMP + vx3_MPM))) + - ((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP))); - - // a_100 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP + vx1_PMM + vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; - a_100 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_PPM - vx1_MMP)) + ((vx1_PMM - vx1_MPP) + (vx1_PMP - vx1_MPM))); - - // b_100 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP + vx2_PMM + vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; - b_100 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_PPM - vx2_MMP)) + ((vx2_PMM - vx2_MPP) + (vx2_PMP - vx2_MPM))); - - // c_100 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP + vx3_PMM + vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; - c_100 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_PPM - vx3_MMP)) + ((vx3_PMM - vx3_MPP) + (vx3_PMP - vx3_MPM))); - - // a_200 = (kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_MPP + - // kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_MMP + - // kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_MPP + - // kxxMzzFromfcNEQ_PMM + kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx2_PPM + - // c2o1 * vx2_PPP - c2o1 * vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM - c2o1 * vx2_PMP + c2o1 * vx2_MMM + - // c2o1 * vx2_MMP - c2o1 * vx3_PPM + c2o1 * vx3_PPP + c2o1 * vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + - // c2o1 * vx3_PMP + c2o1 * vx3_MMM - c2o1 * vx3_MMP) / - // c16o1; - a_200 = - c1o16 * (c2o1 * (((vx2_PPP + vx2_MMM) + (vx2_PPM - vx2_MPP)) + ((vx2_MMP - vx2_PMM) - (vx2_MPM + vx2_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MPP)) + ((vx3_MPM + vx3_PMP) - (vx3_MMP + vx3_PMM))) + - ((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM)) + - ((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM))); - - // b_200 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP - kxyFromfcNEQ_MPM - kxyFromfcNEQ_MPP + kxyFromfcNEQ_PMM + - // kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx1_PPM - c2o1 * vx1_PPP + - // c2o1 * vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM + c2o1 * vx1_PMP - c2o1 * vx1_MMM - c2o1 * vx1_MMP) / - // c8o1; - b_200 = - c1o8 * (c2o1 * (-((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) + ((vx1_MPP + vx1_PMM) + (vx1_MPM + vx1_PMP))) + - ((kxyFromfcNEQ_PPP - kxyFromfcNEQ_MMM) + (kxyFromfcNEQ_PPM - kxyFromfcNEQ_MMP)) + - ((kxyFromfcNEQ_PMM - kxyFromfcNEQ_MPP) + (kxyFromfcNEQ_PMP - kxyFromfcNEQ_MPM))); - - // c_200 = (kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM - kxzFromfcNEQ_MPP + kxzFromfcNEQ_PMM + - // kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM - kxzFromfcNEQ_MMP + c2o1 * vx1_PPM - c2o1 * vx1_PPP - c2o1 * - // vx1_MPM + c2o1 * vx1_MPP + c2o1 * vx1_PMM - c2o1 * vx1_PMP - c2o1 * vx1_MMM + c2o1 * vx1_MMP) / - // c8o1; - c_200 = c1o8 * (c2o1 * (((vx1_PPM + vx1_MMP) - (vx1_PPP + vx1_MMM)) + ((vx1_MPP + vx1_PMM) - (vx1_MPM + vx1_PMP))) + - ((kxzFromfcNEQ_PPP - kxzFromfcNEQ_MMM) + (kxzFromfcNEQ_PPM - kxzFromfcNEQ_MMP)) + - ((kxzFromfcNEQ_PMM - kxzFromfcNEQ_MPP) + (kxzFromfcNEQ_PMP - kxzFromfcNEQ_MPM))); - - // a_010 = (vx1_PPM + vx1_PPP + vx1_MPM + vx1_MPP - vx1_PMM - vx1_PMP - vx1_MMM - vx1_MMP) / c4o1; - a_010 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_PPM - vx1_MMP)) + ((vx1_MPP - vx1_PMM) + (vx1_MPM - vx1_PMP))); - - // b_010 = (vx2_PPM + vx2_PPP + vx2_MPM + vx2_MPP - vx2_PMM - vx2_PMP - vx2_MMM - vx2_MMP) / c4o1; - b_010 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_PPM - vx2_MMP)) + ((vx2_MPP - vx2_PMM) + (vx2_MPM - vx2_PMP))); - - // c_010 = (vx3_PPM + vx3_PPP + vx3_MPM + vx3_MPP - vx3_PMM - vx3_PMP - vx3_MMM - vx3_MMP) / c4o1; - c_010 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_PPM - vx3_MMP)) + ((vx3_MPP - vx3_PMM) + (vx3_MPM - vx3_PMP))); - - // a_020 = (kxyFromfcNEQ_PPM + kxyFromfcNEQ_PPP + kxyFromfcNEQ_MPM + kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM - - // kxyFromfcNEQ_PMP - kxyFromfcNEQ_MMM - kxyFromfcNEQ_MMP - c2o1 * vx2_PPM - c2o1 * vx2_PPP + - // c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM - c2o1 * vx2_MMP) / - // c8o1; - a_020 = - c1o8 * (c2o1 * (-((vx2_PPP + vx2_MMM) + (vx2_MMP + vx2_PPM)) + ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP))) + - ((kxyFromfcNEQ_PPP - kxyFromfcNEQ_MMM) + (kxyFromfcNEQ_PPM - kxyFromfcNEQ_MMP)) + - ((kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM) + (kxyFromfcNEQ_MPM - kxyFromfcNEQ_PMP))); - - // b_020 = (-c2o1 * kxxMyyFromfcNEQ_PPM - c2o1 * kxxMyyFromfcNEQ_PPP - c2o1 * kxxMyyFromfcNEQ_MPM - - // c2o1 * kxxMyyFromfcNEQ_MPP + c2o1 * kxxMyyFromfcNEQ_PMM + c2o1 * kxxMyyFromfcNEQ_PMP + - // c2o1 * kxxMyyFromfcNEQ_MMM + c2o1 * kxxMyyFromfcNEQ_MMP + kxxMzzFromfcNEQ_PPM + kxxMzzFromfcNEQ_PPP + - // kxxMzzFromfcNEQ_MPM + kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_PMP - - // kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_MMP + c2o1 * vx1_PPM + c2o1 * vx1_PPP - c2o1 * vx1_MPM - - // c2o1 * vx1_MPP - c2o1 * vx1_PMM - c2o1 * vx1_PMP + c2o1 * vx1_MMM + c2o1 * vx1_MMP - c2o1 * vx3_PPM + - // c2o1 * vx3_PPP - c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP + c2o1 * vx3_MMM - - // c2o1 * vx3_MMP) / - // c16o1; - b_020 = - c1o16 * (c2o1 * (((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM)) + - ((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) - ((vx1_MPP + vx1_PMM) + (vx1_PMP + vx1_MPM)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_MPP + vx3_PMM) - (vx3_MPM + vx3_PMP))) + - ((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP))); - - // c_020 = (kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP + kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM - - // kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM - kyzFromfcNEQ_MMP + c2o1 * vx2_PPM - c2o1 * vx2_PPP + c2o1 * - // vx2_MPM - c2o1 * vx2_MPP - c2o1 * vx2_PMM + c2o1 * vx2_PMP - c2o1 * vx2_MMM + c2o1 * vx2_MMP) / - // c8o1; - c_020 = c1o8 * (c2o1 * (((vx2_MMP + vx2_PPM) - (vx2_PPP + vx2_MMM)) + ((vx2_PMP + vx2_MPM) - (vx2_MPP + vx2_PMM))) + - ((kyzFromfcNEQ_PPP - kyzFromfcNEQ_MMM) + (kyzFromfcNEQ_PPM - kyzFromfcNEQ_MMP)) + - ((kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM) + (kyzFromfcNEQ_MPM - kyzFromfcNEQ_PMP))); - - // a_001 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP - vx1_PMM + vx1_PMP - vx1_MMM + vx1_MMP) / c4o1; - a_001 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_MMP - vx1_PPM)) + ((vx1_MPP - vx1_PMM) + (vx1_PMP - vx1_MPM))); - - // b_001 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP - vx2_PMM + vx2_PMP - vx2_MMM + vx2_MMP) / c4o1; - b_001 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_MMP - vx2_PPM)) + ((vx2_MPP - vx2_PMM) + (vx2_PMP - vx2_MPM))); - - // c_001 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP - vx3_PMM + vx3_PMP - vx3_MMM + vx3_MMP) / c4o1; - c_001 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_MMP - vx3_PPM)) + ((vx3_MPP - vx3_PMM) + (vx3_PMP - vx3_MPM))); - - // a_002 = (-kxzFromfcNEQ_PPM + kxzFromfcNEQ_PPP - kxzFromfcNEQ_MPM + kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM + - // kxzFromfcNEQ_PMP - kxzFromfcNEQ_MMM + kxzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP - - // c2o1 * vx3_MPM + c2o1 * vx3_MPP + c2o1 * vx3_PMM - c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / - // c8o1; - a_002 = c1o8 * (c2o1 * (((vx3_PPM + vx3_MMP) - (vx3_PPP + vx3_MMM)) + ((vx3_MPP + vx3_PMM) - (vx3_PMP + vx3_MPM))) + - ((kxzFromfcNEQ_PPP - kxzFromfcNEQ_MMM) + (kxzFromfcNEQ_MMP - kxzFromfcNEQ_PPM)) + - ((kxzFromfcNEQ_PMP - kxzFromfcNEQ_MPM) + (kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM))); - - // b_002 = (-kyzFromfcNEQ_PPM + kyzFromfcNEQ_PPP - kyzFromfcNEQ_MPM + kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM + - // kyzFromfcNEQ_PMP - kyzFromfcNEQ_MMM + kyzFromfcNEQ_MMP + c2o1 * vx3_PPM - c2o1 * vx3_PPP + c2o1 * - // vx3_MPM - c2o1 * vx3_MPP - c2o1 * vx3_PMM + c2o1 * vx3_PMP - c2o1 * vx3_MMM + c2o1 * vx3_MMP) / - // c8o1; - b_002 = c1o8 * (c2o1 * (((vx3_PPM + vx3_MMP) - (vx3_PPP + vx3_MMM)) + ((vx3_MPM + vx3_PMP) - (vx3_PMM + vx3_MPP))) + - ((kyzFromfcNEQ_PPP - kyzFromfcNEQ_MMM) + (kyzFromfcNEQ_MMP - kyzFromfcNEQ_PPM)) + - ((kyzFromfcNEQ_PMP - kyzFromfcNEQ_MPM) + (kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM))); - - // c_002 = (-kxxMyyFromfcNEQ_PPM + kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MPM + kxxMyyFromfcNEQ_MPP - - // kxxMyyFromfcNEQ_PMM + kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MMM + kxxMyyFromfcNEQ_MMP + - // c2o1 * kxxMzzFromfcNEQ_PPM - c2o1 * kxxMzzFromfcNEQ_PPP + c2o1 * kxxMzzFromfcNEQ_MPM - - // c2o1 * kxxMzzFromfcNEQ_MPP + c2o1 * kxxMzzFromfcNEQ_PMM - c2o1 * kxxMzzFromfcNEQ_PMP + - // c2o1 * kxxMzzFromfcNEQ_MMM - c2o1 * kxxMzzFromfcNEQ_MMP - c2o1 * vx1_PPM + c2o1 * vx1_PPP + - // c2o1 * vx1_MPM - c2o1 * vx1_MPP - c2o1 * vx1_PMM + c2o1 * vx1_PMP + c2o1 * vx1_MMM - c2o1 * vx1_MMP - - // c2o1 * vx2_PPM + c2o1 * vx2_PPP - c2o1 * vx2_MPM + c2o1 * vx2_MPP + c2o1 * vx2_PMM - c2o1 * vx2_PMP + - // c2o1 * vx2_MMM - c2o1 * vx2_MMP) / - // c16o1; - c_002 = - c1o16 * (c2o1 * (((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP) + (kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP)) + - ((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_PMM + vx1_MPP)) + - ((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_PMM + vx2_MPP) - (vx2_MPM + vx2_PMP))) + - ((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM) + (kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM))); - - // a_110 = (vx1_PPM + vx1_PPP - vx1_MPM - vx1_MPP - vx1_PMM - vx1_PMP + vx1_MMM + vx1_MMP) / c2o1; - // b_110 = (vx2_PPM + vx2_PPP - vx2_MPM - vx2_MPP - vx2_PMM - vx2_PMP + vx2_MMM + vx2_MMP) / c2o1; - // c_110 = (vx3_PPM + vx3_PPP - vx3_MPM - vx3_MPP - vx3_PMM - vx3_PMP + vx3_MMM + vx3_MMP) / c2o1; - a_110 = c1o2 * (((vx1_PPP + vx1_MMM) + (vx1_MMP + vx1_PPM)) - ((vx1_MPM + vx1_PMP) + (vx1_PMM + vx1_MPP))); - b_110 = c1o2 * (((vx2_PPP + vx2_MMM) + (vx2_MMP + vx2_PPM)) - ((vx2_MPM + vx2_PMP) + (vx2_PMM + vx2_MPP))); - c_110 = c1o2 * (((vx3_PPP + vx3_MMM) + (vx3_MMP + vx3_PPM)) - ((vx3_MPM + vx3_PMP) + (vx3_PMM + vx3_MPP))); - - // a_101 = (-vx1_PPM + vx1_PPP + vx1_MPM - vx1_MPP - vx1_PMM + vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; - // b_101 = (-vx2_PPM + vx2_PPP + vx2_MPM - vx2_MPP - vx2_PMM + vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; - // c_101 = (-vx3_PPM + vx3_PPP + vx3_MPM - vx3_MPP - vx3_PMM + vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; - a_101 = c1o2 * (((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_PMM + vx1_MPP))); - b_101 = c1o2 * (((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_MPM + vx2_PMP) - (vx2_PMM + vx2_MPP))); - c_101 = c1o2 * (((vx3_PPP + vx3_MMM) - (vx3_MMP + vx3_PPM)) + ((vx3_MPM + vx3_PMP) - (vx3_PMM + vx3_MPP))); - - // a_011 = (-vx1_PPM + vx1_PPP - vx1_MPM + vx1_MPP + vx1_PMM - vx1_PMP + vx1_MMM - vx1_MMP) / c2o1; - // b_011 = (-vx2_PPM + vx2_PPP - vx2_MPM + vx2_MPP + vx2_PMM - vx2_PMP + vx2_MMM - vx2_MMP) / c2o1; - // c_011 = (-vx3_PPM + vx3_PPP - vx3_MPM + vx3_MPP + vx3_PMM - vx3_PMP + vx3_MMM - vx3_MMP) / c2o1; - a_011 = c1o2 * (((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_PMM + vx1_MPP) - (vx1_MPM + vx1_PMP))); - b_011 = c1o2 * (((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_PMM + vx2_MPP) - (vx2_MPM + vx2_PMP))); - c_011 = c1o2 * (((vx3_PPP + vx3_MMM) - (vx3_MMP + vx3_PPM)) + ((vx3_PMM + vx3_MPP) - (vx3_MPM + vx3_PMP))); - - // a_111 = -vx1_PPM + vx1_PPP + vx1_MPM - vx1_MPP + vx1_PMM - vx1_PMP - vx1_MMM + vx1_MMP; - // b_111 = -vx2_PPM + vx2_PPP + vx2_MPM - vx2_MPP + vx2_PMM - vx2_PMP - vx2_MMM + vx2_MMP; - // c_111 = -vx3_PPM + vx3_PPP + vx3_MPM - vx3_MPP + vx3_PMM - vx3_PMP - vx3_MMM + vx3_MMP; - a_111 = ((vx1_PPP - vx1_MMM) + (vx1_MMP - vx1_PPM)) + ((vx1_MPM - vx1_PMP) + (vx1_PMM - vx1_MPP)); - b_111 = ((vx2_PPP - vx2_MMM) + (vx2_MMP - vx2_PPM)) + ((vx2_MPM - vx2_PMP) + (vx2_PMM - vx2_MPP)); - c_111 = ((vx3_PPP - vx3_MMM) + (vx3_MMP - vx3_PPM)) + ((vx3_MPM - vx3_PMP) + (vx3_PMM - vx3_MPP)); - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - real kxyAverage = c0o1; - real kyzAverage = c0o1; - real kxzAverage = c0o1; - real kxxMyyAverage = c0o1; - real kxxMzzAverage = c0o1; - - // real kxyAverage = (kxyFromfcNEQ_MMM+ - // kxyFromfcNEQ_MMP+ - // kxyFromfcNEQ_PMP+ - // kxyFromfcNEQ_PMM+ - // kxyFromfcNEQ_MPM+ - // kxyFromfcNEQ_MPP+ - // kxyFromfcNEQ_PPP+ - // kxyFromfcNEQ_PPM) * c1o8 - (a_010 + b_100); - // real kyzAverage = (kyzFromfcNEQ_MMM+ - // kyzFromfcNEQ_MMP+ - // kyzFromfcNEQ_PMP+ - // kyzFromfcNEQ_PMM+ - // kyzFromfcNEQ_MPM+ - // kyzFromfcNEQ_MPP+ - // kyzFromfcNEQ_PPP+ - // kyzFromfcNEQ_PPM) * c1o8 - (b_001 + c_010); - // real kxzAverage = (kxzFromfcNEQ_MMM+ - // kxzFromfcNEQ_MMP+ - // kxzFromfcNEQ_PMP+ - // kxzFromfcNEQ_PMM+ - // kxzFromfcNEQ_MPM+ - // kxzFromfcNEQ_MPP+ - // kxzFromfcNEQ_PPP+ - // kxzFromfcNEQ_PPM) * c1o8 - (a_001 + c_100); - // real kxxMyyAverage = (kxxMyyFromfcNEQ_MMM+ - // kxxMyyFromfcNEQ_MMP+ - // kxxMyyFromfcNEQ_PMP+ - // kxxMyyFromfcNEQ_PMM+ - // kxxMyyFromfcNEQ_MPM+ - // kxxMyyFromfcNEQ_MPP+ - // kxxMyyFromfcNEQ_PPP+ - // kxxMyyFromfcNEQ_PPM) * c1o8 - (a_100 - b_010); - // real kxxMzzAverage = (kxxMzzFromfcNEQ_MMM+ - // kxxMzzFromfcNEQ_MMP+ - // kxxMzzFromfcNEQ_PMP+ - // kxxMzzFromfcNEQ_PMM+ - // kxxMzzFromfcNEQ_MPM+ - // kxxMzzFromfcNEQ_MPP+ - // kxxMzzFromfcNEQ_PPP+ - // kxxMzzFromfcNEQ_PPM) * c1o8 - (a_100 - c_001); - - //////////////////////////////////////////////////////////////////////////////// - //! - Set the relative position of the offset cell {-1, 0, 1} - //! - real xoff = neighborCoarseToFine.x[nodeIndex]; - real yoff = neighborCoarseToFine.y[nodeIndex]; - real zoff = neighborCoarseToFine.z[nodeIndex]; - - real xoff_sq = xoff * xoff; - real yoff_sq = yoff * yoff; - real zoff_sq = zoff * zoff; - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //drho - real LaplaceRho = - ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) - ? c0o1 - : -c3o1 * (a_100 * a_100 + b_010 * b_010 + c_001 * c_001) - c6o1 * (b_100 * a_010 + c_100 * a_001 + c_010 * b_001); - // d_000 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP + drho_PMM + drho_PMP + drho_MMM + drho_MMP) * c1o8; - d_000 = c1o8 * (((drho_PPP + drho_MMM) + (drho_PPM + drho_MMP)) + ((drho_PMM + drho_MPP) + (drho_PMP + drho_MPM))); - - // d_100 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP + drho_PMM + drho_PMP - drho_MMM - drho_MMP) * c1o4; - d_100 = c1o4 * (((drho_PPP - drho_MMM) + (drho_PPM - drho_MMP)) + ((drho_PMM - drho_MPP) + (drho_PMP - drho_MPM))); - - // d_010 = ( drho_PPM + drho_PPP + drho_MPM + drho_MPP - drho_PMM - drho_PMP - drho_MMM - drho_MMP) * c1o4; - d_010 = c1o4 * (((drho_PPP - drho_MMM) + (drho_PPM - drho_MMP)) + ((drho_MPP - drho_PMM) + (drho_MPM - drho_PMP))); + Distributions27 distFine; + vf::gpu::getPointersToDistributions(distFine, distributionsFine, numberOfLBnodesFine, true); - // d_001 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP - drho_PMM + drho_PMP - drho_MMM + drho_MMP) * c1o4; - d_001 = c1o4 * (((drho_PPP - drho_MMM) + (drho_MMP - drho_PPM)) + ((drho_MPP - drho_PMM) + (drho_PMP - drho_MPM))); - - // d_110 = ( drho_PPM + drho_PPP - drho_MPM - drho_MPP - drho_PMM - drho_PMP + drho_MMM + drho_MMP) * c1o2; - d_110 = c1o2 * (((drho_PPP + drho_MMM) + (drho_PPM + drho_MMP)) - ((drho_PMM + drho_MPP) + (drho_PMP + drho_MPM))); - - // d_101 = (-drho_PPM + drho_PPP + drho_MPM - drho_MPP - drho_PMM + drho_PMP + drho_MMM - drho_MMP) * c1o2; - d_101 = c1o2 * (((drho_PPP + drho_MMM) - (drho_PPM + drho_MMP)) + ((drho_PMP + drho_MPM) - (drho_PMM + drho_MPP))); - - // d_011 = (-drho_PPM + drho_PPP - drho_MPM + drho_MPP + drho_PMM - drho_PMP + drho_MMM - drho_MMP) * c1o2; - d_011 = c1o2 * (((drho_PPP + drho_MMM) - (drho_PPM + drho_MMP)) + ((drho_PMM + drho_MPP) - (drho_PMP + drho_MPM))); - - // d_111 = -drho_PPM + drho_PPP + drho_MPM - drho_MPP + drho_PMM - drho_PMP - drho_MMM + drho_MMP; - d_111 = (((drho_PPP - drho_MMM) + (drho_MMP - drho_PPM)) + ((drho_PMM - drho_MPP) + (drho_MPM - drho_PMP))); - - ////////////////////////////////////////////////////////////////////////// - //! - Extrapolation for refinement in to the wall (polynomial coefficients) - //! - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // X------X - // | | x---x - // | ---+-+-> | ----> offset-vector - // | | x---x - // X------X - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a_000 = a_000 + xoff * a_100 + yoff * a_010 + zoff * a_001 + xoff_sq * a_200 + yoff_sq * a_020 + zoff_sq * a_002 + - xoff * yoff * a_110 + xoff * zoff * a_101 + yoff * zoff * a_011; - a_100 = a_100 + c2o1 * xoff * a_200 + yoff * a_110 + zoff * a_101; - a_010 = a_010 + c2o1 * yoff * a_020 + xoff * a_110 + zoff * a_011; - a_001 = a_001 + c2o1 * zoff * a_002 + xoff * a_101 + yoff * a_011; - b_000 = b_000 + xoff * b_100 + yoff * b_010 + zoff * b_001 + xoff_sq * b_200 + yoff_sq * b_020 + zoff_sq * b_002 + - xoff * yoff * b_110 + xoff * zoff * b_101 + yoff * zoff * b_011; - b_100 = b_100 + c2o1 * xoff * b_200 + yoff * b_110 + zoff * b_101; - b_010 = b_010 + c2o1 * yoff * b_020 + xoff * b_110 + zoff * b_011; - b_001 = b_001 + c2o1 * zoff * b_002 + xoff * b_101 + yoff * b_011; - c_000 = c_000 + xoff * c_100 + yoff * c_010 + zoff * c_001 + xoff_sq * c_200 + yoff_sq * c_020 + zoff_sq * c_002 + - xoff * yoff * c_110 + xoff * zoff * c_101 + yoff * zoff * c_011; - c_100 = c_100 + c2o1 * xoff * c_200 + yoff * c_110 + zoff * c_101; - c_010 = c_010 + c2o1 * yoff * c_020 + xoff * c_110 + zoff * c_011; - c_001 = c_001 + c2o1 * zoff * c_002 + xoff * c_101 + yoff * c_011; - d_000 = d_000 + xoff * d_100 + yoff * d_010 + zoff * d_001 + - xoff * yoff * d_110 + xoff * zoff * d_101 + yoff * zoff * d_011; - d_100 = d_100 + yoff * d_110 + zoff * d_101; - d_010 = d_010 + xoff * d_110 + zoff * d_011; - d_001 = d_001 + xoff * d_101 + yoff * d_011; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Set all moments to zero - //! - real m_111 = c0o1; - real m_211 = c0o1; - real m_011 = c0o1; - real m_121 = c0o1; - real m_101 = c0o1; - real m_112 = c0o1; - real m_110 = c0o1; - real m_221 = c0o1; - real m_001 = c0o1; - real m_201 = c0o1; - real m_021 = c0o1; - real m_212 = c0o1; - real m_010 = c0o1; - real m_210 = c0o1; - real m_012 = c0o1; - real m_122 = c0o1; - real m_100 = c0o1; - real m_120 = c0o1; - real m_102 = c0o1; - real m_222 = c0o1; - real m_022 = c0o1; - real m_202 = c0o1; - real m_002 = c0o1; - real m_220 = c0o1; - real m_020 = c0o1; - real m_200 = c0o1; - real m_000 = c0o1; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Define aliases to use the same variable for the distributions (f's): - //! - real& f_000 = m_111; - real& f_P00 = m_211; - real& f_M00 = m_011; - real& f_0P0 = m_121; - real& f_0M0 = m_101; - real& f_00P = m_112; - real& f_00M = m_110; - real& f_PP0 = m_221; - real& f_MM0 = m_001; - real& f_PM0 = m_201; - real& f_MP0 = m_021; - real& f_P0P = m_212; - real& f_M0M = m_010; - real& f_P0M = m_210; - real& f_M0P = m_012; - real& f_0PP = m_122; - real& f_0MM = m_100; - real& f_0PM = m_120; - real& f_0MP = m_102; - real& f_PPP = m_222; - real& f_MPP = m_022; - real& f_PMP = m_202; - real& f_MMP = m_002; - real& f_PPM = m_220; - real& f_MPM = m_020; - real& f_PMM = m_200; - real& f_MMM = m_000; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Position BSW = MMM: -0.25, -0.25, -0.25 // @@ -901,81 +66,37 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( real z = -c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // index of the base node and its neighbors - k_base_000 = indicesFineMMM[nodeIndex]; - k_base_M00 = neighborXfine [k_base_000]; - k_base_0M0 = neighborYfine [k_base_000]; - k_base_00M = neighborZfine [k_base_000]; - k_base_MM0 = neighborYfine [k_base_M00]; - k_base_M0M = neighborZfine [k_base_M00]; - k_base_0MM = neighborZfine [k_base_0M0]; - k_base_MMM = neighborZfine [k_base_MM0]; + unsigned int k_base_000 = indicesFineMMM[nodeIndex]; + unsigned int k_base_M00 = neighborXfine [k_base_000]; + unsigned int k_base_0M0 = neighborYfine [k_base_000]; + unsigned int k_base_00M = neighborZfine [k_base_000]; + unsigned int k_base_MM0 = neighborYfine [k_base_M00]; + unsigned int k_base_M0M = neighborZfine [k_base_M00]; + unsigned int k_base_0MM = neighborZfine [k_base_0M0]; + unsigned int k_base_MMM = neighborZfine [k_base_MM0]; ////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_base_000; - k_M00 = k_base_M00; - k_0M0 = k_base_0M0; - k_00M = k_base_00M; - k_MM0 = k_base_MM0; - k_M0M = k_base_M0M; - k_0MM = k_base_0MM; - k_MMM = k_base_MMM; + vf::gpu::ListIndices indices; + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; //////////////////////////////////////////////////////////////////////////////// //! - Set moments (zeroth to sixth order) on destination node //! + real omegaF = omegaFine; + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + const real epsilon_new = c1o2; // ratio of grid resolutions + real f[27]; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + + write(distFine, indices, f); - ////////////////////////////////////////////////////////////////////////// - //! - Write distributions: style of reading and writing the distributions from/to - //! stored arrays dependent on timestep is based on the esoteric twist algorithm - //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), - //! DOI:10.3390/computation5020019 ]</b></a> - //! - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; - ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -987,66 +108,23 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZfine[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZfine[k_M0M]; - k_0MM = neighborZfine[k_0MM]; - k_MMM = neighborZfine[k_MMM]; + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZfine[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZfine[indices.k_M0M]; + indices.k_0MM = neighborZfine[indices.k_0MM]; + indices.k_MMM = neighborZfine[indices.k_MMM]; //////////////////////////////////////////////////////////////////////////////// // Set moments (zeroth to sixth orders) on destination node - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -1058,66 +136,23 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_M00; - k_M00 = neighborXfine[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXfine[k_MM0]; - k_M0M = neighborXfine[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXfine[k_MMM]; + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborXfine[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborXfine[indices.k_MM0]; + indices.k_M0M = neighborXfine[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborXfine[indices.k_MMM]; //////////////////////////////////////////////////////////////////////////////// // Set moments (zeroth to sixth orders) on destination node - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -1129,67 +164,23 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = -c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXfine[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXfine[k_base_MM0]; + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborXfine[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborXfine[k_base_MM0]; //////////////////////////////////////////////////////////////////////////////// // Set moments (zeroth to sixth orders) on destination node - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Position BNW = MPM: -0.25, 0.25, -0.25 @@ -1212,67 +203,23 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( ////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_base_000; - k_M00 = k_base_M00; - k_0M0 = k_base_0M0; - k_00M = k_base_00M; - k_MM0 = k_base_MM0; - k_M0M = k_base_M0M; - k_0MM = k_base_0MM; - k_MMM = k_base_MMM; + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; //////////////////////////////////////////////////////////////////////////////// // Set moments (zeroth to sixth orders) on destination node - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Position TNW = MPP: -0.25, 0.25, 0.25 @@ -1283,67 +230,20 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZfine[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZfine[k_M0M]; - k_0MM = neighborZfine[k_0MM]; - k_MMM = neighborZfine[k_MMM]; + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZfine[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZfine[indices.k_M0M]; + indices.k_0MM = neighborZfine[indices.k_0MM]; + indices.k_MMM = neighborZfine[indices.k_MMM]; - //////////////////////////////////////////////////////////////////////////////// - // Set moments (zeroth to sixth orders) on destination node + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); - - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Position TNE = PPP: 0.25, 0.25, 0.25 @@ -1354,67 +254,20 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = c1o4; //////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_000 = k_M00; - k_M00 = neighborXfine[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXfine[k_MM0]; - k_M0M = neighborXfine[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXfine[k_MMM]; + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborXfine[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborXfine[indices.k_MM0]; + indices.k_M0M = neighborXfine[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborXfine[indices.k_MMM]; - //////////////////////////////////////////////////////////////////////////////// - // Set moments (zeroth to sixth orders) on destination node + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); - - ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + write(distFine, indices, f); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //Position BNE = PPM: 0.25, 0.25, -0.25 @@ -1425,66 +278,252 @@ template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( z = -c1o4; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Set neighbor indices - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXfine[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXfine[k_base_MM0]; + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborXfine[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborXfine[k_base_MM0]; + + omegaF = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaFine, turbulentViscosityFine[indices.k_000]) : omegaFine; + + vf::lbm::interpolateCF(f, omegaF, epsilon_new, coefficients, x, y, z); + + write(distFine, indices, f); +} + +////////////////////////////////////////////////////////////////////////// +//! \brief Interpolate from coarse to fine nodes +//! \details This scaling function is designed for the Cumulant K17 Kernel chimera collision kernel. +//! +//! The function is executed in the following steps: +//! +// based on scaleCF_RhoSq_comp_27 +template<bool hasTurbulentViscosity> __global__ void scaleCF_compressible( + real* distributionsCoarse, + real* distributionsFine, + unsigned int* neighborXcoarse, + unsigned int* neighborYcoarse, + unsigned int* neighborZcoarse, + unsigned int* neighborXfine, + unsigned int* neighborYfine, + unsigned int* neighborZfine, + unsigned long long numberOfLBnodesCoarse, + unsigned long long numberOfLBnodesFine, + bool isEvenTimestep, + unsigned int* indicesCoarseMMM, + unsigned int* indicesFineMMM, + unsigned int numberOfInterfaceNodes, + real omegaCoarse, + real omegaFine, + real* turbulentViscosityCoarse, + real* turbulentViscosityFine, + ICellNeigh neighborCoarseToFine) +{ + const unsigned nodeIndex = vf::gpu::getNodeIndex(); + + if (nodeIndex >= numberOfInterfaceNodes) + return; + + // 1.calculate moments + vf::lbm::MomentsOnSourceNodeSet momentsSet; + // - ########################################### + // TODO: The following part starting from here + // should be exchanged by function call of calculate_moment_set<hasTurbulentViscosity>() + // However, this leads to a very small deviation in the results (~10e-6). + real omegaC = omegaCoarse; + Distributions27 distCoarse; + vf::gpu::getPointersToDistributions(distCoarse, distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); + + vf::gpu::ListIndices indices; //////////////////////////////////////////////////////////////////////////////// - // Set moments (zeroth to sixth orders) on destination node + //! - Calculate moments for each source node + //! + //////////////////////////////////////////////////////////////////////////////// + // source node BSW = MMM + //////////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + unsigned int k_base_000 = indicesCoarseMMM[nodeIndex]; + unsigned int k_base_M00 = neighborXcoarse [k_base_000]; + unsigned int k_base_0M0 = neighborYcoarse [k_base_000]; + unsigned int k_base_00M = neighborZcoarse [k_base_000]; + unsigned int k_base_MM0 = neighborYcoarse [k_base_M00]; + unsigned int k_base_M0M = neighborZcoarse [k_base_M00]; + unsigned int k_base_0MM = neighborZcoarse [k_base_0M0]; + unsigned int k_base_MMM = neighborZcoarse [k_base_MM0]; + //////////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + real f_coarse[27]; + + read(f_coarse, distCoarse, indices); + momentsSet.calculateMMM(f_coarse, omegaC); + + ////////////////////////////////////////////////////////////////////////// + // source node TSW = MMP + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices - has to be recalculated for the new source node + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZcoarse[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZcoarse[indices.k_M0M]; + indices.k_0MM = neighborZcoarse[indices.k_0MM]; + indices.k_MMM = neighborZcoarse[indices.k_MMM]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculateMMP(f_coarse, omegaC); + + ////////////////////////////////////////////////////////////////////////// + // source node TSE = PMP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborXcoarse[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborXcoarse[indices.k_MM0]; + indices.k_M0M = neighborXcoarse[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborXcoarse[indices.k_MMM]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculatePMP(f_coarse, omegaC); + + ////////////////////////////////////////////////////////////////////////// + // source node BSE = PMM + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborXcoarse[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborXcoarse[k_base_MM0]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - interpolateDistributions( - x, y, z, - m_000, - m_100, m_010, m_001, - m_011, m_101, m_110, m_200, m_020, m_002, - m_111, m_210, m_012, m_201, m_021, m_120, m_102, - m_022, m_202, m_220, m_211, m_121, m_112, - m_122, m_212, m_221, - m_222, - a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011, a_111, - b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011, b_111, - c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011, c_111, - d_000, d_100, d_010, d_001, d_110, d_101, d_011, d_111, - LaplaceRho, eps_new, omegaF, - kxxMyyAverage, kxxMzzAverage, kyzAverage, kxzAverage, kxyAverage - ); + read(f_coarse, distCoarse, indices); + momentsSet.calculatePMM(f_coarse, omegaC); ////////////////////////////////////////////////////////////////////////// - // Write distributions - (distFine.f[DIR_000])[k_000] = f_000; - (distFine.f[DIR_P00])[k_000] = f_P00; - (distFine.f[DIR_M00])[k_M00] = f_M00; - (distFine.f[DIR_0P0])[k_000] = f_0P0; - (distFine.f[DIR_0M0])[k_0M0] = f_0M0; - (distFine.f[DIR_00P])[k_000] = f_00P; - (distFine.f[DIR_00M])[k_00M] = f_00M; - (distFine.f[DIR_PP0])[k_000] = f_PP0; - (distFine.f[DIR_MM0])[k_MM0] = f_MM0; - (distFine.f[DIR_PM0])[k_0M0] = f_PM0; - (distFine.f[DIR_MP0])[k_M00] = f_MP0; - (distFine.f[DIR_P0P])[k_000] = f_P0P; - (distFine.f[DIR_M0M])[k_M0M] = f_M0M; - (distFine.f[DIR_P0M])[k_00M] = f_P0M; - (distFine.f[DIR_M0P])[k_M00] = f_M0P; - (distFine.f[DIR_0PP])[k_000] = f_0PP; - (distFine.f[DIR_0MM])[k_0MM] = f_0MM; - (distFine.f[DIR_0PM])[k_00M] = f_0PM; - (distFine.f[DIR_0MP])[k_0M0] = f_0MP; - (distFine.f[DIR_PPP])[k_000] = f_PPP; - (distFine.f[DIR_MPP])[k_M00] = f_MPP; - (distFine.f[DIR_PMP])[k_0M0] = f_PMP; - (distFine.f[DIR_MMP])[k_MM0] = f_MMP; - (distFine.f[DIR_PPM])[k_00M] = f_PPM; - (distFine.f[DIR_MPM])[k_M0M] = f_MPM; - (distFine.f[DIR_PMM])[k_0MM] = f_PMM; - (distFine.f[DIR_MMM])[k_MMM] = f_MMM; + // source node BNW = MPM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors --> indices of all source nodes + k_base_000 = k_base_0M0; + k_base_M00 = k_base_MM0; + k_base_0M0 = neighborYcoarse[k_base_0M0]; + k_base_00M = k_base_0MM; + k_base_MM0 = neighborYcoarse[k_base_MM0]; + k_base_M0M = k_base_MMM; + k_base_0MM = neighborYcoarse[k_base_0MM]; + k_base_MMM = neighborYcoarse[k_base_MMM]; + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculateMPM(f_coarse, omegaC); + + ////////////////////////////////////////////////////////////////////////// + // source node TNW = MPP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZcoarse[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZcoarse[indices.k_M0M]; + indices.k_0MM = neighborZcoarse[indices.k_0MM]; + indices.k_MMM = neighborZcoarse[indices.k_MMM]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculateMPP(f_coarse, omegaC); + ////////////////////////////////////////////////////////////////////////// + // source node TNE = PPP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborXcoarse[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborXcoarse[indices.k_MM0]; + indices.k_M0M = neighborXcoarse[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborXcoarse[indices.k_MMM]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculatePPP(f_coarse, omegaC); + ////////////////////////////////////////////////////////////////////////// + // source node BNE = PPM + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborXcoarse[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborXcoarse[k_base_MM0]; + + omegaC = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + + read(f_coarse, distCoarse, indices); + momentsSet.calculatePPM(f_coarse, omegaC); + // should be extractel until this line + // - ################################################################### + + // 2.calculate coefficients + vf::lbm::Coefficients coefficients; + momentsSet.calculateCoefficients(coefficients, neighborCoarseToFine.x[nodeIndex], neighborCoarseToFine.y[nodeIndex], neighborCoarseToFine.z[nodeIndex]); + + // 3. interpolate coarse to fine + interpolate<hasTurbulentViscosity>( + coefficients, + nodeIndex, + distributionsFine, + neighborXfine, + neighborYfine, + neighborZfine, + numberOfLBnodesFine, + indicesFineMMM, + omegaFine, + turbulentViscosityFine); } template __global__ void scaleCF_compressible<true>( real* distributionsCoarse, real* distributionsFine, unsigned int* neighborXcoarse, unsigned int* neighborYcoarse, unsigned int* neighborZcoarse, unsigned int* neighborXfine, unsigned int* neighborYfine, unsigned int* neighborZfine, unsigned long long numberOfLBnodesCoarse, unsigned long long numberOfLBnodesFine, bool isEvenTimestep, unsigned int* indicesCoarseMMM, unsigned int* indicesFineMMM, unsigned int numberOfInterfaceNodes, real omegaCoarse, real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh offsetCF); diff --git a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu index 5776ba476e3537360b32ee85f32514324946ff75..3276db0595329b4c948779d0b27857170d125f78 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/GridScaling/scaleFC_compressible.cu @@ -35,16 +35,44 @@ #include "LBM/GPUHelperFunctions/KernelUtilities.h" #include "LBM/GPUHelperFunctions/ScalingUtilities.h" -using namespace vf::basics::constant; -using namespace vf::lbm::dir; -using namespace vf::gpu; +#include <lbm/KernelParameter.h> +#include <lbm/refinement/InterpolationFC.h> +#include <lbm/refinement/Coefficients.h> + + +template <bool hasTurbulentViscosity> __device__ void interpolate( + vf::lbm::Coefficients& coefficients, + const unsigned int nodeIndex, + real* distributionsCoarse, + unsigned int* neighborXcoarse, + unsigned int* neighborYcoarse, + unsigned int* neighborZcoarse, + unsigned long long numberOfLBnodesCoarse, + unsigned int* indicesCoarse000, + real omegaCoarse, + real* turbulentViscosityCoarse, + bool isEvenTimestep +) +{ + // Position Coarse 0., 0., 0. + Distributions27 distCoarse; + vf::gpu::getPointersToDistributions(distCoarse, distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); + + vf::gpu::ListIndices indices(indicesCoarse000[nodeIndex], neighborXcoarse, neighborYcoarse, neighborZcoarse); + + const real epsilonNew = c2o1; // ratio of grid resolutions + const real omegaCoarseNew = hasTurbulentViscosity ? vf::gpu::calculateOmega(omegaCoarse, turbulentViscosityCoarse[indices.k_000]) : omegaCoarse; + real fCoarse[27]; + vf::lbm::interpolateFC(fCoarse, epsilonNew, omegaCoarseNew, coefficients); + + vf::gpu::write(distCoarse, indices, fCoarse); +} + + ////////////////////////////////////////////////////////////////////////// //! \brief Interpolate from fine to coarse //! \details This scaling function is designed for the Cumulant K17 Kernel chimera collision kernel -//! The function is executed in the following steps: -//! - // based on scaleFC_RhoSq_comp_27 template<bool hasTurbulentViscosity> __global__ void scaleFC_compressible( real *distributionsCoarse, @@ -61,653 +89,41 @@ template<bool hasTurbulentViscosity> __global__ void scaleFC_compressible( unsigned int *indicesCoarse000, unsigned int *indicesFineMMM, unsigned int numberOfInterfaceNodes, - real omegaCoarse, - real omegaFine, + const real omega_coarse, + const real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh neighborFineToCoarse) { - //////////////////////////////////////////////////////////////////////////////// - //! - Get the node index coordinates from threadIdx, blockIdx, blockDim and gridDim. - //! - const unsigned nodeIndex = getNodeIndex(); + const unsigned nodeIndex = vf::gpu::getNodeIndex(); - ////////////////////////////////////////////////////////////////////////// - //! - Return for non-interface node if (nodeIndex >= numberOfInterfaceNodes) return; - ////////////////////////////////////////////////////////////////////////// - //! - Read distributions: style of reading and writing the distributions from/to stored arrays dependent on - //! timestep is based on the esoteric twist algorithm \ref <a - //! href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), - //! DOI:10.3390/computation5020019 ]</b></a> - //! - Distributions27 distFine, distCoarse; - getPointersToDistributions(distFine, distributionsFine, numberOfLBnodesFine, true); - getPointersToDistributions(distCoarse, distributionsCoarse, numberOfLBnodesCoarse, isEvenTimestep); - - //////////////////////////////////////////////////////////////////////////////// - //! - declare local variables for source nodes - //! - real eps_new = c2o1; // ratio of grid resolutions - real omegaF = omegaFine; - real omegaC = omegaCoarse; - - // zeroth and first order moments at the source nodes - real drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP; - real drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP; - real drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP; - real drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP; - real drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM; - real drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM; - real drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM; - real drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM; - - // second order moments at the source nodes - real kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP; - real kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP; - real kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP; - real kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP; - real kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM; - real kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM; - real kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM; - real kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM; - - ////////////////////////////////////////////////////////////////////////// - //! - Calculate moments for each source node - //! - ////////////////////////////////////////////////////////////////////////// - // source node BSW = MMM - ////////////////////////////////////////////////////////////////////////// - // index of the base node and its neighbors - unsigned int k_base_000 = indicesFineMMM[nodeIndex]; - unsigned int k_base_M00 = neighborXfine [k_base_000]; - unsigned int k_base_0M0 = neighborYfine [k_base_000]; - unsigned int k_base_00M = neighborZfine [k_base_000]; - unsigned int k_base_MM0 = neighborYfine [k_base_M00]; - unsigned int k_base_M0M = neighborZfine [k_base_M00]; - unsigned int k_base_0MM = neighborZfine [k_base_0M0]; - unsigned int k_base_MMM = neighborZfine [k_base_MM0]; - ////////////////////////////////////////////////////////////////////////// - // Set neighbor indices - unsigned int k_000 = k_base_000; - unsigned int k_M00 = k_base_M00; - unsigned int k_0M0 = k_base_0M0; - unsigned int k_00M = k_base_00M; - unsigned int k_MM0 = k_base_MM0; - unsigned int k_M0M = k_base_M0M; - unsigned int k_0MM = k_base_0MM; - unsigned int k_MMM = k_base_MMM; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMM, vx1_MMM, vx2_MMM, vx3_MMM, - kxyFromfcNEQ_MMM, kyzFromfcNEQ_MMM, kxzFromfcNEQ_MMM, kxxMyyFromfcNEQ_MMM, kxxMzzFromfcNEQ_MMM); - - ////////////////////////////////////////////////////////////////////////// - // source node TSW = MMP - ////////////////////////////////////////////////////////////////////////// - // Set neighbor indices - has to be recalculated for the new source node - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZfine[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZfine[k_M0M]; - k_0MM = neighborZfine[k_0MM]; - k_MMM = neighborZfine[k_MMM]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MMP, vx1_MMP, vx2_MMP, vx3_MMP, - kxyFromfcNEQ_MMP, kyzFromfcNEQ_MMP, kxzFromfcNEQ_MMP, kxxMyyFromfcNEQ_MMP, kxxMzzFromfcNEQ_MMP); - - ////////////////////////////////////////////////////////////////////////// - // source node TSE = PMP - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_M00; - k_M00 = neighborXfine[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXfine[k_MM0]; - k_M0M = neighborXfine[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXfine[k_MMM]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMP, vx1_PMP, vx2_PMP, vx3_PMP, - kxyFromfcNEQ_PMP, kyzFromfcNEQ_PMP, kxzFromfcNEQ_PMP, kxxMyyFromfcNEQ_PMP, kxxMzzFromfcNEQ_PMP); - - ////////////////////////////////////////////////////////////////////////// - // source node BSE = PMM - ////////////////////////////////////////////////////////////////////////// - // index - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXfine[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXfine[k_base_MM0]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PMM, vx1_PMM, vx2_PMM, vx3_PMM, - kxyFromfcNEQ_PMM, kyzFromfcNEQ_PMM, kxzFromfcNEQ_PMM, kxxMyyFromfcNEQ_PMM, kxxMzzFromfcNEQ_PMM); - - ////////////////////////////////////////////////////////////////////////// - // source node BNW = MPM - ////////////////////////////////////////////////////////////////////////// - // index of the base node and its neighbors --> indices of all source nodes - k_base_000 = k_base_0M0; - k_base_M00 = k_base_MM0; - k_base_0M0 = neighborYfine[k_base_0M0]; - k_base_00M = k_base_0MM; - k_base_MM0 = neighborYfine[k_base_MM0]; - k_base_M0M = k_base_MMM; - k_base_0MM = neighborYfine[k_base_0MM]; - k_base_MMM = neighborYfine[k_base_MMM]; - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_base_000; - k_M00 = k_base_M00; - k_0M0 = k_base_0M0; - k_00M = k_base_00M; - k_MM0 = k_base_MM0; - k_M0M = k_base_M0M; - k_0MM = k_base_0MM; - k_MMM = k_base_MMM; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPM, vx1_MPM, vx2_MPM, vx3_MPM, - kxyFromfcNEQ_MPM, kyzFromfcNEQ_MPM, kxzFromfcNEQ_MPM, kxxMyyFromfcNEQ_MPM, kxxMzzFromfcNEQ_MPM); - - ////////////////////////////////////////////////////////////////////////// - // source node TNW = MPP - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_00M; - k_M00 = k_M0M; - k_0M0 = k_0MM; - k_00M = neighborZfine[k_00M]; - k_MM0 = k_MMM; - k_M0M = neighborZfine[k_M0M]; - k_0MM = neighborZfine[k_0MM]; - k_MMM = neighborZfine[k_MMM]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_MPP, vx1_MPP, vx2_MPP, vx3_MPP, - kxyFromfcNEQ_MPP, kyzFromfcNEQ_MPP, kxzFromfcNEQ_MPP, kxxMyyFromfcNEQ_MPP, kxxMzzFromfcNEQ_MPP); - - ////////////////////////////////////////////////////////////////////////// - // source node TNE = PPP - ////////////////////////////////////////////////////////////////////////// - // index - k_000 = k_M00; - k_M00 = neighborXfine[k_M00]; - k_0M0 = k_MM0; - k_00M = k_M0M; - k_MM0 = neighborXfine[k_MM0]; - k_M0M = neighborXfine[k_M0M]; - k_0MM = k_MMM; - k_MMM = neighborXfine[k_MMM]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPP, vx1_PPP, vx2_PPP, vx3_PPP, - kxyFromfcNEQ_PPP, kyzFromfcNEQ_PPP, kxzFromfcNEQ_PPP, kxxMyyFromfcNEQ_PPP, kxxMzzFromfcNEQ_PPP); - - ////////////////////////////////////////////////////////////////////////// - // source node BNE = PPM - ////////////////////////////////////////////////////////////////////////// - // index - k_00M = k_000; - k_M0M = k_M00; - k_0MM = k_0M0; - k_MMM = k_MM0; - k_000 = k_base_M00; - k_M00 = neighborXfine[k_base_M00]; - k_0M0 = k_base_MM0; - k_MM0 = neighborXfine[k_base_MM0]; - - if(hasTurbulentViscosity) omegaF = omegaFine/ (c1o1 + c3o1*omegaFine*turbulentViscosityFine[k_000]); - - calculateMomentsOnSourceNodes( distFine, omegaF, - k_000, k_M00, k_0M0, k_00M, k_MM0, k_M0M, k_0MM, k_MMM, drho_PPM, vx1_PPM, vx2_PPM, vx3_PPM, - kxyFromfcNEQ_PPM, kyzFromfcNEQ_PPM, kxzFromfcNEQ_PPM, kxxMyyFromfcNEQ_PPM, kxxMzzFromfcNEQ_PPM); - - ////////////////////////////////////////////////////////////////////////// - //! - Calculate coefficients for polynomial interpolation - //! - // example: a_110: derivation in x and y direction - real a_000, a_100, a_010, a_001, a_200, a_020, a_002, a_110, a_101, a_011; - real b_000, b_100, b_010, b_001, b_200, b_020, b_002, b_110, b_101, b_011; - real c_000, c_100, c_010, c_001, c_200, c_020, c_002, c_110, c_101, c_011; - real d_000, d_100, d_010, d_001, d_110, d_101, d_011; - - a_000 = c1o64 * ( - c2o1 * ( - ((kxyFromfcNEQ_MMM - kxyFromfcNEQ_PPP) + (kxyFromfcNEQ_MMP - kxyFromfcNEQ_PPM)) + ((kxyFromfcNEQ_PMM - kxyFromfcNEQ_MPP) + (kxyFromfcNEQ_PMP - kxyFromfcNEQ_MPM)) + - ((kxzFromfcNEQ_MMM - kxzFromfcNEQ_PPP) + (kxzFromfcNEQ_PPM - kxzFromfcNEQ_MMP)) + ((kxzFromfcNEQ_PMM - kxzFromfcNEQ_MPP) + (kxzFromfcNEQ_MPM - kxzFromfcNEQ_PMP)) + - ((vx2_PPP + vx2_MMM) + (vx2_PPM + vx2_MMP)) - ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_PMP + vx3_MPM) - (vx3_MPP + vx3_PMM))) + - c8o1 * (((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) + ((vx1_MPP + vx1_PMM) + (vx1_PMP + vx1_MPM))) + - ((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP)) + - ((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP))); - b_000 = c1o64 * ( - c2o1 * ( - ((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP)) + - ((kxyFromfcNEQ_MMM - kxyFromfcNEQ_PPP) + (kxyFromfcNEQ_MMP - kxyFromfcNEQ_PPM)) + - ((kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM) + (kxyFromfcNEQ_MPM - kxyFromfcNEQ_PMP)) + - ((kyzFromfcNEQ_MMM - kyzFromfcNEQ_PPP) + (kyzFromfcNEQ_PPM - kyzFromfcNEQ_MMP)) + - ((kyzFromfcNEQ_PMM - kyzFromfcNEQ_MPP) + (kyzFromfcNEQ_MPM - kyzFromfcNEQ_PMP)) + - ((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) - ((vx1_MPM + vx1_MPP) + (vx1_PMM + vx1_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_MPP + vx3_PMM) - (vx3_MPM + vx3_PMP))) + - c8o1 * (((vx2_PPP + vx2_MMM) + (vx2_PPM + vx2_MMP)) + ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP))) + - ((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM))); - c_000 = c1o64 * ( - c2o1 * ( - ((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_MMP - kxxMzzFromfcNEQ_PPM)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM)) + - ((kxzFromfcNEQ_MMM - kxzFromfcNEQ_PPP) + (kxzFromfcNEQ_MMP - kxzFromfcNEQ_PPM)) + - ((kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM) + (kxzFromfcNEQ_MPM - kxzFromfcNEQ_PMP)) + - ((kyzFromfcNEQ_MMM - kyzFromfcNEQ_PPP) + (kyzFromfcNEQ_MMP - kyzFromfcNEQ_PPM)) + - ((kyzFromfcNEQ_PMM - kyzFromfcNEQ_MPP) + (kyzFromfcNEQ_PMP - kyzFromfcNEQ_MPM)) + - ((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_MPP + vx1_PMM)) + - ((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_MPP + vx2_PMM) - (vx2_MPM + vx2_PMP))) + - c8o1 * (((vx3_PPP + vx3_MMM) + (vx3_PPM + vx3_MMP)) + ((vx3_PMM + vx3_MPP) + (vx3_PMP + vx3_MPM))) + - ((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_MPM - kxxMyyFromfcNEQ_PMP))); - - a_100 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_PPM - vx1_MMP)) + ((vx1_PMM - vx1_MPP) + (vx1_PMP - vx1_MPM))); - b_100 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_PPM - vx2_MMP)) + ((vx2_PMM - vx2_MPP) + (vx2_PMP - vx2_MPM))); - c_100 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_PPM - vx3_MMP)) + ((vx3_PMM - vx3_MPP) + (vx3_PMP - vx3_MPM))); - - a_200 = c1o16 * ( - c2o1 * ( - ((vx2_PPP + vx2_MMM) + (vx2_PPM - vx2_MPP)) + ((vx2_MMP - vx2_PMM) - (vx2_MPM + vx2_PMP)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MPP)) + ((vx3_MPM + vx3_PMP) - (vx3_MMP + vx3_PMM))) + - ((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_PPM - kxxMyyFromfcNEQ_MMP)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM)) + - ((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP) + (kxxMzzFromfcNEQ_PMP - kxxMzzFromfcNEQ_MPM))); - b_200 = c1o8 * ( - c2o1 * ( - -((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) + ((vx1_MPP + vx1_PMM) + (vx1_MPM + vx1_PMP))) + - ((kxyFromfcNEQ_PPP - kxyFromfcNEQ_MMM) + (kxyFromfcNEQ_PPM - kxyFromfcNEQ_MMP)) + - ((kxyFromfcNEQ_PMM - kxyFromfcNEQ_MPP) + (kxyFromfcNEQ_PMP - kxyFromfcNEQ_MPM))); - c_200 = c1o8 * ( - c2o1 * ( - ((vx1_PPM + vx1_MMP) - (vx1_PPP + vx1_MMM)) + ((vx1_MPP + vx1_PMM) - (vx1_MPM + vx1_PMP))) + - ((kxzFromfcNEQ_PPP - kxzFromfcNEQ_MMM) + (kxzFromfcNEQ_PPM - kxzFromfcNEQ_MMP)) + - ((kxzFromfcNEQ_PMM - kxzFromfcNEQ_MPP) + (kxzFromfcNEQ_PMP - kxzFromfcNEQ_MPM))); - - a_010 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_PPM - vx1_MMP)) + ((vx1_MPP - vx1_PMM) + (vx1_MPM - vx1_PMP))); - b_010 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_PPM - vx2_MMP)) + ((vx2_MPP - vx2_PMM) + (vx2_MPM - vx2_PMP))); - c_010 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_PPM - vx3_MMP)) + ((vx3_MPP - vx3_PMM) + (vx3_MPM - vx3_PMP))); - - a_020 = c1o8 * ( - c2o1 * (-((vx2_PPP + vx2_MMM) + (vx2_MMP + vx2_PPM)) + ((vx2_MPP + vx2_PMM) + (vx2_MPM + vx2_PMP))) + - ((kxyFromfcNEQ_PPP - kxyFromfcNEQ_MMM) + (kxyFromfcNEQ_PPM - kxyFromfcNEQ_MMP)) + - ((kxyFromfcNEQ_MPP - kxyFromfcNEQ_PMM) + (kxyFromfcNEQ_MPM - kxyFromfcNEQ_PMP))); - b_020 = c1o16 * ( - c2o1 * ( - ((kxxMyyFromfcNEQ_MMM - kxxMyyFromfcNEQ_PPP) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_PMM - kxxMyyFromfcNEQ_MPP) + (kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM)) + - ((vx1_PPP + vx1_MMM) + (vx1_PPM + vx1_MMP)) - ((vx1_MPP + vx1_PMM) + (vx1_PMP + vx1_MPM)) + - ((vx3_PPP + vx3_MMM) - (vx3_PPM + vx3_MMP)) + ((vx3_MPP + vx3_PMM) - (vx3_MPM + vx3_PMP))) + - ((kxxMzzFromfcNEQ_PPP - kxxMzzFromfcNEQ_MMM) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_MPP - kxxMzzFromfcNEQ_PMM) + (kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP))); - c_020 = c1o8 * ( - c2o1 * (((vx2_MMP + vx2_PPM) - (vx2_PPP + vx2_MMM)) + ((vx2_PMP + vx2_MPM) - (vx2_MPP + vx2_PMM))) + - ((kyzFromfcNEQ_PPP - kyzFromfcNEQ_MMM) + (kyzFromfcNEQ_PPM - kyzFromfcNEQ_MMP)) + - ((kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM) + (kyzFromfcNEQ_MPM - kyzFromfcNEQ_PMP))); - - a_001 = c1o4 * (((vx1_PPP - vx1_MMM) + (vx1_MMP - vx1_PPM)) + ((vx1_MPP - vx1_PMM) + (vx1_PMP - vx1_MPM))); - b_001 = c1o4 * (((vx2_PPP - vx2_MMM) + (vx2_MMP - vx2_PPM)) + ((vx2_MPP - vx2_PMM) + (vx2_PMP - vx2_MPM))); - c_001 = c1o4 * (((vx3_PPP - vx3_MMM) + (vx3_MMP - vx3_PPM)) + ((vx3_MPP - vx3_PMM) + (vx3_PMP - vx3_MPM))); - - a_002 = c1o8 * ( - c2o1 * (((vx3_PPM + vx3_MMP) - (vx3_PPP + vx3_MMM)) + ((vx3_MPP + vx3_PMM) - (vx3_PMP + vx3_MPM))) + - ((kxzFromfcNEQ_PPP - kxzFromfcNEQ_MMM) + (kxzFromfcNEQ_MMP - kxzFromfcNEQ_PPM)) + - ((kxzFromfcNEQ_PMP - kxzFromfcNEQ_MPM) + (kxzFromfcNEQ_MPP - kxzFromfcNEQ_PMM))); - b_002 = c1o8 * ( - c2o1 * (((vx3_PPM + vx3_MMP) - (vx3_PPP + vx3_MMM)) + ((vx3_MPM + vx3_PMP) - (vx3_PMM + vx3_MPP))) + - ((kyzFromfcNEQ_PPP - kyzFromfcNEQ_MMM) + (kyzFromfcNEQ_MMP - kyzFromfcNEQ_PPM)) + - ((kyzFromfcNEQ_PMP - kyzFromfcNEQ_MPM) + (kyzFromfcNEQ_MPP - kyzFromfcNEQ_PMM))); - c_002 = c1o16 * ( - c2o1 * ( - ((kxxMzzFromfcNEQ_MMM - kxxMzzFromfcNEQ_PPP) + (kxxMzzFromfcNEQ_PPM - kxxMzzFromfcNEQ_MMP)) + - ((kxxMzzFromfcNEQ_MPM - kxxMzzFromfcNEQ_PMP) + (kxxMzzFromfcNEQ_PMM - kxxMzzFromfcNEQ_MPP)) + - ((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_PMM + vx1_MPP)) + - ((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_PMM + vx2_MPP) - (vx2_MPM + vx2_PMP))) + - ((kxxMyyFromfcNEQ_PPP - kxxMyyFromfcNEQ_MMM) + (kxxMyyFromfcNEQ_MMP - kxxMyyFromfcNEQ_PPM)) + - ((kxxMyyFromfcNEQ_PMP - kxxMyyFromfcNEQ_MPM) + (kxxMyyFromfcNEQ_MPP - kxxMyyFromfcNEQ_PMM))); - - a_110 = c1o2 * (((vx1_PPP + vx1_MMM) + (vx1_MMP + vx1_PPM)) - ((vx1_MPM + vx1_PMP) + (vx1_PMM + vx1_MPP))); - b_110 = c1o2 * (((vx2_PPP + vx2_MMM) + (vx2_MMP + vx2_PPM)) - ((vx2_MPM + vx2_PMP) + (vx2_PMM + vx2_MPP))); - c_110 = c1o2 * (((vx3_PPP + vx3_MMM) + (vx3_MMP + vx3_PPM)) - ((vx3_MPM + vx3_PMP) + (vx3_PMM + vx3_MPP))); - - a_101 = c1o2 * (((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_MPM + vx1_PMP) - (vx1_PMM + vx1_MPP))); - b_101 = c1o2 * (((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_MPM + vx2_PMP) - (vx2_PMM + vx2_MPP))); - c_101 = c1o2 * (((vx3_PPP + vx3_MMM) - (vx3_MMP + vx3_PPM)) + ((vx3_MPM + vx3_PMP) - (vx3_PMM + vx3_MPP))); - - a_011 = c1o2 * (((vx1_PPP + vx1_MMM) - (vx1_MMP + vx1_PPM)) + ((vx1_PMM + vx1_MPP) - (vx1_MPM + vx1_PMP))); - b_011 = c1o2 * (((vx2_PPP + vx2_MMM) - (vx2_MMP + vx2_PPM)) + ((vx2_PMM + vx2_MPP) - (vx2_MPM + vx2_PMP))); - c_011 = c1o2 * (((vx3_PPP + vx3_MMM) - (vx3_MMP + vx3_PPM)) + ((vx3_PMM + vx3_MPP) - (vx3_MPM + vx3_PMP))); - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - real kxyAverage = c0o1; - real kyzAverage = c0o1; - real kxzAverage = c0o1; - real kxxMyyAverage = c0o1; - real kxxMzzAverage = c0o1; - - //////////////////////////////////////////////////////////////////////////////// - //! - Set the relative position of the offset cell {-1, 0, 1} - //! - real xoff = neighborFineToCoarse.x[nodeIndex]; - real yoff = neighborFineToCoarse.y[nodeIndex]; - real zoff = neighborFineToCoarse.z[nodeIndex]; - - real xoff_sq = xoff * xoff; - real yoff_sq = yoff * yoff; - real zoff_sq = zoff * zoff; - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //!- Calculate coefficients for the polynomial interpolation of the pressure - //! - real LaplaceRho = - ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) - ? c0o1 : -c3o1 * (a_100 * a_100 + b_010 * b_010 + c_001 * c_001) - c6o1 * (b_100 * a_010 + c_100 * a_001 + c_010 * b_001); - d_000 = c1o8 * ((((drho_PPP + drho_MMM) + (drho_PPM + drho_MMP)) + ((drho_PMM + drho_MPP) + (drho_PMP + drho_MPM))) - c2o1 * LaplaceRho); - d_100 = c1o4 * (((drho_PPP - drho_MMM) + (drho_PPM - drho_MMP)) + ((drho_PMM - drho_MPP) + (drho_PMP - drho_MPM))); - d_010 = c1o4 * (((drho_PPP - drho_MMM) + (drho_PPM - drho_MMP)) + ((drho_MPP - drho_PMM) + (drho_MPM - drho_PMP))); - d_001 = c1o4 * (((drho_PPP - drho_MMM) + (drho_MMP - drho_PPM)) + ((drho_MPP - drho_PMM) + (drho_PMP - drho_MPM))); - d_110 = c1o2 * (((drho_PPP + drho_MMM) + (drho_PPM + drho_MMP)) - ((drho_PMM + drho_MPP) + (drho_PMP + drho_MPM))); - d_101 = c1o2 * (((drho_PPP + drho_MMM) - (drho_PPM + drho_MMP)) + ((drho_PMP + drho_MPM) - (drho_PMM + drho_MPP))); - d_011 = c1o2 * (((drho_PPP + drho_MMM) - (drho_PPM + drho_MMP)) + ((drho_PMM + drho_MPP) - (drho_PMP + drho_MPM))); - - - ////////////////////////////////////////////////////////////////////////// - //! - Extrapolation for refinement in to the wall (polynomial coefficients) - //! - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // x------x - // | | - // | ---+--->X - // | | \ - // x------x \ - // offset-vector - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - a_000 = a_000 + xoff * a_100 + yoff * a_010 + zoff * a_001 + xoff_sq * a_200 + yoff_sq * a_020 + zoff_sq * a_002 + - xoff * yoff * a_110 + xoff * zoff * a_101 + yoff * zoff * a_011; - a_100 = a_100 + c2o1 * xoff * a_200 + yoff * a_110 + zoff * a_101; - a_010 = a_010 + c2o1 * yoff * a_020 + xoff * a_110 + zoff * a_011; - a_001 = a_001 + c2o1 * zoff * a_002 + xoff * a_101 + yoff * a_011; - b_000 = b_000 + xoff * b_100 + yoff * b_010 + zoff * b_001 + xoff_sq * b_200 + yoff_sq * b_020 + zoff_sq * b_002 + - xoff * yoff * b_110 + xoff * zoff * b_101 + yoff * zoff * b_011; - b_100 = b_100 + c2o1 * xoff * b_200 + yoff * b_110 + zoff * b_101; - b_010 = b_010 + c2o1 * yoff * b_020 + xoff * b_110 + zoff * b_011; - b_001 = b_001 + c2o1 * zoff * b_002 + xoff * b_101 + yoff * b_011; - c_000 = c_000 + xoff * c_100 + yoff * c_010 + zoff * c_001 + xoff_sq * c_200 + yoff_sq * c_020 + zoff_sq * c_002 + - xoff * yoff * c_110 + xoff * zoff * c_101 + yoff * zoff * c_011; - c_100 = c_100 + c2o1 * xoff * c_200 + yoff * c_110 + zoff * c_101; - c_010 = c_010 + c2o1 * yoff * c_020 + xoff * c_110 + zoff * c_011; - c_001 = c_001 + c2o1 * zoff * c_002 + xoff * c_101 + yoff * c_011; - d_000 = d_000 + xoff * d_100 + yoff * d_010 + zoff * d_001 + - xoff * yoff * d_110 + xoff * zoff * d_101 + yoff * zoff * d_011; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Set all moments to zero - //! - real m_111 = c0o1; - real m_211 = c0o1; - real m_011 = c0o1; - real m_121 = c0o1; - real m_101 = c0o1; - real m_112 = c0o1; - real m_110 = c0o1; - real m_221 = c0o1; - real m_001 = c0o1; - real m_201 = c0o1; - real m_021 = c0o1; - real m_212 = c0o1; - real m_010 = c0o1; - real m_210 = c0o1; - real m_012 = c0o1; - real m_122 = c0o1; - real m_100 = c0o1; - real m_120 = c0o1; - real m_102 = c0o1; - real m_222 = c0o1; - real m_022 = c0o1; - real m_202 = c0o1; - real m_002 = c0o1; - real m_220 = c0o1; - real m_020 = c0o1; - real m_200 = c0o1; - real m_000 = c0o1; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Define aliases to use the same variable for the distributions (f's): - //! - real& f_000 = m_111; - real& f_P00 = m_211; - real& f_M00 = m_011; - real& f_0P0 = m_121; - real& f_0M0 = m_101; - real& f_00P = m_112; - real& f_00M = m_110; - real& f_PP0 = m_221; - real& f_MM0 = m_001; - real& f_PM0 = m_201; - real& f_MP0 = m_021; - real& f_P0P = m_212; - real& f_M0M = m_010; - real& f_P0M = m_210; - real& f_M0P = m_012; - real& f_0PP = m_122; - real& f_0MM = m_100; - real& f_0PM = m_120; - real& f_0MP = m_102; - real& f_PPP = m_222; - real& f_MPP = m_022; - real& f_PMP = m_202; - real& f_MMP = m_002; - real& f_PPM = m_220; - real& f_MPM = m_020; - real& f_PMM = m_200; - real& f_MMM = m_000; - - //////////////////////////////////////////////////////////////////////////////// - //! - Declare local variables for destination nodes - //! - real vvx, vvy, vvz, vx_sq, vy_sq, vz_sq; - real mxxPyyPzz, mxxMyy, mxxMzz, mxxyPyzz, mxxyMyzz, mxxzPyyz, mxxzMyyz, mxyyPxzz, mxyyMxzz; - real useNEQ = c1o1; // zero; //one; //.... one = on ..... zero = off - real press; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // - // Position Coarse 0., 0., 0. - // - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // x = 0.; - // y = 0.; - // z = 0.; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // index of the destination node and its neighbors - k_000 = indicesCoarse000[nodeIndex]; - k_M00 = neighborXcoarse [k_000]; - k_0M0 = neighborYcoarse [k_000]; - k_00M = neighborZcoarse [k_000]; - k_MM0 = neighborYcoarse [k_M00]; - k_M0M = neighborZcoarse [k_M00]; - k_0MM = neighborZcoarse [k_0M0]; - k_MMM = neighborZcoarse [k_MM0]; - //////////////////////////////////////////////////////////////////////////////////// - - if(hasTurbulentViscosity) omegaC = omegaCoarse / (c1o1 + c3o1*omegaCoarse*turbulentViscosityCoarse[k_000]); - - //////////////////////////////////////////////////////////////////////////////// - //! - Set macroscopic values on destination node (zeroth and first order moments) - //! - press = d_000; - vvx = a_000; - vvy = b_000; - vvz = c_000; - - m_000 = press; // m_000 is press, if drho is interpolated directly - - vx_sq = vvx * vvx; - vy_sq = vvy * vvy; - vz_sq = vvz * vvz; - - //////////////////////////////////////////////////////////////////////////////// - //! - Set moments (second to sixth order) on destination node - //! - // linear combinations for second order moments - mxxPyyPzz = m_000; - - mxxMyy = -c2o3 * ((a_100 - b_010) + kxxMyyAverage) * eps_new / omegaC * (c1o1 + press); - mxxMzz = -c2o3 * ((a_100 - c_001) + kxxMzzAverage) * eps_new / omegaC * (c1o1 + press); - - m_011 = -c1o3 * ((b_001 + c_010) + kyzAverage) * eps_new / omegaC * (c1o1 + press); - m_101 = -c1o3 * ((a_001 + c_100) + kxzAverage) * eps_new / omegaC * (c1o1 + press); - m_110 = -c1o3 * ((a_010 + b_100) + kxyAverage) * eps_new / omegaC * (c1o1 + press); - - m_200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; - m_020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; - m_002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; - - // linear combinations for third order moments - m_111 = c0o1; - - mxxyPyzz = c0o1; - mxxyMyzz = c0o1; - mxxzPyyz = c0o1; - mxxzMyyz = c0o1; - mxyyPxzz = c0o1; - mxyyMxzz = c0o1; - - m_210 = ( mxxyMyzz + mxxyPyzz) * c1o2; - m_012 = (-mxxyMyzz + mxxyPyzz) * c1o2; - m_201 = ( mxxzMyyz + mxxzPyyz) * c1o2; - m_021 = (-mxxzMyyz + mxxzPyyz) * c1o2; - m_120 = ( mxyyMxzz + mxyyPxzz) * c1o2; - m_102 = (-mxyyMxzz + mxyyPxzz) * c1o2; - - // fourth order moments - m_022 = m_000 * c1o9; - m_202 = m_022; - m_220 = m_022; - - // fifth order moments - - // sixth order moments - m_222 = m_000 * c1o27; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in - //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), - //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a - //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 - //! ]</b></a> - //! - //////////////////////////////////////////////////////////////////////////////////// - // X - Dir - backwardInverseChimeraWithK(m_000, m_100, m_200, vvx, vx_sq, c1o1, c1o1); - backwardChimera( m_010, m_110, m_210, vvx, vx_sq); - backwardInverseChimeraWithK(m_020, m_120, m_220, vvx, vx_sq, c3o1, c1o3); - backwardChimera( m_001, m_101, m_201, vvx, vx_sq); - backwardChimera( m_011, m_111, m_211, vvx, vx_sq); - backwardChimera( m_021, m_121, m_221, vvx, vx_sq); - backwardInverseChimeraWithK(m_002, m_102, m_202, vvx, vx_sq, c3o1, c1o3); - backwardChimera( m_012, m_112, m_212, vvx, vx_sq); - backwardInverseChimeraWithK(m_022, m_122, m_222, vvx, vx_sq, c9o1, c1o9); - - //////////////////////////////////////////////////////////////////////////////////// - // Y - Dir - backwardInverseChimeraWithK(m_000, m_010, m_020, vvy, vy_sq, c6o1, c1o6); - backwardChimera( m_001, m_011, m_021, vvy, vy_sq); - backwardInverseChimeraWithK(m_002, m_012, m_022, vvy, vy_sq, c18o1, c1o18); - backwardInverseChimeraWithK(m_100, m_110, m_120, vvy, vy_sq, c3o2, c2o3); - backwardChimera( m_101, m_111, m_121, vvy, vy_sq); - backwardInverseChimeraWithK(m_102, m_112, m_122, vvy, vy_sq, c9o2, c2o9); - backwardInverseChimeraWithK(m_200, m_210, m_220, vvy, vy_sq, c6o1, c1o6); - backwardChimera( m_201, m_211, m_221, vvy, vy_sq); - backwardInverseChimeraWithK(m_202, m_212, m_222, vvy, vy_sq, c18o1, c1o18); - - //////////////////////////////////////////////////////////////////////////////////// - // Z - Dir - backwardInverseChimeraWithK(m_000, m_001, m_002, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_010, m_011, m_012, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_020, m_021, m_022, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_100, m_101, m_102, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_110, m_111, m_112, vvz, vz_sq, c9o4, c4o9); - backwardInverseChimeraWithK(m_120, m_121, m_122, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_200, m_201, m_202, vvz, vz_sq, c36o1, c1o36); - backwardInverseChimeraWithK(m_210, m_211, m_212, vvz, vz_sq, c9o1, c1o9); - backwardInverseChimeraWithK(m_220, m_221, m_222, vvz, vz_sq, c36o1, c1o36); - - //////////////////////////////////////////////////////////////////////////////////// - //! - Write distributions: style of reading and writing the distributions from/to - //! stored arrays dependent on timestep is based on the esoteric twist algorithm - //! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), - //! DOI:10.3390/computation5020019 ]</b></a> - //! - (distCoarse.f[DIR_000])[k_000] = f_000; - (distCoarse.f[DIR_P00])[k_000] = f_P00; - (distCoarse.f[DIR_M00])[k_M00] = f_M00; - (distCoarse.f[DIR_0P0])[k_000] = f_0P0; - (distCoarse.f[DIR_0M0])[k_0M0] = f_0M0; - (distCoarse.f[DIR_00P])[k_000] = f_00P; - (distCoarse.f[DIR_00M])[k_00M] = f_00M; - (distCoarse.f[DIR_PP0])[k_000] = f_PP0; - (distCoarse.f[DIR_MM0])[k_MM0] = f_MM0; - (distCoarse.f[DIR_PM0])[k_0M0] = f_PM0; - (distCoarse.f[DIR_MP0])[k_M00] = f_MP0; - (distCoarse.f[DIR_P0P])[k_000] = f_P0P; - (distCoarse.f[DIR_M0M])[k_M0M] = f_M0M; - (distCoarse.f[DIR_P0M])[k_00M] = f_P0M; - (distCoarse.f[DIR_M0P])[k_M00] = f_M0P; - (distCoarse.f[DIR_0PP])[k_000] = f_0PP; - (distCoarse.f[DIR_0MM])[k_0MM] = f_0MM; - (distCoarse.f[DIR_0PM])[k_00M] = f_0PM; - (distCoarse.f[DIR_0MP])[k_0M0] = f_0MP; - (distCoarse.f[DIR_PPP])[k_000] = f_PPP; - (distCoarse.f[DIR_MPP])[k_M00] = f_MPP; - (distCoarse.f[DIR_PMP])[k_0M0] = f_PMP; - (distCoarse.f[DIR_MMP])[k_MM0] = f_MMP; - (distCoarse.f[DIR_PPM])[k_00M] = f_PPM; - (distCoarse.f[DIR_MPM])[k_M0M] = f_MPM; - (distCoarse.f[DIR_PMM])[k_0MM] = f_PMM; - (distCoarse.f[DIR_MMM])[k_MMM] = f_MMM; - //////////////////////////////////////////////////////////////////////////////////// + // 1.calculate moments + vf::lbm::MomentsOnSourceNodeSet momentsSet; + vf::gpu::calculateMomentSet<hasTurbulentViscosity>( + momentsSet, nodeIndex, distributionsFine, neighborXfine, neighborYfine, neighborZfine, indicesFineMMM, turbulentViscosityFine, numberOfLBnodesFine, omegaFine, true); + + // 2.calculate coefficients + vf::lbm::Coefficients coefficients; + momentsSet.calculateCoefficients(coefficients, neighborFineToCoarse.x[nodeIndex], neighborFineToCoarse.y[nodeIndex], neighborFineToCoarse.z[nodeIndex]); + + // 3. interpolate fine to coarse + interpolate<hasTurbulentViscosity>( + coefficients, + nodeIndex, + distributionsCoarse, + neighborXcoarse, + neighborYcoarse, + neighborZcoarse, + numberOfLBnodesCoarse, + indicesCoarse000, + omega_coarse, + turbulentViscosityCoarse, + isEvenTimestep); } -template __global__ void scaleFC_compressible<true>( real *distributionsCoarse, real *distributionsFine, unsigned int *neighborXcoarse, unsigned int *neighborYcoarse, unsigned int *neighborZcoarse, unsigned int *neighborXfine, unsigned int *neighborYfine, unsigned int *neighborZfine, unsigned long long numberOfLBnodesCoarse, unsigned long long numberOfLBnodesFine, bool isEvenTimestep, unsigned int *indicesCoarse000, unsigned int *indicesFineMMM, unsigned int numberOfInterfaceNodes, real omegaCoarse, real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh neighborFineToCoarse); +template __global__ void scaleFC_compressible<true>(real *distributionsCoarse, real *distributionsFine, unsigned int *neighborXcoarse, unsigned int *neighborYcoarse, unsigned int *neighborZcoarse, unsigned int *neighborXfine, unsigned int *neighborYfine, unsigned int *neighborZfine, unsigned long long numberOfLBnodesCoarse, unsigned long long numberOfLBnodesFine, bool isEvenTimestep, unsigned int *indicesCoarse000, unsigned int *indicesFineMMM, unsigned int numberOfInterfaceNodes, real omegaCoarse, real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh neighborFineToCoarse); -template __global__ void scaleFC_compressible<false>( real *distributionsCoarse, real *distributionsFine, unsigned int *neighborXcoarse, unsigned int *neighborYcoarse, unsigned int *neighborZcoarse, unsigned int *neighborXfine, unsigned int *neighborYfine, unsigned int *neighborZfine, unsigned long long numberOfLBnodesCoarse, unsigned long long numberOfLBnodesFine, bool isEvenTimestep, unsigned int *indicesCoarse000, unsigned int *indicesFineMMM, unsigned int numberOfInterfaceNodes, real omegaCoarse, real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh neighborFineToCoarse); \ No newline at end of file +template __global__ void scaleFC_compressible<false>(real *distributionsCoarse, real *distributionsFine, unsigned int *neighborXcoarse, unsigned int *neighborYcoarse, unsigned int *neighborZcoarse, unsigned int *neighborXfine, unsigned int *neighborYfine, unsigned int *neighborZfine, unsigned long long numberOfLBnodesCoarse, unsigned long long numberOfLBnodesFine, bool isEvenTimestep, unsigned int *indicesCoarse000, unsigned int *indicesFineMMM, unsigned int numberOfInterfaceNodes, real omegaCoarse, real omegaFine, real* turbulentViscosityCoarse, real* turbulentViscosityFine, ICellNeigh neighborFineToCoarse); \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu index df88632f8fd48b3ae8d50b444a65076ab0a0c12f..59b1b6494479e256e910d750e239d707573e2f71 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu @@ -14,7 +14,7 @@ #include <iomanip> -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> #include "Parameter/Parameter.h" // includes, kernels diff --git a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu index 0a54db35bc4598702f3c3a3b194eb054a9ca478a..e9bd3ea551e93cb82baa85bf759d93b7a7d4dde0 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/LBMKernel.cu @@ -11,7 +11,7 @@ #include <helper_cuda.h> #include "LBM/LB.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> // includes, kernels #include "GPU/GPU_Kernels.cuh" diff --git a/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu index d00941aba35d2885e893eea1ffe23c89002046c4..be1159d15440c63187a8e29e7db89343ca785be4 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/TurbulentViscosityKernels.cu @@ -34,7 +34,7 @@ #include "TurbulentViscosityKernels.h" #include "basics/constants/NumericConstants.h" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> #include <cuda_runtime.h> #include <helper_cuda.h> #include "LBM/LB.h" diff --git a/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp b/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp index 46f6254f7cf2e8ce53ee6f47d69db76405b52dd6..1406abff0ed77399333fda33353f9f231953d3df 100644 --- a/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/VfReader.cpp @@ -1,7 +1,6 @@ #include "Init/VfReader.h" #include "Parameter/Parameter.h" -#include "Communication/Communicator.h" #include "Init/PositionReader.h" #include "GPU/CudaMemoryManager.h" diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.cu new file mode 100644 index 0000000000000000000000000000000000000000..955dc0736de37ed3ad680a99ced5bb0e55d77b11 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.cu @@ -0,0 +1,40 @@ +#include "B15CompressibleNavierStokesBGKplus.h" + +#include "B15CompressibleNavierStokesBGKplus_Device.cuh" +#include "Parameter/Parameter.h" +#include "cuda_helper/CudaGrid.h" + +std::shared_ptr<B15CompressibleNavierStokesBGKplus> B15CompressibleNavierStokesBGKplus::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<B15CompressibleNavierStokesBGKplus>(new B15CompressibleNavierStokesBGKplus(para, level)); +} + +void B15CompressibleNavierStokesBGKplus::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + + B15CompressibleNavierStokesBGKplus_Device<<<grid.grid, grid.threads>>>( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("B15CompressibleNavierStokesBGKplus_Device execution failed"); +} + +B15CompressibleNavierStokesBGKplus::B15CompressibleNavierStokesBGKplus(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitCompSP27); + + +} + +B15CompressibleNavierStokesBGKplus::B15CompressibleNavierStokesBGKplus() +{ +} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.h new file mode 100644 index 0000000000000000000000000000000000000000..0347e30dc1aec97bcdd6e21eb58cf929084987cc --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.h @@ -0,0 +1,17 @@ +#ifndef B15CompressibleNavierStokesBGKplus_H +#define B15CompressibleNavierStokesBGKplus_H + +#include "Kernel/KernelImp.h" + +class B15CompressibleNavierStokesBGKplus : public KernelImp +{ +public: + static std::shared_ptr<B15CompressibleNavierStokesBGKplus> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + B15CompressibleNavierStokesBGKplus(); + B15CompressibleNavierStokesBGKplus(std::shared_ptr< Parameter> para, int level); +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.cu similarity index 83% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.cu index 0a5ac6cf7a1b6564a61d0150b187b10b584222b8..bafd4477dc611b77f17c896dc85832b71acdccc0 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.cu @@ -1,4 +1,4 @@ -#include "BGKUnified.h" +#include "B15CompressibleNavierStokesBGKplusUnified.h" #include <stdexcept> @@ -15,7 +15,7 @@ namespace gpu { -BGKUnified::BGKUnified(std::shared_ptr<Parameter> para, int level) +B15CompressibleNavierStokesBGKplusUnified::B15CompressibleNavierStokesBGKplusUnified(std::shared_ptr<Parameter> para, int level) : KernelImp(para, level) { #ifndef BUILD_CUDA_LTO @@ -30,7 +30,7 @@ BGKUnified::BGKUnified(std::shared_ptr<Parameter> para, int level) } -void BGKUnified::run() +void B15CompressibleNavierStokesBGKplusUnified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.h new file mode 100644 index 0000000000000000000000000000000000000000..ffc8ce41d13369b78d19ff0d55bab988696cdb5d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.h @@ -0,0 +1,22 @@ +#ifndef B15CompressibleNavierStokesBGKplusUnified_H +#define B15CompressibleNavierStokesBGKplusUnified_H + +#include "Kernel/KernelImp.h" + +namespace vf +{ +namespace gpu +{ + +class B15CompressibleNavierStokesBGKplusUnified : public KernelImp +{ +public: + B15CompressibleNavierStokesBGKplusUnified(std::shared_ptr<Parameter> para, int level); + + void run(); +}; + +} +} + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cu index 638210bd2da8ebf30bda603a3f6d70c19468193e..b21213bf58fd786a4006faf485f18e5c18694e2e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_BGK_Plus_Comp_SP_27( +__global__ void B15CompressibleNavierStokesBGKplus_Device( real omega, unsigned int* bcMatD, unsigned int* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..2a4775b95d0b4d371fadb332a08868fda0fafd37 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus_Device.cuh @@ -0,0 +1,16 @@ +#ifndef B15CompressibleNavierStokesBGKplus_Device_H +#define B15CompressibleNavierStokesBGKplus_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void B15CompressibleNavierStokesBGKplus_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + bool EvenOrOdd); +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.cu similarity index 55% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.cu index 4aef26b7dd31435b2dadceb78ac1e0b7ebedf029..cf5971023e5f1110dd8bfb11bff38626ecc5dc7a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "BGKCompSP27.h" +#include "B92CompressibleNavierStokes.h" -#include "BGKCompSP27_Device.cuh" +#include "B92CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<BGKCompSP27> BGKCompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<B92CompressibleNavierStokes> B92CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<BGKCompSP27>(new BGKCompSP27(para, level)); + return std::shared_ptr<B92CompressibleNavierStokes>(new B92CompressibleNavierStokes(para, level)); } -void BGKCompSP27::run() +void B92CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_BGK_Comp_SP_27<<< grid.grid, grid.threads >>>( + B92CompressibleNavierStokes_Device<<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void BGKCompSP27::run() getLastCudaError("LB_Kernel_BGK_Comp_SP_27 execution failed"); } -BGKCompSP27::BGKCompSP27(std::shared_ptr<Parameter> para, int level) +B92CompressibleNavierStokes::B92CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -34,6 +34,6 @@ BGKCompSP27::BGKCompSP27(std::shared_ptr<Parameter> para, int level) } -BGKCompSP27::BGKCompSP27() +B92CompressibleNavierStokes::B92CompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..8b7ba23b33c6c78c1a87113a4e61748da42d400d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef B92CompressibleNavierStokes_H +#define B92CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class B92CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<B92CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + B92CompressibleNavierStokes(); + B92CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cu index 44add98d9607642531a6068021d0a4e831cb3d4e..d032936a96f77304071d014590e35512c1ca7771 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cu @@ -7,7 +7,7 @@ using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_BGK_Comp_SP_27( real omega, +__global__ void B92CompressibleNavierStokes_Device( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..4e0450452ddeca71cfd7c76074988159e51fa78d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes_Device.cuh @@ -0,0 +1,17 @@ +#ifndef B92CompressibleNavierStokes_Device_H +#define B92CompressibleNavierStokes_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void B92CompressibleNavierStokes_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + bool EvenOrOdd); + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.cu similarity index 52% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.cu index 664b46fcebd277b0c93300d86b2171edf4f91b2a..2f906587857bfa6cf90d0441a5488efefc140f3d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CascadeCompSP27.h" +#include "C06CompressibleNavierStokes.h" -#include "CascadeCompSP27_Device.cuh" +#include "C06CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CascadeCompSP27> CascadeCompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<C06CompressibleNavierStokes> C06CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CascadeCompSP27>(new CascadeCompSP27(para, level)); + return std::shared_ptr<C06CompressibleNavierStokes>(new C06CompressibleNavierStokes(para, level)); } -void CascadeCompSP27::run() +void C06CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_Cascade_Comp_SP_27 <<< grid.grid, grid.threads >>>( + C06CompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void CascadeCompSP27::run() getLastCudaError("LB_Kernel_Cascade_Comp_SP_27 execution failed"); } -CascadeCompSP27::CascadeCompSP27(std::shared_ptr<Parameter> para, int level) +C06CompressibleNavierStokes::C06CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -35,6 +35,6 @@ CascadeCompSP27::CascadeCompSP27(std::shared_ptr<Parameter> para, int level) } -CascadeCompSP27::CascadeCompSP27() +C06CompressibleNavierStokes::C06CompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..8004ad52ea2471ed6319fc373175e509dedef5ff --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef C06CompressibleNavierStokes_H +#define C06CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class C06CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<C06CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + C06CompressibleNavierStokes(); + C06CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cu index 6bd4415c7edcb5c9954874c074801b865cce3efe..6cf0fd639523d4cef8290f860f03b4bc75e3252c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cascade_Comp_SP_27(real omega, +__global__ void C06CompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cuh similarity index 57% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cuh index 947ce68259432efe87af84fd9986916e62521397..fb8fc657a03c89efbad879ca1c9b4e493acabd86 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes_Device.cuh @@ -1,10 +1,11 @@ -#ifndef LB_KERNEL_MRT_COMP_SP_27_H -#define LB_KERNEL_MRT_COMP_SP_27_H +#ifndef C06CompressibleNavierStokes_Device_H +#define C06CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_MRT_Comp_SP_27(real omega, +__global__ void C06CompressibleNavierStokes_Device( + real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/FluidFlowCompStrategy.cpp similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.cpp rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/FluidFlowCompStrategy.cpp diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/FluidFlowCompStrategy.h similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.h rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/FluidFlowCompStrategy.h diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.cu similarity index 52% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.cu index 218623b7c51099717f6aaa6f375a82516e0c0dae..7e8a0f5af702da465116320c0a02638b4a5274f9 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CumulantCompSP27.h" +#include "K08CompressibleNavierStokes.h" -#include "CumulantCompSP27_Device.cuh" +#include "K08CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantCompSP27> CumulantCompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K08CompressibleNavierStokes> K08CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantCompSP27>(new CumulantCompSP27(para, level)); + return std::shared_ptr<K08CompressibleNavierStokes>(new K08CompressibleNavierStokes(para, level)); } -void CumulantCompSP27::run() +void K08CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_Cum_Comp_SP_27 <<< grid.grid, grid.threads >>>( + K08CompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -26,7 +26,7 @@ void CumulantCompSP27::run() } -CumulantCompSP27::CumulantCompSP27(std::shared_ptr<Parameter> para, int level) +K08CompressibleNavierStokes::K08CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -36,6 +36,6 @@ CumulantCompSP27::CumulantCompSP27(std::shared_ptr<Parameter> para, int level) } -CumulantCompSP27::CumulantCompSP27() +K08CompressibleNavierStokes::K08CompressibleNavierStokes() { } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..2f91a459818173775aeb0b966ec6677fe7803b48 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.h @@ -0,0 +1,17 @@ +#ifndef K08CompressibleNavierStokes_H +#define K08CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class K08CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<K08CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K08CompressibleNavierStokes(); + K08CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cu index 6ab3385b86611614eceeb0018f6beef73031711c..021ec25f3d70802402bb2d96ca6a462e60774982 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cum_Comp_SP_27(real omega, +__global__ void K08CompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cuh similarity index 57% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cuh index 8a49bd02af3ab420b42bc257e8668dd3ff9eca2c..b2a6d02b6ab40e8dc89238b207c7f274ab7fe828 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes_Device.cuh @@ -1,10 +1,11 @@ -#ifndef LB_KERNEL_CASCADE_COMP_SP_27_H -#define LB_KERNEL_CASCADE_COMP_SP_27_H +#ifndef K08CompressibleNavierStokes_Device_H +#define K08CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_Cascade_Comp_SP_27(real s9, +__global__ void K08CompressibleNavierStokes_Device( + real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.cu similarity index 63% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.cu index 09a3aa1cdb1a3cf9c01002a9d335c5a907f94917..086914172185a45a7a84873ded4726ea77bc0985 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.cu @@ -1,15 +1,15 @@ -#include "CumulantK15Comp.h" +#include "K15CompressibleNavierStokes.h" -#include "CumulantK15Comp_Device.cuh" +#include "K15CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -std::shared_ptr<CumulantK15Comp> CumulantK15Comp::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K15CompressibleNavierStokes> K15CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK15Comp>(new CumulantK15Comp(para, level)); + return std::shared_ptr<K15CompressibleNavierStokes>(new K15CompressibleNavierStokes(para, level)); } -void CumulantK15Comp::run() +void K15CompressibleNavierStokes::run() { int numberOfThreads = para->getParD(level)->numberofthreads; int size_Mat = (int)para->getParD(level)->numberOfNodes; @@ -29,7 +29,7 @@ void CumulantK15Comp::run() dim3 grid(Grid1, Grid2, 1); dim3 threads(numberOfThreads, 1, 1); - LB_Kernel_CumulantK15Comp <<< grid, threads >>>( + K15CompressibleNavierStokes_Device <<< grid, threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -43,7 +43,7 @@ void CumulantK15Comp::run() getLastCudaError("LB_Kernel_CumulantK15Comp execution failed"); } -CumulantK15Comp::CumulantK15Comp(std::shared_ptr<Parameter> para, int level) +K15CompressibleNavierStokes::K15CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..2410a8eb2d744bba87f5642218f22c9d9ab39fd1 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef K15CompressibleNavierStokes_H +#define K15CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class K15CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr< K15CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15CompressibleNavierStokes(); + K15CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.cu new file mode 100644 index 0000000000000000000000000000000000000000..b52f6cc855a5d4dba45b3106841e7951a1d7f3b3 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.cu @@ -0,0 +1,42 @@ +#include "K15CompressibleNavierStokesBulkViscosity.h" + +#include "K15CompressibleNavierStokesBulkViscosity_Device.cuh" +#include "Parameter/Parameter.h" +#include <cuda_helper/CudaGrid.h> + +std::shared_ptr<K15CompressibleNavierStokesBulkViscosity> K15CompressibleNavierStokesBulkViscosity::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<K15CompressibleNavierStokesBulkViscosity>(new K15CompressibleNavierStokesBulkViscosity(para, level)); +} + +void K15CompressibleNavierStokesBulkViscosity::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + + K15CompressibleNavierStokesBulkViscosity_Device <<<grid.grid, grid.threads>>>( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getParD(level)->isEvenTimestep); + getLastCudaError("LB_Kernel_CumulantK15BulkComp execution failed"); +} + +K15CompressibleNavierStokesBulkViscosity::K15CompressibleNavierStokesBulkViscosity(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitCompSP27); + + +} + +K15CompressibleNavierStokesBulkViscosity::K15CompressibleNavierStokesBulkViscosity() +{ +} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.h new file mode 100644 index 0000000000000000000000000000000000000000..a29eb1b4e8712eb0ad0a1d1519840597620d91c6 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.h @@ -0,0 +1,17 @@ +#ifndef K15CompressibleNavierStokesBulkViscosity_H +#define K15CompressibleNavierStokesBulkViscosity_H + +#include "Kernel/KernelImp.h" + +class K15CompressibleNavierStokesBulkViscosity : public KernelImp +{ +public: + static std::shared_ptr<K15CompressibleNavierStokesBulkViscosity> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15CompressibleNavierStokesBulkViscosity(); + K15CompressibleNavierStokesBulkViscosity(std::shared_ptr< Parameter> para, int level); +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cu index c0e48a9d5754f79d62b11129cef754adf91dbe03..91716f420dbff6aeb6d6505e1ff6fbc76dfbf92c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK15BulkComp(real omega, +__global__ void K15CompressibleNavierStokesBulkViscosity_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..18c2a7a3400ce2511a17b589ca25236876af84d8 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity_Device.cuh @@ -0,0 +1,19 @@ +#ifndef K15CompressibleNavierStokesBulkViscosity_Device_H +#define K15CompressibleNavierStokesBulkViscosity_Device_H + +#include <DataTypes.h> +#include <curand.h> + + +__global__ void K15CompressibleNavierStokesBulkViscosity_Device(real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + int level, + real* forces, + bool EvenOrOdd); + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.cu similarity index 53% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.cu index 69f84b0671c11fad8ae15676230c491ee815153d..eadf2a147ed526943d1ada85474dfd0ba522cd38 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.cu @@ -1,19 +1,19 @@ -#include "CumulantK15SpongeComp.h" +#include "K15CompressibleNavierStokesSponge.h" -#include "CumulantK15SpongeComp_Device.cuh" +#include "K15CompressibleNavierStokesSponge_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantK15SpongeComp> CumulantK15SpongeComp::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K15CompressibleNavierStokesSponge> K15CompressibleNavierStokesSponge::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK15SpongeComp>(new CumulantK15SpongeComp(para, level)); + return std::shared_ptr<K15CompressibleNavierStokesSponge>(new K15CompressibleNavierStokesSponge(para, level)); } -void CumulantK15SpongeComp::run() +void K15CompressibleNavierStokesSponge::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_CumulantK15SpongeComp <<< grid.grid, grid.threads >>>( + K15CompressibleNavierStokesSponge_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -28,7 +28,7 @@ void CumulantK15SpongeComp::run() getLastCudaError("LB_Kernel_CumulantK15SpongeComp execution failed"); } -CumulantK15SpongeComp::CumulantK15SpongeComp(std::shared_ptr<Parameter> para, int level) +K15CompressibleNavierStokesSponge::K15CompressibleNavierStokesSponge(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -38,6 +38,6 @@ CumulantK15SpongeComp::CumulantK15SpongeComp(std::shared_ptr<Parameter> para, in } -CumulantK15SpongeComp::CumulantK15SpongeComp() +K15CompressibleNavierStokesSponge::K15CompressibleNavierStokesSponge() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.h new file mode 100644 index 0000000000000000000000000000000000000000..cff5a369bc68d868a041f436b2dd3975b66775ed --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.h @@ -0,0 +1,17 @@ +#ifndef K15CompressibleNavierStokesSponge_H +#define K15CompressibleNavierStokesSponge_H + +#include "Kernel/KernelImp.h" + +class K15CompressibleNavierStokesSponge : public KernelImp +{ +public: + static std::shared_ptr<K15CompressibleNavierStokesSponge> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15CompressibleNavierStokesSponge(); + K15CompressibleNavierStokesSponge(std::shared_ptr< Parameter> para, int level); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cu index 20f3f913589f26978dcf713cd0175fc2ad425545..6b3a06614a1bec560e8d361c3610f9a00a0cdaf3 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK15SpongeComp(real omegaIn, +__global__ void K15CompressibleNavierStokesSponge_Device(real omegaIn, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cuh similarity index 59% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cuh index 3a526112e56947a77d5ac337052d62e95dd4e578..b79c2a9941c44c12f1e5eadf0b66a1402f394856 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge_Device.cuh @@ -1,10 +1,10 @@ -#ifndef LB_KERNEL_CUMULANT_K15_SPONGE_COMP_H -#define LB_KERNEL_CUMULANT_K15_SPONGE_COMP_H +#ifndef K15CompressibleNavierStokesSponge_Device_H +#define K15CompressibleNavierStokesSponge_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_CumulantK15SpongeComp(real omega, +__global__ void K15CompressibleNavierStokesSponge_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.cu similarity index 85% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.cu index c95289f15fe13decbbe173e17f5d4255b8ef80b5..6e1fbfbe60808fda3980fff462f237096b6a4568 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.cu @@ -1,4 +1,4 @@ -#include "CumulantK15Unified.h" +#include "K15CompressibleNavierStokesUnified.h" #include <stdexcept> @@ -13,7 +13,7 @@ namespace vf namespace gpu { -CumulantK15Unified::CumulantK15Unified(std::shared_ptr<Parameter> para, int level) +K15CompressibleNavierStokesUnified::K15CompressibleNavierStokesUnified(std::shared_ptr<Parameter> para, int level) : KernelImp(para, level) { #ifndef BUILD_CUDA_LTO @@ -28,7 +28,7 @@ CumulantK15Unified::CumulantK15Unified(std::shared_ptr<Parameter> para, int leve this->cudaGrid = cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); } -void CumulantK15Unified::run() +void K15CompressibleNavierStokesUnified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.h new file mode 100644 index 0000000000000000000000000000000000000000..e16211520a4e310d4ee1a73c00437a4d18441354 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.h @@ -0,0 +1,21 @@ +#ifndef K15CompressibleNavierStokesUnified_H +#define K15CompressibleNavierStokesUnified_H + +#include "Kernel/KernelImp.h" + +namespace vf +{ +namespace gpu +{ +class K15CompressibleNavierStokesUnified : public KernelImp +{ +public: + K15CompressibleNavierStokesUnified(std::shared_ptr<Parameter> para, int level); + + void run(); +}; + +} +} + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cu index 9c5d484ee00c1dfab92e1d5eaf0cdffb61fd122b..e38c24d6557c0abc64681a71fc63c51b866fb25a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK15Comp(real omega, +__global__ void K15CompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cuh similarity index 59% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cuh index e1d60ab0a181b88fba81bdb5ff649d7971c235a7..0dfdb3488136575921eb169cde4364d9de1507f5 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes_Device.cuh @@ -1,11 +1,11 @@ -#ifndef LB_KERNEL_CUMULANT_K15_BULK_COMP_H -#define LB_KERNEL_CUMULANT_K15_BULK_COMP_H +#ifndef K15CompressibleNavierStokes_Device_H +#define K15CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> - -__global__ void LB_Kernel_CumulantK15BulkComp(real omega, +__global__ void K15CompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, @@ -15,5 +15,4 @@ __global__ void LB_Kernel_CumulantK15BulkComp(real omega, int level, real* forces, bool EvenOrOdd); - #endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.cu similarity index 86% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.cu index b31e4964b609bcee1c3015dcf950b540977f8333..fccd9bfd246c9bd927bd9dcce6da8993e3d57374 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.cu @@ -1,21 +1,21 @@ -#include "CumulantK17.h" +#include "K17CompressibleNavierStokes.h" #include <logger/Logger.h> #include "Parameter/Parameter.h" #include "Parameter/CudaStreamManager.h" -#include "CumulantK17_Device.cuh" +#include "K17CompressibleNavierStokes_Device.cuh" #include <cuda.h> template<TurbulenceModel turbulenceModel> -std::shared_ptr< CumulantK17<turbulenceModel> > CumulantK17<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr< K17CompressibleNavierStokes<turbulenceModel> > K17CompressibleNavierStokes<turbulenceModel>::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK17<turbulenceModel> >(new CumulantK17<turbulenceModel>(para,level)); + return std::shared_ptr<K17CompressibleNavierStokes<turbulenceModel> >(new K17CompressibleNavierStokes<turbulenceModel>(para,level)); } template<TurbulenceModel turbulenceModel> -void CumulantK17<turbulenceModel>::run() +void K17CompressibleNavierStokes<turbulenceModel>::run() { - LB_Kernel_CumulantK17 < turbulenceModel, false, false > <<< cudaGrid.grid, cudaGrid.threads >>>( para->getParD(level)->omega, + K17CompressibleNavierStokes_Device < turbulenceModel, false, false > <<< cudaGrid.grid, cudaGrid.threads >>>( para->getParD(level)->omega, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, para->getParD(level)->distributions.f[0], para->getParD(level)->rho, @@ -31,18 +31,18 @@ void CumulantK17<turbulenceModel>::run() para->getParD(level)->taggedFluidNodeIndices[CollisionTemplate::Default], para->getParD(level)->numberOfTaggedFluidNodes[CollisionTemplate::Default]); - getLastCudaError("LB_Kernel_CumulantK17 execution failed"); + getLastCudaError("K17CompressibleNavierStokes_Device execution failed"); } template<TurbulenceModel turbulenceModel> -void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex ) +void K17CompressibleNavierStokes<turbulenceModel>::runOnIndices( const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex ) { cudaStream_t stream = para->getStreamManager()->getStream(streamIndex); switch (collisionTemplate) { case CollisionTemplate::Default: - LB_Kernel_CumulantK17 < turbulenceModel, false, false > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(para->getParD(level)->omega, + K17CompressibleNavierStokes_Device < turbulenceModel, false, false > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>(para->getParD(level)->omega, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, para->getParD(level)->distributions.f[0], para->getParD(level)->rho, @@ -60,7 +60,7 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un break; case CollisionTemplate::WriteMacroVars: - LB_Kernel_CumulantK17 < turbulenceModel, true, false > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, + K17CompressibleNavierStokes_Device < turbulenceModel, true, false > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, para->getParD(level)->distributions.f[0], para->getParD(level)->rho, @@ -79,7 +79,7 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un case CollisionTemplate::SubDomainBorder: case CollisionTemplate::AllFeatures: - LB_Kernel_CumulantK17 < turbulenceModel, true, true > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, + K17CompressibleNavierStokes_Device < turbulenceModel, true, true > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, para->getParD(level)->distributions.f[0], para->getParD(level)->rho, @@ -97,7 +97,7 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un break; case CollisionTemplate::ApplyBodyForce: - LB_Kernel_CumulantK17 < turbulenceModel, false, true > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, + K17CompressibleNavierStokes_Device < turbulenceModel, false, true > <<< cudaGrid.grid, cudaGrid.threads, 0, stream >>>( para->getParD(level)->omega, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, para->getParD(level)->distributions.f[0], para->getParD(level)->rho, @@ -118,11 +118,11 @@ void CumulantK17<turbulenceModel>::runOnIndices( const unsigned int *indices, un break; } - getLastCudaError("LB_Kernel_CumulantK17 execution failed"); + getLastCudaError("K17CompressibleNavierStokes_Device execution failed"); } template<TurbulenceModel turbulenceModel> -CumulantK17<turbulenceModel>::CumulantK17(std::shared_ptr<Parameter> para, int level) +K17CompressibleNavierStokes<turbulenceModel>::K17CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -137,7 +137,7 @@ CumulantK17<turbulenceModel>::CumulantK17(std::shared_ptr<Parameter> para, int l VF_LOG_INFO("Using turbulence model: {}", turbulenceModel); } -template class CumulantK17<TurbulenceModel::AMD>; -template class CumulantK17<TurbulenceModel::Smagorinsky>; -template class CumulantK17<TurbulenceModel::QR>; -template class CumulantK17<TurbulenceModel::None>; +template class K17CompressibleNavierStokes<TurbulenceModel::AMD>; +template class K17CompressibleNavierStokes<TurbulenceModel::Smagorinsky>; +template class K17CompressibleNavierStokes<TurbulenceModel::QR>; +template class K17CompressibleNavierStokes<TurbulenceModel::None>; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..543b2de3e2ef9ad7c4bf4881aae2afb6110ec552 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.h @@ -0,0 +1,20 @@ +#ifndef K17CompressibleNavierStokes_H +#define K17CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" +#include "Parameter/Parameter.h" + +template<TurbulenceModel turbulenceModel> +class K17CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr< K17CompressibleNavierStokes<turbulenceModel> > getNewInstance(std::shared_ptr< Parameter> para, int level); + void run() override; + void runOnIndices(const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex) override; + +private: + K17CompressibleNavierStokes(); + K17CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.cu new file mode 100644 index 0000000000000000000000000000000000000000..bf6e7801cfc5c6c431f10f12d41521842955d7b4 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.cu @@ -0,0 +1,47 @@ +#include "K17CompressibleNavierStokesBulkViscosity.h" + +#include "K17CompressibleNavierStokesBulkViscosity_Device.cuh" +#include "Parameter/Parameter.h" + +std::shared_ptr<K17CompressibleNavierStokesBulkViscosity> K17CompressibleNavierStokesBulkViscosity::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<K17CompressibleNavierStokesBulkViscosity>(new K17CompressibleNavierStokesBulkViscosity(para, level)); +} + +void K17CompressibleNavierStokesBulkViscosity::run() +{ + int size_Array = para->getParD(level)->size_Array_SP; + int numberOfThreads = para->getParD(level)->numberofthreads; + + int Grid = size_Array / numberOfThreads; + dim3 grid(Grid, 1, 1); + dim3 threads(numberOfThreads, 1, 1); + + K17CompressibleNavierStokesBulkViscosity_Device << < grid, threads >> >( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep); + getLastCudaError("K17CompressibleNavierStokesBulkViscosity_Device execution failed"); +} + +K17CompressibleNavierStokesBulkViscosity::K17CompressibleNavierStokesBulkViscosity(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitCompSP27); + + +} + +K17CompressibleNavierStokesBulkViscosity::K17CompressibleNavierStokesBulkViscosity() +{ +} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.h new file mode 100644 index 0000000000000000000000000000000000000000..9411cc4969af4fcd13f1a853710510a40fdf5069 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.h @@ -0,0 +1,17 @@ +#ifndef K17CompressibleNavierStokesBulkViscosity_H +#define K17CompressibleNavierStokesBulkViscosity_H + +#include "Kernel/KernelImp.h" + +class K17CompressibleNavierStokesBulkViscosity : public KernelImp +{ +public: + static std::shared_ptr<K17CompressibleNavierStokesBulkViscosity> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K17CompressibleNavierStokesBulkViscosity(); + K17CompressibleNavierStokesBulkViscosity(std::shared_ptr< Parameter> para, int level); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cu index 5e98ebe6db990f5d16fd9d7a839c0e5f0927ba87..1803c083f8f04182cbe1556c33936fc052499596 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK17BulkComp(real omega, +__global__ void K17CompressibleNavierStokesBulkViscosity_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..62b349df5750bd5baf743feb52e14146aeddea2b --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity_Device.cuh @@ -0,0 +1,18 @@ +#ifndef K17CompressibleNavierStokesBulkViscosity_Device_H +#define K17CompressibleNavierStokesBulkViscosity_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void K17CompressibleNavierStokesBulkViscosity_Device(real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + int level, + real* forces, + real* quadricLimiters, + bool EvenOrOdd); +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.cu new file mode 100644 index 0000000000000000000000000000000000000000..0f637558ba9ed16afb0311ab4eefba5d7b4d1208 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.cu @@ -0,0 +1,38 @@ +#include "K17CompressibleNavierStokesChimeraLegacy.h" + +#include "Parameter/Parameter.h" +#include "K17CompressibleNavierStokesChimeraLegacy_Device.cuh" +#include "cuda_helper/CudaGrid.h" + +std::shared_ptr<K17CompressibleNavierStokesChimeraLegacy> K17CompressibleNavierStokesChimeraLegacy::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<K17CompressibleNavierStokesChimeraLegacy>(new K17CompressibleNavierStokesChimeraLegacy(para,level)); +} + +void K17CompressibleNavierStokesChimeraLegacy::run() +{ + K17CompressibleNavierStokesChimeraLegacy_Device <<< cudaGrid.grid, cudaGrid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getIsBodyForce(), + para->getForcesDev(), + para->getParD(level)->forceX_SP, + para->getParD(level)->forceY_SP, + para->getParD(level)->forceZ_SP, + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep); + getLastCudaError("K17CompressibleNavierStokesChimeraLegacy_Device execution failed"); +} + +K17CompressibleNavierStokesChimeraLegacy::K17CompressibleNavierStokesChimeraLegacy(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) +{ + myPreProcessorTypes.push_back(InitCompSP27); + + this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.h new file mode 100644 index 0000000000000000000000000000000000000000..b611526ce8f53ec0ed8215e3378764cf9858d19b --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.h @@ -0,0 +1,17 @@ +#ifndef K17CompressibleNavierStokesChimeraLegacy_H +#define K17CompressibleNavierStokesChimeraLegacy_H + +#include "Kernel/KernelImp.h" + +class K17CompressibleNavierStokesChimeraLegacy : public KernelImp +{ +public: + static std::shared_ptr<K17CompressibleNavierStokesChimeraLegacy> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K17CompressibleNavierStokesChimeraLegacy(); + K17CompressibleNavierStokesChimeraLegacy(std::shared_ptr<Parameter> para, int level); +}; + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cu index 1da801654adb3682ea11ca87c7c7a2fd10b065d3..d796f38bca8b7c70940515db78160fe460a702f9 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cu @@ -41,7 +41,7 @@ using namespace vf::lbm::dir; using namespace vf::gpu; //////////////////////////////////////////////////////////////////////////////// -__global__ void LB_Kernel_CumulantK17CompChim( +__global__ void K17CompressibleNavierStokesChimeraLegacy_Device( real omega, uint* typeOfGridNode, uint* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cuh similarity index 64% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cuh index a480278652ca3bae0122d33b2655e2210d203727..bd2bd08ca184f468bd5491532fc9c444328ab487 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy_Device.cuh @@ -1,10 +1,10 @@ -#ifndef LB_Kernel_CUMULANT_K17_COMP_CHIM_H -#define LB_Kernel_CUMULANT_K17_COMP_CHIM_H +#ifndef K17CompressibleNavierStokesChimeraLegacy_Device_H +#define K17CompressibleNavierStokesChimeraLegacy_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_CumulantK17CompChim( +__global__ void K17CompressibleNavierStokesChimeraLegacy_Device( real omega, uint* typeOfGridNode, uint* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.cu new file mode 100644 index 0000000000000000000000000000000000000000..1b3c978487bd8c2cd39ab92e6ac6d2af59c5cf04 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.cu @@ -0,0 +1,39 @@ +#include "K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.h" + +#include "K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cuh" +#include "Parameter/Parameter.h" +#include "cuda_helper/CudaGrid.h" + +std::shared_ptr<K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants> K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants>(new K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants(para, level)); +} + +void K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + + K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device <<< grid.grid, grid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + level, + para->getForcesDev(), + para->getQuadricLimitersDev(), + para->getParD(level)->isEvenTimestep); + getLastCudaError("LB_Kernel_Cumulant_D3Q27All4 execution failed"); +} + +K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants::K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitCompSP27); + + +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.h new file mode 100644 index 0000000000000000000000000000000000000000..cfc30852016375a4c6512f1ed1e35f069d5e366a --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.h @@ -0,0 +1,16 @@ +#ifndef K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_H +#define K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_H + +#include "Kernel/KernelImp.h" + +class K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants : public KernelImp +{ +public: + static std::shared_ptr<K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants(); + K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cu index 7a5e39d6f1f95f5b34bb38f1514ab728f477c34b..4919f56979ef004d3d74049feadc43895ad7cf28 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cu @@ -1,4 +1,4 @@ -#include "CumulantAll4CompSP27_Device.cuh" +#include "K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cuh" #include "LBM/LB.h" #include "lbm/constants/D3Q27.h" @@ -8,17 +8,18 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - int level, - real* forces, - real* quadricLimiters, - bool EvenOrOdd) +__global__ void K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + int level, + real* forces, + real* quadricLimiters, + bool EvenOrOdd) { //////////////////////////////////////////////////////////////////////////////// const unsigned x = threadIdx.x; // Globaler x-Index diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..df7f6a09676740503aaed1f4b16b0b8db96624c8 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device.cuh @@ -0,0 +1,19 @@ +#ifndef K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device_H +#define K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + int level, + real* forces, + real* quadricLimiters, + bool EvenOrOdd); +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.cu similarity index 80% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.cu index 59c405ae6e3bb46f608454ddb3a11bb0baac134f..45a998e215b999a9f920358132865fbfccc458aa 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.cu @@ -1,4 +1,4 @@ -#include "CumulantK17Unified.h" +#include "K17CompressibleNavierStokesUnified.h" #include <stdexcept> @@ -13,7 +13,7 @@ namespace gpu { -CumulantK17Unified::CumulantK17Unified(std::shared_ptr<Parameter> para, int level) +K17CompressibleNavierStokesUnified::K17CompressibleNavierStokesUnified(std::shared_ptr<Parameter> para, int level) : KernelImp(para, level) { #ifndef BUILD_CUDA_LTO @@ -29,7 +29,7 @@ CumulantK17Unified::CumulantK17Unified(std::shared_ptr<Parameter> para, int leve -void CumulantK17Unified::run() +void K17CompressibleNavierStokesUnified::run() { GPUKernelParameter kernelParameter{ para->getParD(level)->omega, @@ -48,7 +48,7 @@ void CumulantK17Unified::run() runKernel<<<cudaGrid.grid, cudaGrid.threads>>>(lambda, kernelParameter); - getLastCudaError("LB_Kernel_CumulantK17Unified execution failed"); + getLastCudaError("K17CompressibleNavierStokesUnified execution failed"); } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.h new file mode 100644 index 0000000000000000000000000000000000000000..2b416a6d80d6bbb961152e6d3c559922e280b997 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.h @@ -0,0 +1,23 @@ +#ifndef K17CompressibleNavierStokesUnified_H +#define K17CompressibleNavierStokesUnified_H + +#include "Kernel/KernelImp.h" + +namespace vf +{ +namespace gpu +{ + + +class K17CompressibleNavierStokesUnified : public KernelImp +{ +public: + K17CompressibleNavierStokesUnified(std::shared_ptr<Parameter> para, int level); + + void run(); +}; + +} +} + +#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cu similarity index 82% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cu index c206381d4b54130a7a5489536729465f398e5ee4..732e96ce44e64d2f86bf899bd87bb33de4725874 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cu @@ -55,7 +55,7 @@ using namespace vf::gpu; //////////////////////////////////////////////////////////////////////////////// template<TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce> -__global__ void LB_Kernel_CumulantK17( +__global__ void K17CompressibleNavierStokes_Device( real omega_in, uint* neighborX, uint* neighborY, @@ -693,34 +693,34 @@ __global__ void LB_Kernel_CumulantK17( (dist.f[DIR_MMM])[k_MMM] = f_PPP; } -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::AMD, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::Smagorinsky, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::QR, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::None, true, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::AMD, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::Smagorinsky, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::QR, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::None, true, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::AMD, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::Smagorinsky, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::QR, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::None, false, true > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::AMD, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::AMD, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::Smagorinsky, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::QR, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::QR, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); -template __global__ void LB_Kernel_CumulantK17 < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); +template __global__ void K17CompressibleNavierStokes_Device < TurbulenceModel::None, false, false > ( real omega_in, uint* neighborX, uint* neighborY, uint* neighborZ, real* distributions, real* rho, real* vx, real* vy, real* vz, real* turbulentViscosity, real SGSconstant, unsigned long long numberOfLBnodes, int level, real* forces, real* bodyForceX, real* bodyForceY, real* bodyForceZ, real* quadricLimiters, bool isEvenTimestep, const uint *fluidNodeIndices, uint numberOfFluidNodes); diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cuh similarity index 77% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cuh index da576618d1b08b55629c3c65fc115ceb822c8f7e..49f144422bf5803582edebf9826f34b2af3f929a 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes_Device.cuh @@ -1,10 +1,10 @@ -#ifndef LB_Kernel_CUMULANT_K17_H -#define LB_Kernel_CUMULANT_K17_H +#ifndef K17CompressibleNavierStokes_Device_H +#define K17CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void LB_Kernel_CumulantK17( +template< TurbulenceModel turbulenceModel, bool writeMacroscopicVariables, bool applyBodyForce > __global__ void K17CompressibleNavierStokes_Device( real omega_in, uint* neighborX, uint* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.cu similarity index 59% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.cu index 15d3509e735faa08b97d0876600c30876829c35f..efc90492b18c2360c49f523e26c4bcfe2b594e47 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CumulantK18Comp.h" +#include "K18CompressibleNavierStokes.h" -#include "CumulantK18Comp_Device.cuh" +#include "K18CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantK18Comp> CumulantK18Comp::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K18CompressibleNavierStokes> K18CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK18Comp>(new CumulantK18Comp(para, level)); + return std::shared_ptr<K18CompressibleNavierStokes>(new K18CompressibleNavierStokes(para, level)); } -void CumulantK18Comp::run() +void K18CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_CumulantK18Comp <<< grid.grid, grid.threads >>>( + K18CompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -29,7 +29,7 @@ void CumulantK18Comp::run() getLastCudaError("LB_Kernel_CumulantK18Comp execution failed"); } -CumulantK18Comp::CumulantK18Comp(std::shared_ptr<Parameter> para, int level) +K18CompressibleNavierStokes::K18CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..d75920c78efe48ad586c4c92f775c3868195e9b8 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.h @@ -0,0 +1,17 @@ +#ifndef K18CompressibleNavierStokes_H +#define K18CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class K18CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr< K18CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K18CompressibleNavierStokes(); + K18CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cu index c585c19aaca870e97fec63b0cd1742f7aad32556..169dedd3660ba9fc3c5e15bdfb60941bad2856c3 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK18Comp( +__global__ void K18CompressibleNavierStokes_Device( real omega, unsigned int* bcMatD, unsigned int* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cuh similarity index 58% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cuh index 04448787256cb1cfeef46c5d9b7146918e6a4c38..601071a73c8ea2e0e9d3d0e1b3ba69f921fd821d 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes_Device.cuh @@ -1,18 +1,21 @@ -#ifndef LB_KERNEL_CUMULANT_K17_BULK_COMP_H -#define LB_KERNEL_CUMULANT_K17_BULK_COMP_H +#ifndef K18CompressibleNavierStokes_Device_H +#define K18CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_CumulantK17BulkComp(real omega, +__global__ void K18CompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ, real* DDStart, + real* F3, int size_Mat, int level, real* forces, real* quadricLimiters, bool EvenOrOdd); -#endif \ No newline at end of file + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.cu similarity index 59% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.cu index 8181cdb690b5813c368eddadb9cda58a7d749302..1a07b5a09614e38bd589b3f02d70b831d73b587e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CumulantK20Comp.h" +#include "K20CompressibleNavierStokes.h" -#include "CumulantK20Comp_Device.cuh" +#include "K20CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantK20Comp> CumulantK20Comp::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K20CompressibleNavierStokes> K20CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK20Comp>(new CumulantK20Comp(para, level)); + return std::shared_ptr<K20CompressibleNavierStokes>(new K20CompressibleNavierStokes(para, level)); } -void CumulantK20Comp::run() +void K20CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_CumulantK20Comp <<< grid.grid, grid.threads >>>( + K20CompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -29,7 +29,7 @@ void CumulantK20Comp::run() getLastCudaError("LB_Kernel_CumulantK20Comp execution failed"); } -CumulantK20Comp::CumulantK20Comp(std::shared_ptr<Parameter> para, int level) +K20CompressibleNavierStokes::K20CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..fc6d4e72acf330a482e80c145a669bda74c0dd8a --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef K20CompressibleNavierStokes_H +#define K20CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class K20CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr< K20CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K20CompressibleNavierStokes(); + K20CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cu index 0a26eff29c3624bd78ef7dd4a8f675b8cb1a99d3..d722baa512dea2d7cc01ebf4f986f3239345fb40 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK20Comp( +__global__ void K20CompressibleNavierStokes_Device( real omega, unsigned int* bcMatD, unsigned int* neighborX, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cuh similarity index 75% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cuh index 17691f621b5a46d29556d71304195f4a346a7ec6..b86fc38428b964304772cf283b310d6056be2682 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes_Device.cuh @@ -1,10 +1,10 @@ -#ifndef LB_Kernel_Cumulant_K20_H -#define LB_Kernel_Cumulant_K20_H +#ifndef K20CompressibleNavierStokes_Device_H +#define K20CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_CumulantK20Comp( real omega, +__global__ void K20CompressibleNavierStokes_Device( real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.cu similarity index 55% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.cu index 6e11bd97a2e76cca3983a83f785a2435d40f594b..ffba813e2626c61323c13a5d4ac74d331e6e6c78 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "MRTCompSP27.h" +#include "M02CompressibleNavierStokes.h" -#include "MRTCompSP27_Device.cuh" +#include "M02CompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<MRTCompSP27> MRTCompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<M02CompressibleNavierStokes> M02CompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<MRTCompSP27>(new MRTCompSP27(para, level)); + return std::shared_ptr<M02CompressibleNavierStokes>(new M02CompressibleNavierStokes(para, level)); } -void MRTCompSP27::run() +void M02CompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_MRT_Comp_SP_27 <<< grid.grid, grid.threads >>>( + M02CompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,16 +25,15 @@ void MRTCompSP27::run() getLastCudaError("LB_Kernel_MRT_Comp_SP_27 execution failed"); } -MRTCompSP27::MRTCompSP27(std::shared_ptr<Parameter> para, int level) +M02CompressibleNavierStokes::M02CompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; myPreProcessorTypes.push_back(InitCompSP27); - } -MRTCompSP27::MRTCompSP27() +M02CompressibleNavierStokes::M02CompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..b18eb3dfb7f144e664d9dd2236b5a76a1c63dfa2 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.h @@ -0,0 +1,17 @@ +#ifndef M02CompressibleNavierStokes_H +#define M02CompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + + +class M02CompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<M02CompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + M02CompressibleNavierStokes(); + M02CompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cu index 41b24a349da75586be4fb818c9eb3f194a2447fd..ae0f67fdb44884ffbcdf555fd48b275b64499c85 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_MRT_Comp_SP_27(real omega, +__global__ void M02CompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cuh similarity index 56% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cuh index cf6a926698e4082383b04c5f1e2d886c6dca6380..06542a20c7c40367195fda9bdb3acac339e62f0e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes_Device.cuh @@ -1,10 +1,10 @@ -#ifndef LB_KERNEL_CUM_COMP_SP_27_H -#define LB_KERNEL_CUM_COMP_SP_27_H +#ifndef M02CompressibleNavierStokes_Device_H +#define M02CompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_Cum_Comp_SP_27(real s9, +__global__ void M02CompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/RunLBMKernel.cuh similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/RunLBMKernel.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Compressible/FluidFlow/RunLBMKernel.cuh diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.cu new file mode 100644 index 0000000000000000000000000000000000000000..846c2effc1d7df08f76e9752ed706e821254aba7 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.cu @@ -0,0 +1,40 @@ +#include "B15IncompressibleNavierStokesBGKplus.h" + +#include "B15IncompressibleNavierStokesBGKplus_Device.cuh" +#include "Parameter/Parameter.h" +#include <cuda_helper/CudaGrid.h> + +std::shared_ptr<B15IncompressibleNavierStokesBGKplus> B15IncompressibleNavierStokesBGKplus::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<B15IncompressibleNavierStokesBGKplus>(new B15IncompressibleNavierStokesBGKplus(para, level)); +} + +void B15IncompressibleNavierStokesBGKplus::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + + B15IncompressibleNavierStokesBGKplus_Device <<< grid.grid, grid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("LB_Kernel_BGK_Plus_Incomp_SP_27 execution failed"); +} + +B15IncompressibleNavierStokesBGKplus::B15IncompressibleNavierStokesBGKplus(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitSP27); + + +} + +B15IncompressibleNavierStokesBGKplus::B15IncompressibleNavierStokesBGKplus() +{ +} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.h new file mode 100644 index 0000000000000000000000000000000000000000..2426d32cb0262c90aa32e8eaeea40ad9e273b75d --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.h @@ -0,0 +1,17 @@ +#ifndef B15IncompressibleNavierStokesBGKplus_H +#define B15IncompressibleNavierStokesBGKplus_H + +#include "Kernel/KernelImp.h" + +class B15IncompressibleNavierStokesBGKplus : public KernelImp +{ +public: + static std::shared_ptr<B15IncompressibleNavierStokesBGKplus> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + B15IncompressibleNavierStokesBGKplus(); + B15IncompressibleNavierStokesBGKplus(std::shared_ptr< Parameter> para, int level); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cu index 1fee181619070e3bc30370a1bc32b949a3af9a2a..49764bc07bc910911dff0668105252f75d062205 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, +__global__ void B15IncompressibleNavierStokesBGKplus_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..1c812f936541deaba06060fda0367dc60f231e63 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus_Device.cuh @@ -0,0 +1,17 @@ +#ifndef B15IncompressibleNavierStokesBGKplus_Device_H +#define B15IncompressibleNavierStokesBGKplus_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void B15IncompressibleNavierStokesBGKplus_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + bool EvenOrOdd); + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.cu similarity index 54% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.cu index 39bd1f3491d0d70e4734d04ef8a2d6e38cdc6448..99f5fda8377bd7ce5bd4d486db5e2a680add7e84 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "BGKIncompSP27.h" +#include "B92IncompressibleNavierStokes.h" -#include "BGKIncompSP27_Device.cuh" +#include "B92IncompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<BGKIncompSP27> BGKIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<B92IncompressibleNavierStokes> B92IncompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<BGKIncompSP27>(new BGKIncompSP27(para, level)); + return std::shared_ptr<B92IncompressibleNavierStokes>(new B92IncompressibleNavierStokes(para, level)); } -void BGKIncompSP27::run() +void B92IncompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_BGK_Incomp_SP_27 <<< grid.grid, grid.threads >>>( + B92IncompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void BGKIncompSP27::run() getLastCudaError("LB_Kernel_BGK_Incomp_SP_27 execution failed"); } -BGKIncompSP27::BGKIncompSP27(std::shared_ptr<Parameter> para, int level) +B92IncompressibleNavierStokes::B92IncompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -35,6 +35,6 @@ BGKIncompSP27::BGKIncompSP27(std::shared_ptr<Parameter> para, int level) } -BGKIncompSP27::BGKIncompSP27() +B92IncompressibleNavierStokes::B92IncompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..782b764460b85b6525d8c3ec89ef25e333eadd40 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.h @@ -0,0 +1,17 @@ +#ifndef B92IncompressibleNavierStokes_H +#define B92IncompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + + +class B92IncompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<B92IncompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + B92IncompressibleNavierStokes(); + B92IncompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cu index 6cfde7648bdfe8808cb39dd1b80d6537bb3c3280..1d343eb3020816fe3114538a5362162e4a86169e 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cu @@ -6,7 +6,7 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, +__global__ void B92IncompressibleNavierStokes_Device(real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cuh similarity index 80% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cuh index f1a90b45238a2df4d93860d7e77cb1242b9fbd90..8b81ebf323cd27faaa60f4b5f75d113a17a2b5e8 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes_Device.cuh @@ -4,7 +4,8 @@ #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_BGK_Incomp_SP_27(real omega, +__global__ void B92IncompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.cu similarity index 54% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.cu index b060137f2d505886ee02a4b72e372ce8b4d48a78..16f6ffd99e8e7b68b954976fd79f0f2aeb7370b9 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CascadeIncompSP27.h" +#include "C06IncompressibleNavierStokes.h" #include "CascadeIncompSP27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CascadeIncompSP27> CascadeIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<C06IncompressibleNavierStokes> C06IncompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CascadeIncompSP27>(new CascadeIncompSP27(para, level)); + return std::shared_ptr<C06IncompressibleNavierStokes>(new C06IncompressibleNavierStokes(para, level)); } -void CascadeIncompSP27::run() +void C06IncompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_Cascade_Incomp_SP_27 <<< grid.grid, grid.threads >>>( + C06IncompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void CascadeIncompSP27::run() getLastCudaError("LB_Kernel_Cascade_Incomp_SP_27 execution failed"); } -CascadeIncompSP27::CascadeIncompSP27(std::shared_ptr<Parameter> para, int level) +C06IncompressibleNavierStokes::C06IncompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -35,6 +35,6 @@ CascadeIncompSP27::CascadeIncompSP27(std::shared_ptr<Parameter> para, int level) } -CascadeIncompSP27::CascadeIncompSP27() +C06IncompressibleNavierStokes::C06IncompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..292b37ee75e1f8098845888776089d448e133332 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.h @@ -0,0 +1,17 @@ +#ifndef C06IncompressibleNavierStokes_H +#define C06IncompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class C06IncompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<C06IncompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + C06IncompressibleNavierStokes(); + C06IncompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); + +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cu index 0346f12cf609c355aedd4743dd7f971f444d5fe9..3f51dd4044887803a1b6b5f2470639ce4537b8d2 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cu @@ -6,7 +6,8 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cascade_Incomp_SP_27(real omega, +__global__ void C06IncompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cuh similarity index 56% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cuh index a531fa7bd64b9782f43f800b29fe666504612f1a..daebc3345411812700a8776da1b1f5917dff2f59 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/C06/CascadeIncompSP27_Device.cuh @@ -1,10 +1,11 @@ -#ifndef LB_KERNEL_CASCADE_INCOMP_SP_27_H -#define LB_KERNEL_CASCADE_INCOMP_SP_27_H +#ifndef C06IncompressibleNavierStokes_Device_H +#define C06IncompressibleNavierStokes_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_Cascade_Incomp_SP_27(real s9, +__global__ void C06IncompressibleNavierStokes_Device( + real s9, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/FluidFlowIncompStrategy.cpp similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.cpp rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/FluidFlowIncompStrategy.cpp diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/FluidFlowIncompStrategy.h similarity index 100% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.h rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/FluidFlowIncompStrategy.h diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.cu similarity index 51% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.cu index c597924193d859a35dddaa7b37a56e21d265ceba..f457eb98e856733795681f5b285d82decc6ff2b6 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "CumulantK15Incomp.h" +#include "K15IncompressibleNavierStokes.h" -#include "CumulantK15Incomp_Device.cuh" +#include "K15IncompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantK15Incomp> CumulantK15Incomp::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K15IncompressibleNavierStokes> K15IncompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantK15Incomp>(new CumulantK15Incomp(para, level)); + return std::shared_ptr<K15IncompressibleNavierStokes>(new K15IncompressibleNavierStokes(para, level)); } -void CumulantK15Incomp::run() +void K15IncompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_CumulantK15Incomp <<< grid.grid, grid.threads >>>( + K15IncompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void CumulantK15Incomp::run() getLastCudaError("LB_Kernel_CumulantK15Incomp execution failed"); } -CumulantK15Incomp::CumulantK15Incomp(std::shared_ptr<Parameter> para, int level) +K15IncompressibleNavierStokes::K15IncompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -35,6 +35,6 @@ CumulantK15Incomp::CumulantK15Incomp(std::shared_ptr<Parameter> para, int level) } -CumulantK15Incomp::CumulantK15Incomp() +K15IncompressibleNavierStokes::K15IncompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..40d06dfaef95cdd71ab1d11fbfc356087345ce91 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef K15IncompressibleNavierStokes_H +#define K15IncompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class K15IncompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<K15IncompressibleNavierStokes> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15IncompressibleNavierStokes(); + K15IncompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.cu similarity index 53% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.cu index 840067da7f34a4415b1b14458ae0fc8d316e366d..0db31e686cfce85c19ae5b4aa37fef71ecc6e354 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.cu @@ -1,19 +1,19 @@ -#include "CumulantIsoIncompSP27.h" +#include "K15IncompressibleNavierStokesIsoCheck.h" -#include "CumulantIsoIncompSP27_Device.cuh" +#include "K15IncompressibleNavierStokesIsoCheck_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<CumulantIsoIncompSP27> CumulantIsoIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<K15IncompressibleNavierStokesIsoCheck> K15IncompressibleNavierStokesIsoCheck::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<CumulantIsoIncompSP27>(new CumulantIsoIncompSP27(para, level)); + return std::shared_ptr<K15IncompressibleNavierStokesIsoCheck>(new K15IncompressibleNavierStokesIsoCheck(para, level)); } -void CumulantIsoIncompSP27::run() +void K15IncompressibleNavierStokesIsoCheck::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_Cum_IsoTest_Incomp_SP_27 <<< grid.grid, grid.threads >>>( + K15IncompressibleNavierStokesIsoCheck_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -28,7 +28,7 @@ void CumulantIsoIncompSP27::run() getLastCudaError("LB_Kernel_Cum_IsoTest_Incomp_SP_27 execution failed"); } -CumulantIsoIncompSP27::CumulantIsoIncompSP27(std::shared_ptr<Parameter> para, int level) +K15IncompressibleNavierStokesIsoCheck::K15IncompressibleNavierStokesIsoCheck(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -38,6 +38,6 @@ CumulantIsoIncompSP27::CumulantIsoIncompSP27(std::shared_ptr<Parameter> para, in } -CumulantIsoIncompSP27::CumulantIsoIncompSP27() +K15IncompressibleNavierStokesIsoCheck::K15IncompressibleNavierStokesIsoCheck() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.h new file mode 100644 index 0000000000000000000000000000000000000000..c2871b389c421b191cb65b36fd8cab3c6c35cb2c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.h @@ -0,0 +1,18 @@ +#ifndef K15IncompressibleNavierStokesIsoCheck_H +#define K15IncompressibleNavierStokesIsoCheck_H + +#include "Kernel/KernelImp.h" + +class K15IncompressibleNavierStokesIsoCheck : public KernelImp +{ +public: + static std::shared_ptr<K15IncompressibleNavierStokesIsoCheck> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15IncompressibleNavierStokesIsoCheck(); + K15IncompressibleNavierStokesIsoCheck(std::shared_ptr< Parameter> para, int level); + +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cu index 623d3c2c26b2c4d8fdfdaa718ca92662dfe5b548..6c91d9bfc4cf2c39b812a493986da29b45165407 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cu @@ -6,7 +6,8 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, +__global__ void K15IncompressibleNavierStokesIsoCheck_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cuh similarity index 56% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cuh index 57dc7180ce7900333b4071db409a03ac847dd641..b392245582cec7a098a9d7bf2583d75a578b6993 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck_Device.cuh @@ -1,10 +1,11 @@ -#ifndef LB_KERNEL_CUM_ISO_TEST_INCOMP_SP_27 -#define LB_KERNEL_CUM_ISO_TEST_INCOMP_SP_27 +#ifndef K15IncompressibleNavierStokesIsoCheck_Device_27 +#define K15IncompressibleNavierStokesIsoCheck_Device_27 #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_Cum_IsoTest_Incomp_SP_27(real omega, +__global__ void K15IncompressibleNavierStokesIsoCheck_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.cu new file mode 100644 index 0000000000000000000000000000000000000000..5e5f99045cdc6bdbe365a4624e73b05dc82c2438 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.cu @@ -0,0 +1,45 @@ +#include "K15IncompressibleNavierStokesRotatingVelocityField.h" + +#include "K15IncompressibleNavierStokesRotatingVelocityField_Device.cuh" +#include "Parameter/Parameter.h" +#include "cuda_helper/CudaGrid.h" + +std::shared_ptr<K15IncompressibleNavierStokesRotatingVelocityField> K15IncompressibleNavierStokesRotatingVelocityField::getNewInstance(std::shared_ptr<Parameter> para, int level) +{ + return std::shared_ptr<K15IncompressibleNavierStokesRotatingVelocityField>(new K15IncompressibleNavierStokesRotatingVelocityField(para, level)); +} + +void K15IncompressibleNavierStokesRotatingVelocityField::run() +{ + vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); + + K15IncompressibleNavierStokesRotatingVelocityField_Device <<< grid.grid, grid.threads >>>( + para->getParD(level)->omega, + para->getParD(level)->deltaPhi, + para->getAngularVelocity(), + para->getParD(level)->typeOfGridNode, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + para->getParD(level)->coordinateX, + para->getParD(level)->coordinateY, + para->getParD(level)->coordinateZ, + para->getParD(level)->distributions.f[0], + para->getParD(level)->numberOfNodes, + para->getParD(level)->isEvenTimestep); + getLastCudaError("K15IncompressibleNavierStokesRotatingVelocityField_Device execution failed"); +} + +K15IncompressibleNavierStokesRotatingVelocityField::K15IncompressibleNavierStokesRotatingVelocityField(std::shared_ptr<Parameter> para, int level) +{ + this->para = para; + this->level = level; + + myPreProcessorTypes.push_back(InitSP27); + + +} + +K15IncompressibleNavierStokesRotatingVelocityField::K15IncompressibleNavierStokesRotatingVelocityField() +{ +} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.h new file mode 100644 index 0000000000000000000000000000000000000000..94858833254f2e2b40c0ae3ef00eaa0789ded88b --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.h @@ -0,0 +1,18 @@ +#ifndef K15IncompressibleNavierStokesRotatingVelocityField_H +#define K15IncompressibleNavierStokesRotatingVelocityField_H + +#include "Kernel/KernelImp.h" + +class K15IncompressibleNavierStokesRotatingVelocityField : public KernelImp +{ +public: + static std::shared_ptr<K15IncompressibleNavierStokesRotatingVelocityField> getNewInstance(std::shared_ptr< Parameter> para, int level); + void run(); + +private: + K15IncompressibleNavierStokesRotatingVelocityField(); + K15IncompressibleNavierStokesRotatingVelocityField(std::shared_ptr< Parameter> para, int level); + +}; + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cu index ac88396b42483e3178869be585124fb031d099ec..082a5dc3882a498838d174e0c7b24ae134dca622 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cu @@ -6,7 +6,8 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, +__global__ void K15IncompressibleNavierStokesRotatingVelocityField_Device( + real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cuh similarity index 56% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cuh index 0679e770f244ad2e2c59c9cacf9d3524a640a42e..b313fcb8f2e7aa4544249ce26f6ada3cf85c7a79 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27_Device.cuh +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField_Device.cuh @@ -1,10 +1,11 @@ -#ifndef LB_KERNEL_CUM_1H_INCOMP_SP_27_H -#define LB_KERNEL_CUM_1H_INCOMP_SP_27_H +#ifndef K15IncompressibleNavierStokesRotatingVelocityField_Device_H +#define K15IncompressibleNavierStokesRotatingVelocityField_Device_H #include <DataTypes.h> #include <curand.h> -__global__ void LB_Kernel_Cum_1h_Incomp_SP_27(real omega, +__global__ void K15IncompressibleNavierStokesRotatingVelocityField_Device( + real omega, real deltaPhi, real angularVelocity, unsigned int* bcMatD, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cu index 9fcfeaa97d97b9bfcf2ad0227464cbcabbc28f44..5b666eb73c7a19d472d26f2047b04462f83d0d23 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cu @@ -6,7 +6,8 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_CumulantK15Incomp(real omega, +__global__ void K15IncompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..9252b17df43b405e7098359d3c5ff7406cc90759 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes_Device.cuh @@ -0,0 +1,17 @@ +#ifndef K15IncompressibleNavierStokes_Device_H +#define K15IncompressibleNavierStokes_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void K15IncompressibleNavierStokes_Device( + real s9, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + bool EvenOrOdd); + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.cu similarity index 54% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.cu index daa90091fe092a98741d0764e2327f3ce4c9d2bc..a08eef4a381b06729da8ff26a0ab305e5cf3615c 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.cu @@ -1,19 +1,19 @@ -#include "MRTIncompSP27.h" +#include "M02IncompressibleNavierStokes.h" -#include "MRTIncompSP27_Device.cuh" +#include "M02IncompressibleNavierStokes_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> -std::shared_ptr<MRTIncompSP27> MRTIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) +std::shared_ptr<M02IncompressibleNavierStokes> M02IncompressibleNavierStokes::getNewInstance(std::shared_ptr<Parameter> para, int level) { - return std::shared_ptr<MRTIncompSP27>(new MRTIncompSP27(para, level)); + return std::shared_ptr<M02IncompressibleNavierStokes>(new M02IncompressibleNavierStokes(para, level)); } -void MRTIncompSP27::run() +void M02IncompressibleNavierStokes::run() { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - LB_Kernel_MRT_Incomp_SP_27 <<< grid.grid, grid.threads >>>( + M02IncompressibleNavierStokes_Device <<< grid.grid, grid.threads >>>( para->getParD(level)->omega, para->getParD(level)->typeOfGridNode, para->getParD(level)->neighborX, @@ -25,7 +25,7 @@ void MRTIncompSP27::run() getLastCudaError("LB_Kernel_MRT_Incomp_SP_27 execution failed"); } -MRTIncompSP27::MRTIncompSP27(std::shared_ptr<Parameter> para, int level) +M02IncompressibleNavierStokes::M02IncompressibleNavierStokes(std::shared_ptr<Parameter> para, int level) { this->para = para; this->level = level; @@ -35,6 +35,6 @@ MRTIncompSP27::MRTIncompSP27(std::shared_ptr<Parameter> para, int level) } -MRTIncompSP27::MRTIncompSP27() +M02IncompressibleNavierStokes::M02IncompressibleNavierStokes() { } diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.h b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.h new file mode 100644 index 0000000000000000000000000000000000000000..dde5846114b84abb6c276f155e3f583f7de0ecd6 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.h @@ -0,0 +1,16 @@ +#ifndef M02IncompressibleNavierStokes_H +#define M02IncompressibleNavierStokes_H + +#include "Kernel/KernelImp.h" + +class M02IncompressibleNavierStokes : public KernelImp +{ +public: + static std::shared_ptr<M02IncompressibleNavierStokes> getNewInstance(std::shared_ptr<Parameter> para, int level); + void run(); + +private: + M02IncompressibleNavierStokes(); + M02IncompressibleNavierStokes(std::shared_ptr< Parameter> para, int level); +}; +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cu similarity index 99% rename from src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu rename to src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cu index 2fbc7d64d5f10a2c6313647e508fbb2192dd435b..4c94c960e0bf9521c558ede0c00076f2bfe82ce4 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cu @@ -6,7 +6,8 @@ using namespace vf::basics::constant; using namespace vf::lbm::dir; #include "math.h" -__global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, +__global__ void M02IncompressibleNavierStokes_Device( + real omega, unsigned int* bcMatD, unsigned int* neighborX, unsigned int* neighborY, diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cuh new file mode 100644 index 0000000000000000000000000000000000000000..c62c73b10fcab18f8e4c7b3189dc10204a60de28 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes_Device.cuh @@ -0,0 +1,17 @@ +#ifndef M02IncompressibleNavierStokes_Device_H +#define M02IncompressibleNavierStokes_Device_H + +#include <DataTypes.h> +#include <curand.h> + +__global__ void M02IncompressibleNavierStokes_Device( + real omega, + unsigned int* bcMatD, + unsigned int* neighborX, + unsigned int* neighborY, + unsigned int* neighborZ, + real* DDStart, + int size_Mat, + bool EvenOrOdd); + +#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h index 84e5f3f6ac08b92ccd92fbf142cceb3245de51d5..00d392c9e8ff7b8c55b75f50327946b0140a3d68 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h +++ b/src/gpu/VirtualFluids_GPU/Kernel/KernelImp.h @@ -7,7 +7,7 @@ #include <memory> -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> class CheckParameterStrategy; class Parameter; diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu index 4d4467acb20232ecb364451f61265b71f1692517..21ad7202a62a685bc18b8a0c44e093e487e8eb84 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.cu @@ -2,7 +2,7 @@ #include "ADComp27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<ADComp27> ADComp27::getNewInstance(std::shared_ptr<Parameter> para, int level) { diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu index d218489c754edc89f99277670f09536962ce62b2..fa6d378353aa5058f1b58979a517e8490d7d3916 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADComp7/ADComp7.cu @@ -2,7 +2,7 @@ #include "ADComp7_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<ADComp7> ADComp7::getNewInstance(std::shared_ptr<Parameter> para, int level) { diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu index 3c10e7a6996a9a26668a18390ddee4e2cbbec853..22782ddf6aebb6b860c3dc1e2b1a384223931085 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADIncomp27/ADIncomp27.cu @@ -2,7 +2,7 @@ #include "ADIncomp27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<ADIncomp27> ADIncomp27::getNewInstance(std::shared_ptr<Parameter> para, int level) { diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu index 71adc96eef733084e01fa963f6d0fad66a2e1062..613491dcfc4e124fed2826f5439ae7a2b99544b7 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod7/ADIncomp7/ADIncomp7.cu @@ -2,7 +2,7 @@ #include "ADIncomp7_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<ADIncomp7> ADIncomp7::getNewInstance(std::shared_ptr<Parameter> para, int level) { diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.h deleted file mode 100644 index 4163d87fa5105a737138cd5c5e67fe5b01edaeed..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BGK_COMP_SP27_H -#define BGK_COMP_SP27_H - -#include "Kernel/KernelImp.h" - -class BGKCompSP27 : public KernelImp -{ -public: - static std::shared_ptr<BGKCompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - BGKCompSP27(); - BGKCompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh deleted file mode 100644 index 59a5240862ed92a9ea3e9187c503ee9233da7e5a..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27_Device.cuh +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef LB_Kernel_BGK_COMP_SP_27_H -#define LB_Kernel_BGK_COMP_SP_27_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_BGK_Comp_SP_27( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - bool EvenOrOdd); - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu deleted file mode 100644 index 00aaf3c27f16a5d53e7aee225214f05bd62a541a..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.cu +++ /dev/null @@ -1,40 +0,0 @@ -#include "BGKPlusCompSP27.h" - -#include "BGKPlusCompSP27_Device.cuh" -#include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" - -std::shared_ptr<BGKPlusCompSP27> BGKPlusCompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<BGKPlusCompSP27>(new BGKPlusCompSP27(para, level)); -} - -void BGKPlusCompSP27::run() -{ - vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - - LB_Kernel_BGK_Plus_Comp_SP_27 <<< grid.grid, grid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_BGK_Plus_Comp_SP_27 execution failed"); -} - -BGKPlusCompSP27::BGKPlusCompSP27(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitCompSP27); - - -} - -BGKPlusCompSP27::BGKPlusCompSP27() -{ -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.h deleted file mode 100644 index da40eb8aeee5d19646a66b7a0f8f8da498b85a2a..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BGK_PLUS_COMP_SP27_H -#define BGK_PLUS_COMP_SP27_H - -#include "Kernel/KernelImp.h" - -class BGKPlusCompSP27 : public KernelImp -{ -public: - static std::shared_ptr<BGKPlusCompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - BGKPlusCompSP27(); - BGKPlusCompSP27(std::shared_ptr< Parameter> para, int level); -}; - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh deleted file mode 100644 index 9e991ffa4b16e0df78fe23f6ee5a1e0678919cd7..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27_Device.cuh +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef LB_Kernel_BGK_PLUS_Comp_SP_27_H -#define LB_Kernel_BGK_PLUS_Comp_SP_27_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_BGK_Plus_Comp_SP_27( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - bool EvenOrOdd); -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.h deleted file mode 100644 index 762eaaa5935bd01fa6ae002521a40e45cd239dfd..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GPU_BKGUnified_H -#define GPU_BKGUnified_H - -#include "Kernel/KernelImp.h" - -namespace vf -{ -namespace gpu -{ - -class BGKUnified : public KernelImp -{ -public: - BGKUnified(std::shared_ptr<Parameter> para, int level); - - void run(); -}; - -} -} - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.h deleted file mode 100644 index 900f41884c5f19f050c33a0e6141010e0b72b46f..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CASCADE_COMP_SP27_H -#define CASCADE_COMP_SP27_H - -#include "Kernel/KernelImp.h" - -class CascadeCompSP27 : public KernelImp -{ -public: - static std::shared_ptr<CascadeCompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CascadeCompSP27(); - CascadeCompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.h deleted file mode 100644 index 0f9317f12b9438f770cd60355c41dc13599f1ad2..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_COMP_SP27_H -#define CUMULANT_COMP_SP27_H - -#include "Kernel/KernelImp.h" - -class CumulantCompSP27 : public KernelImp -{ -public: - static std::shared_ptr<CumulantCompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantCompSP27(); - CumulantCompSP27(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu deleted file mode 100644 index c8aad41b87ef39514f6cf5abc8b8bff42a869346..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.cu +++ /dev/null @@ -1,39 +0,0 @@ -#include "CumulantAll4CompSP27.h" - -#include "CumulantAll4CompSP27_Device.cuh" -#include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" - -std::shared_ptr<CumulantAll4CompSP27> CumulantAll4CompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<CumulantAll4CompSP27>(new CumulantAll4CompSP27(para, level)); -} - -void CumulantAll4CompSP27::run() -{ - vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - - LB_Kernel_Cumulant_D3Q27All4 <<< grid.grid, grid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - level, - para->getForcesDev(), - para->getQuadricLimitersDev(), - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_Cumulant_D3Q27All4 execution failed"); -} - -CumulantAll4CompSP27::CumulantAll4CompSP27(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitCompSP27); - - -} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h deleted file mode 100644 index e36d51bc471ff38a4f213f415c9e86bd677add32..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CUMULANT_ALL4_COMP_SP27_H -#define CUMULANT_ALL4_COMP_SP27_H - -#include "Kernel/KernelImp.h" - -class CumulantAll4CompSP27 : public KernelImp -{ -public: - static std::shared_ptr<CumulantAll4CompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantAll4CompSP27(); - CumulantAll4CompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh deleted file mode 100644 index 5f23194d561d106cf2493c36199444f8da15efd7..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27_Device.cuh +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LB_Kernel_Cumulant_D3Q27All4_H -#define LB_Kernel_Cumulant_D3Q27All4_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_Cumulant_D3Q27All4( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - int level, - real* forces, - real* quadricLimiters, - bool EvenOrOdd); -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.h deleted file mode 100644 index 386a9c2047ec067abfb86c1f8741cc5cb548e81b..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CUMULANT_K15_COMP_H -#define CUMULANT_K15_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK15Comp : public KernelImp -{ -public: - static std::shared_ptr< CumulantK15Comp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK15Comp(); - CumulantK15Comp(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh deleted file mode 100644 index 149aab34a16673ddd707427c222a56cf18d127ca..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp_Device.cuh +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef LB_Kernel_CUMULANT_K15_COMP_H -#define LB_Kernel_CUMULANT_K15_COMP_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_CumulantK15Comp( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - int level, - real* forces, - bool EvenOrOdd); -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu deleted file mode 100644 index f0e29a9740438bc78d39574e1046d937cd7b86ce..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.cu +++ /dev/null @@ -1,42 +0,0 @@ -#include "CumulantK15BulkComp.h" - -#include "CumulantK15BulkComp_Device.cuh" -#include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" - -std::shared_ptr<CumulantK15BulkComp> CumulantK15BulkComp::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<CumulantK15BulkComp>(new CumulantK15BulkComp(para, level)); -} - -void CumulantK15BulkComp::run() -{ - vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - - LB_Kernel_CumulantK15BulkComp <<< grid.grid, grid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - level, - para->getForcesDev(), - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_CumulantK15BulkComp execution failed"); -} - -CumulantK15BulkComp::CumulantK15BulkComp(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitCompSP27); - - -} - -CumulantK15BulkComp::CumulantK15BulkComp() -{ -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.h deleted file mode 100644 index 389e961b21f7b54adc7fd0fc6b3f8712af6e4531..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_K15_BULK_COMP_H -#define CUMULANT_K15_BULK_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK15BulkComp : public KernelImp -{ -public: - static std::shared_ptr<CumulantK15BulkComp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK15BulkComp(); - CumulantK15BulkComp(std::shared_ptr< Parameter> para, int level); -}; - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.h deleted file mode 100644 index de7fbfd90afc89d4dfdd441e18160c21e683b67b..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_K15_SPONGE_COMP_H -#define CUMULANT_K15_SPONGE_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK15SpongeComp : public KernelImp -{ -public: - static std::shared_ptr<CumulantK15SpongeComp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK15SpongeComp(); - CumulantK15SpongeComp(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.h deleted file mode 100644 index 8756253950484e00773af89327589c3d8f157729..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef CUMULANT_K15_UNIFIED_COMP_H -#define CUMULANT_K15_UNIFIED_COMP_H - -#include "Kernel/KernelImp.h" - -namespace vf -{ -namespace gpu -{ -class CumulantK15Unified : public KernelImp -{ -public: - CumulantK15Unified(std::shared_ptr<Parameter> para, int level); - - void run(); -}; - -} -} - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.h deleted file mode 100644 index 00c79a30c9ccf9a89901165d020fc85d5a479c1d..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef CUMULANT_K17_H -#define CUMULANT_K17_H - -#include "Kernel/KernelImp.h" -#include "Parameter/Parameter.h" - -template<TurbulenceModel turbulenceModel> -class CumulantK17 : public KernelImp -{ -public: - static std::shared_ptr< CumulantK17<turbulenceModel> > getNewInstance(std::shared_ptr< Parameter> para, int level); - void run() override; - void runOnIndices(const unsigned int *indices, unsigned int size_indices, CollisionTemplate collisionTemplate, CudaStreamIndex streamIndex) override; - -private: - CumulantK17(); - CumulantK17(std::shared_ptr<Parameter> para, int level); -}; - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu deleted file mode 100644 index 13b54723780fa16374b332c731fc35c5664d75b6..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.cu +++ /dev/null @@ -1,47 +0,0 @@ -#include "CumulantK17BulkComp.h" - -#include "CumulantK17BulkComp_Device.cuh" -#include "Parameter/Parameter.h" - -std::shared_ptr<CumulantK17BulkComp> CumulantK17BulkComp::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<CumulantK17BulkComp>(new CumulantK17BulkComp(para, level)); -} - -void CumulantK17BulkComp::run() -{ - int size_Array = para->getParD(level)->size_Array_SP; - int numberOfThreads = para->getParD(level)->numberofthreads; - - int Grid = size_Array / numberOfThreads; - dim3 grid(Grid, 1, 1); - dim3 threads(numberOfThreads, 1, 1); - - LB_Kernel_CumulantK17BulkComp << < grid, threads >> >( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - level, - para->getForcesDev(), - para->getQuadricLimitersDev(), - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_CumulantK17BulkComp execution failed"); -} - -CumulantK17BulkComp::CumulantK17BulkComp(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitCompSP27); - - -} - -CumulantK17BulkComp::CumulantK17BulkComp() -{ -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h deleted file mode 100644 index 94ad8064053360247bba6a7abf940e0ad21625b5..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_K17_BULK_COMP_H -#define CUMULANT_K17_BULK_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK17BulkComp : public KernelImp -{ -public: - static std::shared_ptr<CumulantK17BulkComp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK17BulkComp(); - CumulantK17BulkComp(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h deleted file mode 100644 index af8470b717ad7a98e7a3fcd507976353d9e8bd41..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CUMULANT_K17_UNIFIED_H -#define CUMULANT_K17_UNIFIED_H - -#include "Kernel/KernelImp.h" - -namespace vf -{ -namespace gpu -{ - - -class CumulantK17Unified : public KernelImp -{ -public: - CumulantK17Unified(std::shared_ptr<Parameter> para, int level); - - void run(); -}; - -} -} - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu deleted file mode 100644 index 466b9f85999257196e860e84919ca6ccce6946b7..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.cu +++ /dev/null @@ -1,38 +0,0 @@ -#include "CumulantK17CompChim.h" - -#include "Parameter/Parameter.h" -#include "CumulantK17CompChim_Device.cuh" -#include "cuda/CudaGrid.h" - -std::shared_ptr<CumulantK17CompChim> CumulantK17CompChim::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<CumulantK17CompChim>(new CumulantK17CompChim(para,level)); -} - -void CumulantK17CompChim::run() -{ - LB_Kernel_CumulantK17CompChim <<< cudaGrid.grid, cudaGrid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - level, - para->getIsBodyForce(), - para->getForcesDev(), - para->getParD(level)->forceX_SP, - para->getParD(level)->forceY_SP, - para->getParD(level)->forceZ_SP, - para->getQuadricLimitersDev(), - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_CumulantK17CompChim execution failed"); -} - -CumulantK17CompChim::CumulantK17CompChim(std::shared_ptr<Parameter> para, int level): KernelImp(para, level) -{ - myPreProcessorTypes.push_back(InitCompSP27); - - this->cudaGrid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); -} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h deleted file mode 100644 index 2f8b807c57b26588eed0801bca14afab6b13e7dd..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_K17_COMP_CHIM_H -#define CUMULANT_K17_COMP_CHIM_H - -#include "Kernel/KernelImp.h" - -class CumulantK17CompChim : public KernelImp -{ -public: - static std::shared_ptr<CumulantK17CompChim> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK17CompChim(); - CumulantK17CompChim(std::shared_ptr<Parameter> para, int level); -}; - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h deleted file mode 100644 index 6cffff12643d066d167d19bf9ab2f0c450979d3f..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_K18_COMP_H -#define CUMULANT_K18_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK18Comp : public KernelImp -{ -public: - static std::shared_ptr< CumulantK18Comp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK18Comp(); - CumulantK18Comp(std::shared_ptr< Parameter> para, int level); -}; - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh deleted file mode 100644 index 60a15145e3c117cadb7485f2899ba768b10eb0c1..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp_Device.cuh +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef LB_Kernel_Cumulant_K18_H -#define LB_Kernel_Cumulant_K18_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_CumulantK18Comp( real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - real* F3, - int size_Mat, - int level, - real* forces, - real* quadricLimiters, - bool EvenOrOdd); - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.h deleted file mode 100644 index 24745df47ed75eb3369f41068d49d27702eee461..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CUMULANT_K20_COMP_H -#define CUMULANT_K20_COMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK20Comp : public KernelImp -{ -public: - static std::shared_ptr< CumulantK20Comp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK20Comp(); - CumulantK20Comp(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.h deleted file mode 100644 index 07aba55fd4bad868c919284ebf11846ba8f9ebec..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef MRT_COMP_SP27_H -#define MRT_COMP_SP27_H - -#include "Kernel/KernelImp.h" - - -class MRTCompSP27 : public KernelImp -{ -public: - static std::shared_ptr<MRTCompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - MRTCompSP27(); - MRTCompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.h deleted file mode 100644 index 04308f6919fd15495761d929da06a583457ba0c0..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BGK_INCOMP_SP27_H -#define BGK_INCOMP_SP27_H - -#include "Kernel/KernelImp.h" - - -class BGKIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<BGKIncompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - BGKIncompSP27(); - BGKIncompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu deleted file mode 100644 index 84a55b89d68f9a1e18c5114f8088a7dee24a4cd1..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.cu +++ /dev/null @@ -1,40 +0,0 @@ -#include "BGKPlusIncompSP27.h" - -#include "BGKPlusIncompSP27_Device.cuh" -#include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" - -std::shared_ptr<BGKPlusIncompSP27> BGKPlusIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<BGKPlusIncompSP27>(new BGKPlusIncompSP27(para, level)); -} - -void BGKPlusIncompSP27::run() -{ - vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - - LB_Kernel_BGK_Plus_Incomp_SP_27 <<< grid.grid, grid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_BGK_Plus_Incomp_SP_27 execution failed"); -} - -BGKPlusIncompSP27::BGKPlusIncompSP27(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitSP27); - - -} - -BGKPlusIncompSP27::BGKPlusIncompSP27() -{ -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.h deleted file mode 100644 index c6a1dcaca1ea267738e4a9cec735273ce4ccdb9c..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BGK_PLUS_INCOMP_SP27_H -#define BGK_PLUS_INCOMP_SP27_H - -#include "Kernel/KernelImp.h" - -class BGKPlusIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<BGKPlusIncompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - BGKPlusIncompSP27(); - BGKPlusIncompSP27(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh deleted file mode 100644 index 7f85f3ca29d4d8d7620e2503df9947fd7e42fe8f..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27_Device.cuh +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef LB_KERNEL_BGK_PLUS_INCOMP_SP_27_H -#define LB_KERNEL_BGK_PLUS_INCOMP_SP_27_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_BGK_Plus_Incomp_SP_27(real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - bool EvenOrOdd); - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.h deleted file mode 100644 index 4ebb0c50a642a943defb7a42ce96cba72d03ddf4..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CASCADE_INCOMP_P27_H -#define CASCADE_INCOMP_P27_H - -#include "Kernel/KernelImp.h" - -class CascadeIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<CascadeIncompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CascadeIncompSP27(); - CascadeIncompSP27(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu deleted file mode 100644 index 2cade430786b17567c47264f0638dba259b3192d..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.cu +++ /dev/null @@ -1,45 +0,0 @@ -#include "Cumulant1hIncompSP27.h" - -#include "Cumulant1hIncompSP27_Device.cuh" -#include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" - -std::shared_ptr<Cumulant1hIncompSP27> Cumulant1hIncompSP27::getNewInstance(std::shared_ptr<Parameter> para, int level) -{ - return std::shared_ptr<Cumulant1hIncompSP27>(new Cumulant1hIncompSP27(para, level)); -} - -void Cumulant1hIncompSP27::run() -{ - vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParD(level)->numberofthreads, para->getParD(level)->numberOfNodes); - - LB_Kernel_Cum_1h_Incomp_SP_27 <<< grid.grid, grid.threads >>>( - para->getParD(level)->omega, - para->getParD(level)->deltaPhi, - para->getAngularVelocity(), - para->getParD(level)->typeOfGridNode, - para->getParD(level)->neighborX, - para->getParD(level)->neighborY, - para->getParD(level)->neighborZ, - para->getParD(level)->coordinateX, - para->getParD(level)->coordinateY, - para->getParD(level)->coordinateZ, - para->getParD(level)->distributions.f[0], - para->getParD(level)->numberOfNodes, - para->getParD(level)->isEvenTimestep); - getLastCudaError("LB_Kernel_Cum_1h_Incomp_SP_27 execution failed"); -} - -Cumulant1hIncompSP27::Cumulant1hIncompSP27(std::shared_ptr<Parameter> para, int level) -{ - this->para = para; - this->level = level; - - myPreProcessorTypes.push_back(InitSP27); - - -} - -Cumulant1hIncompSP27::Cumulant1hIncompSP27() -{ -} diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.h deleted file mode 100644 index c6086649dc577afd6a00b684769858deb7d85e20..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CUMULANT_1H_INCOMP_SP27_H -#define CUMULANT_1H_INCOMP_SP27_H - -#include "Kernel/KernelImp.h" - -class Cumulant1hIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<Cumulant1hIncompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - Cumulant1hIncompSP27(); - Cumulant1hIncompSP27(std::shared_ptr< Parameter> para, int level); - -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.h deleted file mode 100644 index 99d2230be843d9acd6ff6e95283e8530a52acbef..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef CUMULANT_ISO_INCOMP_SP27_H -#define CUMULANT_ISO_INCOMP_SP27_H - -#include "Kernel/KernelImp.h" - -class CumulantIsoIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<CumulantIsoIncompSP27> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantIsoIncompSP27(); - CumulantIsoIncompSP27(std::shared_ptr< Parameter> para, int level); - -}; - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.h deleted file mode 100644 index c08737b4331df171efb72594d487da3ea346f8ca..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CUMULANT_K15_INCOMP_H -#define CUMULANT_K15_INCOMP_H - -#include "Kernel/KernelImp.h" - -class CumulantK15Incomp : public KernelImp -{ -public: - static std::shared_ptr<CumulantK15Incomp> getNewInstance(std::shared_ptr< Parameter> para, int level); - void run(); - -private: - CumulantK15Incomp(); - CumulantK15Incomp(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh deleted file mode 100644 index f2b5063f9db6d55b9efb547c0c05d450463e0509..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp_Device.cuh +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef LB_KERNEL_CUMULANT_K15_IMCOMP_H -#define LB_KERNEL_CUMULANT_K15_IMCOMP_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_CumulantK15Incomp(real s9, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - bool EvenOrOdd); - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.h b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.h deleted file mode 100644 index dd467be23b888d0968520f706b3e2dd3da6c3fd7..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef MRT_INCOMP_SP27_H -#define MRT_INCOMP_SP27_H - -#include "Kernel/KernelImp.h" - -class MRTIncompSP27 : public KernelImp -{ -public: - static std::shared_ptr<MRTIncompSP27> getNewInstance(std::shared_ptr<Parameter> para, int level); - void run(); - -private: - MRTIncompSP27(); - MRTIncompSP27(std::shared_ptr< Parameter> para, int level); -}; -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh b/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh deleted file mode 100644 index d3a9fcea7c1a53e4084acf8dc5f1f815d0da967d..0000000000000000000000000000000000000000 --- a/src/gpu/VirtualFluids_GPU/Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27_Device.cuh +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef LB_KERNEL_MRT_INCOMP_SP_27_H -#define LB_KERNEL_MRT_INCOMP_SP_27_H - -#include <DataTypes.h> -#include <curand.h> - -__global__ void LB_Kernel_MRT_Incomp_SP_27(real omega, - unsigned int* bcMatD, - unsigned int* neighborX, - unsigned int* neighborY, - unsigned int* neighborZ, - real* DDStart, - int size_Mat, - bool EvenOrOdd); - -#endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu index a1d9ba6665576c90406eee13084e5133acdb448c..3cc4b33f0b752943c97b1b770c62189a6c17d9c8 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/DistributionHelper.cu @@ -19,33 +19,33 @@ __device__ DistributionWrapper::DistributionWrapper(real *distributions, unsigne __device__ void DistributionWrapper::read() { - distribution.f[vf::lbm::dir::PZZ] = (distribution_references.f[DIR_P00])[k]; - distribution.f[vf::lbm::dir::MZZ] = (distribution_references.f[DIR_M00])[kw]; - distribution.f[vf::lbm::dir::ZPZ] = (distribution_references.f[DIR_0P0])[k]; - distribution.f[vf::lbm::dir::ZMZ] = (distribution_references.f[DIR_0M0])[ks]; - distribution.f[vf::lbm::dir::ZZP] = (distribution_references.f[DIR_00P])[k]; - distribution.f[vf::lbm::dir::ZZM] = (distribution_references.f[DIR_00M])[kb]; - distribution.f[vf::lbm::dir::PPZ] = (distribution_references.f[DIR_PP0])[k]; - distribution.f[vf::lbm::dir::MMZ] = (distribution_references.f[DIR_MM0])[ksw]; - distribution.f[vf::lbm::dir::PMZ] = (distribution_references.f[DIR_PM0])[ks]; - distribution.f[vf::lbm::dir::MPZ] = (distribution_references.f[DIR_MP0])[kw]; - distribution.f[vf::lbm::dir::PZP] = (distribution_references.f[DIR_P0P])[k]; - distribution.f[vf::lbm::dir::MZM] = (distribution_references.f[DIR_M0M])[kbw]; - distribution.f[vf::lbm::dir::PZM] = (distribution_references.f[DIR_P0M])[kb]; - distribution.f[vf::lbm::dir::MZP] = (distribution_references.f[DIR_M0P])[kw]; - distribution.f[vf::lbm::dir::ZPP] = (distribution_references.f[DIR_0PP])[k]; - distribution.f[vf::lbm::dir::ZMM] = (distribution_references.f[DIR_0MM])[kbs]; - distribution.f[vf::lbm::dir::ZPM] = (distribution_references.f[DIR_0PM])[kb]; - distribution.f[vf::lbm::dir::ZMP] = (distribution_references.f[DIR_0MP])[ks]; - distribution.f[vf::lbm::dir::PPP] = (distribution_references.f[DIR_PPP])[k]; - distribution.f[vf::lbm::dir::MPP] = (distribution_references.f[DIR_MPP])[kw]; - distribution.f[vf::lbm::dir::PMP] = (distribution_references.f[DIR_PMP])[ks]; - distribution.f[vf::lbm::dir::MMP] = (distribution_references.f[DIR_MMP])[ksw]; - distribution.f[vf::lbm::dir::PPM] = (distribution_references.f[DIR_PPM])[kb]; - distribution.f[vf::lbm::dir::MPM] = (distribution_references.f[DIR_MPM])[kbw]; - distribution.f[vf::lbm::dir::PMM] = (distribution_references.f[DIR_PMM])[kbs]; - distribution.f[vf::lbm::dir::MMM] = (distribution_references.f[DIR_MMM])[kbsw]; - distribution.f[vf::lbm::dir::ZZZ] = (distribution_references.f[DIR_000])[k]; + distribution.f[vf::lbm::dir::DIR_P00] = (distribution_references.f[DIR_P00])[k]; + distribution.f[vf::lbm::dir::DIR_M00] = (distribution_references.f[DIR_M00])[kw]; + distribution.f[vf::lbm::dir::DIR_0P0] = (distribution_references.f[DIR_0P0])[k]; + distribution.f[vf::lbm::dir::DIR_0M0] = (distribution_references.f[DIR_0M0])[ks]; + distribution.f[vf::lbm::dir::DIR_00P] = (distribution_references.f[DIR_00P])[k]; + distribution.f[vf::lbm::dir::DIR_00M] = (distribution_references.f[DIR_00M])[kb]; + distribution.f[vf::lbm::dir::DIR_PP0] = (distribution_references.f[DIR_PP0])[k]; + distribution.f[vf::lbm::dir::DIR_MM0] = (distribution_references.f[DIR_MM0])[ksw]; + distribution.f[vf::lbm::dir::DIR_PM0] = (distribution_references.f[DIR_PM0])[ks]; + distribution.f[vf::lbm::dir::DIR_MP0] = (distribution_references.f[DIR_MP0])[kw]; + distribution.f[vf::lbm::dir::DIR_P0P] = (distribution_references.f[DIR_P0P])[k]; + distribution.f[vf::lbm::dir::DIR_M0M] = (distribution_references.f[DIR_M0M])[kbw]; + distribution.f[vf::lbm::dir::DIR_P0M] = (distribution_references.f[DIR_P0M])[kb]; + distribution.f[vf::lbm::dir::DIR_M0P] = (distribution_references.f[DIR_M0P])[kw]; + distribution.f[vf::lbm::dir::DIR_0PP] = (distribution_references.f[DIR_0PP])[k]; + distribution.f[vf::lbm::dir::DIR_0MM] = (distribution_references.f[DIR_0MM])[kbs]; + distribution.f[vf::lbm::dir::DIR_0PM] = (distribution_references.f[DIR_0PM])[kb]; + distribution.f[vf::lbm::dir::DIR_0MP] = (distribution_references.f[DIR_0MP])[ks]; + distribution.f[vf::lbm::dir::DIR_PPP] = (distribution_references.f[DIR_PPP])[k]; + distribution.f[vf::lbm::dir::DIR_MPP] = (distribution_references.f[DIR_MPP])[kw]; + distribution.f[vf::lbm::dir::DIR_PMP] = (distribution_references.f[DIR_PMP])[ks]; + distribution.f[vf::lbm::dir::DIR_MMP] = (distribution_references.f[DIR_MMP])[ksw]; + distribution.f[vf::lbm::dir::DIR_PPM] = (distribution_references.f[DIR_PPM])[kb]; + distribution.f[vf::lbm::dir::DIR_MPM] = (distribution_references.f[DIR_MPM])[kbw]; + distribution.f[vf::lbm::dir::DIR_PMM] = (distribution_references.f[DIR_PMM])[kbs]; + distribution.f[vf::lbm::dir::DIR_MMM] = (distribution_references.f[DIR_MMM])[kbsw]; + distribution.f[vf::lbm::dir::DIR_000] = (distribution_references.f[DIR_000])[k]; } __device__ void DistributionWrapper::write() diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp index 7b7b857d5c3ac157445bb154aecfb4dfa9c4b0bc..db803b0b3acc7cbddcc3aacfbf9c9eff594a0f74 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelFactory/KernelFactoryImp.cpp @@ -7,32 +7,32 @@ #include "Kernel/Utilities/KernelTypes.h" //LBM kernel (compressible) -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGK/BGKCompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKUnified/BGKUnified.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/BGKPlus/BGKPlusCompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cascade/CascadeCompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/Cumulant/CumulantCompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Unified/CumulantK17Unified.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17chim/CumulantK17CompChim.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17/CumulantK17.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK17Bulk/CumulantK17BulkComp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantAll4/CumulantAll4CompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK18/CumulantK18Comp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK20/CumulantK20Comp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15/CumulantK15Comp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Unified/CumulantK15Unified.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Bulk/CumulantK15BulkComp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/CumulantK15Sponge/CumulantK15SpongeComp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/MRT/MRTCompSP27.h" +#include "Kernel/Compressible/FluidFlow/B92/B92CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplusUnified.h" +#include "Kernel/Compressible/FluidFlow/B15/B15CompressibleNavierStokesBGKplus.h" +#include "Kernel/Compressible/FluidFlow/M02/M02CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/C06/C06CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/K08/K08CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesBulkViscosity.h" +#include "Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesSponge.h" +#include "Kernel/Compressible/FluidFlow/K15/K15CompressibleNavierStokesUnified.h" +#include "Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesChimeraLegacy.h" +#include "Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesBulkViscosity.h" +#include "Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesUnified.h" +#include "Kernel/Compressible/FluidFlow/K17/K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants.h" +#include "Kernel/Compressible/FluidFlow/K18/K18CompressibleNavierStokes.h" +#include "Kernel/Compressible/FluidFlow/K20/K20CompressibleNavierStokes.h" //LBM kernel (inkompressible) -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGK/BGKIncompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/BGKPlus/BGKPlusIncompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cascade/CascadeIncompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/Cumulant1hSP27/Cumulant1hIncompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantIsoSP27/CumulantIsoIncompSP27.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/CumulantK15/CumulantK15Incomp.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/MRT/MRTIncompSP27.h" +#include "Kernel/Incompressible/FluidFlow/B92/B92IncompressibleNavierStokes.h" +#include "Kernel/Incompressible/FluidFlow/B15/B15IncompressibleNavierStokesBGKplus.h" +#include "Kernel/Incompressible/FluidFlow/C06/C06IncompressibleNavierStokes.h" +#include "Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesRotatingVelocityField.h" +#include "Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokesIsoCheck.h" +#include "Kernel/Incompressible/FluidFlow/K15/K15IncompressibleNavierStokes.h" +#include "Kernel/Incompressible/FluidFlow/M02/M02IncompressibleNavierStokes.h" //advection diffusion kernel (compressible) #include "Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADComp27/ADComp27.h" @@ -52,8 +52,8 @@ #include "Kernel/Kernels/WaleKernels/FluidFlow/Compressible/CumulantK15BySoniMalav/WaleBySoniMalavCumulantK15Comp.h" //strategies -#include "Kernel/Kernels/BasicKernels/FluidFlow/Compressible/FluidFlowCompStrategy.h" -#include "Kernel/Kernels/BasicKernels/FluidFlow/Incompressible/FluidFlowIncompStrategy.h" +#include "Kernel/Compressible/FluidFlow/FluidFlowCompStrategy.h" +#include "Kernel/Incompressible/FluidFlow/FluidFlowIncompStrategy.h" #include "Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod27/ADMod27CompStrategy.h" #include "Kernel/Kernels/BasicKernels/AdvectionDiffusion/Compressible/Mod7/ADMod7CompStrategy.h" #include "Kernel/Kernels/BasicKernels/AdvectionDiffusion/Incompressible/Mod27/ADMod27IncompStrategy.h" @@ -101,49 +101,49 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter> std::shared_ptr<CheckParameterStrategy> checkStrategy; if (kernel == CollisionKernel::Compressible::BGK) { - newKernel = BGKCompSP27::getNewInstance(para, level); // compressible + newKernel = B92CompressibleNavierStokes::getNewInstance(para, level); // compressible checkStrategy = FluidFlowCompStrategy::getInstance(); // || } else if (kernel == CollisionKernel::Compressible::BGKUnified) { // \/ - newKernel = std::make_shared<vf::gpu::BGKUnified>(para, level); + newKernel = std::make_shared<vf::gpu::B15CompressibleNavierStokesBGKplusUnified>(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::BGKPlus) { - newKernel = BGKPlusCompSP27::getNewInstance(para, level); + newKernel = B15CompressibleNavierStokesBGKplus::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::MRT) { - newKernel = MRTCompSP27::getNewInstance(para, level); + newKernel = M02CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::Cascade) { - newKernel = CascadeCompSP27::getNewInstance(para, level); + newKernel = C06CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::CumulantClassic) { - newKernel = CumulantCompSP27::getNewInstance(para, level); + newKernel = K08CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::CumulantK15Unified) { - newKernel = std::make_shared<vf::gpu::CumulantK15Unified>(para, level); + newKernel = std::make_shared<vf::gpu::K15CompressibleNavierStokesUnified>(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK17Unified) { - newKernel = std::make_shared<vf::gpu::CumulantK17Unified>(para, level); + } else if (kernel == CollisionKernel::Compressible::K17CompressibleNavierStokesUnified) { + newKernel = std::make_shared<vf::gpu::K17CompressibleNavierStokesUnified>(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK17Bulk) { - newKernel = CumulantK17BulkComp::getNewInstance(para, level); + } else if (kernel == CollisionKernel::Compressible::K17CompressibleNavierStokesBulkViscosity) { + newKernel = K17CompressibleNavierStokesBulkViscosity::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK17Chim) { - newKernel = CumulantK17CompChim::getNewInstance(para, level); + } else if (kernel == CollisionKernel::Compressible::K17CompressibleNavierStokesChimeraLegacy) { + newKernel = K17CompressibleNavierStokesChimeraLegacy::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK17){ + } else if (kernel == CollisionKernel::Compressible::K17CompressibleNavierStokes){ switch(para->getTurbulenceModel()) { case TurbulenceModel::AMD: - newKernel = CumulantK17<TurbulenceModel::AMD>::getNewInstance(para, level); + newKernel = K17CompressibleNavierStokes<TurbulenceModel::AMD>::getNewInstance(para, level); break; case TurbulenceModel::Smagorinsky: - newKernel = CumulantK17<TurbulenceModel::Smagorinsky>::getNewInstance(para, level); + newKernel = K17CompressibleNavierStokes<TurbulenceModel::Smagorinsky>::getNewInstance(para, level); break; case TurbulenceModel::QR: - newKernel = CumulantK17<TurbulenceModel::QR>::getNewInstance(para, level); + newKernel = K17CompressibleNavierStokes<TurbulenceModel::QR>::getNewInstance(para, level); break; case TurbulenceModel::None: - newKernel = CumulantK17<TurbulenceModel::None>::getNewInstance(para, level); + newKernel = K17CompressibleNavierStokes<TurbulenceModel::None>::getNewInstance(para, level); break; default: throw std::runtime_error("Unknown turbulence model!"); @@ -151,44 +151,44 @@ std::shared_ptr<Kernel> KernelFactoryImp::makeKernel(std::shared_ptr<Parameter> } checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::CumulantAll4SP27) { - newKernel = CumulantAll4CompSP27::getNewInstance(para, level); + newKernel = K17CompressibleNavierStokesSecondDerivatesFrom5thCumulants::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::CumulantK18) { - newKernel = CumulantK18Comp::getNewInstance(para, level); + newKernel = K18CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); } else if (kernel == CollisionKernel::Compressible::CumulantK20) { - newKernel = CumulantK20Comp::getNewInstance(para, level); + newKernel = K20CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK15) { - newKernel = CumulantK15Comp::getNewInstance(para, level); + } else if (kernel == CollisionKernel::Compressible::K15CompressibleNavierStokes) { + newKernel = K15CompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK15Bulk) { - newKernel = CumulantK15BulkComp::getNewInstance(para, level); + } else if (kernel == CollisionKernel::Compressible::K15CompressibleNavierStokesBulk) { + newKernel = K15CompressibleNavierStokesBulkViscosity::getNewInstance(para, level); checkStrategy = FluidFlowCompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Compressible::CumulantK15Sponge) { // /\ // - newKernel = CumulantK15SpongeComp::getNewInstance(para, level); // || + } else if (kernel == CollisionKernel::Compressible::K15CompressibleNavierStokesSponge) { // /\ // + newKernel = K15CompressibleNavierStokesSponge::getNewInstance(para, level); // || checkStrategy = FluidFlowCompStrategy::getInstance(); // compressible } //=============== else if ( kernel == CollisionKernel::Incompressible::BGK) { // incompressible - newKernel = BGKIncompSP27::getNewInstance(para, level); // || + newKernel = B92IncompressibleNavierStokes::getNewInstance(para, level); // || checkStrategy = FluidFlowIncompStrategy::getInstance(); // \/ } else if (kernel == CollisionKernel::Incompressible::BGKPlus) { - newKernel = BGKPlusIncompSP27::getNewInstance(para, level); + newKernel = B15IncompressibleNavierStokesBGKplus::getNewInstance(para, level); checkStrategy = FluidFlowIncompStrategy::getInstance(); } else if (kernel == CollisionKernel::Incompressible::MRT) { - newKernel = MRTIncompSP27::getNewInstance(para, level); + newKernel = M02IncompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowIncompStrategy::getInstance(); } else if (kernel == CollisionKernel::Incompressible::Cascade) { - newKernel = CascadeIncompSP27::getNewInstance(para, level); + newKernel = C06IncompressibleNavierStokes::getNewInstance(para, level); checkStrategy = FluidFlowIncompStrategy::getInstance(); } else if (kernel == CollisionKernel::Incompressible::Cumulant1h) { - newKernel = Cumulant1hIncompSP27::getNewInstance(para, level); - checkStrategy = FluidFlowIncompStrategy::getInstance(); - } else if (kernel == CollisionKernel::Incompressible::CumulantIsometric) { - newKernel = CumulantIsoIncompSP27::getNewInstance(para, level); + newKernel = K15IncompressibleNavierStokesRotatingVelocityField::getNewInstance(para, level); checkStrategy = FluidFlowIncompStrategy::getInstance(); + //} else if (kernel == CollisionKernel::Incompressible::CumulantIsometric) { + // newKernel = K15IncompressibleNavierStokesIsoTest::getNewInstance(para, level); + // checkStrategy = FluidFlowIncompStrategy::getInstance(); } else if (kernel == CollisionKernel::Incompressible::CumulantK15) { // /\ // - newKernel = CumulantK15Incomp::getNewInstance(para, level); // || + newKernel = K15IncompressibleNavierStokes::getNewInstance(para, level); // || checkStrategy = FluidFlowIncompStrategy::getInstance(); // incompressible } //=============== else if (kernel == CollisionKernel::PorousMedia::CumulantOne) { // porous media diff --git a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h index f249c0bd595d21455b4338334763be4e08abeda9..fd502fbeadf6d9445a786a8567dee1677557365f 100644 --- a/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h +++ b/src/gpu/VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h @@ -11,20 +11,20 @@ namespace vf::CollisionKernel::Compressible { static const std::string CumulantClassic = "CumulantCompSP27"; static const std::string CumulantK15Unified = "CumulantK15Unified"; - static const std::string CumulantK17Unified = "CumulantK17Unified"; + static const std::string K17CompressibleNavierStokesUnified = "K17CompressibleNavierStokesUnified"; - static const std::string CumulantK17Bulk = "CumulantK17BulkComp"; - static const std::string CumulantK17Chim = "CumulantK17CompChim"; - static const std::string CumulantK17 = "CumulantK17"; + static const std::string K17CompressibleNavierStokes = "K17CompressibleNavierStokes"; + static const std::string K17CompressibleNavierStokesBulkViscosity = "K17CompressibleNavierStokesBulkViscosity"; + static const std::string K17CompressibleNavierStokesChimeraLegacy = "K17CompressibleNavierStokesChimeraLegacy"; static const std::string CumulantAll4SP27 = "CumulantAll4CompSP27"; static const std::string CumulantK18 = "CumulantK18Comp"; static const std::string CumulantK20 = "CumulantK20Comp"; - static const std::string CumulantK15 = "CumulantK15Comp"; - static const std::string CumulantK15Bulk = "CumulantK15BulkComp"; - static const std::string CumulantK15Sponge = "CumulantK15SpongeComp"; -} + static const std::string K15CompressibleNavierStokes = "K15CompressibleNavierStokes"; + static const std::string K15CompressibleNavierStokesBulk = "K15CompressibleNavierStokesBulk"; + static const std::string K15CompressibleNavierStokesSponge = "K15CompressibleNavierStokesSponge"; + } namespace vf::CollisionKernel::Incompressible { static const std::string BGK = "BGKIncompSP27"; diff --git a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp index e8fc3f318c920be36be7861a28659124a7b1e977..1c1e65fa34720a1f9d19b5ef02e4afda167b323f 100644 --- a/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp +++ b/src/gpu/VirtualFluids_GPU/KernelManager/BCKernelManager.cpp @@ -415,7 +415,7 @@ void BCKernelManager::runPrecursorBCKernelPost(int level, uint t, CudaMemoryMana para->getParD(level)->precursorBC.current = para->getParD(level)->precursorBC.next; para->getParD(level)->precursorBC.next = tmp; - real loadTime = nextTime*pow(2,-level)*para->getTimeRatio(); + real loadTime = nextTime*exp2(-level)*para->getTimeRatio(); for(auto reader : para->getParH(level)->transientBCInputFileReader) { diff --git a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/KernelUtilities.h b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/KernelUtilities.h index 5541bc54597ea02c5e3e89d00169b6eb6ff6564b..ebd1b8ab367b31c62fc1608b39215622819d35d9 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/KernelUtilities.h +++ b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/KernelUtilities.h @@ -34,8 +34,11 @@ #define KERNEL_UTILITIES_H #include "LBM/LB.h" -#include "lbm/constants/D3Q27.h" -#include "basics/constants/NumericConstants.h" + +#include <cassert> + +#include <lbm/constants/D3Q27.h> +#include <basics/constants/NumericConstants.h> using namespace vf::basics::constant; using namespace vf::lbm::dir; @@ -201,6 +204,125 @@ __inline__ __device__ bool isValidFluidNode(uint nodeType) } +struct ListIndices +{ + __device__ ListIndices() {} + __device__ ListIndices(unsigned int k, unsigned int* neighborX, unsigned int* neighborY, unsigned int* neighborZ) + { + k_000 = k; + k_M00 = neighborX[k_000]; + k_0M0 = neighborY[k_000]; + k_00M = neighborZ[k_000]; + k_MM0 = neighborY[k_M00]; + k_M0M = neighborZ[k_M00]; + k_0MM = neighborZ[k_0M0]; + k_MMM = neighborZ[k_MM0]; + } + + unsigned int k_000 { 0 }; + unsigned int k_M00 { 0 }; + unsigned int k_0M0 { 0 }; + unsigned int k_00M { 0 }; + unsigned int k_MM0 { 0 }; + unsigned int k_M0M { 0 }; + unsigned int k_0MM { 0 }; + unsigned int k_MMM { 0 }; +}; + + +//////////////////////////////////////////////////////////////////////////////////// +//! - Read distributions: style of reading and writing the distributions from/to +//! stored arrays dependent on timestep is based on the esoteric twist algorithm +//! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), +//! DOI:10.3390/computation5020019 ]</b></a> +__device__ __inline__ void read(real *f, const Distributions27 &dist, const ListIndices &indices) +{ + f[DIR_000] = (dist.f[DIR_000])[indices.k_000]; + f[DIR_P00] = (dist.f[DIR_P00])[indices.k_000]; + f[DIR_M00] = (dist.f[DIR_M00])[indices.k_M00]; + f[DIR_0P0] = (dist.f[DIR_0P0])[indices.k_000]; + f[DIR_0M0] = (dist.f[DIR_0M0])[indices.k_0M0]; + f[DIR_00P] = (dist.f[DIR_00P])[indices.k_000]; + f[DIR_00M] = (dist.f[DIR_00M])[indices.k_00M]; + f[DIR_PP0] = (dist.f[DIR_PP0])[indices.k_000]; + f[DIR_MM0] = (dist.f[DIR_MM0])[indices.k_MM0]; + f[DIR_PM0] = (dist.f[DIR_PM0])[indices.k_0M0]; + f[DIR_MP0] = (dist.f[DIR_MP0])[indices.k_M00]; + f[DIR_P0P] = (dist.f[DIR_P0P])[indices.k_000]; + f[DIR_M0M] = (dist.f[DIR_M0M])[indices.k_M0M]; + f[DIR_P0M] = (dist.f[DIR_P0M])[indices.k_00M]; + f[DIR_M0P] = (dist.f[DIR_M0P])[indices.k_M00]; + f[DIR_0PP] = (dist.f[DIR_0PP])[indices.k_000]; + f[DIR_0MM] = (dist.f[DIR_0MM])[indices.k_0MM]; + f[DIR_0PM] = (dist.f[DIR_0PM])[indices.k_00M]; + f[DIR_0MP] = (dist.f[DIR_0MP])[indices.k_0M0]; + f[DIR_PPP] = (dist.f[DIR_PPP])[indices.k_000]; + f[DIR_MPP] = (dist.f[DIR_MPP])[indices.k_M00]; + f[DIR_PMP] = (dist.f[DIR_PMP])[indices.k_0M0]; + f[DIR_MMP] = (dist.f[DIR_MMP])[indices.k_MM0]; + f[DIR_PPM] = (dist.f[DIR_PPM])[indices.k_00M]; + f[DIR_MPM] = (dist.f[DIR_MPM])[indices.k_M0M]; + f[DIR_PMM] = (dist.f[DIR_PMM])[indices.k_0MM]; + f[DIR_MMM] = (dist.f[DIR_MMM])[indices.k_MMM]; +} + +__device__ __inline__ void readInverse(real *f, const Distributions27 &dist, const ListIndices &indices) +{ + //TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/101 + assert((false) || !fprintf(stderr, "Not implemented yet.\n")); +} + + +//////////////////////////////////////////////////////////////////////////////////// +//! - Write distributions: style of reading and writing the distributions from/to +//! stored arrays dependent on timestep is based on the esoteric twist algorithm +//! <a href="https://doi.org/10.3390/computation5020019"><b>[ M. Geier et al. (2017), +//! DOI:10.3390/computation5020019 ]</b></a> +__inline__ __device__ void write(Distributions27 &destination, const ListIndices &indices, const real* f) +{ + (destination.f[DIR_000])[indices.k_000] = f[DIR_000]; + (destination.f[DIR_P00])[indices.k_000] = f[DIR_P00]; + (destination.f[DIR_M00])[indices.k_M00] = f[DIR_M00]; + (destination.f[DIR_0P0])[indices.k_000] = f[DIR_0P0]; + (destination.f[DIR_0M0])[indices.k_0M0] = f[DIR_0M0]; + (destination.f[DIR_00P])[indices.k_000] = f[DIR_00P]; + (destination.f[DIR_00M])[indices.k_00M] = f[DIR_00M]; + (destination.f[DIR_PP0])[indices.k_000] = f[DIR_PP0]; + (destination.f[DIR_MM0])[indices.k_MM0] = f[DIR_MM0]; + (destination.f[DIR_PM0])[indices.k_0M0] = f[DIR_PM0]; + (destination.f[DIR_MP0])[indices.k_M00] = f[DIR_MP0]; + (destination.f[DIR_P0P])[indices.k_000] = f[DIR_P0P]; + (destination.f[DIR_M0M])[indices.k_M0M] = f[DIR_M0M]; + (destination.f[DIR_P0M])[indices.k_00M] = f[DIR_P0M]; + (destination.f[DIR_M0P])[indices.k_M00] = f[DIR_M0P]; + (destination.f[DIR_0PP])[indices.k_000] = f[DIR_0PP]; + (destination.f[DIR_0MM])[indices.k_0MM] = f[DIR_0MM]; + (destination.f[DIR_0PM])[indices.k_00M] = f[DIR_0PM]; + (destination.f[DIR_0MP])[indices.k_0M0] = f[DIR_0MP]; + (destination.f[DIR_PPP])[indices.k_000] = f[DIR_PPP]; + (destination.f[DIR_MPP])[indices.k_M00] = f[DIR_MPP]; + (destination.f[DIR_PMP])[indices.k_0M0] = f[DIR_PMP]; + (destination.f[DIR_MMP])[indices.k_MM0] = f[DIR_MMP]; + (destination.f[DIR_PPM])[indices.k_00M] = f[DIR_PPM]; + (destination.f[DIR_MPM])[indices.k_M0M] = f[DIR_MPM]; + (destination.f[DIR_PMM])[indices.k_0MM] = f[DIR_PMM]; + (destination.f[DIR_MMM])[indices.k_MMM] = f[DIR_MMM]; +} + +__inline__ __device__ void writeInverse(Distributions27 &destination, const ListIndices &indices, const real* f) +{ + //TODO: https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/101 + assert((false) || !fprintf(stderr, "Not implemented yet.\n")); +} + + + + +__inline__ __device__ real calculateOmega(const real omega_old, real turbulenceViscosity) +{ + return omega_old / (c1o1 + c3o1 * omega_old * turbulenceViscosity); +} + } #endif diff --git a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h index a7c1390c728df1d0ca83424fb7f9f4fb09faba65..606f6b38b4f50ebc621cce23f05c2d54091934f9 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h +++ b/src/gpu/VirtualFluids_GPU/LBM/GPUHelperFunctions/ScalingUtilities.h @@ -33,9 +33,15 @@ #ifndef SCALING_HELPER_FUNCTIONS_H #define SCALING_HELPER_FUNCTIONS_H -#include "LBM/LB.h" -#include "lbm/constants/D3Q27.h" -#include "basics/constants/NumericConstants.h" +#include "LBM/GPUHelperFunctions/KernelUtilities.h" + +#include <basics/constants/NumericConstants.h> + +#include <lbm/constants/D3Q27.h> +#include <lbm/KernelParameter.h> +#include <basics/DataTypes.h> + +#include <lbm/refinement/Coefficients.h> using namespace vf::basics::constant; using namespace vf::lbm::dir; @@ -43,94 +49,196 @@ using namespace vf::lbm::dir; namespace vf::gpu { -__device__ __inline__ void calculateMomentsOnSourceNodes(Distributions27 &dist, real &omega, unsigned int &k_000, - unsigned int &k_M00, unsigned int &k_0M0, unsigned int &k_00M, - unsigned int &k_MM0, unsigned int &k_M0M, unsigned int &k_0MM, - unsigned int &k_MMM, real &drho, real &velocityX, - real &velocityY, real &velocityZ, real &kxyFromfcNEQ, - real &kyzFromfcNEQ, real &kxzFromfcNEQ, real &kxxMyyFromfcNEQ, - real &kxxMzzFromfcNEQ) +template<bool hasTurbulentViscosity> __device__ void calculateMomentSet( + vf::lbm::MomentsOnSourceNodeSet& momentsSet, + const unsigned nodeIndex, + real *distribution, + unsigned int *neighborX, + unsigned int *neighborY, + unsigned int *neighborZ, + unsigned int *indices_MMM, + real* turbulentViscosity, + unsigned long long numberOfLBnodes, + const real omega, + bool isEvenTimestep +) { - //////////////////////////////////////////////////////////////////////////////////// - //! - Set local distributions (f's) on source nodes: - //! - real f_000 = (dist.f[DIR_000])[k_000]; - real f_P00 = (dist.f[DIR_P00])[k_000]; - real f_M00 = (dist.f[DIR_M00])[k_M00]; - real f_0P0 = (dist.f[DIR_0P0])[k_000]; - real f_0M0 = (dist.f[DIR_0M0])[k_0M0]; - real f_00P = (dist.f[DIR_00P])[k_000]; - real f_00M = (dist.f[DIR_00M])[k_00M]; - real f_PP0 = (dist.f[DIR_PP0])[k_000]; - real f_MM0 = (dist.f[DIR_MM0])[k_MM0]; - real f_PM0 = (dist.f[DIR_PM0])[k_0M0]; - real f_MP0 = (dist.f[DIR_MP0])[k_M00]; - real f_P0P = (dist.f[DIR_P0P])[k_000]; - real f_M0M = (dist.f[DIR_M0M])[k_M0M]; - real f_P0M = (dist.f[DIR_P0M])[k_00M]; - real f_M0P = (dist.f[DIR_M0P])[k_M00]; - real f_0PP = (dist.f[DIR_0PP])[k_000]; - real f_0MM = (dist.f[DIR_0MM])[k_0MM]; - real f_0PM = (dist.f[DIR_0PM])[k_00M]; - real f_0MP = (dist.f[DIR_0MP])[k_0M0]; - real f_PPP = (dist.f[DIR_PPP])[k_000]; - real f_MPP = (dist.f[DIR_MPP])[k_M00]; - real f_PMP = (dist.f[DIR_PMP])[k_0M0]; - real f_MMP = (dist.f[DIR_MMP])[k_MM0]; - real f_PPM = (dist.f[DIR_PPM])[k_00M]; - real f_MPM = (dist.f[DIR_MPM])[k_M0M]; - real f_PMM = (dist.f[DIR_PMM])[k_0MM]; - real f_MMM = (dist.f[DIR_MMM])[k_MMM]; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Calculate density and velocity using pyramid summation for low round-off errors as in Eq. (J1)-(J3) \ref - //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), - //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> - //! - drho = ((((f_PPP + f_MMM) + (f_MPM + f_PMP)) + ((f_MPP + f_PMM) + (f_MMP + f_PPM))) + - (((f_0MP + f_0PM) + (f_0MM + f_0PP)) + ((f_M0P + f_P0M) + (f_M0M + f_P0P)) + - ((f_MP0 + f_PM0) + (f_MM0 + f_PP0))) + - ((f_M00 + f_P00) + (f_0M0 + f_0P0) + (f_00M + f_00P))) + - f_000; - - real oneOverRho = c1o1 / (c1o1 + drho); - - velocityX = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_PMM - f_MPP) + (f_PPM - f_MMP))) + - (((f_P0M - f_M0P) + (f_P0P - f_M0M)) + ((f_PM0 - f_MP0) + (f_PP0 - f_MM0))) + (f_P00 - f_M00)) * - oneOverRho; - velocityY = ((((f_PPP - f_MMM) + (f_MPM - f_PMP)) + ((f_MPP - f_PMM) + (f_PPM - f_MMP))) + - (((f_0PM - f_0MP) + (f_0PP - f_0MM)) + ((f_MP0 - f_PM0) + (f_PP0 - f_MM0))) + (f_0P0 - f_0M0)) * - oneOverRho; - velocityZ = ((((f_PPP - f_MMM) + (f_PMP - f_MPM)) + ((f_MPP - f_PMM) + (f_MMP - f_PPM))) + - (((f_0MP - f_0PM) + (f_0PP - f_0MM)) + ((f_M0P - f_P0M) + (f_P0P - f_M0M))) + (f_00P - f_00M)) * - oneOverRho; - - //////////////////////////////////////////////////////////////////////////////////// - //! - Calculate second order moments for interpolation + real omega_ = omega; + Distributions27 distFine; + getPointersToDistributions(distFine, distribution, numberOfLBnodes, isEvenTimestep); + + ListIndices indices; + + ////////////////////////////////////////////////////////////////////////// + //! - Calculate moments for each source node //! - // example: kxxMzz: moment, second derivative in x direction minus the second derivative in z direction - kxyFromfcNEQ = -c3o1 * omega * - ((f_MM0 + f_MMM + f_MMP - f_MP0 - f_MPM - f_MPP - f_PM0 - f_PMM - f_PMP + f_PP0 + f_PPM + f_PPP) / - (c1o1 + drho) - - ((velocityX * velocityY))); - kyzFromfcNEQ = -c3o1 * omega * - ((f_0MM + f_PMM + f_MMM - f_0MP - f_PMP - f_MMP - f_0PM - f_PPM - f_MPM + f_0PP + f_PPP + f_MPP) / - (c1o1 + drho) - - ((velocityY * velocityZ))); - kxzFromfcNEQ = -c3o1 * omega * - ((f_M0M + f_MMM + f_MPM - f_M0P - f_MMP - f_MPP - f_P0M - f_PMM - f_PPM + f_P0P + f_PMP + f_PPP) / - (c1o1 + drho) - - ((velocityX * velocityZ))); - kxxMyyFromfcNEQ = -c3o2 * omega * - ((f_M0M + f_M00 + f_M0P - f_0MM - f_0M0 - f_0MP - f_0PM - f_0P0 - f_0PP + f_P0M + f_P00 + f_P0P) / - (c1o1 + drho) - - ((velocityX * velocityX - velocityY * velocityY))); - kxxMzzFromfcNEQ = -c3o2 * omega * - ((f_MM0 + f_M00 + f_MP0 - f_0MM - f_0MP - f_00M - f_00P - f_0PM - f_0PP + f_PM0 + f_P00 + f_PP0) / - (c1o1 + drho) - - ((velocityX * velocityX - velocityZ * velocityZ))); + ////////////////////////////////////////////////////////////////////////// + // source node BSW = MMM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors + unsigned int k_base_000 = indices_MMM[nodeIndex]; + unsigned int k_base_M00 = neighborX [k_base_000]; + unsigned int k_base_0M0 = neighborY [k_base_000]; + unsigned int k_base_00M = neighborZ [k_base_000]; + unsigned int k_base_MM0 = neighborY [k_base_M00]; + unsigned int k_base_M0M = neighborZ [k_base_M00]; + unsigned int k_base_0MM = neighborZ [k_base_0M0]; + unsigned int k_base_MMM = neighborZ [k_base_MM0]; + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + real f_fine[27]; + + read(f_fine, distFine, indices); + momentsSet.calculateMMM(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node TSW = MMP + ////////////////////////////////////////////////////////////////////////// + // Set neighbor indices - has to be recalculated for the new source node + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZ[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZ[indices.k_M0M]; + indices.k_0MM = neighborZ[indices.k_0MM]; + indices.k_MMM = neighborZ[indices.k_MMM]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculateMMP(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node TSE = PMP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborX[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborX[indices.k_MM0]; + indices.k_M0M = neighborX[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborX[indices.k_MMM]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculatePMP(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node BSE = PMM + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborX[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborX[k_base_MM0]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculatePMM(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node BNW = MPM + ////////////////////////////////////////////////////////////////////////// + // index of the base node and its neighbors --> indices of all source nodes + k_base_000 = k_base_0M0; + k_base_M00 = k_base_MM0; + k_base_0M0 = neighborY[k_base_0M0]; + k_base_00M = k_base_0MM; + k_base_MM0 = neighborY[k_base_MM0]; + k_base_M0M = k_base_MMM; + k_base_0MM = neighborY[k_base_0MM]; + k_base_MMM = neighborY[k_base_MMM]; + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = k_base_000; + indices.k_M00 = k_base_M00; + indices.k_0M0 = k_base_0M0; + indices.k_00M = k_base_00M; + indices.k_MM0 = k_base_MM0; + indices.k_M0M = k_base_M0M; + indices.k_0MM = k_base_0MM; + indices.k_MMM = k_base_MMM; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculateMPM(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node TNW = MPP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_00M; + indices.k_M00 = indices.k_M0M; + indices.k_0M0 = indices.k_0MM; + indices.k_00M = neighborZ[indices.k_00M]; + indices.k_MM0 = indices.k_MMM; + indices.k_M0M = neighborZ[indices.k_M0M]; + indices.k_0MM = neighborZ[indices.k_0MM]; + indices.k_MMM = neighborZ[indices.k_MMM]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculateMPP(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node TNE = PPP + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_000 = indices.k_M00; + indices.k_M00 = neighborX[indices.k_M00]; + indices.k_0M0 = indices.k_MM0; + indices.k_00M = indices.k_M0M; + indices.k_MM0 = neighborX[indices.k_MM0]; + indices.k_M0M = neighborX[indices.k_M0M]; + indices.k_0MM = indices.k_MMM; + indices.k_MMM = neighborX[indices.k_MMM]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculatePPP(f_fine, omega_); + + ////////////////////////////////////////////////////////////////////////// + // source node BNE = PPM + ////////////////////////////////////////////////////////////////////////// + // index + indices.k_00M = indices.k_000; + indices.k_M0M = indices.k_M00; + indices.k_0MM = indices.k_0M0; + indices.k_MMM = indices.k_MM0; + indices.k_000 = k_base_M00; + indices.k_M00 = neighborX[k_base_M00]; + indices.k_0M0 = k_base_MM0; + indices.k_MM0 = neighborX[k_base_MM0]; + + omega_ = hasTurbulentViscosity ? calculateOmega(omega, turbulentViscosity[indices.k_000]) : omega; + + read(f_fine, distFine, indices); + momentsSet.calculatePPM(f_fine, omega_); } -} // namespace vf::gpu +} #endif diff --git a/src/gpu/VirtualFluids_GPU/LBM/LB.h b/src/gpu/VirtualFluids_GPU/LBM/LB.h index a5ae5f5ceef213e8ec9b2306106035a09b1ffd0d..5da2a2a82c59d9a70e26849d4ee413b7c6e8f1d3 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/LB.h +++ b/src/gpu/VirtualFluids_GPU/LBM/LB.h @@ -107,47 +107,59 @@ constexpr std::initializer_list<CollisionTemplate> bulk_CollisionTemplate = { Co //Interface Cells // example of old names (pre 2023) ICellCFC: interpolation from Coarse (C) to Fine (F), indices of the Coarse cells (C) -typedef struct ICells{ +struct ICells +{ uint* fineCellIndices; uint* coarseCellIndices; uint numberOfCells; -} InterpolationCells; +}; + +using InterpolationCells = ICells; //! \brief stores location of neighboring cell (necessary for refinement into the wall) -typedef struct ICellNeigh{ +struct ICellNeigh +{ real* x; real* y; real* z; -} InterpolationCellNeighbor; +}; -// Distribution functions g 6 -typedef struct Distri6 { // ADD IN FUTURE RELEASE +using InterpolationCellNeighbor = ICellNeigh; + +// ADD IN FUTURE RELEASE +struct Distributions6 +{ real* g[6]; -} Distributions6; +}; -// Distribution functions f 7 -typedef struct Distri7{ // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct Distributions7 +{ real* f[7]; -} Distributions7; +}; -// Distribution functions f 19 -typedef struct Distri19{ // DEPRECATED +// DEPRECATED +struct Distributions19 +{ real* f[19]; -} Distributions19; +}; -// Distribution functions f 27 -typedef struct Distri27{ +struct Distributions27 +{ real* f[27]; -} Distributions27, DistributionReferences27; +}; -// Subgrid distances q 27 -typedef struct SubgridDist27{ +using DistributionReferences27 = Distributions27; + +struct SubgridDistances27 +{ real* q[27]; -} SubgridDistances27; +}; //Q for second order BCs //! \struct to manage sub-grid-distances (q) for second order Boundary Conditions (BCs) -typedef struct QforBC{ +struct QforBoundaryConditions +{ int* k; int* kN; long long* valueQ; @@ -160,13 +172,15 @@ typedef struct QforBC{ real *Vx1, *Vy1, *Vz1; real *deltaVz, *RhoBC; real *normalX, *normalY, *normalZ; -}QforBoundaryConditions; +}; -typedef struct QforPrecursorBC{ +struct QforPrecursorBoundaryConditions +{ int* k; int numberOfBCnodes=0; int sizeQ; int numberOfPrecursorNodes=0; + uint streamIndex=0; uint nPrecursorReads=0; uint timeStepsBetweenReads; size_t numberOfQuantities; @@ -175,34 +189,38 @@ typedef struct QforPrecursorBC{ real* weights0PP, *weights0PM, *weights0MP, *weights0MM; real* last, *current, *next; real velocityX, velocityY, velocityZ; -}QforPrecursorBoundaryConditions; +}; -//BCTemp -typedef struct TempforBC{ // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct TempforBoundaryConditions +{ int* k; real* temp; int kTemp=0; -}TempforBoundaryConditions; +}; -//BCTempVel -typedef struct TempVelforBC{ // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct TempVelforBoundaryConditions +{ int* k; real* temp; real* tempPulse; real* velo; int kTemp=0; -}TempVelforBoundaryConditions; +}; -//BCTempPress -typedef struct TempPressforBC{ // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct TempPressforBoundaryConditions +{ int* k; real* temp; real* velo; int kTemp=0; -}TempPressforBoundaryConditions; +}; // Settings for wall model used in StressBC -typedef struct WMparas{ +struct WallModelParameters +{ real* z0; int* samplingOffset; bool hasMonitor; @@ -210,11 +228,12 @@ typedef struct WMparas{ real* Fx; real* Fy; real* Fz; -}WallModelParameters; +}; -//measurePoints -typedef struct MeasP{ // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct MeasurePoints +{ std::string name; uint k; std::vector<real> Vx; @@ -225,10 +244,11 @@ typedef struct MeasP{ // ADD IN FUTURE RELEASE //real* Vy; //real* Vz; //real* Rho; -}MeasurePoints; +}; + -//Process Neighbors -typedef struct PN27{ +struct ProcessNeighbor27 +{ real* f[27]; uint memsizeFs; int* index; @@ -236,9 +256,11 @@ typedef struct PN27{ uint rankNeighbor; int numberOfNodes; int numberOfFs; -}ProcessNeighbor27; +}; -typedef struct PN_F3 { // ADD IN FUTURE RELEASE +// ADD IN FUTURE RELEASE +struct ProcessNeighborF3 +{ real* g[6]; uint memsizeGs; int* index; @@ -246,10 +268,11 @@ typedef struct PN_F3 { // ADD IN FUTURE RELEASE uint rankNeighbor; int numberOfNodes; int numberOfGs; -}ProcessNeighborF3; +}; -//path line particles // DEPRECATED -typedef struct PLP{ +// DEPRECATED +struct PathLineParticles +{ bool *stuck, *hot; real *coordXabsolut, *coordYabsolut, *coordZabsolut; real *coordXlocal, *coordYlocal, *coordZlocal; @@ -260,13 +283,12 @@ typedef struct PLP{ uint *cellBaseID; uint numberOfParticles, numberOfTimestepsParticles; uint memSizeID, memSizeTimestep, memSizerealAll, memSizereal, memSizeBool, memSizeBoolBC; -}PathLineParticles; +}; ////////////////////////////////////////////////////////////////////////// // DEPRECATED -inline int vectorPosition(int i, int j, int k, int Lx, int Ly ) +inline int vectorPosition(int i, int j, int k, int Lx, int Ly) { - //return((j+15)*(Lx+2*16)+(i+15)); return((Lx+2*STARTOFFX)*((Ly+2*STARTOFFY)*(k+STARTOFFZ)+(j+STARTOFFY))+(i+STARTOFFX)); } ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp index 55c0250223901a94d03bd1e65bbb72438bcc99c3..eb4e4f7bec0a23d4658825f26c26bdb637cb0c58 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp @@ -4,10 +4,8 @@ #include <helper_timer.h> - #include "Factories/GridScalingFactory.h" #include "LBM/LB.h" -#include "Communication/Communicator.h" #include "Communication/ExchangeData27.h" #include "Parameter/Parameter.h" #include "Parameter/CudaStreamManager.h" @@ -58,11 +56,12 @@ #include "Kernel/Utilities/KernelFactory/KernelFactoryImp.h" #include "Kernel/Kernel.h" #include "TurbulenceModels/TurbulenceModelFactory.h" -#include <cuda/DeviceInfo.h> -#include <logger/Logger.h> +#include <cuda_helper/DeviceInfo.h> +#include <logger/Logger.h> +#include <parallel/Communicator.h> std::string getFileName(const std::string& fname, int step, int myID) { @@ -70,7 +69,7 @@ std::string getFileName(const std::string& fname, int step, int myID) } Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, - vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory) + vf::parallel::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory) : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), preProcessorFactory(std::make_shared<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) { @@ -79,7 +78,7 @@ Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemo } Simulation::Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, - vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory) + vf::parallel::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory) : para(para), cudaMemoryManager(memoryManager), communicator(communicator), kernelFactory(std::make_unique<KernelFactoryImp>()), preProcessorFactory(std::make_shared<PreProcessorFactoryImp>()), dataWriter(std::make_unique<FileWriter>()) { @@ -90,8 +89,7 @@ void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFa { gridProvider.initalGridInformations(); - vf::cuda::verifyAndSetDevice( - communicator.mapCudaDevice(para->getMyProcessID(), para->getNumprocs(), para->getDevices(), para->getMaxDev())); + vf::cuda::verifyAndSetDevice(communicator.mapCudaDevicesOnHosts(para->getDevices(), para->getMaxDev())); para->initLBMSimulationParameter(); @@ -139,9 +137,8 @@ void Simulation::init(GridProvider &gridProvider, BoundaryConditionFactory *bcFa ////////////////////////////////////////////////////////////////////////// // CUDA streams if (para->getUseStreams()) { - para->getStreamManager()->registerStream(CudaStreamIndex::SubDomainBorder); - para->getStreamManager()->registerStream(CudaStreamIndex::Bulk); - para->getStreamManager()->launchStreams(); + para->getStreamManager()->registerAndLaunchStream(CudaStreamIndex::SubDomainBorder); + para->getStreamManager()->registerAndLaunchStream(CudaStreamIndex::Bulk); para->getStreamManager()->createCudaEvents(); } ////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h index ba2a321707db4138aee9e1c30bae4dede017a5b8..146ab4cf6aebe395bff695f3e99aa7b6b1e776d3 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.h +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.h @@ -6,11 +6,13 @@ #include <PointerDefinitions.h> -#include "Utilities/Buffer2D.hpp" #include "LBM/LB.h" +#include "Utilities/Buffer2D.hpp" - -namespace vf::gpu { class Communicator; } +namespace vf::parallel +{ +class Communicator; +} class CudaMemoryManager; class Parameter; @@ -37,9 +39,9 @@ class Simulation { public: Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, - vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory = nullptr); + vf::parallel::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, GridScalingFactory* scalingFactory = nullptr); Simulation(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> memoryManager, - vf::gpu::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory = nullptr); + vf::parallel::Communicator &communicator, GridProvider &gridProvider, BoundaryConditionFactory* bcFactory, SPtr<TurbulenceModelFactory> tmFactory, GridScalingFactory* scalingFactory = nullptr); ~Simulation(); void run(); @@ -76,7 +78,7 @@ private: Buffer2D <int> geo_rbuf_b; - vf::gpu::Communicator& communicator; + vf::parallel::Communicator& communicator; SPtr<Parameter> para; std::shared_ptr<DataWriter> dataWriter; std::shared_ptr<CudaMemoryManager> cudaMemoryManager; diff --git a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.cu b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.cu index e5062a8ec63940ab6e23e567c0674681d4af6509..df6b2e6623977331bf4b64f2ea798deb7700020f 100644 --- a/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.cu +++ b/src/gpu/VirtualFluids_GPU/Output/DistributionDebugInspector.cu @@ -37,7 +37,7 @@ #include "basics/constants/NumericConstants.h" #include "LBM/GPUHelperFunctions/KernelUtilities.h" -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> #include <cuda.h> #include <iostream> diff --git a/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp index ee5333dfc130ac7dfdf7ab8c4de812a2916777fa..eb43a5f1fb85e538d4a930ba43fdf546b5c878a8 100644 --- a/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/EdgeNodeDebugWriter.hpp @@ -3,7 +3,7 @@ #include <fstream> #include <sstream> -#include <stdio.h> +#include <cstdio> // #include <math.h> #include "StringUtilities/StringUtil.h" #include "lbm/constants/D3Q27.h" @@ -13,7 +13,6 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> #include <cmath> -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" namespace EdgeNodeDebugWriter { @@ -25,7 +24,7 @@ void addCoordinatesToNodeVector(SPtr<LBMSimulationParameter> parH, std::vector<U nodesVec[indexInNodesVector] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); } -void writeEdgeNodesXZ_Send(SPtr<Parameter> para) +void writeEdgeNodesXZ_Send(SPtr<Parameter> para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; std::vector<std::string> datanames = { "SparseIndex", "ProcessNeighbor", "IndexInSendVector", "AfterFtoC" }; @@ -54,14 +53,14 @@ void writeEdgeNodesXZ_Send(SPtr<Parameter> para) nodeCount++; } std::string filenameVec = para->getFName() + "_writeEdgeNodesXZ_Send_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); } } -void writeEdgeNodesXZ_Recv(SPtr<Parameter> para) +void writeEdgeNodesXZ_Recv(SPtr<Parameter> para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; std::vector<std::string> datanames = { "SparseIndex", "ProcessNeighbor", "IndexInRecvVector", "AfterFtoC" }; @@ -90,7 +89,7 @@ void writeEdgeNodesXZ_Recv(SPtr<Parameter> para) nodeCount++; } std::string filenameVec = para->getFName() + "_writeEdgeNodesXZ_Recv_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp index cb8cefa389c141b7f38bbc54a68d8cf9841ba699..9d4173b22a458f089d6ba96618dafeb6b89cbca0 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp @@ -8,7 +8,7 @@ #include "FileWriter.h" #include <logger/Logger.h> -#include <stdio.h> +#include <cstdio> #include <fstream> #include <sstream> #include <cmath> @@ -23,6 +23,43 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> +std::string makePartFileNameEnding(int level, int ID, int part, int timestep) +{ + return "_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(ID) + "_Part_" + StringUtil::toString<int>(part) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; +} + +std::string makeCollectionFileNameEnding(int ID, int timestep) +{ + return "_ID_" + StringUtil::toString<int>(ID) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; +} + +std::string makePartFileName(const std::string &prefix, int level, int ID, int part, int timestep) +{ + return prefix + "_bin" + makePartFileNameEnding(level, ID, part, timestep); +} + +std::string makeMedianPartFileName(const std::string &prefix, int level, int ID, int part, int timestep) +{ + return prefix + "_bin_median" + makePartFileNameEnding(level, ID, part, timestep); +} + + +std::string makeCollectionFileName(const std::string &prefix, int ID, int timestep) +{ + return prefix + "_bin" + makeCollectionFileNameEnding(ID, timestep); +} + +std::string makeMedianCollectionFileName(const std::string &prefix, int ID, int timestep) +{ + return prefix + "_bin_median" + makeCollectionFileNameEnding(ID, timestep); +} + +std::string makePvdCollectionFileName(const std::string &prefix, int mpiProcessID) +{ + return prefix + "_bin" + "_ID_" + StringUtil::toString<int>(mpiProcessID); +} + + void FileWriter::writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) { unsigned int timestep = para->getTimestepInit(); @@ -31,6 +68,7 @@ void FileWriter::writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<Cuda writeTimestep(para, timestep, level); } + this->fileNamesForCollectionFileTimeSeries[timestep] = this->fileNamesForCollectionFile; this->writeCollectionFile(para, timestep); if( para->getCalcMedian() ) @@ -42,6 +80,10 @@ void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int tim for (int level = para->getCoarse(); level <= para->getFine(); level++) writeTimestep(para, timestep, level); + this->fileNamesForCollectionFileTimeSeries[timestep] = this->fileNamesForCollectionFile; + if (timestep == para->getTimestepEnd()) + this->writePvdCollectionFileForTimeSeries(*para); + this->writeCollectionFile(para, timestep); if( para->getCalcMedian() ) @@ -50,30 +92,28 @@ void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int tim void FileWriter::writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) { - const unsigned int numberOfParts = (uint)para->getParH(level)->numberOfNodes / para->getlimitOfNodesForVTK() + 1; - std::vector<std::string> fname; - std::vector<std::string> fnameMed; + const unsigned int numberOfParts = (uint)para->getParH(level)->numberOfNodes / para->getLimitOfNodesForVTK() + 1; + std::vector<std::string> fnames; + std::vector<std::string> fnamesMed; for (unsigned int i = 1; i <= numberOfParts; i++) { - fname.push_back(para->getFName() + "_bin_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); - fnameMed.push_back(para->getFName() + "_bin_median_lev_" + StringUtil::toString<int>(level) + "_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_Part_" + StringUtil::toString<int>(i) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"); + std::string fname = makePartFileName(para->getFName(), level, para->getMyProcessID(), i, timestep); + std::string fnameMed = makeMedianPartFileName(para->getFName(), level, para->getMyProcessID(), i, timestep); - this->fileNamesForCollectionFile.push_back( fname.back() ); - this->fileNamesForCollectionFileMedian.push_back( fnameMed.back() ); + fnames.push_back(fname); + fnamesMed.push_back(fnameMed); } - if (para->getDiffOn() == true) - writeUnstrucuredGridLTConc(para, level, fname); - else - writeUnstrucuredGridLT(para, level, fname); + std::vector<std::string> fnamesLong = writeUnstructuredGridLT(para, level, fnames); + for(auto fname : fnamesLong) + this->fileNamesForCollectionFile.push_back(fname.substr( fname.find_last_of('/') + 1 )); if (para->getCalcMedian()) { - if (para->getDiffOn() == true) - writeUnstrucuredGridMedianLTConc(para, level, fnameMed); - else - writeUnstrucuredGridMedianLT(para, level, fnameMed); + std::vector<std::string> fnamesMedianLong = writeUnstructuredGridMedianLT(para, level, fnamesMed); + for(auto fname : fnamesMedianLong) + this->fileNamesForCollectionFileMedian.push_back(fname.substr( fname.find_last_of('/') + 1 )); } } @@ -84,194 +124,175 @@ bool FileWriter::isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsi (para->getParH(level)->coordinateZ[number5] < para->getParH(level)->coordinateZ[number1]); } -void VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFile(std::shared_ptr<Parameter> para, unsigned int timestep) +std::vector<std::string> FileWriter::getNodeDataNames(std::shared_ptr<Parameter> para) { - std::string filename = para->getFName() + "_bin_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; + std::vector<std::string> nodeDataNames; + nodeDataNames.push_back("press"); + nodeDataNames.push_back("rho"); + nodeDataNames.push_back("vx1"); + nodeDataNames.push_back("vx2"); + nodeDataNames.push_back("vx3"); + nodeDataNames.push_back("geo"); - std::ofstream file; + if(para->getDiffOn()) + nodeDataNames.push_back("conc"); - file.open( filename + ".pvtu" ); - - ////////////////////////////////////////////////////////////////////////// - file << "<?xml version=\"1.0\"?>" << std::endl; - file << "<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">" << std::endl; - file << " <PUnstructuredGrid GhostLevel=\"1\">" << std::endl; - - file << " <PPointData>" << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"press\" /> " << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"rho\" /> " << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"vx1\" /> " << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"vx2\" /> " << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"vx3\" /> " << std::endl; - file << " <PDataArray type=\"Float64\" Name=\"geo\" /> " << std::endl; - if( para->getDiffOn() ) file << " <PDataArray type=\"Float64\" Name=\"conc\" /> " << std::endl; - file << " </PPointData>" << std::endl; - - file << " <PPoints>" << std::endl; - file << " <PDataArray type=\"Float32\" Name=\"Points\" NumberOfComponents=\"3\"/>" << std::endl; - file << " </PPoints>" << std::endl; - - for( auto& fname : this->fileNamesForCollectionFile ) + if(para->getIsBodyForce()) { - const auto filenameWithoutPath=fname.substr( fname.find_last_of('/') + 1 ); - file << " <Piece Source=\"" << filenameWithoutPath << ".bin.vtu\"/>" << std::endl; + nodeDataNames.push_back("Fx"); + nodeDataNames.push_back("Fy"); + nodeDataNames.push_back("Fz"); } - file << " </PUnstructuredGrid>" << std::endl; - file << "</VTKFile>" << std::endl; + if(para->getUseTurbulentViscosity()) + { + nodeDataNames.push_back("nut"); + } - ////////////////////////////////////////////////////////////////////////// + if (para->getCalcTurbulenceIntensity()) { + nodeDataNames.push_back("vxx"); + nodeDataNames.push_back("vyy"); + nodeDataNames.push_back("vzz"); + nodeDataNames.push_back("vxy"); + nodeDataNames.push_back("vxz"); + nodeDataNames.push_back("vyz"); + } + return nodeDataNames; +} - file.close(); +std::vector<std::string> FileWriter::getMedianNodeDataNames(std::shared_ptr<Parameter> para) +{ + std::vector<std::string> nodeDataNames; + + if(para->getDiffOn()) + nodeDataNames.push_back("conc"); + nodeDataNames.push_back("pressMed"); + nodeDataNames.push_back("rhoMed"); + nodeDataNames.push_back("vx1Med"); + nodeDataNames.push_back("vx2Med"); + nodeDataNames.push_back("vx3Med"); + nodeDataNames.push_back("geo"); + + return nodeDataNames; +} +std::string VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFile(std::shared_ptr<Parameter> para, unsigned int timestep) +{ + std::string filename = makeCollectionFileName(para->getFName(), para->getMyProcessID(), timestep); + auto nodeDataNames = this->getNodeDataNames(para); + std::vector<std::string> cellDataNames; + std::string pFileName= WbWriterVtkXmlBinary::getInstance()->writeParallelFile(filename, this->fileNamesForCollectionFile, nodeDataNames, cellDataNames); this->fileNamesForCollectionFile.clear(); + return pFileName; } -void VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFileMedian(std::shared_ptr<Parameter> para, unsigned int timestep) +std::string VIRTUALFLUIDS_GPU_EXPORT FileWriter::writeCollectionFileMedian(std::shared_ptr<Parameter> para, unsigned int timestep) { - - std::string filename = para->getFName() + "_bin_median_ID_" + StringUtil::toString<int>(para->getMyProcessID()) + "_t_" + StringUtil::toString<int>(timestep) + ".vtk"; - - std::ofstream file; - - file.open( filename + ".pvtu" ); - - ////////////////////////////////////////////////////////////////////////// - - file << "<VTKFile type=\"PUnstructuredGrid\" version=\"1.0\" byte_order=\"LittleEndian\" header_type=\"UInt64\">" << std::endl; - file << " <PUnstructuredGrid GhostLevel=\"1\">" << std::endl; - - file << " <PPointData>" << std::endl; - if( para->getDiffOn() ) file << " <DataArray type=\"Float32\" Name=\"concMed\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"pressMed\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"rhoMed\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx1Med\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx2Med\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"vx3Med\" /> " << std::endl; - file << " <DataArray type=\"Float32\" Name=\"geo\" /> " << std::endl; - file << " </PPointData>" << std::endl; - - file << " <PPoints>" << std::endl; - file << " <PDataArray type=\"Float32\" Name=\"Points\" NumberOfComponents=\"3\"/>" << std::endl; - file << " </PPoints>" << std::endl; - - for( auto& fname : this->fileNamesForCollectionFileMedian ) - { - const auto filenameWithoutPath=fname.substr( fname.find_last_of('/') + 1 ); - file << " <Piece Source=\"" << filenameWithoutPath << ".bin.vtu\"/>" << std::endl; - } - - file << " </PUnstructuredGrid>" << std::endl; - file << "</VTKFile>" << std::endl; - - ////////////////////////////////////////////////////////////////////////// - - file.close(); - + std::string filename = makeMedianCollectionFileName(para->getFName(), para->getMyProcessID(), timestep); + std::vector<std::string> nodeDataNames = getMedianNodeDataNames(para); + std::vector<std::string> cellDataNames; + std::string pFileName = WbWriterVtkXmlBinary::getInstance()->writeParallelFile(filename, this->fileNamesForCollectionFileMedian, nodeDataNames, cellDataNames); this->fileNamesForCollectionFileMedian.clear(); + return pFileName; +} + +std::string FileWriter::writePvdCollectionFileForTimeSeries(const Parameter ¶) +{ + const std::string filename = makePvdCollectionFileName(para.getFName(), para.getMyProcessID()); + return WbWriterVtkXmlBinary::getInstance()->writeCollectionForTimeSeries(filename, this->fileNamesForCollectionFileTimeSeries, false); } -void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) +std::vector<std::string> FileWriter::writeUnstructuredGridLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { std::vector< UbTupleFloat3 > nodes; std::vector< UbTupleUInt8 > cells; - std::vector< std::string > nodedatanames; - nodedatanames.push_back("press"); - nodedatanames.push_back("rho"); - nodedatanames.push_back("vx1"); - nodedatanames.push_back("vx2"); - nodedatanames.push_back("vx3"); - nodedatanames.push_back("geo"); + std::vector< std::string > nodeDataNames = getNodeDataNames(para); + + std::vector< std::string > outFNames; + + uint dataIndex = 6; + + uint firstConcNode = dataIndex; + if(para->getDiffOn()) dataIndex++; - uint firstBodyForceNode = (uint) nodedatanames.size(); - if(para->getIsBodyForce()) - { - nodedatanames.push_back("Fx"); - nodedatanames.push_back("Fy"); - nodedatanames.push_back("Fz"); - } + uint firstBodyForceNode = dataIndex; + if(para->getIsBodyForce()) dataIndex+=3; - uint firstNutNode = (uint) nodedatanames.size(); - if(para->getUseTurbulentViscosity()) - { - nodedatanames.push_back("nut"); - } + uint firstNutNode = dataIndex; + if(para->getUseTurbulentViscosity()) dataIndex++; - uint firstTurbNode = (uint) nodedatanames.size(); - if (para->getCalcTurbulenceIntensity()) { - nodedatanames.push_back("vxx"); - nodedatanames.push_back("vyy"); - nodedatanames.push_back("vzz"); - nodedatanames.push_back("vxy"); - nodedatanames.push_back("vxz"); - nodedatanames.push_back("vyz"); - } + uint firstTurbulenceNode = dataIndex; + if (para->getCalcTurbulenceIntensity()) dataIndex += 6; unsigned int number1, number2, number3, number4, number5, number6, number7, number8; uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; bool neighborsAreFluid; - unsigned int startpos = 0; - unsigned int endpos = 0; - unsigned int sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); + unsigned int startPosition; + unsigned int endPosition; + unsigned int sizeOfNodes; + std::vector< std::vector< double > > nodeData(nodeDataNames.size()); for (unsigned int part = 0; part < fname.size(); part++) { - if (((part + 1)*para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + if (((part + 1)*para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); else - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; + startPosition = part * para->getLimitOfNodesForVTK(); + endPosition = startPosition + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); nodes.resize(sizeOfNodes); - for (uint i = 0; i < (uint)nodedatanames.size(); i++) - nodedata[i].resize(sizeOfNodes); + for (uint i = 0; i < (uint)nodeDataNames.size(); i++) + nodeData[i].resize(sizeOfNodes); ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) + for (unsigned int pos = startPosition; pos < endPosition; pos++) { if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { + ////////////////////////////////////////////////////////////////////////// double x1 = para->getParH(level)->coordinateX[pos]; double x2 = para->getParH(level)->coordinateY[pos]; double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; - dn1 = pos - startpos; + dn1 = pos - startPosition; neighborsAreFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + nodeData[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodeData[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); + nodeData[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); + nodeData[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); + nodeData[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); + nodeData[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + + if(para->getDiffOn()) + nodeData[firstConcNode][dn1] = (double)para->getParH(level)->concentration[pos]; if(para->getIsBodyForce()) { - nodedata[firstBodyForceNode ][dn1] = (double)para->getParH(level)->forceX_SP[pos] * (double)para->getScaledForceRatio(level); - nodedata[firstBodyForceNode + 1][dn1] = (double)para->getParH(level)->forceY_SP[pos] * (double)para->getScaledForceRatio(level); - nodedata[firstBodyForceNode + 2][dn1] = (double)para->getParH(level)->forceZ_SP[pos] * (double)para->getScaledForceRatio(level); + nodeData[firstBodyForceNode ][dn1] = (double)para->getParH(level)->forceX_SP[pos] * (double)para->getScaledForceRatio(level); + nodeData[firstBodyForceNode + 1][dn1] = (double)para->getParH(level)->forceY_SP[pos] * (double)para->getScaledForceRatio(level); + nodeData[firstBodyForceNode + 2][dn1] = (double)para->getParH(level)->forceZ_SP[pos] * (double)para->getScaledForceRatio(level); } if(para->getUseTurbulentViscosity()) { - nodedata[firstNutNode][dn1] = (double)para->getParH(level)->turbViscosity[pos] * (double)para->getScaledViscosityRatio(level); + nodeData[firstNutNode][dn1] = (double)para->getParH(level)->turbViscosity[pos] * (double)para->getScaledViscosityRatio(level); } if (para->getCalcTurbulenceIntensity()) { - nodedata[firstTurbNode ][dn1] = (double)para->getParH(level)->vxx[pos]; - nodedata[firstTurbNode + 1][dn1] = (double)para->getParH(level)->vyy[pos]; - nodedata[firstTurbNode + 2][dn1] = (double)para->getParH(level)->vzz[pos]; - nodedata[firstTurbNode + 3][dn1] = (double)para->getParH(level)->vxy[pos]; - nodedata[firstTurbNode + 4][dn1] = (double)para->getParH(level)->vxz[pos]; - nodedata[firstTurbNode + 5][dn1] = (double)para->getParH(level)->vyz[pos]; + nodeData[firstTurbulenceNode ][dn1] = (double)para->getParH(level)->vxx[pos]; + nodeData[firstTurbulenceNode + 1][dn1] = (double)para->getParH(level)->vyy[pos]; + nodeData[firstTurbulenceNode + 2][dn1] = (double)para->getParH(level)->vzz[pos]; + nodeData[firstTurbulenceNode + 3][dn1] = (double)para->getParH(level)->vxy[pos]; + nodeData[firstTurbulenceNode + 4][dn1] = (double)para->getParH(level)->vxz[pos]; + nodeData[firstTurbulenceNode + 5][dn1] = (double)para->getParH(level)->vyz[pos]; } ////////////////////////////////////////////////////////////////////////// @@ -291,21 +312,21 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsAreFluid = false; ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsAreFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; + if (number2 > endPosition || + number3 > endPosition || + number4 > endPosition || + number5 > endPosition || + number6 > endPosition || + number7 > endPosition || + number8 > endPosition) neighborsAreFluid = false; + ////////////////////////////////////////////////////////////////////////// + dn2 = number2 - startPosition; + dn3 = number3 - startPosition; + dn4 = number4 - startPosition; + dn5 = number5 - startPosition; + dn6 = number6 - startPosition; + dn7 = number7 - startPosition; + dn8 = number8 - startPosition; ////////////////////////////////////////////////////////////////////////// if (isPeriodicCell(para, level, number2, number1, number3, number5)) continue; @@ -314,164 +335,53 @@ void FileWriter::writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int lev cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); } } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); + outFNames.push_back( WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodeDataNames, nodeData) ); } + return outFNames; } -void FileWriter::writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) +std::vector<std::string> FileWriter::writeUnstructuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { - std::vector< UbTupleFloat3 > nodes; - std::vector< UbTupleUInt8 > cells; - std::vector< std::string > nodedatanames; - nodedatanames.push_back("press"); - nodedatanames.push_back("rho"); - nodedatanames.push_back("vx1"); - nodedatanames.push_back("vx2"); - nodedatanames.push_back("vx3"); - nodedatanames.push_back("geo"); - nodedatanames.push_back("conc"); - unsigned int number1, number2, number3, number4, number5, number6, number7, number8; - uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; - bool neighborsAreFluid; - unsigned int startpos = 0; - unsigned int endpos = 0; - unsigned int sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); - - for (unsigned int part = 0; part < fname.size(); part++) - { - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); - else - sizeOfNodes = para->getlimitOfNodesForVTK(); - - ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; - ////////////////////////////////////////////////////////////////////////// - cells.clear(); - nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); - nodedata[6].resize(sizeOfNodes); - ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) - { - ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordinateX[pos]; - double x2 = para->getParH(level)->coordinateY[pos]; - double x3 = para->getParH(level)->coordinateZ[pos]; - ////////////////////////////////////////////////////////////////////////// - number1 = pos; - dn1 = pos - startpos; - neighborsAreFluid = true; - ////////////////////////////////////////////////////////////////////////// - nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->pressure[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[1][dn1] = (double)para->getParH(level)->rho[pos] / (double)3.0 * (double)para->getDensityRatio() * (double)para->getVelocityRatio() * (double)para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->velocityX[pos] * (double)para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->velocityY[pos] * (double)para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->velocityZ[pos] * (double)para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; - nodedata[6][dn1] = (double)para->getParH(level)->concentration[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX[number1]; - number3 = para->getParH(level)->neighborY[number2]; - number4 = para->getParH(level)->neighborY[number1]; - number5 = para->getParH(level)->neighborZ[number1]; - number6 = para->getParH(level)->neighborZ[number2]; - number7 = para->getParH(level)->neighborZ[number3]; - number8 = para->getParH(level)->neighborZ[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsAreFluid = false; - ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsAreFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// - if (neighborsAreFluid) - cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); - } - } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); - } -} + std::vector< std::string > outFNames; -void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) -{ std::vector< UbTupleFloat3 > nodes; std::vector< UbTupleUInt8 > cells; //std::vector< UbTupleUInt8 > cells2; - std::vector< std::string > nodedatanames; - nodedatanames.push_back("pressMed"); - nodedatanames.push_back("rhoMed"); - nodedatanames.push_back("vx1Med"); - nodedatanames.push_back("vx2Med"); - nodedatanames.push_back("vx3Med"); - nodedatanames.push_back("geo"); + std::vector< std::string > nodeDataNames = getMedianNodeDataNames(para); + int startIndex = para->getDiffOn()? 1 : 0; + unsigned int number1, number2, number3, number4, number5, number6, number7, number8; unsigned int dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; bool neighborsFluid; - unsigned int startpos = 0; - unsigned int endpos = 0; - unsigned int sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); + unsigned int startPosition; + unsigned int endPosition; + unsigned int sizeOfNodes; + std::vector< std::vector< double > > nodeData(nodeDataNames.size()); //printf("\n test for if... \n"); for (unsigned int part = 0; part < fname.size(); part++) { //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; + startPosition = part * para->getLimitOfNodesForVTK(); + endPosition = startPosition + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); + for (size_t i = 0; i < nodeDataNames.size(); i++) + nodeData[i].resize(sizeOfNodes); ////////////////////////////////////////////////////////////////////////// //printf("\n test in if II... \n"); - for (unsigned int pos = startpos; pos < endpos; pos++) + for (unsigned int pos = startPosition; pos < endPosition; pos++) { if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) { @@ -481,16 +391,18 @@ void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, i double x3 = para->getParH(level)->coordinateZ[pos]; ////////////////////////////////////////////////////////////////////////// number1 = pos; - dn1 = pos - startpos; + dn1 = pos - startPosition; neighborsFluid = true; ////////////////////////////////////////////////////////////////////////// nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[1][dn1] = para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; + if(para->getDiffOn()) + nodeData[0][dn1] = (double)para->getParH(level)->Conc_Med_Out[pos]; + nodeData[startIndex ][dn1] = para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodeData[startIndex + 1][dn1] = para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); + nodeData[startIndex + 2][dn1] = para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); + nodeData[startIndex + 3][dn1] = para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); + nodeData[startIndex + 4][dn1] = para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); + nodeData[startIndex + 5][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; ////////////////////////////////////////////////////////////////////////// number2 = para->getParH(level)->neighborX[number1]; number3 = para->getParH(level)->neighborY[number2]; @@ -508,21 +420,21 @@ void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, i para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; + if (number2 > endPosition || + number3 > endPosition || + number4 > endPosition || + number5 > endPosition || + number6 > endPosition || + number7 > endPosition || + number8 > endPosition) neighborsFluid = false; + ////////////////////////////////////////////////////////////////////////// + dn2 = number2 - startPosition; + dn3 = number3 - startPosition; + dn4 = number4 - startPosition; + dn5 = number5 - startPosition; + dn6 = number6 - startPosition; + dn7 = number7 - startPosition; + dn8 = number8 - startPosition; ////////////////////////////////////////////////////////////////////////// if (isPeriodicCell(para, level, number2, number1, number3, number5)) continue; @@ -531,122 +443,8 @@ void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, i ////////////////////////////////////////////////////////////////////////// } } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); + outFNames.push_back(WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodeDataNames, nodeData)); ////////////////////////////////////////////////////////////////////////// } -} - -void FileWriter::writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) -{ - std::vector< UbTupleFloat3 > nodes; - std::vector< UbTupleUInt8 > cells; - std::vector< std::string > nodedatanames; - nodedatanames.push_back("concMed"); - nodedatanames.push_back("pressMed"); - nodedatanames.push_back("rhoMed"); - nodedatanames.push_back("vx1Med"); - nodedatanames.push_back("vx2Med"); - nodedatanames.push_back("vx3Med"); - nodedatanames.push_back("geo"); - uint number1, number2, number3, number4, number5, number6, number7, number8; - uint dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8; - bool neighborsFluid; - uint startpos = 0; - uint endpos = 0; - uint sizeOfNodes = 0; - std::vector< std::vector< double > > nodedata(nodedatanames.size()); - - for (unsigned int part = 0; part < fname.size(); part++) - { - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); - else - sizeOfNodes = para->getlimitOfNodesForVTK(); - ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); - endpos = startpos + sizeOfNodes; - ////////////////////////////////////////////////////////////////////////// - cells.clear(); - nodes.resize(sizeOfNodes); - nodedata[0].resize(sizeOfNodes); - nodedata[1].resize(sizeOfNodes); - nodedata[2].resize(sizeOfNodes); - nodedata[3].resize(sizeOfNodes); - nodedata[4].resize(sizeOfNodes); - nodedata[5].resize(sizeOfNodes); - nodedata[6].resize(sizeOfNodes); - ////////////////////////////////////////////////////////////////////////// - for (unsigned int pos = startpos; pos < endpos; pos++) - { - if (para->getParH(level)->typeOfGridNode[pos] == GEO_FLUID) - { - ////////////////////////////////////////////////////////////////////////// - double x1 = para->getParH(level)->coordinateX[pos]; - double x2 = para->getParH(level)->coordinateY[pos]; - double x3 = para->getParH(level)->coordinateZ[pos]; - ////////////////////////////////////////////////////////////////////////// - number1 = pos; - dn1 = pos - startpos; - neighborsFluid = true; - ////////////////////////////////////////////////////////////////////////// - nodes[dn1] = (makeUbTuple((float)(x1), (float)(x2), (float)(x3))); - nodedata[0][dn1] = (double)para->getParH(level)->Conc_Med_Out[pos]; - nodedata[1][dn1] = (double)para->getParH(level)->press_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[2][dn1] = (double)para->getParH(level)->rho_SP_Med_Out[pos] / 3.0f * para->getDensityRatio() * para->getVelocityRatio() * para->getVelocityRatio(); - nodedata[3][dn1] = (double)para->getParH(level)->vx_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[4][dn1] = (double)para->getParH(level)->vy_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[5][dn1] = (double)para->getParH(level)->vz_SP_Med_Out[pos] * para->getVelocityRatio(); - nodedata[6][dn1] = (double)para->getParH(level)->typeOfGridNode[pos]; - ////////////////////////////////////////////////////////////////////////// - number2 = para->getParH(level)->neighborX[number1]; - number3 = para->getParH(level)->neighborY[number2]; - number4 = para->getParH(level)->neighborY[number1]; - number5 = para->getParH(level)->neighborZ[number1]; - number6 = para->getParH(level)->neighborZ[number2]; - number7 = para->getParH(level)->neighborZ[number3]; - number8 = para->getParH(level)->neighborZ[number4]; - ////////////////////////////////////////////////////////////////////////// - if (para->getParH(level)->typeOfGridNode[number2] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number3] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number4] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number5] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number6] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number7] != GEO_FLUID || - para->getParH(level)->typeOfGridNode[number8] != GEO_FLUID) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - if (number2 > endpos || - number3 > endpos || - number4 > endpos || - number5 > endpos || - number6 > endpos || - number7 > endpos || - number8 > endpos) neighborsFluid = false; - ////////////////////////////////////////////////////////////////////////// - dn2 = number2 - startpos; - dn3 = number3 - startpos; - dn4 = number4 - startpos; - dn5 = number5 - startpos; - dn6 = number6 - startpos; - dn7 = number7 - startpos; - dn8 = number8 - startpos; - ////////////////////////////////////////////////////////////////////////// - if (isPeriodicCell(para, level, number2, number1, number3, number5)) - continue; - ////////////////////////////////////////////////////////////////////////// - if (neighborsFluid) - cells.push_back(makeUbTuple(dn1, dn2, dn3, dn4, dn5, dn6, dn7, dn8)); - ////////////////////////////////////////////////////////////////////////// - } - } - WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(fname[part], nodes, cells, nodedatanames, nodedata); - ////////////////////////////////////////////////////////////////////////// - } -} -////////////////////////////////////////////////////////////////////////// - - - - - - - + return outFNames; +} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.h b/src/gpu/VirtualFluids_GPU/Output/FileWriter.h index 2d7c176fa067ea86573849e90bd91dab259526b4..c30e33b171563a612e224fd08fd1e4ee68b8fea8 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.h +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.h @@ -4,36 +4,39 @@ #include <memory> #include <vector> #include <string> - +#include <map> #include "DataWriter.h" class Parameter; class CudaMemoryManager; -struct PN27; class FileWriter : public DataWriter { public: - void writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) override; - void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep) override; + void writeInit(std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaMemoryManager) override; + void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep) override; private: - void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) override; - //void writeParticle(Parameter* para, unsigned int t); - void writeUnstrucuredGridLT(std::shared_ptr<Parameter> para, int level, + void writeTimestep(std::shared_ptr<Parameter> para, unsigned int timestep, int level) override; + std::vector<std::string> writeUnstructuredGridLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string> &fname); - void writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - void writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - void writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); - bool isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5); + std::vector<std::string> writeUnstructuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname); + bool isPeriodicCell(std::shared_ptr<Parameter> para, int level, unsigned int number2, unsigned int number1, unsigned int number3, unsigned int number5); + + std::string writeCollectionFile( std::shared_ptr<Parameter> para, unsigned int timestep ); - void writeCollectionFile( std::shared_ptr<Parameter> para, unsigned int timestep ); + std::string writeCollectionFileMedian( std::shared_ptr<Parameter> para, unsigned int timestep ); - void writeCollectionFileMedian( std::shared_ptr<Parameter> para, unsigned int timestep ); + std::string writePvdCollectionFileForTimeSeries(const Parameter ¶); + + std::vector<std::string> getNodeDataNames(std::shared_ptr<Parameter> para); + std::vector<std::string> getMedianNodeDataNames(std::shared_ptr<Parameter> para); std::vector< std::string > fileNamesForCollectionFile; std::vector< std::string > fileNamesForCollectionFileMedian; + + std::map<uint, std::vector<std::string>> fileNamesForCollectionFileTimeSeries; // key: timeStep, value: fileNames for timeStep }; -#endif \ No newline at end of file +#endif diff --git a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp index 4af9a50a123588e25f1ca9faa5c18581601f69d2..da5307c3d8080d7d10ad91dc970639fdd83dd2dc 100644 --- a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp @@ -11,8 +11,6 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> #include <cmath> -#include "VirtualFluids_GPU/Communication/MpiCommunicator.h" - namespace InterfaceDebugWriter { @@ -603,7 +601,7 @@ void checkForSendNodeZ(int pos, int &sendDir, int &sendDirectionInCommAfterFtoC, para->getParH(level)->sendProcessNeighborsAfterFtoCZ, 8.0); } -void writeInterfaceFCC_Send(Parameter *para) +void writeInterfaceFCC_Send(Parameter *para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; int nodeNumberVec = 0; @@ -650,14 +648,14 @@ void writeInterfaceFCC_Send(Parameter *para) nodeCount++; } std::string filenameVec = para->getFName() + "_writeInterfaceFCC_Send_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); } } -void writeInterfaceCFC_Recv(Parameter *para) +void writeInterfaceCFC_Recv(Parameter *para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; int nodeNumberVec = 0; @@ -703,7 +701,7 @@ void writeInterfaceCFC_Recv(Parameter *para) nodeCount++; } std::string filenameVec = para->getFName() + "_writeInterfaceCFC_Recv_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); @@ -718,7 +716,7 @@ void addToNodesVector(const int level, const int pos, std::vector<UbTupleFloat3> nodesVec.push_back(makeUbTuple((float)(x1), (float)(x2), (float)(x3))); } -void writeSendNodesStream(Parameter *para) +void writeSendNodesStream(Parameter *para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; @@ -808,14 +806,14 @@ void writeSendNodesStream(Parameter *para) } } std::string filenameVec = para->getFName() + "_writeSendNodesStreams_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); } } -void writeRecvNodesStream(Parameter *para) +void writeRecvNodesStream(Parameter *para, int processID = 0) { std::vector<UbTupleFloat3> nodesVec; @@ -894,7 +892,7 @@ void writeRecvNodesStream(Parameter *para) // Recv are nodes ghost nodes and therefore they can't be coarse cells for the interpolation from coarse to fine std::string filenameVec = para->getFName() + "_writeRecvNodesStreams_PID_" + - std::to_string(vf::gpu::MpiCommunicator::getInstance().getPID()) + "_" + + std::to_string(processID) + "_" + StringUtil::toString<int>(level); WbWriterVtkXmlBinary::getInstance()->writeNodesWithNodeData(filenameVec, nodesVec, datanames, nodedata); diff --git a/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp index e506a56bb76a263ac8982a7e53f39e67c268e49b..a05aad82137fc378b7f899d31c1b06d53199d694 100644 --- a/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/NeighborDebugWriter.hpp @@ -11,7 +11,6 @@ #include "StringUtilities/StringUtil.h" #include "Utilities/FindNeighbors.h" -#include "gpu/VirtualFluids_GPU/Communication/Communicator.h" namespace NeighborDebugWriter { diff --git a/src/gpu/VirtualFluids_GPU/Output/QDebugVtkWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/QDebugVtkWriter.hpp index d075c78e53a45e96adea43c8846159f4ba128c6d..5448db1329885ca542c951b3d068f3ab48fe502c 100644 --- a/src/gpu/VirtualFluids_GPU/Output/QDebugVtkWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/QDebugVtkWriter.hpp @@ -11,7 +11,6 @@ #include <logger/Logger.h> #include "gpu/GridGenerator/grid/NodeValues.h" -#include "gpu/VirtualFluids_GPU/Communication/Communicator.h" #include "gpu/VirtualFluids_GPU/LBM/LB.h" #include "gpu/VirtualFluids_GPU/Parameter/Parameter.h" #include "gpu/VirtualFluids_GPU/Utilities/FindNeighbors.h" diff --git a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp index b24dab20be957fa27b9306d0bbabbec53694753c..d58526cab3b114e77bdb146053584795b05bac8a 100644 --- a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp @@ -33,8 +33,8 @@ namespace QDebugWriter } } if (qKey > 0) { - real transportKey = *((real*)&qKey); - qNode.push_back(transportKey); + float transportKey = *((float*)&qKey); + qNode.push_back((real)transportKey); qNode.push_back((real)k[j]); qs.push_back(qNode); } diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.cpp b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp index f6efff58440bd786d57a3ccb44d2271c29761323..a3048e62d674aff4e21a93292f694541dc86e36f 100644 --- a/src/gpu/VirtualFluids_GPU/Output/Timer.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/Timer.cpp @@ -4,7 +4,8 @@ #include "UbScheduler.h" #include "Parameter/Parameter.h" -#include "VirtualFluids_GPU/Communication/Communicator.h" + +#include <parallel/Communicator.h> void Timer::initTimer() { @@ -31,7 +32,7 @@ void Timer::resetTimer() this->totalElapsedTime = 0.0; } -void Timer::outputPerformance(uint t, Parameter* para, vf::gpu::Communicator& communicator) +void Timer::outputPerformance(uint t, Parameter* para, vf::parallel::Communicator& communicator) { real fnups = 0.0; real bandwidth = 0.0; @@ -42,18 +43,18 @@ void Timer::outputPerformance(uint t, Parameter* para, vf::gpu::Communicator& co bandwidth += (27.0+1.0) * 4.0 * 1000.0 * (t-para->getTimestepStart()) * para->getParH(lev)->numberOfNodes / (this->totalElapsedTime*1.0E9); } - if(this->firstOutput && communicator.getPID() == 0) //only display the legend once + if(this->firstOutput && communicator.getProcessID() == 0) //only display the legend once { VF_LOG_INFO("PID \t --- {} --- Processing time (ms) \t Nups in Mio \t Bandwidth in GB/sec", this->name ); this->firstOutput = false; } - VF_LOG_INFO(" {} \t --- {} --- {:>8.1f}/ {:<8.1f} \t {:5.1f} \t {:4.1f}", communicator.getPID(), this->name, this->elapsedTime, this->totalElapsedTime, fnups, bandwidth); + VF_LOG_INFO(" {} \t --- {} --- {:>8.1f}/ {:<8.1f} \t {:5.1f} \t {:4.1f}", communicator.getProcessID(), this->name, this->elapsedTime, this->totalElapsedTime, fnups, bandwidth); // When using multiple GPUs, sum the nups of all processes - if (communicator.getNumberOfProcess() > 1) { - double nupsSum = communicator.reduceSum(fnups); - if (communicator.getPID() == 0) - VF_LOG_INFO("Sum of all {} processes: Nups in Mio: {:.1f}", communicator.getNumberOfProcess(), nupsSum); + if (communicator.getNumberOfProcesses() > 1) { + double nupsSum = communicator.reduceSum(fnups); + if (communicator.getProcessID() == 0) + VF_LOG_INFO("Sum of all {} processes: Nups in Mio: {:.1f}", communicator.getNumberOfProcesses(), nupsSum); } } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/Timer.h b/src/gpu/VirtualFluids_GPU/Output/Timer.h index 55ada64ad245ee41aa99a1185eba134a652067c9..fd76c66703c2a60d9aed26365f415fe3c93e7e1f 100644 --- a/src/gpu/VirtualFluids_GPU/Output/Timer.h +++ b/src/gpu/VirtualFluids_GPU/Output/Timer.h @@ -6,14 +6,15 @@ #include "Parameter/Parameter.h" #include <logger/Logger.h> -namespace vf::gpu{ - class Communicator; +namespace vf::parallel +{ +class Communicator; } class Parameter; class Timer { - public: +public: Timer(std::string _name): name(_name) { this->initTimer(); @@ -29,13 +30,12 @@ class Timer void startTimer(); void stopTimer(); void resetTimer(); - void outputPerformance(uint t, Parameter* para, vf::gpu::Communicator& communicator); + void outputPerformance(uint t, Parameter* para, vf::parallel::Communicator& communicator); float getElapsedTime(){ return this->elapsedTime; } float getTotalElapsedTime(){ return this->totalElapsedTime; } - private: - +private: cudaEvent_t start_t, stop_t; float elapsedTime = 0.0; float totalElapsedTime = 0.0; @@ -44,6 +44,4 @@ class Timer bool firstOutput = true; }; - - #endif \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp index cafe70205455ae8592c1efe86e4ba9de8e1ba170..5d5548ba7e64a23152126446e3c438da1c7e7653 100644 --- a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp @@ -197,16 +197,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if ( ((part+1)*para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -340,16 +340,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -479,16 +479,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -628,16 +628,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -771,16 +771,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -1342,16 +1342,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if ( ((part+1)*para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if ( ((part+1)*para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -1465,16 +1465,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -1595,16 +1595,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -1975,16 +1975,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -2080,16 +2080,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); @@ -2192,16 +2192,16 @@ namespace UnstructuredGridWriter vxmax = 0; //printf("\n test in if I... \n"); ////////////////////////////////////////////////////////////////////////// - if (((part + 1) * para->getlimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) + if (((part + 1) * para->getLimitOfNodesForVTK()) > (uint)para->getParH(level)->numberOfNodes) { - sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getlimitOfNodesForVTK()); + sizeOfNodes = (uint)para->getParH(level)->numberOfNodes - (part * para->getLimitOfNodesForVTK()); } else { - sizeOfNodes = para->getlimitOfNodesForVTK(); + sizeOfNodes = para->getLimitOfNodesForVTK(); } ////////////////////////////////////////////////////////////////////////// - startpos = part * para->getlimitOfNodesForVTK(); + startpos = part * para->getLimitOfNodesForVTK(); endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// cells.clear(); diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp index 3cc771e413134e90b0d09d8eeb6dfee791f8a1e2..c6db87138610a6c029a06e32b70f496dc2306a83 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.cpp @@ -31,15 +31,14 @@ #include <helper_cuda.h> #include <iostream> -void CudaStreamManager::registerStream(CudaStreamIndex streamIndex) +int CudaStreamManager::registerAndLaunchStream(CudaStreamIndex streamIndex) { - if(streamIndex != CudaStreamIndex::Legacy) - cudaStreams.emplace(streamIndex, nullptr); -} -void CudaStreamManager::launchStreams() -{ - for (auto &stream : cudaStreams) - cudaStreamCreate(&stream.second); + if(streamIndex == CudaStreamIndex::Legacy) return 0; + + cudaStream_t new_stream = nullptr; + cudaStreamCreate(&new_stream); + cudaStreams.emplace(streamIndex, new_stream); + return int(cudaStreams.count(streamIndex) - 1); } void CudaStreamManager::terminateStreams() diff --git a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h index 631a945a653e6b4b60924a650e94b3873ebacc7d..98032ef16adebf56f10d8ed5e9c04bbf517876c3 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/CudaStreamManager.h @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// This file is part of VirtualFluids. VirtualFluids is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of +// License as published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. -// +// // You should have received a copy of the GNU General Public License along // with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. // @@ -43,27 +43,26 @@ enum class CudaStreamIndex Precursor, ActuatorFarm }; + class CudaStreamManager -{ +{ private: std::multimap<CudaStreamIndex, cudaStream_t> cudaStreams; cudaEvent_t startBulkKernel = NULL; cudaStream_t legacyStream = CU_STREAM_LEGACY; - public: - void registerStream(CudaStreamIndex streamIndex); - void launchStreams(); + int registerAndLaunchStream(CudaStreamIndex streamIndex); void terminateStreams(); - cudaStream_t &getStream(CudaStreamIndex streamIndex, uint multiStreamIndex=0); + cudaStream_t &getStream(CudaStreamIndex streamIndex, uint multiStreamIndex = 0); bool streamIsRegistered(CudaStreamIndex streamIndex); // Events void createCudaEvents(); void destroyCudaEvents(); - void triggerStartBulkKernel(CudaStreamIndex streamIndex, uint multiStreamIndex=0); - void waitOnStartBulkKernelEvent(CudaStreamIndex streamIndex, uint multiStreamIndex=0); + void triggerStartBulkKernel(CudaStreamIndex streamIndex, uint multiStreamIndex = 0); + void waitOnStartBulkKernelEvent(CudaStreamIndex streamIndex, uint multiStreamIndex = 0); }; #endif diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp index bf0d72448fb5a69c849d93749e24f29290cf9621..746029baf8cfdc7529b3150e97e6a1efb7ba18ab 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -37,7 +37,15 @@ #include <cstdlib> #include <optional> +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" +#pragma clang diagnostic ignored "-Wunused-but-set-parameter" +#endif #include <curand_kernel.h> +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #include "StringUtilities/StringUtil.h" @@ -338,7 +346,7 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Kernel if (configData.contains("MainKernelName")) - this->setMainKernel(configData.getValue<std::string>("MainKernelName")); + this->configureMainKernel(configData.getValue<std::string>("MainKernelName")); if (configData.contains("MultiKernelOn")) this->setMultiKernelOn(configData.getValue<bool>("MultiKernelOn")); @@ -591,7 +599,7 @@ void Parameter::initLBMSimulationParameter() void Parameter::checkParameterValidityCumulantK17() const { - if (this->mainKernel != "CumulantK17") + if (this->mainKernel != vf::CollisionKernel::Compressible::K17CompressibleNavierStokes) return; const real viscosity = this->parH[maxlevel]->viscosity; @@ -1627,10 +1635,10 @@ void Parameter::setOutflowBoundaryNormalZ(std::string outflowNormalZ) { this->outflowNormalZ = outflowNormalZ; } -void Parameter::setMainKernel(std::string kernel) +void Parameter::configureMainKernel(std::string kernel) { this->mainKernel = kernel; - if ( kernel.find("CumulantK17") != std::string::npos ) + if (kernel == vf::CollisionKernel::Compressible::K17CompressibleNavierStokes) this->kernelNeedsFluidNodeIndicesToRun = true; } void Parameter::setMultiKernelOn(bool isOn) @@ -1713,7 +1721,7 @@ unsigned int Parameter::getOutputCount() { return this->outputCount; } -unsigned int Parameter::getlimitOfNodesForVTK() +unsigned int Parameter::getLimitOfNodesForVTK() { return this->limitOfNodesForVTK; } @@ -1875,7 +1883,7 @@ std::string Parameter::getOutputPrefix() { return this->oPrefix; } -std::string Parameter::getFName() +std::string Parameter::getFName() const { return this->fname; } @@ -1947,11 +1955,11 @@ int Parameter::getMaxDev() { return this->maxdev; } -int Parameter::getMyProcessID() +int Parameter::getMyProcessID() const { return this->myProcessId; } -int Parameter::getNumprocs() +int Parameter::getNumprocs() const { return this->numprocs; } diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index 5944cf66caed4f680ff0480c7b7c39ff7d237aab..739b07cbaca6ce8aedb1c030d179f192fe15e228 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -43,6 +43,7 @@ #include "LBM/LB.h" #include "PreCollisionInteractor/PreCollisionInteractor.h" #include "TurbulenceModels/TurbulenceModelFactory.h" +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" #include "VirtualFluids_GPU_export.h" @@ -676,7 +677,7 @@ public: void setOutflowBoundaryNormalY(std::string outflowNormalY); void setOutflowBoundaryNormalZ(std::string outflowNormalZ); // Kernel - void setMainKernel(std::string kernel); + void configureMainKernel(std::string kernel); void setMultiKernelOn(bool isOn); void setMultiKernelLevel(std::vector<int> kernelLevel); void setMultiKernel(std::vector<std::string> kernel); @@ -700,7 +701,7 @@ public: real getEndXHotWall(); unsigned int getStepEnsight(); unsigned int getOutputCount(); - unsigned int getlimitOfNodesForVTK(); + unsigned int getLimitOfNodesForVTK(); unsigned int getStartTurn(); bool getEvenOrOdd(int level); bool getDiffOn(); @@ -730,11 +731,11 @@ public: int getTimeCalcMedEnd(); int getMaxDev(); //! \returns the ID of the current MPI process - int getMyProcessID(); - int getNumprocs(); + int getMyProcessID() const; + int getNumprocs() const; std::string getOutputPath(); std::string getOutputPrefix(); - std::string getFName(); + std::string getFName() const; std::string getGridPath(); std::string getGeometryFileC(); std::string getGeometryFileM(); @@ -1085,7 +1086,7 @@ private: // Kernel - std::string mainKernel{ "CumulantK17CompChim" }; + std::string mainKernel{ vf::CollisionKernel::Compressible::K17CompressibleNavierStokes }; bool multiKernelOn{ false }; std::vector<int> multiKernelLevel; std::vector<std::string> multiKernel; diff --git a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp index bed52dc97b8bde45712bca95f924a026ccb894f1..2eee0f7f2e88ee3315e6c80fe6e7827141979a80 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp @@ -9,12 +9,14 @@ #include "PointerDefinitions.h" #include "basics/config/ConfigurationFile.h" +#include "DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "Factories/BoundaryConditionFactory.h" #include "Factories/GridScalingFactory.h" -#include "Communication/Communicator.h" -#include "DataStructureInitializer/GridReaderGenerator/GridGenerator.h" #include "GPU/CudaMemoryManager.h" #include "gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h" +#include "VirtualFluids_GPU/Kernel/Utilities/KernelTypes.h" + +#include <parallel/Communicator.h> TEST(ParameterTest, passingEmptyFileWithoutPath_ShouldNotThrow) { @@ -212,7 +214,7 @@ class MockGridGenerator : public GridGenerator public: MockGridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, - std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::gpu::Communicator &communicator) + std::shared_ptr<CudaMemoryManager> cudaMemoryManager, vf::parallel::Communicator &communicator) : GridGenerator(builder, para, cudaMemoryManager, communicator) { } @@ -270,7 +272,7 @@ TEST_F(ParameterTestCumulantK17, CumulantK17_VelocityIsTooHigh_expectWarning) { para.setVelocityLB(0.11); - para.setMainKernel("CumulantK17"); + para.configureMainKernel(vf::CollisionKernel::Compressible::K17CompressibleNavierStokes); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); @@ -281,7 +283,7 @@ TEST_F(ParameterTestCumulantK17, CumulantK17_VelocityIsTooHigh_expectWarning) TEST_F(ParameterTestCumulantK17, CumulantK17_VelocityIsOk_expectNoWarning) { para.setVelocityLB(0.09); - para.setMainKernel("CumulantK17"); + para.configureMainKernel("K17CompressibleNavierStokes"); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); @@ -292,7 +294,7 @@ TEST_F(ParameterTestCumulantK17, CumulantK17_VelocityIsOk_expectNoWarning) TEST_F(ParameterTestCumulantK17, NotCumulantK17_VelocityIsTooHigh_expectNoWarning) { para.setVelocityLB(42); - para.setMainKernel("K"); + para.configureMainKernel("K"); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); @@ -303,7 +305,7 @@ TEST_F(ParameterTestCumulantK17, NotCumulantK17_VelocityIsTooHigh_expectNoWarnin TEST_F(ParameterTestCumulantK17, CumulantK17_ViscosityIsTooHigh_expectWarning) { para.setViscosityLB(0.024); - para.setMainKernel("CumulantK17"); + para.configureMainKernel("K17CompressibleNavierStokes"); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); @@ -314,7 +316,7 @@ TEST_F(ParameterTestCumulantK17, CumulantK17_ViscosityIsTooHigh_expectWarning) TEST_F(ParameterTestCumulantK17, CumulantK17_ViscosityIsOk_expectNoWarning) { para.setViscosityLB(0.023); - para.setMainKernel("CumulantK17"); + para.configureMainKernel("K17CompressibleNavierStokes"); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); @@ -325,7 +327,7 @@ TEST_F(ParameterTestCumulantK17, CumulantK17_ViscosityIsOk_expectNoWarning) TEST_F(ParameterTestCumulantK17, NotCumulantK17_ViscosityIsTooHigh_expectNoWarning) { para.setViscosityLB(10); - para.setMainKernel("K"); + para.configureMainKernel("K"); testing::internal::CaptureStdout(); para.initLBMSimulationParameter(); diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu index bcdd63657d13cd8a9dcef3372fe02760a337b057..c09e58d9dd664e7b513131ffa1bdb548eb35a244 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.cu @@ -31,43 +31,29 @@ //! \author Henrik Asmuth, Henry Korb //====================================================================================== #include "ActuatorFarm.h" +#include "ActuatorFarmInlines.h" #include <cuda.h> #include <cuda_runtime.h> #include <helper_cuda.h> -#include "cuda/CudaGrid.h" +#include <logger/Logger.h> +#include <cuda_helper/CudaGrid.h> +#include <basics/constants/NumericConstants.h> +#include <basics/writer/WbWriterVtkXmlBinary.h> + #include "VirtualFluids_GPU/GPU/GeometryUtils.h" #include "LBM/GPUHelperFunctions/KernelUtilities.h" - #include "Parameter/Parameter.h" #include "Parameter/CudaStreamManager.h" #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" -#include "basics/constants/NumericConstants.h" -#include <logger/Logger.h> using namespace vf::basics::constant; - -__host__ __device__ __inline__ uint calcNode(uint bladeNode, uint numberOfBladeNodes, uint blade, uint numberOfBlades, uint turbine, uint numberOfTurbines) -{ - - return bladeNode+numberOfBladeNodes*(blade+numberOfBlades*turbine); -} - -__host__ __device__ __inline__ void calcTurbineBladeAndBladeNode(uint node, uint& bladeNode, uint numberOfBladeNodes, uint& blade, uint numberOfBlades, uint& turbine, uint numberOfTurbines) -{ - turbine = node/(numberOfBladeNodes*numberOfBlades); - uint x_off = turbine*numberOfBladeNodes*numberOfBlades; - blade = (node - x_off)/numberOfBlades; - uint y_off = numberOfBladeNodes*blade+x_off; - bladeNode = (node - y_off); -} - __host__ __device__ __forceinline__ real distSqrd(real distX, real distY, real distZ) { - return distX*distX+distY*distY+distZ*distZ; + return distX * distX + distY * distY + distZ * distZ; } void swapArrays(real* &arr1, real* &arr2) @@ -100,13 +86,31 @@ __host__ __device__ __inline__ void rotateFromGlobalToBlade( invRotateAboutX3D(azimuth, tmpX, tmpY, tmpZ, bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF); } -__global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real* gridCoordsZ, - uint* neighborsX, uint* neighborsY, uint* neighborsZ, uint* neighborsWSB, - real* vx, real* vy, real* vz, +__host__ __device__ __inline__ void calcCoordinateOfBladeNodeInGridFrameOfReference(uint bladeNodeIndex, uint turbine, real localAzimuth, real yaw, + const real* bladeCoordsX, const real* bladeCoordsY, const real* bladeCoordsZ, + const real* turbPosX, const real* turbPosY, const real* turbPosZ, + real& bladeCoordX_GF, real& bladeCoordY_GF, real& bladeCoordZ_GF) +{ + + const real bladeCoordX_BF = bladeCoordsX[bladeNodeIndex]; + const real bladeCoordY_BF = bladeCoordsY[bladeNodeIndex]; + const real bladeCoordZ_BF = bladeCoordsZ[bladeNodeIndex]; + + rotateFromBladeToGlobal(bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF, bladeCoordX_GF, bladeCoordY_GF, + bladeCoordZ_GF, localAzimuth, yaw); + + bladeCoordX_GF += turbPosX[turbine]; + bladeCoordY_GF += turbPosY[turbine]; + bladeCoordZ_GF += turbPosZ[turbine]; +} + +__global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real* gridCoordsZ, + uint* neighborsX, uint* neighborsY, uint* neighborsZ, uint* neighborsWSB, + real* vx, real* vy, real* vz, real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, - real* bladeVelocitiesX, real* bladeVelocitiesY, real* bladeVelocitiesZ, - uint numberOfTurbines, uint numberOfBlades, uint numberOfBladeNodes, - real* azimuths, real* yaws, real* omegas, + real* bladeVelocitiesX, real* bladeVelocitiesY, real* bladeVelocitiesZ, + uint numberOfTurbines, uint numberOfBlades, uint numberOfBladeNodes, + real* azimuths, real* yaws, real* omegas, real* turbPosX, real* turbPosY, real* turbPosZ, uint* bladeIndices, real velocityRatio, real invDeltaX) { @@ -116,66 +120,54 @@ __global__ void interpolateVelocities(real* gridCoordsX, real* gridCoordsY, real //! const unsigned nodeIndex = vf::gpu::getNodeIndex(); - if(nodeIndex>=numberOfBladeNodes*numberOfBlades*numberOfTurbines) return; - - uint turbine, bladeNode, blade; + if (nodeIndex >= numberOfBladeNodes * numberOfBlades * numberOfTurbines) return; - calcTurbineBladeAndBladeNode(nodeIndex, bladeNode, numberOfBladeNodes, blade, numberOfBlades, turbine, numberOfTurbines); + auto [turbine, blade, bladeNodeIndexOnBlade] = calcTurbineBladeAndBladeNode(nodeIndex, numberOfBladeNodes, numberOfBlades); - real bladeCoordX_BF = bladeCoordsX[nodeIndex]; - real bladeCoordY_BF = bladeCoordsY[nodeIndex]; - real bladeCoordZ_BF = bladeCoordsZ[nodeIndex]; + const real localAzimuth = azimuths[turbine] + blade * c2Pi / numberOfBlades; + const real yaw = yaws[turbine]; real bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF; - - real localAzimuth = azimuths[turbine]+blade*c2Pi/numberOfBlades; - real yaw = yaws[turbine]; - - - rotateFromBladeToGlobal(bladeCoordX_BF, bladeCoordY_BF, bladeCoordZ_BF, - bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, - localAzimuth, yaw); - - bladeCoordX_GF += turbPosX[turbine]; - bladeCoordY_GF += turbPosY[turbine]; - bladeCoordZ_GF += turbPosZ[turbine]; + calcCoordinateOfBladeNodeInGridFrameOfReference(nodeIndex, turbine, localAzimuth, yaw, + bladeCoordsX, bladeCoordsY, bladeCoordsZ, + turbPosX, turbPosY, turbPosZ, + bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF); uint k, ke, kn, kt; uint kne, kte, ktn, ktne; - k = findNearestCellBSW(bladeIndices[nodeIndex], - gridCoordsX, gridCoordsY, gridCoordsZ, - bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, + k = findNearestCellBSW(bladeIndices[nodeIndex], + gridCoordsX, gridCoordsY, gridCoordsZ, + bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF, neighborsX, neighborsY, neighborsZ, neighborsWSB); - + bladeIndices[nodeIndex] = k; getNeighborIndicesOfBSW(k, ke, kn, kt, kne, kte, ktn, ktne, neighborsX, neighborsY, neighborsZ); real dW, dE, dN, dS, dT, dB; - real distX = invDeltaX*(bladeCoordX_GF-gridCoordsX[k]); - real distY = invDeltaX*(bladeCoordY_GF-gridCoordsY[k]); - real distZ = invDeltaX*(bladeCoordZ_GF-gridCoordsZ[k]); + real distX = invDeltaX * (bladeCoordX_GF - gridCoordsX[k]); + real distY = invDeltaX * (bladeCoordY_GF - gridCoordsY[k]); + real distZ = invDeltaX * (bladeCoordZ_GF - gridCoordsZ[k]); getInterpolationWeights(dW, dE, dN, dS, dT, dB, distX, distY, distZ); - real bladeVelX_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx)*velocityRatio; - real bladeVelY_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy)*velocityRatio; - real bladeVelZ_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz)*velocityRatio; + real bladeVelX_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vx) * velocityRatio; + real bladeVelY_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vy) * velocityRatio; + real bladeVelZ_GF = trilinearInterpolation(dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz) * velocityRatio; real bladeVelX_BF, bladeVelY_BF, bladeVelZ_BF; - rotateFromGlobalToBlade(bladeVelX_BF, bladeVelY_BF, bladeVelZ_BF, - bladeVelX_GF, bladeVelY_GF, bladeVelZ_GF, + rotateFromGlobalToBlade(bladeVelX_BF, bladeVelY_BF, bladeVelZ_BF, + bladeVelX_GF, bladeVelY_GF, bladeVelZ_GF, localAzimuth, yaw); bladeVelocitiesX[nodeIndex] = bladeVelX_BF; - bladeVelocitiesY[nodeIndex] = bladeVelY_BF+omegas[turbine]*bladeCoordZ_BF; + bladeVelocitiesY[nodeIndex] = bladeVelY_BF + omegas[turbine] * bladeCoordsZ[nodeIndex]; bladeVelocitiesZ[nodeIndex] = bladeVelZ_BF; } - __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* gridCoordsZ, real* gridForcesX, real* gridForcesY, real* gridForcesZ, real* bladeCoordsX, real* bladeCoordsY, real* bladeCoordsZ, @@ -189,8 +181,7 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid const uint index = vf::gpu::getNodeIndex(); - if(index>=nIndices) return; - + if (index >= nIndices) return; uint gridIndex = gridIndices[index]; @@ -202,34 +193,30 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid real gridForceY_RF = c0o1; real gridForceZ_RF = c0o1; - real dAzimuth = c2Pi/numberOfBlades; + real dAzimuth = c2Pi / numberOfBlades; - for(uint turbine = 0; turbine<numberOfTurbines; turbine++) - { - real radius = c1o2*diameters[turbine]; + for (uint turbine = 0; turbine < numberOfTurbines; turbine++) { + real radius = c1o2 * diameters[turbine]; real gridCoordX_RF = gridCoordX_GF - turbPosX[turbine]; real gridCoordY_RF = gridCoordY_GF - turbPosY[turbine]; real gridCoordZ_RF = gridCoordZ_GF - turbPosZ[turbine]; - if(distSqrd(gridCoordX_RF, gridCoordY_RF, gridCoordZ_RF)*invEpsilonSqrd > radius*radius*invEpsilonSqrd+c7o1) - continue; + if (distSqrd(gridCoordX_RF, gridCoordY_RF, gridCoordZ_RF) * invEpsilonSqrd > radius * radius * invEpsilonSqrd + c7o1) continue; real azimuth = azimuths[turbine]; real yaw = yaws[turbine]; - for( uint blade=0; blade<numberOfBlades; blade++) - { - real localAzimuth = azimuth+blade*dAzimuth; - + for (uint blade = 0; blade < numberOfBlades; blade++) { + real localAzimuth = azimuth + blade * dAzimuth; real gridCoordX_BF, gridCoordY_BF, gridCoordZ_BF; rotateFromGlobalToBlade(gridCoordX_BF, gridCoordY_BF, gridCoordZ_BF, gridCoordX_RF, gridCoordY_RF, gridCoordZ_RF, localAzimuth, yaw); - + uint node; - uint nextNode = calcNode(0, numberOfBladeNodes, blade, numberOfBlades, turbine, numberOfTurbines); + uint nextNode = calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ blade, /*.bladeNode =*/0 }, numberOfBladeNodes, numberOfBlades); real last_z = c0o1; real current_z = c0o1; @@ -237,10 +224,9 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid real x, y, dz, eta, forceX_RF, forceY_RF, forceZ_RF; - for( uint bladeNode=0; bladeNode<numberOfBladeNodes-1; bladeNode++) - { + for (uint bladeNode = 0; bladeNode < numberOfBladeNodes - 1; bladeNode++) { node = nextNode; - nextNode = calcNode(bladeNode+1, numberOfBladeNodes, blade, numberOfBlades, turbine, numberOfTurbines); + nextNode = calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ blade, /*.bladeNode =*/bladeNode + 1 }, numberOfBladeNodes, numberOfBlades); x = bladeCoordsX[node]; y = bladeCoordsY[node]; @@ -248,19 +234,17 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid current_z = next_z; next_z = bladeCoordsZ[nextNode]; - dz = c1o2*(next_z-last_z); + dz = c1o2 * (next_z - last_z); - eta = dz*factorGaussian*exp(-distSqrd(x-gridCoordX_BF, y-gridCoordY_BF, current_z-gridCoordZ_BF)*invEpsilonSqrd); - rotateFromBladeToGlobal(bladeForcesX[node], bladeForcesY[node], bladeForcesZ[node], - forceX_RF, forceY_RF, forceZ_RF, - localAzimuth, yaw); - - gridForceX_RF += forceX_RF*eta; - gridForceY_RF += forceY_RF*eta; - gridForceZ_RF += forceZ_RF*eta; + eta = dz * factorGaussian * exp(-distSqrd(x - gridCoordX_BF, y - gridCoordY_BF, current_z - gridCoordZ_BF) * invEpsilonSqrd); + rotateFromBladeToGlobal(bladeForcesX[node], bladeForcesY[node], bladeForcesZ[node], forceX_RF, forceY_RF, forceZ_RF, localAzimuth, yaw); + + gridForceX_RF += forceX_RF * eta; + gridForceY_RF += forceY_RF * eta; + gridForceZ_RF += forceZ_RF * eta; } - //Handle last node separately + // Handle last node separately node = nextNode; @@ -269,17 +253,17 @@ __global__ void applyBodyForces(real* gridCoordsX, real* gridCoordsY, real* grid last_z = current_z; current_z = next_z; - dz = c1o2*(radius-last_z); + dz = c1o2 * (radius - last_z); - eta = dz*factorGaussian*exp(-distSqrd(x-gridCoordX_BF, y-gridCoordY_BF, current_z-gridCoordZ_BF)*invEpsilonSqrd); + eta = dz * factorGaussian * exp(-distSqrd(x - gridCoordX_BF, y - gridCoordY_BF, current_z - gridCoordZ_BF) * invEpsilonSqrd); - rotateFromBladeToGlobal(bladeForcesX[node], bladeForcesY[node], bladeForcesZ[node], - forceX_RF, forceY_RF, forceZ_RF, + rotateFromBladeToGlobal(bladeForcesX[node], bladeForcesY[node], bladeForcesZ[node], + forceX_RF, forceY_RF, forceZ_RF, localAzimuth, yaw); - - gridForceX_RF += forceX_RF*eta; - gridForceY_RF += forceY_RF*eta; - gridForceZ_RF += forceZ_RF*eta; + + gridForceX_RF += forceX_RF * eta; + gridForceY_RF += forceY_RF * eta; + gridForceZ_RF += forceZ_RF * eta; } } @@ -300,9 +284,9 @@ void ActuatorFarm::addTurbine(real posX, real posY, real posZ, real diameter, re preInitBladeRadii.push_back(bladeRadii); } -void ActuatorFarm::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) +void ActuatorFarm::init(Parameter *para, GridProvider *gridProvider, CudaMemoryManager *cudaMemoryManager) { - if(!para->getIsBodyForce()) throw std::runtime_error("try to allocate ActuatorFarm but BodyForce is not set in Parameter."); + if (!para->getIsBodyForce()) throw std::runtime_error("try to allocate ActuatorFarm but BodyForce is not set in Parameter."); this->forceRatio = para->getForceRatio(); this->initTurbineGeometries(cudaMemoryManager); this->initBladeCoords(cudaMemoryManager); @@ -310,43 +294,45 @@ void ActuatorFarm::init(Parameter* para, GridProvider* gridProvider, CudaMemoryM this->initBladeVelocities(cudaMemoryManager); this->initBladeForces(cudaMemoryManager); this->initBoundingSpheres(para, cudaMemoryManager); - this->streamIndex = 0; + this->streamIndex = para->getStreamManager()->registerAndLaunchStream(CudaStreamIndex::ActuatorFarm); } -void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, unsigned int t) +void ActuatorFarm::interact(Parameter *para, CudaMemoryManager *cudaMemoryManager, int level, unsigned int t) { if (level != this->level) return; cudaStream_t stream = para->getStreamManager()->getStream(CudaStreamIndex::ActuatorFarm, this->streamIndex); - if(useHostArrays) cudaMemoryManager->cudaCopyBladeCoordsHtoD(this); + if (useHostArrays) cudaMemoryManager->cudaCopyBladeCoordsHtoD(this); vf::cuda::CudaGrid bladeGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->numberOfGridNodes); + // if (t == 0) this->writeBladeCoordsToVtkForDebug("output/ALM/bladecoords_" + std::to_string(t)); + interpolateVelocities<<< bladeGrid.grid, bladeGrid.threads, 0, stream >>>( - para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, + para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, para->getParD(this->level)->neighborX, para->getParD(this->level)->neighborY, para->getParD(this->level)->neighborZ, para->getParD(this->level)->neighborInverse, para->getParD(this->level)->velocityX, para->getParD(this->level)->velocityY, para->getParD(this->level)->velocityZ, this->bladeCoordsXDCurrentTimestep, this->bladeCoordsYDCurrentTimestep, this->bladeCoordsZDCurrentTimestep, - this->bladeVelocitiesXDCurrentTimestep, this->bladeVelocitiesYDCurrentTimestep, this->bladeVelocitiesZDCurrentTimestep, + this->bladeVelocitiesXDCurrentTimestep, this->bladeVelocitiesYDCurrentTimestep, this->bladeVelocitiesZDCurrentTimestep, this->numberOfTurbines, this->numberOfBlades, this->numberOfBladeNodes, this->azimuthsD, this->yawsD, this->omegasD, this->turbinePosXD, this->turbinePosYD, this->turbinePosZD, this->bladeIndicesD, para->getVelocityRatio(), this->invDeltaX); cudaStreamSynchronize(stream); - if(useHostArrays) cudaMemoryManager->cudaCopyBladeVelocitiesDtoH(this); + if (useHostArrays) cudaMemoryManager->cudaCopyBladeVelocitiesDtoH(this); this->calcBladeForces(); this->swapDeviceArrays(); - if(useHostArrays) cudaMemoryManager->cudaCopyBladeForcesHtoD(this); + if (useHostArrays) cudaMemoryManager->cudaCopyBladeForcesHtoD(this); vf::cuda::CudaGrid sphereGrid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, this->numberOfIndices); applyBodyForces<<<sphereGrid.grid, sphereGrid.threads, 0, stream>>>( - para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, - para->getParD(this->level)->forceX_SP, para->getParD(this->level)->forceY_SP, para->getParD(this->level)->forceZ_SP, - this->bladeCoordsXDCurrentTimestep, this->bladeCoordsYDCurrentTimestep, this->bladeCoordsZDCurrentTimestep, + para->getParD(this->level)->coordinateX, para->getParD(this->level)->coordinateY, para->getParD(this->level)->coordinateZ, + para->getParD(this->level)->forceX_SP, para->getParD(this->level)->forceY_SP, para->getParD(this->level)->forceZ_SP, + this->bladeCoordsXDCurrentTimestep, this->bladeCoordsYDCurrentTimestep, this->bladeCoordsZDCurrentTimestep, this->bladeForcesXDCurrentTimestep, this->bladeForcesYDCurrentTimestep, this->bladeForcesZDCurrentTimestep, this->numberOfTurbines, this->numberOfBlades, this->numberOfBladeNodes, this->azimuthsD, this->yawsD, this->diametersD, @@ -357,8 +343,7 @@ void ActuatorFarm::interact(Parameter* para, CudaMemoryManager* cudaMemoryManage cudaStreamSynchronize(stream); } - -void ActuatorFarm::free(Parameter* para, CudaMemoryManager* cudaMemoryManager) +void ActuatorFarm::free(Parameter *para, CudaMemoryManager *cudaMemoryManager) { cudaMemoryManager->cudaFreeBladeGeometries(this); cudaMemoryManager->cudaFreeBladeOrientations(this); @@ -369,43 +354,42 @@ void ActuatorFarm::free(Parameter* para, CudaMemoryManager* cudaMemoryManager) cudaMemoryManager->cudaFreeSphereIndices(this); } - void ActuatorFarm::calcForcesEllipticWing() { real u_rel, v_rel, u_rel_sq; real phi; real Cl = c1o1; real Cd = c0o1; - real c0 = 20*c1o10; + real c0 = 20 * c1o10; real c, Cn, Ct; - for(uint turbine=0; turbine<this->numberOfTurbines; turbine++) + for (uint turbine = 0; turbine < this->numberOfTurbines; turbine++) { real diameter = this->diametersH[turbine]; - for( uint blade=0; blade<this->numberOfBlades; blade++) - { - for( uint bladeNode=0; bladeNode<this->numberOfBladeNodes; bladeNode++) - { - uint node = calcNode(bladeNode, this->numberOfBladeNodes, blade, this->numberOfBlades, turbine, this->numberOfTurbines); + for (uint blade = 0; blade < this->numberOfBlades; blade++) + { + for (uint bladeNode = 0; bladeNode < this->numberOfBladeNodes; bladeNode++) + { + uint node = calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ blade, /*.bladeNode =*/bladeNode }, this->numberOfBladeNodes, this->numberOfBlades); u_rel = this->bladeVelocitiesXH[node]; v_rel = this->bladeVelocitiesYH[node]; - u_rel_sq = u_rel*u_rel+v_rel*v_rel; + u_rel_sq = u_rel * u_rel + v_rel * v_rel; phi = atan2(u_rel, v_rel); - - real tmp = c4o1*this->bladeRadiiH[bladeNode]/diameter-c1o1; - c = c0 * sqrt( c1o1- tmp*tmp ); - Cn = Cl*cos(phi)+Cd*sin(phi); - Ct = Cl*sin(phi)-Cd*cos(phi); - real fx = c1o2*u_rel_sq*c*this->density*Cn; - real fy = c1o2*u_rel_sq*c*this->density*Ct; + + real tmp = c4o1 * this->bladeRadiiH[bladeNode] / diameter - c1o1; + c = c0 * sqrt(c1o1 - tmp * tmp); + Cn = Cl * cos(phi) + Cd * sin(phi); + Ct = Cl * sin(phi) - Cd * cos(phi); + real fx = c1o2 * u_rel_sq * c * this->density * Cn; + real fy = c1o2 * u_rel_sq * c * this->density * Ct; this->bladeForcesXH[node] = -fx; this->bladeForcesYH[node] = -fy; this->bladeForcesZH[node] = c0o1; // printf("u %f v %f fx %f fy %f \n", u_rel, v_rel, fx, fy); } } - azimuthsH[turbine] = azimuthsH[turbine]+deltaT*omegasH[turbine]; + azimuthsH[turbine] = azimuthsH[turbine] + deltaT * omegasH[turbine]; } } @@ -414,28 +398,24 @@ void ActuatorFarm::calcBladeForces() this->calcForcesEllipticWing(); } -void ActuatorFarm::getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) +void ActuatorFarm::getTaggedFluidNodes(Parameter *para, GridProvider *gridProvider) { - std::vector<uint> indicesInSphere(this->boundingSphereIndicesH, this->boundingSphereIndicesH+this->numberOfIndices); + std::vector<uint> indicesInSphere(this->boundingSphereIndicesH, this->boundingSphereIndicesH + this->numberOfIndices); gridProvider->tagFluidNodeIndices(indicesInSphere, CollisionTemplate::AllFeatures, this->level); -} - +} -void ActuatorFarm::initTurbineGeometries(CudaMemoryManager* cudaMemoryManager) +void ActuatorFarm::initTurbineGeometries(CudaMemoryManager *cudaMemoryManager) { this->numberOfTurbines = uint(this->preInitDiameters.size()); - this->numberOfGridNodes = numberOfTurbines*numberOfBladeNodes*numberOfBlades; + this->numberOfGridNodes = numberOfTurbines * numberOfBladeNodes * numberOfBlades; cudaMemoryManager->cudaAllocBladeGeometries(this); cudaMemoryManager->cudaAllocBladeOrientations(this); - for(uint turbine=0; turbine<this->numberOfTurbines; turbine++) - { - for(uint node=0; node<this->numberOfBladeNodes; node++) - { - this->bladeRadiiH[calcNode(node, numberOfBladeNodes, 0, 1, turbine, numberOfTurbines)] = this->preInitBladeRadii[turbine][node]; + for (uint turbine = 0; turbine < this->numberOfTurbines; turbine++) { + for (uint node = 0; node < this->numberOfBladeNodes; node++) { + this->bladeRadiiH[calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ 0, /*.bladeNode =*/node }, numberOfBladeNodes, 1)] = this->preInitBladeRadii[turbine][node]; } - } std::copy(preInitPosX.begin(), preInitPosX.end(), turbinePosXH); std::copy(preInitPosY.begin(), preInitPosY.end(), turbinePosYH); @@ -448,24 +428,23 @@ void ActuatorFarm::initTurbineGeometries(CudaMemoryManager* cudaMemoryManager) std::copy(preInitYaws.begin(), preInitYaws.end(), this->yawsH); cudaMemoryManager->cudaCopyBladeOrientationsHtoD(this); - this->factorGaussian = pow(this->epsilon*sqrt(cPi),-c3o1)/this->forceRatio; + this->factorGaussian = pow(this->epsilon * sqrt(cPi), -c3o1) / this->forceRatio; } -void ActuatorFarm::initBladeCoords(CudaMemoryManager* cudaMemoryManager) -{ +void ActuatorFarm::initBladeCoords(CudaMemoryManager *cudaMemoryManager) +{ cudaMemoryManager->cudaAllocBladeCoords(this); - for(uint turbine=0; turbine<numberOfTurbines; turbine++) + for (uint turbine = 0; turbine < numberOfTurbines; turbine++) { - for(uint blade=0; blade<this->numberOfBlades; blade++) + for (uint blade = 0; blade < this->numberOfBlades; blade++) { - for(uint bladeNode=0; bladeNode<this->numberOfBladeNodes; bladeNode++) - { - uint node = calcNode(bladeNode, this->numberOfBladeNodes, blade, this->numberOfBlades, turbine, this->numberOfTurbines); + for (uint bladeNode = 0; bladeNode < this->numberOfBladeNodes; bladeNode++) { + uint node = calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ blade, /*.bladeNode =*/bladeNode }, this->numberOfBladeNodes, this->numberOfBlades); this->bladeCoordsXH[node] = c0o1; this->bladeCoordsYH[node] = c0o1; - this->bladeCoordsZH[node] = this->bladeRadiiH[calcNode(bladeNode, numberOfBladeNodes, 0, 1, turbine, numberOfTurbines)]; + this->bladeCoordsZH[node] = this->bladeRadiiH[calcNodeIndexInBladeArrays({ /*.turbine = */ turbine, /* .blade = */ 0, /*.bladeNode =*/bladeNode }, numberOfBladeNodes, 1)]; } } } @@ -476,8 +455,8 @@ void ActuatorFarm::initBladeCoords(CudaMemoryManager* cudaMemoryManager) cudaMemoryManager->cudaCopyBladeCoordsHtoD(this); } -void ActuatorFarm::initBladeVelocities(CudaMemoryManager* cudaMemoryManager) -{ +void ActuatorFarm::initBladeVelocities(CudaMemoryManager *cudaMemoryManager) +{ cudaMemoryManager->cudaAllocBladeVelocities(this); std::fill_n(this->bladeVelocitiesXH, this->numberOfGridNodes, c0o1); @@ -491,8 +470,8 @@ void ActuatorFarm::initBladeVelocities(CudaMemoryManager* cudaMemoryManager) cudaMemoryManager->cudaCopyBladeVelocitiesHtoD(this); } -void ActuatorFarm::initBladeForces(CudaMemoryManager* cudaMemoryManager) -{ +void ActuatorFarm::initBladeForces(CudaMemoryManager *cudaMemoryManager) +{ cudaMemoryManager->cudaAllocBladeForces(this); std::fill_n(this->bladeForcesXH, this->numberOfGridNodes, c0o1); @@ -506,8 +485,8 @@ void ActuatorFarm::initBladeForces(CudaMemoryManager* cudaMemoryManager) cudaMemoryManager->cudaCopyBladeForcesHtoD(this); } -void ActuatorFarm::initBladeIndices(Parameter* para, CudaMemoryManager* cudaMemoryManager) -{ +void ActuatorFarm::initBladeIndices(Parameter *para, CudaMemoryManager *cudaMemoryManager) +{ cudaMemoryManager->cudaAllocBladeIndices(this); std::fill_n(this->bladeIndicesH, this->numberOfGridNodes, 1); @@ -515,37 +494,34 @@ void ActuatorFarm::initBladeIndices(Parameter* para, CudaMemoryManager* cudaMemo cudaMemoryManager->cudaCopyBladeIndicesHtoD(this); } -void ActuatorFarm::initBoundingSpheres(Parameter* para, CudaMemoryManager* cudaMemoryManager) +void ActuatorFarm::initBoundingSpheres(Parameter *para, CudaMemoryManager *cudaMemoryManager) { std::vector<int> nodesInSpheres; - for(uint turbine=0; turbine<this->numberOfTurbines; turbine++) - { - real sphereRadius = c1o2*this->diametersH[turbine]+c4o1*this->epsilon; + for (uint turbine = 0; turbine < this->numberOfTurbines; turbine++) { + real sphereRadius = c1o2 * this->diametersH[turbine] + c4o1 * this->epsilon; real posX = this->turbinePosXH[turbine]; real posY = this->turbinePosYH[turbine]; real posZ = this->turbinePosZH[turbine]; - real sphereRadiusSqrd = sphereRadius*sphereRadius; - - uint minimumNumberOfNodesPerSphere = (uint)(c4o3*cPi*pow(sphereRadius-this->deltaX, c3o1)/pow(this->deltaX, c3o1)); + real sphereRadiusSqrd = sphereRadius * sphereRadius; + + uint minimumNumberOfNodesPerSphere = + (uint)(c4o3 * cPi * pow(sphereRadius - this->deltaX, c3o1) / pow(this->deltaX, c3o1)); uint nodesInThisSphere = 0; - for (size_t pos = 1; pos <= para->getParH(this->level)->numberOfNodes; pos++) - { - const real distX = para->getParH(this->level)->coordinateX[pos]-posX; - const real distY = para->getParH(this->level)->coordinateY[pos]-posY; - const real distZ = para->getParH(this->level)->coordinateZ[pos]-posZ; - if(distSqrd(distX,distY,distZ) < sphereRadiusSqrd) - { + for (size_t pos = 1; pos <= para->getParH(this->level)->numberOfNodes; pos++) { + const real distX = para->getParH(this->level)->coordinateX[pos] - posX; + const real distY = para->getParH(this->level)->coordinateY[pos] - posY; + const real distZ = para->getParH(this->level)->coordinateZ[pos] - posZ; + if (distSqrd(distX, distY, distZ) < sphereRadiusSqrd) { nodesInSpheres.push_back((int)pos); nodesInThisSphere++; } } - if(nodesInThisSphere<minimumNumberOfNodesPerSphere) - { + if (nodesInThisSphere < minimumNumberOfNodesPerSphere) { VF_LOG_CRITICAL("Found only {} nodes in bounding sphere of turbine no. {}, expected at least {}!", nodesInThisSphere, turbine, minimumNumberOfNodesPerSphere); throw std::runtime_error("ActuatorFarm::initBoundingSpheres: Turbine bounding sphere partially out of domain."); } @@ -558,60 +534,60 @@ void ActuatorFarm::initBoundingSpheres(Parameter* para, CudaMemoryManager* cudaM cudaMemoryManager->cudaCopySphereIndicesHtoD(this); } -void ActuatorFarm::setAllAzimuths(real* _azimuths) -{ +void ActuatorFarm::setAllAzimuths(real *_azimuths) +{ std::copy_n(_azimuths, this->numberOfTurbines, this->azimuthsH); } -void ActuatorFarm::setAllOmegas(real* _omegas) -{ +void ActuatorFarm::setAllOmegas(real *_omegas) +{ std::copy_n(_omegas, this->numberOfTurbines, this->omegasH); } -void ActuatorFarm::setAllYaws(real* _yaws) -{ +void ActuatorFarm::setAllYaws(real *_yaws) +{ std::copy_n(_yaws, this->numberOfTurbines, this->yawsH); } -void ActuatorFarm::setAllBladeCoords(real* _bladeCoordsX, real* _bladeCoordsY, real* _bladeCoordsZ) -{ +void ActuatorFarm::setAllBladeCoords(real *_bladeCoordsX, real *_bladeCoordsY, real *_bladeCoordsZ) +{ std::copy_n(_bladeCoordsX, this->numberOfGridNodes, this->bladeCoordsXH); std::copy_n(_bladeCoordsY, this->numberOfGridNodes, this->bladeCoordsYH); std::copy_n(_bladeCoordsZ, this->numberOfGridNodes, this->bladeCoordsZH); } -void ActuatorFarm::setAllBladeVelocities(real* _bladeVelocitiesX, real* _bladeVelocitiesY, real* _bladeVelocitiesZ) -{ +void ActuatorFarm::setAllBladeVelocities(real *_bladeVelocitiesX, real *_bladeVelocitiesY, real *_bladeVelocitiesZ) +{ std::copy_n(_bladeVelocitiesX, this->numberOfGridNodes, this->bladeVelocitiesXH); std::copy_n(_bladeVelocitiesY, this->numberOfGridNodes, this->bladeVelocitiesYH); std::copy_n(_bladeVelocitiesZ, this->numberOfGridNodes, this->bladeVelocitiesZH); } -void ActuatorFarm::setAllBladeForces(real* _bladeForcesX, real* _bladeForcesY, real* _bladeForcesZ) -{ +void ActuatorFarm::setAllBladeForces(real *_bladeForcesX, real *_bladeForcesY, real *_bladeForcesZ) +{ std::copy_n(_bladeForcesX, this->numberOfGridNodes, this->bladeForcesXH); std::copy_n(_bladeForcesY, this->numberOfGridNodes, this->bladeForcesYH); std::copy_n(_bladeForcesZ, this->numberOfGridNodes, this->bladeForcesZH); - -}void ActuatorFarm::setTurbineBladeCoords(uint turbine, real* _bladeCoordsX, real* _bladeCoordsY, real* _bladeCoordsZ) -{ - std::copy_n(_bladeCoordsX, numberOfBladeNodes*numberOfBlades, &this->bladeCoordsXH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeCoordsY, numberOfBladeNodes*numberOfBlades, &this->bladeCoordsYH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeCoordsZ, numberOfBladeNodes*numberOfBlades, &this->bladeCoordsZH[turbine*numberOfBladeNodes*numberOfBlades]); +} +void ActuatorFarm::setTurbineBladeCoords(uint turbine, real *_bladeCoordsX, real *_bladeCoordsY, real *_bladeCoordsZ) +{ + std::copy_n(_bladeCoordsX, numberOfBladeNodes * numberOfBlades, &this->bladeCoordsXH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeCoordsY, numberOfBladeNodes * numberOfBlades, &this->bladeCoordsYH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeCoordsZ, numberOfBladeNodes * numberOfBlades, &this->bladeCoordsZH[turbine * numberOfBladeNodes * numberOfBlades]); } -void ActuatorFarm::setTurbineBladeVelocities(uint turbine, real* _bladeVelocitiesX, real* _bladeVelocitiesY, real* _bladeVelocitiesZ) -{ - std::copy_n(_bladeVelocitiesX, numberOfBladeNodes*numberOfBlades, &this->bladeVelocitiesXH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeVelocitiesY, numberOfBladeNodes*numberOfBlades, &this->bladeVelocitiesYH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeVelocitiesZ, numberOfBladeNodes*numberOfBlades, &this->bladeVelocitiesZH[turbine*numberOfBladeNodes*numberOfBlades]); +void ActuatorFarm::setTurbineBladeVelocities(uint turbine, real *_bladeVelocitiesX, real *_bladeVelocitiesY, real *_bladeVelocitiesZ) +{ + std::copy_n(_bladeVelocitiesX, numberOfBladeNodes * numberOfBlades, &this->bladeVelocitiesXH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeVelocitiesY, numberOfBladeNodes * numberOfBlades, &this->bladeVelocitiesYH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeVelocitiesZ, numberOfBladeNodes * numberOfBlades, &this->bladeVelocitiesZH[turbine * numberOfBladeNodes * numberOfBlades]); } -void ActuatorFarm::setTurbineBladeForces(uint turbine, real* _bladeForcesX, real* _bladeForcesY, real* _bladeForcesZ) -{ - std::copy_n(_bladeForcesX, numberOfBladeNodes*numberOfBlades, &this->bladeForcesXH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeForcesY, numberOfBladeNodes*numberOfBlades, &this->bladeForcesYH[turbine*numberOfBladeNodes*numberOfBlades]); - std::copy_n(_bladeForcesZ, numberOfBladeNodes*numberOfBlades, &this->bladeForcesZH[turbine*numberOfBladeNodes*numberOfBlades]); +void ActuatorFarm::setTurbineBladeForces(uint turbine, real *_bladeForcesX, real *_bladeForcesY, real *_bladeForcesZ) +{ + std::copy_n(_bladeForcesX, numberOfBladeNodes * numberOfBlades, &this->bladeForcesXH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeForcesY, numberOfBladeNodes * numberOfBlades, &this->bladeForcesYH[turbine * numberOfBladeNodes * numberOfBlades]); + std::copy_n(_bladeForcesZ, numberOfBladeNodes * numberOfBlades, &this->bladeForcesZH[turbine * numberOfBladeNodes * numberOfBlades]); } void ActuatorFarm::swapDeviceArrays() @@ -627,4 +603,27 @@ void ActuatorFarm::swapDeviceArrays() swapArrays(this->bladeForcesXDPreviousTimestep, this->bladeForcesXDCurrentTimestep); swapArrays(this->bladeForcesYDPreviousTimestep, this->bladeForcesYDCurrentTimestep); swapArrays(this->bladeForcesZDPreviousTimestep, this->bladeForcesZDCurrentTimestep); +} + +void ActuatorFarm::writeBladeCoordsToVtkForDebug(const std::string &filename) +{ + std::vector<real> coordsX(numberOfGridNodes); + std::vector<real> coordsY(numberOfGridNodes); + std::vector<real> coordsZ(numberOfGridNodes); + + for (uint nodeIndex = 0; nodeIndex < numberOfGridNodes; nodeIndex++) { + auto [turbine, blade, bladeNodeIndexOnBlade] = calcTurbineBladeAndBladeNode(nodeIndex, numberOfBladeNodes, numberOfBlades); + + const real localAzimuth = this->getTurbineAzimuth(turbine) + blade * c2Pi / numberOfBlades; + const real yaw = this->getTurbineYaw(turbine); + real bladeCoordX_GF; + real bladeCoordY_GF; + real bladeCoordZ_GF; + calcCoordinateOfBladeNodeInGridFrameOfReference(nodeIndex, turbine, localAzimuth, yaw, this->bladeCoordsXH, this->bladeCoordsYH, this->bladeCoordsZH, this->turbinePosXH, this->turbinePosYH, this->turbinePosZH, bladeCoordX_GF, bladeCoordY_GF, bladeCoordZ_GF); + coordsX[nodeIndex] = bladeCoordX_GF; + coordsY[nodeIndex] = bladeCoordY_GF; + coordsZ[nodeIndex] = bladeCoordZ_GF; + } + + WbWriterVtkXmlBinary::getInstance()->writePolyLines(filename, coordsX, coordsY, coordsZ); } \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h index 67bf83691d19179984647cb808bb6c0592bb0bfb..c71bb9407e686ce14a957d120f233958359f243d 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarm.h @@ -154,6 +154,7 @@ private: void rotateBlades(real angle, uint turbineID); void writeBladeCoords(uint t); + void writeBladeCoordsToVtkForDebug(const std::string& filename); void writeBladeForces(uint t); void writeBladeVelocities(uint t); diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlines.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlines.h new file mode 100644 index 0000000000000000000000000000000000000000..cc151088db963f00d3d39af705c80d22337701c9 --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlines.h @@ -0,0 +1,74 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ActuatorFarm.cu +//! \ingroup PreCollisionInteractor +//! \author Henrik Asmuth, Henry Korb, Anna Wellmann +//====================================================================================== + +#ifndef ACTUATOR_FARM_INLINES +#define ACTUATOR_FARM_INLINES + +#include "basics/DataTypes.h" + +struct TurbineNodeIndex { + uint turbine; + uint blade; + uint bladeNode; +}; + +__host__ __device__ __inline__ uint calcNodeIndexInBladeArrays(uint bladeNode, uint numberOfNodesPerBlade, uint blade, uint numberOfBlades, uint turbine) +{ + // see https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/merge_requests/248 for visualization + return bladeNode + numberOfNodesPerBlade * (blade + numberOfBlades * turbine); +} + +__host__ __device__ __inline__ uint calcNodeIndexInBladeArrays(const TurbineNodeIndex &turbineNodeIndex, uint numberOfNodesPerBlade, uint numberOfBlades) +{ + return calcNodeIndexInBladeArrays(turbineNodeIndex.bladeNode, numberOfNodesPerBlade, turbineNodeIndex.blade, numberOfBlades, turbineNodeIndex.turbine); +} + +__host__ __device__ __inline__ void calcTurbineBladeAndBladeNode(uint node, uint &bladeNode, uint numberOfNodesPerBlade, uint &blade, uint numberOfBlades, uint &turbine) +{ + // see https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/merge_requests/248 for visualization + turbine = node / (numberOfNodesPerBlade * numberOfBlades); + uint x_off = turbine * numberOfNodesPerBlade * numberOfBlades; + blade = (node - x_off) / numberOfNodesPerBlade; + uint y_off = numberOfNodesPerBlade * blade + x_off; + bladeNode = node - y_off; +} +__host__ __device__ __inline__ TurbineNodeIndex calcTurbineBladeAndBladeNode(uint node, uint numberOfNodesPerBlade, uint numberOfBlades) +{ + uint turbine; + uint blade; + uint bladeNode; + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + return { /*.turbine = */ turbine, /*.blade = */ blade, /*.bladeNode = */ bladeNode }; // Designated initializers are a C++ 20 feature +} + +#endif diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlinesTest.cpp b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlinesTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64ede907f8c60263e042b483ce9c18e94f4e5f6c --- /dev/null +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/ActuatorFarmInlinesTest.cpp @@ -0,0 +1,135 @@ +#include <gmock/gmock.h> + +#include "ActuatorFarmInlines.h" + +TEST(ActuatorFarmInlinesTest, calcNodeIndexInBladeArrays) +{ + const uint numberOfNodesPerBlade = 4; + const uint numberOfBlades = 3; + + // first node on first blade + uint bladeNode = 0; + uint blade = 0; + uint turbine = 0; + auto nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(0)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(0)); + + // last node on first blade + bladeNode = 3; + blade = 0; + turbine = 0; + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(3)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(3)); + + // first node on third blade + bladeNode = 0; + blade = 2; + turbine = 0; + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(8)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(8)); + + // last node on third blade, also last node on first turbine + bladeNode = 3; + blade = 2; + turbine = 0; + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(11)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(11)); + + // first node on second turbine + bladeNode = 0; + blade = 0; + turbine = 1; + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(12)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(12)); + + // last node on second turbine + bladeNode = 3; + blade = 2; + turbine = 1; + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays(bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(23)); + nodeIndexInBladeArrays = calcNodeIndexInBladeArrays({turbine, blade, bladeNode}, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(nodeIndexInBladeArrays, testing::Eq(23)); +} + +TEST(ActuatorFarmInlinesTest, calcTurbineBladeAndBladeNode) +{ + const uint numberOfNodesPerBlade = 4; + const uint numberOfBlades = 3; + + uint bladeNode; + uint blade; + uint turbine; + + TurbineNodeIndex result; + + uint node = 0; // first node on first blade + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(0)); + EXPECT_THAT(blade, testing::Eq(0)); + EXPECT_THAT(turbine, testing::Eq(0)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(0)); + EXPECT_THAT(result.blade, testing::Eq(0)); + EXPECT_THAT(result.turbine, testing::Eq(0)); + + node = 3; // last node on first blade + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(3)); + EXPECT_THAT(blade, testing::Eq(0)); + EXPECT_THAT(turbine, testing::Eq(0)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(3)); + EXPECT_THAT(result.blade, testing::Eq(0)); + EXPECT_THAT(result.turbine, testing::Eq(0)); + + node = 8; // first node on third blade + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(0)); + EXPECT_THAT(blade, testing::Eq(2)); + EXPECT_THAT(turbine, testing::Eq(0)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(0)); + EXPECT_THAT(result.blade, testing::Eq(2)); + EXPECT_THAT(result.turbine, testing::Eq(0)); + + node = 11; // last node on third blade, also last node on first turbine + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(3)); + EXPECT_THAT(blade, testing::Eq(2)); + EXPECT_THAT(turbine, testing::Eq(0)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(3)); + EXPECT_THAT(result.blade, testing::Eq(2)); + EXPECT_THAT(result.turbine, testing::Eq(0)); + + node = 12; // first node on second turbine + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(0)); + EXPECT_THAT(blade, testing::Eq(0)); + EXPECT_THAT(turbine, testing::Eq(1)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(0)); + EXPECT_THAT(result.blade, testing::Eq(0)); + EXPECT_THAT(result.turbine, testing::Eq(1)); + + node = 23; // last node on second turbine + calcTurbineBladeAndBladeNode(node, bladeNode, numberOfNodesPerBlade, blade, numberOfBlades, turbine); + EXPECT_THAT(bladeNode, testing::Eq(3)); + EXPECT_THAT(blade, testing::Eq(2)); + EXPECT_THAT(turbine, testing::Eq(1)); + result = calcTurbineBladeAndBladeNode(node, numberOfNodesPerBlade, numberOfBlades); + EXPECT_THAT(result.bladeNode, testing::Eq(3)); + EXPECT_THAT(result.blade, testing::Eq(2)); + EXPECT_THAT(result.turbine, testing::Eq(1)); +} diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h index 811045a32b18fd0f5d7f71be39b0dfec8982b352..90c434bd60e623175d5c8bfbbf23fa41f01e8a37 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PreCollisionInteractor.h @@ -16,8 +16,6 @@ class CudaMemoryManager; class VIRTUALFLUIDS_GPU_EXPORT PreCollisionInteractor { -private: - SPtr<Parameter> para; protected: PreCollisionInteractor() diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu index 99c60fd3d2aae2e796e0c95e624b9d5d33c30ef1..ca1ed594829682ad94b98a59349e082bf3b315a4 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/PrecursorWriter.cu @@ -36,7 +36,7 @@ #include <cuda.h> #include <cuda_runtime.h> #include <helper_cuda.h> -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> #include "LBM/GPUHelperFunctions/KernelUtilities.h" #include "StringUtilities/StringUtil.h" @@ -208,7 +208,7 @@ void PrecursorWriter::init(Parameter* para, GridProvider* gridProvider, CudaMemo precursorStructs[level]->origin = makeUbTuple(lowestY, lowestZ); precursorStructs[level]->extent = makeUbTuple(0, ny-1, 0, nz-1); precursorStructs[level]->numberOfPointsInData = ny*nz; - precursorStructs[level]->numberOfTimestepsPerFile = min(para->getlimitOfNodesForVTK()/(ny*nz), maxtimestepsPerFile); + precursorStructs[level]->numberOfTimestepsPerFile = min(para->getLimitOfNodesForVTK()/(ny*nz), maxtimestepsPerFile); precursorStructs[level]->numberOfFilesWritten = 0; precursorStructs[level]->numberOfTimestepsBuffered = 0; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu index e89d392b5d4bf5983f9bb47642fef81d0f06cc89..43be448998b5fe73ccc1444450f55acdceab9232 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.cu @@ -1,7 +1,7 @@ #include "Probe.h" #include "PlanarAverageProbe.h" -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> #include <cuda.h> #include <cuda_runtime.h> @@ -16,9 +16,11 @@ #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" #include "GPU/GPU_Interface.h" +#include "basics/constants/NumericConstants.h" #include <algorithm> +using namespace vf::basics::constant; /////////////////////////////////////////////////////////////////////////////////// /// Functors for thrust reductions /////////////////////////////////////////////////////////////////////////////////// @@ -307,7 +309,7 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para neighborInplane2 = para->getParD(level)->neighborY; } - bool doTmpAveraging = t_level>=(this->getTStartTmpAveraging()*pow(2,level)); + bool doTmpAveraging = t_level>=(this->getTStartTmpAveraging()*exp2(level)); // Pointer casts to use device arrays in thrust reductions thrust::device_ptr<uint> indices_thrust = thrust::device_pointer_cast(probeStruct->pointIndicesD); @@ -317,7 +319,7 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para thrust::device_ptr<real> nut_thrust = thrust::device_pointer_cast(para->getParD(level)->turbViscosity); real N = (real)probeStruct->nIndices; - real n = (real)probeStruct->vals; + real invNumberOfTimestepsInTmpAvg = c1o1/real(probeStruct->timestepInTimeAverage+1); uint nPoints = probeStruct->nPoints; // Permutation iterators for direct iteration over the velocities of the planes typedef thrust::device_vector<real>::iterator valIterator; @@ -353,17 +355,17 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalMeans)] && doTmpAveraging) { - uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalMeans)]; - real spatTmpMean_vx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; - real spatTmpMean_vy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; - real spatTmpMean_vz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; - real spatTmpMean_nut_old; - if(para->getUseTurbulentViscosity()) spatTmpMean_nut_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node];; - - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vx-spatTmpMean_vx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vy-spatTmpMean_vy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vz-spatTmpMean_vz_old)/n; - if(para->getUseTurbulentViscosity()) probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_nut-spatTmpMean_nut_old)/n; + uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalMeans)]; + real spatTmpMean_vx_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node]; + real spatTmpMean_vy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; + real spatTmpMean_vz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; + real spatTmpMean_nut_old; + if(para->getUseTurbulentViscosity()) spatTmpMean_nut_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node];; + + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vx-spatTmpMean_vx_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vy-spatTmpMean_vy_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vz-spatTmpMean_vz_old)*invNumberOfTimestepsInTmpAvg; + if(para->getUseTurbulentViscosity()) probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_nut-spatTmpMean_nut_old)*invNumberOfTimestepsInTmpAvg; } @@ -400,12 +402,12 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para real spatTmpMean_vxvz_old = probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node]; real spatTmpMean_vyvz_old = probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node]; - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vxvx-spatTmpMean_vxvx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vyvy-spatTmpMean_vyvy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vzvz-spatTmpMean_vzvz_old)/n; - probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_vxvy-spatTmpMean_vxvy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node] += (spatMean_vxvz-spatTmpMean_vxvz_old)/n; - probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node] += (spatMean_vyvz-spatTmpMean_vyvz_old)/n; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_vxvx-spatTmpMean_vxvx_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_vyvy-spatTmpMean_vyvy_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_vzvz-spatTmpMean_vzvz_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+node] += (spatMean_vxvy-spatTmpMean_vxvy_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+node] += (spatMean_vxvz-spatTmpMean_vxvz_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+node] += (spatMean_vyvz-spatTmpMean_vyvz_old)*invNumberOfTimestepsInTmpAvg; } if(probeStruct->quantitiesH[int(Statistic::SpatialSkewness)]) @@ -435,9 +437,9 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para real spatTmpMean_Sy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; real spatTmpMean_Sz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Sx-spatTmpMean_Sx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Sy-spatTmpMean_Sy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Sz-spatTmpMean_Sz_old)/n; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Sx-spatTmpMean_Sx_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Sy-spatTmpMean_Sy_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Sz-spatTmpMean_Sz_old)*invNumberOfTimestepsInTmpAvg; } if(probeStruct->quantitiesH[int(Statistic::SpatialFlatness)]) @@ -464,9 +466,9 @@ void PlanarAverageProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Para real spatTmpMean_Fy_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node]; real spatTmpMean_Fz_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node]; - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Fx-spatTmpMean_Fx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Fy-spatTmpMean_Fy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Fz-spatTmpMean_Fz_old)/n; + probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+node] += (spatMean_Fx-spatTmpMean_Fx_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+node] += (spatMean_Fy-spatTmpMean_Fy_old)*invNumberOfTimestepsInTmpAvg; + probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+node] += (spatMean_Fz-spatTmpMean_Fz_old)*invNumberOfTimestepsInTmpAvg; } } } diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h index 3d3533f74501e776f9150c83c9d9101a0be7ecbc..c2370231c0bc341ca9b3980578ce4aadc1b75c7a 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlanarAverageProbe.h @@ -90,6 +90,8 @@ private: std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) override; void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; + void getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) override {}; + private: real posX, posY, posZ; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu index f55045505bff0e3b5b0b1426be4e9e1a3832d088..a0f15cc340b99bcb5a837b3afbc4840511644a3f 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PlaneProbe.cu @@ -1,7 +1,7 @@ #include "Probe.h" #include "PlaneProbe.h" -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> #include <cuda.h> #include <cuda_runtime.h> @@ -102,10 +102,23 @@ void PlaneProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::ve void PlaneProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, probeStruct->nPoints); - calcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, - para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ, para->getParD(level)->rho, - para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, - probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD); + calcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, + probeStruct->nPoints, + 0, + 0, + probeStruct->timestepInTimeAverage, + probeStruct->nTimesteps, + para->getParD(level)->velocityX, + para->getParD(level)->velocityY, + para->getParD(level)->velocityZ, + para->getParD(level)->rho, + para->getParD(level)->neighborX, + para->getParD(level)->neighborY, + para->getParD(level)->neighborZ, + probeStruct->quantitiesD, + probeStruct->arrayOffsetsD, + probeStruct->quantitiesArrayD + ); } void PlaneProbe::getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu index 89e1f6b87687ed42c079415a5340f1d385c8d62c..bedcc513a1e441b8d5927f5afafa79f13af2cdbc 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.cu @@ -5,7 +5,7 @@ #include <cuda_runtime.h> #include <helper_cuda.h> -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> #include "Parameter/Parameter.h" #include "DataStructureInitializer/GridProvider.h" @@ -103,13 +103,22 @@ void PointProbe::findPoints(Parameter* para, GridProvider* gridProvider, std::ve void PointProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) { vf::cuda::CudaGrid grid = vf::cuda::CudaGrid(para->getParH(level)->numberofthreads, probeStruct->nPoints); - interpAndCalcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, probeStruct->vals, + int oldTimestepInTimeseries = this->outputTimeSeries ? calcOldTimestep(probeStruct->timestepInTimeseries, probeStruct->lastTimestepInOldTimeseries) : 0; + int currentTimestep = this->outputTimeSeries ? probeStruct->timestepInTimeseries : 0; + interpAndCalcQuantitiesKernel<<<grid.grid, grid.threads>>>( probeStruct->pointIndicesD, probeStruct->nPoints, oldTimestepInTimeseries, currentTimestep, probeStruct->timestepInTimeAverage, probeStruct->nTimesteps, probeStruct->distXD, probeStruct->distYD, probeStruct->distZD, para->getParD(level)->velocityX, para->getParD(level)->velocityY, para->getParD(level)->velocityZ, para->getParD(level)->rho, para->getParD(level)->neighborX, para->getParD(level)->neighborY, para->getParD(level)->neighborZ, probeStruct->quantitiesD, probeStruct->arrayOffsetsD, probeStruct->quantitiesArrayD); } +void PointProbe::addProbePoint(real pointCoordX, real pointCoordY, real pointCoordZ) +{ + this->pointCoordsX.push_back(pointCoordX); + this->pointCoordsY.push_back(pointCoordY); + this->pointCoordsZ.push_back(pointCoordZ); +} + void PointProbe::addProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ) { bool isSameLength = ( (_pointCoordsX.size()==_pointCoordsY.size()) && (_pointCoordsY.size()==_pointCoordsZ.size())); diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h index 08c359705f03b20fbd3276fe209b6ff4d782a5e5..b26211dc859bf4601b42a640d25e656b3552300b 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/PointProbe.h @@ -50,7 +50,8 @@ public: uint _tStartAvg, uint _tAvg, uint _tStartOut, - uint _tOut + uint _tOut, + bool _outputTimeseries = false ): Probe(_probeName, _outputPath, _tStartAvg, @@ -59,9 +60,10 @@ public: _tStartOut, _tOut, true, - false) + _outputTimeseries) {} + void addProbePoint(real pointCoordX, real pointCoordY, real pointCoordZ); void addProbePointsFromList(std::vector<real>& _pointCoordsX, std::vector<real>& _pointCoordsY, std::vector<real>& _pointCoordsZ); void addProbePointsFromXNormalPlane(real pos_x, real pos0_y, real pos0_z, real pos1_y, real pos1_z, uint n_y, uint n_z); void getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) override; @@ -80,6 +82,8 @@ private: private: std::vector<real> pointCoordsX, pointCoordsY, pointCoordsZ; + uint getNumberOfTimestepsInTimeseries(Parameter* para, int level) override { return outputTimeSeries ? tOut*exp2(level) : 1; } + }; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu index a7a0e79c0bcbf0f7a9e13e879debfb378e23f69d..2be8743bb28e45234533cb63673a9aebd6b0cf10 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.cu @@ -47,69 +47,92 @@ using namespace vf::basics::constant; -__device__ void calculatePointwiseQuantities(uint n, real* quantityArray, bool* quantities, uint* quantityArrayOffsets, uint nPoints, uint node, real vx, real vy, real vz, real rho) +__host__ __device__ int calcArrayIndex(int node, int nNodes, int timestep, int nTimesteps, int array) +{ + return node+nNodes*(timestep+nTimesteps*array); +} + +uint calcOldTimestep(uint currentTimestep, uint lastTimestepInOldSeries) +{ + return currentTimestep > 0 ? currentTimestep - 1 : lastTimestepInOldSeries; +} + +__device__ void calculatePointwiseQuantities( + uint oldTimestepInTimeseries, + uint timestepInTimeseries, + uint timestepInAverage, + uint nTimesteps, + real* quantityArray, + bool* quantities, + uint* quantityArrayOffsets, + uint nPoints, + uint node, + real vx, + real vy, + real vz, + real rho) { //"https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm" // also has extensions for higher order and covariances + int n = timestepInAverage+1; real inv_n = 1/real(n); - if(quantities[int(Statistic::Instantaneous)]) + if (quantities[int(Statistic::Instantaneous)]) { uint arrOff = quantityArrayOffsets[int(Statistic::Instantaneous)]; - quantityArray[(arrOff+0)*nPoints+node] = vx; - quantityArray[(arrOff+1)*nPoints+node] = vy; - quantityArray[(arrOff+2)*nPoints+node] = vz; - quantityArray[(arrOff+3)*nPoints+node] = rho; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 0)] = vx; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 1)] = vy; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 2)] = vz; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 3)] = rho; } - if(quantities[int(Statistic::Means)]) + if (quantities[int(Statistic::Means)]) { - uint arrOff = quantityArrayOffsets[int(Statistic::Means)]; - real vx_m_old = quantityArray[(arrOff+0)*nPoints+node]; - real vy_m_old = quantityArray[(arrOff+1)*nPoints+node]; - real vz_m_old = quantityArray[(arrOff+2)*nPoints+node]; - real rho_m_old = quantityArray[(arrOff+3)*nPoints+node]; - - real vx_m_new = ( (n-1)*vx_m_old + vx )*inv_n; - real vy_m_new = ( (n-1)*vy_m_old + vy )*inv_n; - real vz_m_new = ( (n-1)*vz_m_old + vz )*inv_n; - real rho_m_new = ( (n-1)*rho_m_old+ rho )*inv_n; - - quantityArray[(arrOff+0)*nPoints+node] = vx_m_new; - quantityArray[(arrOff+1)*nPoints+node] = vy_m_new; - quantityArray[(arrOff+2)*nPoints+node] = vz_m_new; - quantityArray[(arrOff+3)*nPoints+node] = rho_m_new; - - if(quantities[int(Statistic::Variances)]) + real vx_m_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 0)]; + real vy_m_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 1)]; + real vz_m_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 2)]; + real rho_m_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 3)]; + + real vx_m_new = ((n - 1) * vx_m_old + vx) * inv_n; + real vy_m_new = ((n - 1) * vy_m_old + vy) * inv_n; + real vz_m_new = ((n - 1) * vz_m_old + vz) * inv_n; + real rho_m_new = ((n - 1) * rho_m_old + rho) * inv_n; + + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 0)] = vx_m_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 1)] = vy_m_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 2)] = vz_m_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 3)] = rho_m_new; + + if (quantities[int(Statistic::Variances)]) { arrOff = quantityArrayOffsets[int(Statistic::Variances)]; - real vx_var_old = quantityArray[(arrOff+0)*nPoints+node]; - real vy_var_old = quantityArray[(arrOff+1)*nPoints+node]; - real vz_var_old = quantityArray[(arrOff+2)*nPoints+node]; - real rho_var_old = quantityArray[(arrOff+3)*nPoints+node]; + real vx_var_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 0)]; + real vy_var_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 1)]; + real vz_var_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 2)]; + real rho_var_old = quantityArray[calcArrayIndex(node, nPoints, oldTimestepInTimeseries, nTimesteps, arrOff + 3)]; - real vx_var_new = ( (n-1)*(vx_var_old )+(vx - vx_m_old )*(vx - vx_m_new ) )*inv_n; - real vy_var_new = ( (n-1)*(vy_var_old )+(vy - vy_m_old )*(vy - vy_m_new ) )*inv_n; - real vz_var_new = ( (n-1)*(vz_var_old )+(vz - vz_m_old )*(vz - vz_m_new ) )*inv_n; - real rho_var_new = ( (n-1)*(rho_var_old)+(rho - rho_m_old)*(rho - rho_m_new) )*inv_n; + real vx_var_new = ((n - 1) * (vx_var_old) + (vx - vx_m_old) * (vx - vx_m_new)) * inv_n; + real vy_var_new = ((n - 1) * (vy_var_old) + (vy - vy_m_old) * (vy - vy_m_new)) * inv_n; + real vz_var_new = ((n - 1) * (vz_var_old) + (vz - vz_m_old) * (vz - vz_m_new)) * inv_n; + real rho_var_new = ((n - 1) * (rho_var_old) + (rho - rho_m_old) * (rho - rho_m_new)) * inv_n; - quantityArray[(arrOff+0)*nPoints+node] = vx_var_new; - quantityArray[(arrOff+1)*nPoints+node] = vy_var_new; - quantityArray[(arrOff+2)*nPoints+node] = vz_var_new; - quantityArray[(arrOff+3)*nPoints+node] = rho_var_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 0)] = vx_var_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 1)] = vy_var_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 2)] = vz_var_new; + quantityArray[calcArrayIndex(node, nPoints, timestepInTimeseries, nTimesteps, arrOff + 3)] = rho_var_new; } } } __global__ void calcQuantitiesKernel( uint* pointIndices, - uint nPoints, uint n, + uint nPoints, uint oldTimestepInTimeseries, uint timestepInTimeseries, uint timestepInAverage, uint nTimesteps, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, bool* quantities, uint* quantityArrayOffsets, real* quantityArray - ) + ) { const uint x = threadIdx.x; const uint y = blockIdx.x; @@ -132,12 +155,12 @@ __global__ void calcQuantitiesKernel( uint* pointIndices, u_interpZ = vz[k]; rho_interp = rho[k]; - calculatePointwiseQuantities(n, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); + calculatePointwiseQuantities(oldTimestepInTimeseries, timestepInTimeseries, timestepInAverage, nTimesteps, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); } __global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, - uint nPoints, uint n, + uint nPoints, uint oldTimestepInTimeseries, uint timestepInTimeseries, uint timestepInAverage, uint nTimesteps, real* distX, real* distY, real* distZ, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, @@ -173,7 +196,7 @@ __global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, u_interpZ = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, vz ); rho_interp = trilinearInterpolation( dW, dE, dN, dS, dT, dB, k, ke, kn, kt, kne, kte, ktn, ktne, rho ); - calculatePointwiseQuantities(n, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); + calculatePointwiseQuantities(oldTimestepInTimeseries, timestepInTimeseries, timestepInAverage, nTimesteps, quantityArray, quantities, quantityArrayOffsets, nPoints, node, u_interpX, u_interpY, u_interpZ, rho_interp); } @@ -207,26 +230,28 @@ void Probe::init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level, level); - this->addProbeStruct(cudaMemoryManager, probeIndices_level, + this->addProbeStruct(para, cudaMemoryManager, probeIndices_level, distX_level, distY_level, distZ_level, pointCoordsX_level, pointCoordsY_level, pointCoordsZ_level, level); + + if(this->outputTimeSeries) timeseriesFileNames.push_back(this->writeTimeseriesHeader(para, level)); } } -void Probe::addProbeStruct(CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, - std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ, - std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ, - int level) +void Probe::addProbeStruct( Parameter* para, CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, + std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ, + std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ, + int level) { probeParams[level] = SPtr<ProbeStruct>(new ProbeStruct); - probeParams[level]->vals = 1; + probeParams[level]->nTimesteps = this->getNumberOfTimestepsInTimeseries(para, level); probeParams[level]->nPoints = uint(pointCoordsX.size()); // Note, need to have both nPoints and nIndices because they differ in PlanarAverage probeParams[level]->nIndices = uint(probeIndices.size()); - probeParams[level]->pointCoordsX = (real*)malloc(probeParams[level]->nPoints*sizeof(real)); - probeParams[level]->pointCoordsY = (real*)malloc(probeParams[level]->nPoints*sizeof(real)); - probeParams[level]->pointCoordsZ = (real*)malloc(probeParams[level]->nPoints*sizeof(real)); + probeParams[level]->pointCoordsX = (real*)malloc(probeParams[level]->nPoints * sizeof(real)); + probeParams[level]->pointCoordsY = (real*)malloc(probeParams[level]->nPoints * sizeof(real)); + probeParams[level]->pointCoordsZ = (real*)malloc(probeParams[level]->nPoints * sizeof(real)); std::copy(pointCoordsX.begin(), pointCoordsX.end(), probeParams[level]->pointCoordsX); std::copy(pointCoordsY.begin(), pointCoordsY.end(), probeParams[level]->pointCoordsY); @@ -267,39 +292,57 @@ void Probe::addProbeStruct(CudaMemoryManager* cudaMemoryManager, std::vector<int cudaMemoryManager->cudaAllocProbeQuantityArray(this, level); - for(uint arr=0; arr<probeParams[level]->nArrays; arr++) - { - for( uint point=0; point<probeParams[level]->nPoints; point++) - { - probeParams[level]->quantitiesArrayH[arr*probeParams[level]->nPoints+point] = 0.0f; - } - } + std::fill_n(probeParams[level]->quantitiesArrayH, probeParams[level]->nArrays*probeParams[level]->nPoints*probeParams[level]->nTimesteps, c0o1); + if(this->hasDeviceQuantityArray) cudaMemoryManager->cudaCopyProbeQuantityArrayHtoD(this, level); + } void Probe::interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, uint t) { uint t_level = para->getTimeStep(level, t, false); + SPtr<ProbeStruct> probeStruct = this->getProbeStruct(level); + + //!Skip empty probes + if(probeStruct->nPoints==0) return; + //! if tAvg==1 the probe will be evaluated in every sub-timestep of each respective level //! else, the probe will only be evaluated in each synchronous time step tAvg - uint tAvg_level = this->tAvg==1? this->tAvg: this->tAvg*pow(2,level); + uint level_coefficient = exp2(level); - if(max(int(t_level) - int(this->tStartAvg*pow(2,level)), -1) % tAvg_level==0) + uint tAvg_level = this->tAvg == 1 ? this->tAvg : this->tAvg * level_coefficient; + uint tOut_level = this->tOut * level_coefficient; + uint tStartOut_level = this->tStartOut * level_coefficient; + uint tStartAvg_level = this->tStartAvg * level_coefficient; + + uint tAfterStartAvg = t_level - tStartAvg_level; + uint tAfterStartOut = t_level - tStartOut_level; + + if( (t > this->tStartAvg) && (tAfterStartAvg % tAvg_level == 0)) { - SPtr<ProbeStruct> probeStruct = this->getProbeStruct(level); this->calculateQuantities(probeStruct, para, t_level, level); - if(t_level>=(this->tStartTmpAveraging*pow(2,level))) probeStruct->vals++; + + if(t > this->tStartTmpAveraging) probeStruct->timestepInTimeAverage++; + if(this->outputTimeSeries && (t_level >= tStartOut_level)) probeStruct->timestepInTimeseries++; } //! output only in synchronous timesteps - if(max(int(t_level) - int(this->tStartOut*pow(2,level)), -1) % int(this->tOut*pow(2,level)) == 0) + if( (t > this->tStartOut) && (tAfterStartOut % tOut_level == 0) ) { if(this->hasDeviceQuantityArray) cudaMemoryManager->cudaCopyProbeQuantityArrayDtoH(this, level); this->write(para, level, t); + + if(level == 0&& !this->outputTimeSeries) this->writeParallelFile(para, t); + + if(this->outputTimeSeries) + { + probeStruct->lastTimestepInOldTimeseries = probeStruct->timestepInTimeseries > 0 ? probeStruct->timestepInTimeseries - 1: 0; + probeStruct->timestepInTimeseries = 0; + } } } @@ -315,11 +358,6 @@ void Probe::free(Parameter* para, CudaMemoryManager* cudaMemoryManager) } } -void Probe::getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) -{ - // Do nothing -}; - void Probe::addStatistic(Statistic variable) { @@ -335,22 +373,32 @@ void Probe::addStatistic(Statistic variable) } } +template<typename T> +std::string nameComponent(std::string name, T value) +{ + return "_" + name + "_" + StringUtil::toString<T>(value); +} + std::string Probe::makeParallelFileName(int id, int t) { - return this->probeName + "_bin_ID_" + StringUtil::toString<int>(id) - + "_t_" + StringUtil::toString<int>(t) - + ".vtk"; + return this->probeName + "_bin" + nameComponent<int>("ID", id) + nameComponent<int>("t", t) + ".vtk"; + } std::string Probe::makeGridFileName(int level, int id, int t, uint part) { - return this->probeName + "_bin_lev_" + StringUtil::toString<int>(level) - + "_ID_" + StringUtil::toString<int>(id) - + "_Part_" + StringUtil::toString<int>(part) - + "_t_" + StringUtil::toString<int>(t) - + ".vtk"; + return this->probeName + "_bin" + nameComponent<int>("lev", level) + + nameComponent<int>("ID", id) + + nameComponent<int>("Part", part) + + nameComponent<int>("t", t) + ".vtk"; } +std::string Probe::makeTimeseriesFileName(int level, int id) +{ + return this->probeName + "_timeseries" + nameComponent<int>("lev", level) + + nameComponent<int>("ID", id) + + ".txt"; +} void Probe::addAllAvailableStatistics() { for( int var=0; var < int(Statistic::LAST); var++) @@ -362,16 +410,23 @@ void Probe::addAllAvailableStatistics() void Probe::write(Parameter* para, int level, int t) { - int t_write = this->fileNameLU ? t: t/this->tOut; + if(this->outputTimeSeries) + { + this->appendTimeseriesFile(para, level, t); + } + else + { + int t_write = this->fileNameLU ? t: t/this->tOut; - const uint numberOfParts = this->getProbeStruct(level)->nPoints / para->getlimitOfNodesForVTK() + 1; + const uint numberOfParts = this->getProbeStruct(level)->nPoints / para->getLimitOfNodesForVTK() + 1; - std::vector<std::string> fnames; - for (uint i = 1; i <= numberOfParts; i++) - { - this->writeGridFile(para, level, t_write, i); + std::vector<std::string> fnames; + for (uint i = 1; i <= numberOfParts; i++) + { + this->writeGridFile(para, level, t_write, i); + } } - if(level == 0&& !this->outputTimeSeries) this->writeParallelFile(para, t); + } void Probe::writeParallelFile(Parameter* para, int t) @@ -398,8 +453,8 @@ void Probe::writeGridFile(Parameter* para, int level, int t, uint part) SPtr<ProbeStruct> probeStruct = this->getProbeStruct(level); - uint startpos = (part-1) * para->getlimitOfNodesForVTK(); - uint sizeOfNodes = min(para->getlimitOfNodesForVTK(), probeStruct->nPoints - startpos); + uint startpos = (part-1) * para->getLimitOfNodesForVTK(); + uint sizeOfNodes = min(para->getLimitOfNodesForVTK(), probeStruct->nPoints - startpos); uint endpos = startpos + sizeOfNodes; ////////////////////////////////////////////////////////////////////////// @@ -414,25 +469,28 @@ void Probe::writeGridFile(Parameter* para, int level, int t, uint part) for( auto it=nodedata.begin(); it!=nodedata.end(); it++) it->resize(sizeOfNodes); - for( int var=0; var < int(Statistic::LAST); var++){ + uint arrLen = probeStruct->nPoints; + int nTimesteps = probeStruct->nTimesteps; + int timestep = probeStruct->timestepInTimeseries; + + for( int var=0; var < int(Statistic::LAST); var++) + { if(this->quantities[var]) { - Statistic statistic = static_cast<Statistic>(var); - real coeff; + Statistic statistic = static_cast<Statistic>(var); std::vector<PostProcessingVariable> postProcessingVariables = this->getPostProcessingVariables(statistic); uint n_arrs = uint(postProcessingVariables.size()); uint arrOff = probeStruct->arrayOffsetsH[var]; - uint arrLen = probeStruct->nPoints; for(uint arr=0; arr<n_arrs; arr++) { - coeff = postProcessingVariables[arr].conversionFactor(level); + real coeff = postProcessingVariables[arr].conversionFactor(level); for (uint pos = startpos; pos < endpos; pos++) { - nodedata[arrOff+arr][pos-startpos] = double(probeStruct->quantitiesArrayH[(arrOff+arr)*arrLen+pos]*coeff); + nodedata[arrOff+arr][pos-startpos] = double(probeStruct->quantitiesArrayH[calcArrayIndex(pos, arrLen, timestep, nTimesteps, arrOff+arr)]*coeff); } } } @@ -441,6 +499,91 @@ void Probe::writeGridFile(Parameter* para, int level, int t, uint part) this->fileNamesForCollectionFile.push_back(fullName.substr(fullName.find_last_of('/') + 1)); } +std::string Probe::writeTimeseriesHeader(Parameter* para, int level) +{ +/* +File Layout: +TimeseriesOutput +Quantities: Quant1 Quant2 Quant3 +Positions: +point1.x, point1.y, point1.z +point2.x, point2.y, point2.z +... +t0 point1.quant1 point2.quant1 ... point1.quant2 point2.quant2 ... +t1 point1.quant1 point2.quant1 ... point1.quant2 point2.quant2 ... +*/ + auto probeStruct = this->getProbeStruct(level); + std::string fname = this->outputPath + "/" + this->makeTimeseriesFileName(level, para->getMyProcessID()); + std::ofstream out(fname.c_str(), std::ios::out | std::ios::binary); + + if(!out.is_open()) throw std::runtime_error("Could not open timeseries file!"); + + out << "TimeseriesOutput \n"; + out << "Quantities: "; + for(std::string name : getVarNames()) + out << name << ", "; + out << "\n"; + out << "Number of points in this file: \n"; + out << probeStruct->nPoints << "\n"; + out << "Positions: x, y, z\n"; + for( uint i=0; i<probeStruct->nPoints; i++) + out << probeStruct->pointCoordsX[i] << ", " << probeStruct->pointCoordsY[i] << ", " << probeStruct->pointCoordsZ[i] << "\n"; + + out.close(); + + return fname; +} + +void Probe::appendTimeseriesFile(Parameter* para, int level, int t) +{ + std::ofstream out(this->timeseriesFileNames[level], std::ios::app | std::ios::binary); + + uint t_level = para->getTimeStep(level, t, false); + uint tAvg_level = this->tAvg==1 ? this->tAvg: this->tAvg*exp2(-level); + + real dt = para->getTimeRatio()*tAvg_level; + auto probeStruct = this->getProbeStruct(level); + + real t_start = ( t-this->tOut )*para->getTimeRatio(); + + int vals_per_timestep = probeStruct->nPoints*probeStruct->nArrays+1; + + real* timestep_array = (real*) malloc(vals_per_timestep*sizeof(real)); + + for(uint timestep=0; timestep<probeStruct->timestepInTimeseries; timestep++) + { + int val = 0; + timestep_array[val] = t_start+timestep*dt; + val++; + + for( int var=0; var < int(Statistic::LAST); var++) + { + if(!this->quantities[var]) continue; + + Statistic statistic = static_cast<Statistic>(var); + std::vector<PostProcessingVariable> postProcessingVariables = this->getPostProcessingVariables(statistic); + uint n_arrs = uint(postProcessingVariables.size()); + + uint arrOff = probeStruct->arrayOffsetsH[var]; + + for(uint arr=0; arr<n_arrs; arr++) + { + real coeff = postProcessingVariables[arr].conversionFactor(level); + for(uint point=0; point<probeStruct->nPoints; point++) + { + timestep_array[val] = probeStruct->quantitiesArrayH[calcArrayIndex(point, probeStruct->nPoints, timestep, probeStruct->nTimesteps, arrOff+arr)]*coeff; + val++; + } + } + + } + out.write((char*) timestep_array, sizeof(real)*vals_per_timestep); + } + out.close(); +} + + + std::vector<std::string> Probe::getVarNames() { std::vector<std::string> varNames; @@ -454,4 +597,4 @@ std::vector<std::string> Probe::getVarNames() } } return varNames; -} \ No newline at end of file +} diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h index aaf294e87d23c64707a16692b9337d6e9ff9c896..c4ec985beb2b5aa4313ac0a92866a75351f630fa 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/Probe.h @@ -33,7 +33,7 @@ //! //! Any probe should be initiated in the app and added via para->addProbe( someProbe ) //! Note, that all probes generally require that macroscopic variables have been updated in the -//! time step they are called in. Most collision kernels (atm, all except TurbulentViscosityCumulantK17CompChim ) +//! time step they are called in. Most collision kernels (atm, all except K17CompressibleNavierStokes) //! don't do this and would require an explicit call of calcMacroscopicQuantities. It does seem quite //! inexpensive though to simply save vx, vy, etc., directly in the collider. //! @@ -100,7 +100,11 @@ typedef struct PostProcessingVariable{ } PostProcessingVariable; struct ProbeStruct{ - uint nPoints, nIndices, nArrays, vals; + uint nPoints, nIndices, nArrays; + uint nTimesteps=1; + uint timestepInTimeseries=0; + uint timestepInTimeAverage=0; + uint lastTimestepInOldTimeseries=0; uint *pointIndicesH, *pointIndicesD; real *pointCoordsX, *pointCoordsY, *pointCoordsZ; bool hasDistances=false; @@ -110,9 +114,10 @@ struct ProbeStruct{ uint *arrayOffsetsH, *arrayOffsetsD; bool isEvenTAvg = true; }; +__host__ __device__ int calcArrayIndex(int node, int nNodes, int timestep, int nTimesteps, int array); __global__ void calcQuantitiesKernel( uint* pointIndices, - uint nPoints, uint n, + uint nPoints, uint oldTimestepInTimeseries, uint timestepInTimeseries, uint timestepInAverage, uint nTimesteps, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, bool* quantities, @@ -120,7 +125,7 @@ __global__ void calcQuantitiesKernel( uint* pointIndices, ); __global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, - uint nPoints, uint n, + uint nPoints, uint oldTimestepInTimeseries, uint timestepInTimeseries, uint timestepInAverage, uint nTimesteps, real* distX, real* distY, real* distZ, real* vx, real* vy, real* vz, real* rho, uint* neighborX, uint* neighborY, uint* neighborZ, @@ -128,6 +133,7 @@ __global__ void interpAndCalcQuantitiesKernel( uint* pointIndices, uint* quantityArrayOffsets, real* quantityArray ); +uint calcOldTimestep(uint currentTimestep, uint lastTimestepInOldSeries); class Probe : public PreCollisionInteractor { @@ -135,13 +141,13 @@ public: Probe( const std::string _probeName, const std::string _outputPath, - uint _tStartAvg, - uint _tStartTmpAvg, - uint _tAvg, - uint _tStartOut, - uint _tOut, - bool _hasDeviceQuantityArray, - bool _outputTimeSeries + const uint _tStartAvg, + const uint _tStartTmpAvg, + const uint _tAvg, + const uint _tStartOut, + const uint _tOut, + const bool _hasDeviceQuantityArray, + const bool _outputTimeSeries ): probeName(_probeName), outputPath(_outputPath), tStartAvg(_tStartAvg), @@ -153,13 +159,12 @@ public: outputTimeSeries(_outputTimeSeries), PreCollisionInteractor() { - if (_tStartOut<_tStartAvg) throw std::runtime_error("Probe: tStartOut must be larger than tStartAvg!"); + if (tStartOut < tStartAvg) throw std::runtime_error("Probe: tStartOut must be larger than tStartAvg!"); } void init(Parameter* para, GridProvider* gridProvider, CudaMemoryManager* cudaMemoryManager) override; void interact(Parameter* para, CudaMemoryManager* cudaMemoryManager, int level, uint t) override; void free(Parameter* para, CudaMemoryManager* cudaMemoryManager) override; - virtual void getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) override; SPtr<ProbeStruct> getProbeStruct(int level){ return this->probeParams[level]; } @@ -170,7 +175,6 @@ public: uint getTStartTmpAveraging(){return this->tStartTmpAveraging;} void setFileNameToNOut(){this->fileNameLU = false;} - void setTStartTmpAveraging(uint _tStartTmpAveraging){this->tStartTmpAveraging = _tStartTmpAveraging;} protected: virtual WbWriterVtkXmlBinary* getWriter(){ return WbWriterVtkXmlBinary::getInstance(); }; @@ -185,7 +189,7 @@ private: std::vector<real>& distX_level, std::vector<real>& distY_level, std::vector<real>& distZ_level, std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) = 0; - void addProbeStruct(CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, + void addProbeStruct(Parameter* para, CudaMemoryManager* cudaMemoryManager, std::vector<int>& probeIndices, std::vector<real>& distX, std::vector<real>& distY, std::vector<real>& distZ, std::vector<real>& pointCoordsX, std::vector<real>& pointCoordsY, std::vector<real>& pointCoordsZ, int level); @@ -194,10 +198,15 @@ private: virtual void write(Parameter* para, int level, int t); virtual void writeParallelFile(Parameter* para, int t); virtual void writeGridFile(Parameter* para, int level, int t, uint part); + std::string writeTimeseriesHeader(Parameter* para, int level); + void appendTimeseriesFile(Parameter* para, int level, int t); std::vector<std::string> getVarNames(); std::string makeGridFileName(int level, int id, int t, uint part); std::string makeParallelFileName(int id, int t); + std::string makeTimeseriesFileName(int leve, int id); + + virtual uint getNumberOfTimestepsInTimeseries(Parameter* para, int level){ return 1; } protected: const std::string probeName; @@ -205,20 +214,19 @@ protected: std::vector<SPtr<ProbeStruct>> probeParams; bool quantities[int(Statistic::LAST)] = {}; - bool hasDeviceQuantityArray; //!> flag initiating memCopy in Point and PlaneProbe. Other probes are only based on thrust reduce functions and therefore dont need explict memCopy in interact() - bool outputTimeSeries; //!> flag initiating overwrite of output vtk files, skipping collection files and limiting the length of the written data to the current time step (currently only used for WallModelProbe) + const bool hasDeviceQuantityArray; //!> flag initiating memCopy in Point and PlaneProbe. Other probes are only based on thrust reduce functions and therefore dont need explict memCopy in interact() + const bool outputTimeSeries; //!> flag initiating time series output in Point and WallModelProbe. std::vector<std::string> fileNamesForCollectionFile; + std::vector<std::string> timeseriesFileNames; bool fileNameLU = true; //!> if true, written file name contains time step in LU, else is the number of the written probe files protected: - uint tStartAvg; - uint tStartTmpAveraging; //!> only non-zero in PlanarAverageProbe and WallModelProbe to switch on Spatio-temporal averaging (while only doing spatial averaging for t<tStartTmpAveraging) - uint tAvg; //! for tAvg==1 the probe will be evaluated in every sub-timestep of each respective level, else, the probe will only be evaluated in each synchronous time step - uint tStartOut; - uint tOut; - - uint tProbe = 0; //!> counter for number of probe evaluations. Only used when outputting timeseries + const uint tStartAvg; + const uint tStartTmpAveraging; //!> only non-zero in PlanarAverageProbe and WallModelProbe to switch on Spatio-temporal averaging (while only doing spatial averaging for t<tStartTmpAveraging) + const uint tAvg; //! for tAvg==1 the probe will be evaluated in every sub-timestep of each respective level, else, the probe will only be evaluated in each synchronous time step + const uint tStartOut; + const uint tOut; std::function<real(int)> velocityRatio; std::function<real(int)> densityRatio; diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu index 3341111c134ace7ca6ff64eeb7f87b38f8014656..6b263342e899c53917d71aa190eef08f1451fa49 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.cu @@ -1,7 +1,7 @@ #include "Probe.h" #include "WallModelProbe.h" -#include <cuda/CudaGrid.h> +#include <cuda_helper/CudaGrid.h> #include <cuda.h> #include <cuda_runtime.h> @@ -10,63 +10,15 @@ #include <thrust/device_vector.h> #include <thrust/reduce.h> #include <thrust/device_ptr.h> -#include <thrust/inner_product.h> #include "Parameter/Parameter.h" #include "DataStructureInitializer/GridProvider.h" #include "GPU/CudaMemoryManager.h" +#include "basics/constants/NumericConstants.h" - -/////////////////////////////////////////////////////////////////////////////////// -/// Functors for thrust reductions -/////////////////////////////////////////////////////////////////////////////////// - -template<typename T> -struct pow2 : public thrust::unary_function<T,T> -{ - __host__ __device__ T operator()(const T &x) const - { - return x * x; - } -}; - -template<typename T> -struct pow3 : public thrust::unary_function<T,T> -{ - __host__ __device__ T operator()(const T &x) const - { - return x * x * x; - } -}; - -template<typename T> -struct pow4 : public thrust::unary_function<T,T> -{ - __host__ __device__ T operator()(const T &x) const - { - return x * x * x * x; - } -}; - -struct nth_moment -{ - const float mean; - const int n; - - nth_moment(float _mean, int _n) : mean(_mean), n(_n) {} - - __host__ __device__ - float operator()(const float& x) const { - - real fluctuation = x-mean; - real moment = fluctuation; - for(int i = 1; i<n; i++) moment *= fluctuation; - - return moment; - } -}; - - +using namespace vf::basics::constant; +typedef thrust::device_vector<real>::iterator valIterator; +typedef thrust::device_vector<uint>::iterator indIterator; /////////////////////////////////////////////////////////////////////////////////// bool WallModelProbe::isAvailableStatistic(Statistic _variable) { @@ -156,16 +108,10 @@ void WallModelProbe::findPoints(Parameter* para, GridProvider* gridProvider, std int level) { if ( !para->getHasWallModelMonitor()) throw std::runtime_error("WallModelProbe::findPoints(): !para->getHasWallModelMonitor() !"); - - real dt = para->getTimeRatio(); - uint nt = uint((para->getTimestepEnd()-this->tStartAvg)/this->tAvg); - for(uint t=0; t<nt; t++) - { - pointCoordsX_level.push_back(dt*(t*this->tAvg)+this->tStartAvg); // x coord will serve as time in this probe - pointCoordsY_level.push_back(0); - pointCoordsZ_level.push_back(0); - } + pointCoordsX_level.push_back(0); + pointCoordsY_level.push_back(0); + pointCoordsZ_level.push_back(0); if(this->evaluatePressureGradient) { @@ -183,118 +129,109 @@ void WallModelProbe::findPoints(Parameter* para, GridProvider* gridProvider, std /////////////////////////////////////////////////////////////////////////////////// +template<typename T> +T spatial_mean(T* device_pointer, uint numberOfPoints) +{ + thrust::device_ptr<T> thrust_pointer = thrust::device_pointer_cast(device_pointer); + return thrust::reduce(thrust_pointer, thrust_pointer+numberOfPoints)/real(numberOfPoints); +} + +template<typename T> +T index_based_spatial_mean(T* device_pointer, thrust::device_ptr<uint> indeces_ptr, uint numberOfIndeces) +{ + thrust::device_ptr<T> thrust_pointer = thrust::device_pointer_cast(device_pointer); + + thrust::permutation_iterator<valIterator, indIterator> iter_begin(thrust_pointer, indeces_ptr); + thrust::permutation_iterator<valIterator, indIterator> iter_end (thrust_pointer, indeces_ptr+numberOfIndeces); + return thrust::reduce(iter_begin, iter_end)/real(numberOfIndeces); +} + +template<typename T> +T compute_and_save_mean(T* device_pointer, uint numberOfPoints, T* quantitiesArray, uint timestep, uint numberOfTimesteps, uint indexOfArray) +{ + T mean = spatial_mean(device_pointer, numberOfPoints); + quantitiesArray[calcArrayIndex(0, 1, timestep, numberOfTimesteps, indexOfArray)] = mean; + return mean; +} + +template<typename T> +T compute_and_save_index_based_mean(T* device_pointer, thrust::device_ptr<uint> indeces_ptr, uint numberOfIndices, T* quantitiesArray, uint timestep, uint numberOfTimesteps, uint indexOfArray) +{ + T mean = index_based_spatial_mean(device_pointer, indeces_ptr, numberOfIndices); + quantitiesArray[calcArrayIndex(0, 1, timestep, numberOfTimesteps, indexOfArray)] = mean; + return mean; +} + +template<typename T> +void temporal_average(T* quantitiesArray, T currentValue, uint currentTimestep, uint numberOfTimesteps, uint oldTimestep, uint indexOfArray, real invNumberOfAverages) +{ + T oldMean = quantitiesArray[calcArrayIndex(0, 1, oldTimestep, numberOfTimesteps, indexOfArray)]; + quantitiesArray[calcArrayIndex(0, 1, currentTimestep, numberOfTimesteps, indexOfArray)] = oldMean + (currentValue-oldMean)*invNumberOfAverages; +} + void WallModelProbe::calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) { bool doTmpAveraging = (t>this->getTStartTmpAveraging()); - real N = para->getParD(level)->stressBC.numberOfBCnodes; - if(N<1) return; //Skipping levels without StressBC - real n = (real)probeStruct->vals; - int nPoints = probeStruct->nPoints; - - // Pointer casts to use device arrays in thrust reductions - thrust::device_ptr<real> u_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vx); - thrust::device_ptr<real> v_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vy); - thrust::device_ptr<real> w_el_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vz); - thrust::device_ptr<real> u1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vx1); - thrust::device_ptr<real> v1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vy1); - thrust::device_ptr<real> w1_thrust = thrust::device_pointer_cast(para->getParD(level)->stressBC.Vz1); - thrust::device_ptr<real> u_star_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.u_star); - thrust::device_ptr<real> Fx_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fx); - thrust::device_ptr<real> Fy_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fy); - thrust::device_ptr<real> Fz_thrust = thrust::device_pointer_cast(para->getParD(level)->wallModel.Fz); - thrust::device_ptr<real> dpdx_thrust = thrust::device_pointer_cast(para->getParD(level)->forceX_SP); - thrust::device_ptr<real> dpdy_thrust = thrust::device_pointer_cast(para->getParD(level)->forceY_SP); - thrust::device_ptr<real> dpdz_thrust = thrust::device_pointer_cast(para->getParD(level)->forceZ_SP); + uint numberOfStressBCPoints = para->getParD(level)->stressBC.numberOfBCnodes; + if(numberOfStressBCPoints<1) return; //Skipping levels without StressBC + uint timestep = probeStruct->timestepInTimeseries; + real inv_n = c1o1/real(probeStruct->timestepInTimeAverage+1); + uint oldTimestep = calcOldTimestep(timestep, probeStruct->lastTimestepInOldTimeseries); thrust::device_ptr<uint> indices_thrust = thrust::device_pointer_cast(probeStruct->pointIndicesD); - typedef thrust::device_vector<real>::iterator valIterator; - typedef thrust::device_vector<uint>::iterator indIterator; - thrust::permutation_iterator<valIterator, indIterator> dpdx_iter_begin(dpdx_thrust, indices_thrust); - thrust::permutation_iterator<valIterator, indIterator> dpdx_iter_end (dpdx_thrust, indices_thrust+probeStruct->nIndices); - thrust::permutation_iterator<valIterator, indIterator> dpdy_iter_begin(dpdy_thrust, indices_thrust); - thrust::permutation_iterator<valIterator, indIterator> dpdy_iter_end (dpdy_thrust, indices_thrust+probeStruct->nIndices); - thrust::permutation_iterator<valIterator, indIterator> dpdz_iter_begin(dpdz_thrust, indices_thrust); - thrust::permutation_iterator<valIterator, indIterator> dpdz_iter_end (dpdz_thrust, indices_thrust+probeStruct->nIndices); if(probeStruct->quantitiesH[int(Statistic::SpatialMeans)]) { - // Compute the instantaneous spatial means of the velocity moments - real spatMean_u_el = thrust::reduce(u_el_thrust, u_el_thrust+N)/N; - real spatMean_v_el = thrust::reduce(v_el_thrust, v_el_thrust+N)/N; - real spatMean_w_el = thrust::reduce(w_el_thrust, w_el_thrust+N)/N; - real spatMean_u1 = thrust::reduce(u1_thrust, u1_thrust+N)/N; - real spatMean_v1 = thrust::reduce(v1_thrust, v1_thrust+N)/N; - real spatMean_w1 = thrust::reduce(w1_thrust, w1_thrust+N)/N; - real spatMean_u_star = thrust::reduce(u_star_thrust, u_star_thrust+N)/N; - real spatMean_Fx = thrust::reduce(Fx_thrust, Fx_thrust+N)/N; - real spatMean_Fy = thrust::reduce(Fy_thrust, Fy_thrust+N)/N; - real spatMean_Fz = thrust::reduce(Fz_thrust, Fz_thrust+N)/N; - uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatialMeans)]; - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe] = spatMean_u_el; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe] = spatMean_v_el; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe] = spatMean_w_el; - probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe] = spatMean_u1; - probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe] = spatMean_v1; - probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe] = spatMean_w1; - probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe] = spatMean_u_star; - probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe] = spatMean_Fx; - probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe] = spatMean_Fy; - probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe] = spatMean_Fz; + // Compute the instantaneous spatial means of the velocity moments + real spatMean_u_el = compute_and_save_mean(para->getParD(level)->stressBC.Vx , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+0); + real spatMean_v_el = compute_and_save_mean(para->getParD(level)->stressBC.Vy , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+1); + real spatMean_w_el = compute_and_save_mean(para->getParD(level)->stressBC.Vz , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+2); + real spatMean_u1 = compute_and_save_mean(para->getParD(level)->stressBC.Vx1 , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+3); + real spatMean_v1 = compute_and_save_mean(para->getParD(level)->stressBC.Vy1 , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+4); + real spatMean_w1 = compute_and_save_mean(para->getParD(level)->stressBC.Vz1 , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+5); + real spatMean_u_star = compute_and_save_mean(para->getParD(level)->wallModel.u_star, numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+6); + real spatMean_Fx = compute_and_save_mean(para->getParD(level)->wallModel.Fx , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+7); + real spatMean_Fy = compute_and_save_mean(para->getParD(level)->wallModel.Fy , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+8); + real spatMean_Fz = compute_and_save_mean(para->getParD(level)->wallModel.Fz , numberOfStressBCPoints, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+9); real spatMean_dpdx; real spatMean_dpdy; real spatMean_dpdz; if(this->evaluatePressureGradient) { - real N_fluid = (real)probeStruct->nIndices; - spatMean_dpdx = thrust::reduce(dpdx_iter_begin, dpdx_iter_end)/N_fluid; - spatMean_dpdy = thrust::reduce(dpdy_iter_begin, dpdy_iter_end)/N_fluid; - spatMean_dpdz = thrust::reduce(dpdz_iter_begin, dpdz_iter_end)/N_fluid; - probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe] = spatMean_dpdx; - probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe] = spatMean_dpdy; - probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe] = spatMean_dpdz; + spatMean_dpdx = compute_and_save_index_based_mean(para->getParD(level)->forceX_SP, indices_thrust, probeStruct->nIndices, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+10); + spatMean_dpdy = compute_and_save_index_based_mean(para->getParD(level)->forceY_SP, indices_thrust, probeStruct->nIndices, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+11); + spatMean_dpdz = compute_and_save_index_based_mean(para->getParD(level)->forceZ_SP, indices_thrust, probeStruct->nIndices, probeStruct->quantitiesArrayH, timestep, probeStruct->nTimesteps, arrOff+12); } if(probeStruct->quantitiesH[int(Statistic::SpatioTemporalMeans)] && doTmpAveraging) { uint arrOff = probeStruct->arrayOffsetsH[int(Statistic::SpatioTemporalMeans)]; - real spatMean_u_el_old = probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe-1]; - real spatMean_v_el_old = probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe-1]; - real spatMean_w_el_old = probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe-1]; - real spatMean_u1_old = probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe-1]; - real spatMean_v1_old = probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe-1]; - real spatMean_w1_old = probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe-1]; - real spatMean_u_star_old = probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe-1]; - real spatMean_Fx_old = probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe-1]; - real spatMean_Fy_old = probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe-1]; - real spatMean_Fz_old = probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe-1]; - - probeStruct->quantitiesArrayH[(arrOff+0)*nPoints+tProbe] = spatMean_u_el_old + (spatMean_u_el-spatMean_u_el_old)/n; - probeStruct->quantitiesArrayH[(arrOff+1)*nPoints+tProbe] = spatMean_v_el_old + (spatMean_v_el-spatMean_v_el_old)/n; - probeStruct->quantitiesArrayH[(arrOff+2)*nPoints+tProbe] = spatMean_w_el_old + (spatMean_w_el-spatMean_w_el_old)/n; - probeStruct->quantitiesArrayH[(arrOff+3)*nPoints+tProbe] = spatMean_u1_old + (spatMean_u1-spatMean_u1_old)/n; - probeStruct->quantitiesArrayH[(arrOff+4)*nPoints+tProbe] = spatMean_v1_old + (spatMean_v1-spatMean_v1_old)/n; - probeStruct->quantitiesArrayH[(arrOff+5)*nPoints+tProbe] = spatMean_w1_old + (spatMean_w1-spatMean_w1_old)/n; - probeStruct->quantitiesArrayH[(arrOff+6)*nPoints+tProbe] = spatMean_u_star_old +(spatMean_u_star-spatMean_u_star_old)/n; - probeStruct->quantitiesArrayH[(arrOff+7)*nPoints+tProbe] = spatMean_Fx_old + (spatMean_Fx-spatMean_Fx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+8)*nPoints+tProbe] = spatMean_Fy_old + (spatMean_Fy-spatMean_Fy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+9)*nPoints+tProbe] = spatMean_Fz_old + (spatMean_Fz-spatMean_Fz_old)/n; + temporal_average(probeStruct->quantitiesArrayH, spatMean_u_el , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+0, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_v_el , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+1, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_w_el , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+2, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_u1 , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+3, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_v1 , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+4, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_w1 , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+5, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_u_star, timestep, probeStruct->nTimesteps, oldTimestep, arrOff+6, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_Fx , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+7, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_Fy , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+8, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_Fz , timestep, probeStruct->nTimesteps, oldTimestep, arrOff+9, inv_n); if(this->evaluatePressureGradient) { - real spatMean_dpdx_old = probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe-1]; - real spatMean_dpdy_old = probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe-1]; - real spatMean_dpdz_old = probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe-1]; - probeStruct->quantitiesArrayH[(arrOff+10)*nPoints+tProbe] = spatMean_dpdx_old + (spatMean_dpdx-spatMean_dpdx_old)/n; - probeStruct->quantitiesArrayH[(arrOff+11)*nPoints+tProbe] = spatMean_dpdy_old + (spatMean_dpdy-spatMean_dpdy_old)/n; - probeStruct->quantitiesArrayH[(arrOff+12)*nPoints+tProbe] = spatMean_dpdz_old + (spatMean_dpdz-spatMean_dpdz_old)/n; + temporal_average(probeStruct->quantitiesArrayH, spatMean_dpdx, timestep, probeStruct->nTimesteps, oldTimestep, arrOff+10, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_dpdy, timestep, probeStruct->nTimesteps, oldTimestep, arrOff+11, inv_n); + temporal_average(probeStruct->quantitiesArrayH, spatMean_dpdz, timestep, probeStruct->nTimesteps, oldTimestep, arrOff+12, inv_n); } } } - - - this->tProbe += 1; getLastCudaError("WallModelProbe::calculateQuantities execution failed"); } +uint WallModelProbe::getNumberOfTimestepsInTimeseries(Parameter* para, int level) +{ + return this->tOut*exp2(level)/this->tAvg+1; +} + diff --git a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h index 4ea90f74c7a0d57af4995e1b5874234967f1e901..c912656d2dcbb9551b8a156f7fe9818de0f315a4 100644 --- a/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h +++ b/src/gpu/VirtualFluids_GPU/PreCollisionInteractor/Probes/WallModelProbe.h @@ -81,6 +81,8 @@ private: std::vector<real>& pointCoordsX_level, std::vector<real>& pointCoordsY_level, std::vector<real>& pointCoordsZ_level, int level) override; void calculateQuantities(SPtr<ProbeStruct> probeStruct, Parameter* para, uint t, int level) override; + void getTaggedFluidNodes(Parameter *para, GridProvider* gridProvider) override {}; + uint getNumberOfTimestepsInTimeseries(Parameter* para, int level) override; private: bool outputStress = false; //!> if true, output wall force is converted to a stress diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu index 1e70fc642a3fd7f6fca4ed90b9ff4ebc1bb437db..32c02ce8f2ab9a67ba3cbc09ae909d27cf4c9223 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD27/InitCompAD27.cu @@ -2,7 +2,7 @@ #include "InitCompAD27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitCompAD27::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu index f8fc6af00d93cc5a51da4a69d67b69b616f97140..3b70cc80827b2e5f5081a7bcfca6b83789284a05 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompAD7/InitCompAD7.cu @@ -2,7 +2,7 @@ #include "InitCompAD7_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<InitCompAD7> InitCompAD7::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu index c4676f28f969e2db8ff7f1910ac784a1c0dab351..3f2176eace98b825a2dcb8557506787563286434 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitCompSP27/InitCompSP27.cu @@ -2,7 +2,7 @@ #include "InitCompSP27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitCompSP27::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu index 14d6b725337aa8b9af279bf794ff1c0912516b64..cac748bcea4cf3a9067552f87142e6a019c84d90 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitF3/InitF3.cu @@ -2,7 +2,7 @@ #include "InitF3_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitF3::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu index 6a9b4cb31b1032f6921bddbe60d3cd570ef46b6d..246a5884f51af97b4e32977d30f114d6e90a6959 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD27/InitIncompAD27.cu @@ -2,7 +2,7 @@ #include "InitIncompAD27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitIncompAD27::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu index b7c7d46a9ea8e3133b8240e27959b6b4d2ed0cf5..d246d58a279e6edd79de98a911c293d627bba4c3 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitIncompAD7/InitIncompAD7.cu @@ -2,7 +2,7 @@ #include "InitIncompAD7_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitIncompAD7::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu index 078ad24f24659bf10a3dc9ed90bfd62b5e021187..8e0702bc9bd6486edff43212098e5df223842a2a 100644 --- a/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu +++ b/src/gpu/VirtualFluids_GPU/PreProcessor/PreProcessorStrategy/InitSP27/InitSP27.cu @@ -2,7 +2,7 @@ #include "InitSP27_Device.cuh" #include "Parameter/Parameter.h" -#include "cuda/CudaGrid.h" +#include <cuda_helper/CudaGrid.h> std::shared_ptr<PreProcessorStrategy> InitSP27::getNewInstance(std::shared_ptr<Parameter> para) { diff --git a/src/gpu/cuda_helper/CMakeLists.txt b/src/gpu/cuda_helper/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..314ba43431a31643ff9df63018b9194d92a99d6d --- /dev/null +++ b/src/gpu/cuda_helper/CMakeLists.txt @@ -0,0 +1,3 @@ +project(cuda LANGUAGES CUDA CXX) + +vf_add_library(PUBLIC_LINK logger) diff --git a/src/cuda/CudaGrid.cpp b/src/gpu/cuda_helper/CudaGrid.cpp similarity index 100% rename from src/cuda/CudaGrid.cpp rename to src/gpu/cuda_helper/CudaGrid.cpp diff --git a/src/cuda/CudaGrid.h b/src/gpu/cuda_helper/CudaGrid.h similarity index 100% rename from src/cuda/CudaGrid.h rename to src/gpu/cuda_helper/CudaGrid.h diff --git a/src/cuda/CudaTimer.cpp b/src/gpu/cuda_helper/CudaTimer.cpp similarity index 100% rename from src/cuda/CudaTimer.cpp rename to src/gpu/cuda_helper/CudaTimer.cpp diff --git a/src/cuda/CudaTimer.h b/src/gpu/cuda_helper/CudaTimer.h similarity index 100% rename from src/cuda/CudaTimer.h rename to src/gpu/cuda_helper/CudaTimer.h diff --git a/src/cuda/DeviceInfo.cpp b/src/gpu/cuda_helper/DeviceInfo.cpp similarity index 83% rename from src/cuda/DeviceInfo.cpp rename to src/gpu/cuda_helper/DeviceInfo.cpp index 20ea2c4f6ba098b17e444f55625a6791e46141e5..81fea1cf21418ef98217293985f8c1101f8635be 100644 --- a/src/cuda/DeviceInfo.cpp +++ b/src/gpu/cuda_helper/DeviceInfo.cpp @@ -15,7 +15,7 @@ void verifyNumberOfDevices(int deviceId) int device_count = 0; cudaError_t errorId = cudaGetDeviceCount(&device_count); if(errorId != cudaSuccess) { - VF_LOG_CRITICAL("Error while accessing the device count: {}", cudaGetErrorString(errorId)); + VF_LOG_CRITICAL("Device {}: Error while accessing the device count: {}", deviceId, cudaGetErrorString(errorId)); } if (deviceId > device_count) { throw std::runtime_error("chosen gpudevice >= device_count ... exiting\n"); @@ -28,13 +28,13 @@ void verifyComputeCapability(int deviceId) cudaError_t errorId = cudaGetDeviceProperties(&deviceProp, deviceId); if(errorId != cudaSuccess){ - VF_LOG_CRITICAL("Error while accessing the device properties occurs: {}", cudaGetErrorString(errorId)); + VF_LOG_CRITICAL("Device {}: Error while accessing the device properties occurs: {}", deviceId, cudaGetErrorString(errorId)); } VF_LOG_INFO("[compute capability] = [{}.{}]\n", deviceProp.major, deviceProp.minor); if (deviceProp.major > 999) { - throw std::runtime_error("warning, CUDA Device Emulation (CPU) detected, exiting\n"); + throw std::runtime_error("Warning, CUDA Device Emulation (CPU) detected, exiting\n"); } } @@ -43,13 +43,13 @@ void setCudaDevice(int deviceId) // choose a cuda device for kernel execution cudaError_t errorId = cudaSetDevice(deviceId); if (errorId != cudaSuccess) { - VF_LOG_CRITICAL("Error while setting the device to {}: {}", deviceId, cudaGetErrorString(errorId)); + VF_LOG_CRITICAL("Device {}: Error while setting the device to: {}", deviceId, cudaGetErrorString(errorId)); } else { int device; // double check that device was properly selected errorId = cudaGetDevice(&device); if(errorId != cudaSuccess) { - VF_LOG_CRITICAL("Error while getting the device: {}", cudaGetErrorString(errorId)); + VF_LOG_CRITICAL("Device {}: Error while getting the device: {}", deviceId, cudaGetErrorString(errorId)); } } } @@ -70,7 +70,7 @@ void printCudaInformation(int deviceId) cudaError_t errorId = cudaGetDeviceProperties(&prop, deviceId); if(errorId != cudaSuccess){ - VF_LOG_CRITICAL("Error while accessing the device properties occurs: {}", cudaGetErrorString(errorId)); + VF_LOG_CRITICAL("Device {}: Error while accessing the device properties occurs: {}", deviceId, cudaGetErrorString(errorId)); } printf(" --- General Information for device %d ---\n", deviceId); diff --git a/src/cuda/DeviceInfo.h b/src/gpu/cuda_helper/DeviceInfo.h similarity index 100% rename from src/cuda/DeviceInfo.h rename to src/gpu/cuda_helper/DeviceInfo.h diff --git a/src/lbm/MacroscopicQuantities.h b/src/lbm/MacroscopicQuantities.h index 5a93222a5efae2d1814411053360d66ef132d62c..e1b066a104874a95701ff3a77f6747884c5a54d7 100644 --- a/src/lbm/MacroscopicQuantities.h +++ b/src/lbm/MacroscopicQuantities.h @@ -53,6 +53,14 @@ inline __host__ __device__ real getIncompressibleVelocityX3(const real *const &f (((f[dir::DIR_0MP] - f[dir::DIR_0PM]) + (f[dir::DIR_0PP] - f[dir::DIR_0MM])) + ((f[dir::DIR_M0P] - f[dir::DIR_P0M]) + (f[dir::DIR_P0P] - f[dir::DIR_M0M]))) + (f[dir::DIR_00P] - f[dir::DIR_00M])); } +inline __host__ __device__ void getIncompressibleMacroscopicValues(const real *const &f /*[27]*/, real &rho, real &vx1, real &vx2, real &vx3) +{ + rho = getDensity(f); + vx1 = getIncompressibleVelocityX1(f); + vx2 = getIncompressibleVelocityX2(f); + vx3 = getIncompressibleVelocityX3(f); +} + /* @@ -75,6 +83,25 @@ inline __host__ __device__ real getCompressibleVelocityX3(const real *const &f27 return getIncompressibleVelocityX3(f27) / (rho + basics::constant::c1o1); } +inline __host__ __device__ void getCompressibleMacroscopicValues(const real *const &f /*[27]*/, real &drho, real& oneOverRho, real &vx1, real &vx2, real &vx3) +{ + drho = getDensity(f); + vx1 = getIncompressibleVelocityX1(f); + vx2 = getIncompressibleVelocityX2(f); + vx3 = getIncompressibleVelocityX3(f); + oneOverRho = vf::basics::constant::c1o1 / (drho + vf::basics::constant::c1o1); + vx1 *= oneOverRho; + vx2 *= oneOverRho; + vx3 *= oneOverRho; +} + +inline __host__ __device__ void getCompressibleMacroscopicValues(const real *const &f /*[27]*/, real &drho, real &vx1, real &vx2, real &vx3) +{ + real oneOverRho; + getCompressibleMacroscopicValues(f, drho, oneOverRho, vx1, vx2, vx3); +} + + /* * Pressure */ diff --git a/src/lbm/MacroscopicQuantitiesTests.cpp b/src/lbm/MacroscopicQuantitiesTests.cpp index 382ec180e7a97749c4a005734a61f96ec7a146d5..b39387ae7ac741cc4dc36b4c58de4bad43052793 100644 --- a/src/lbm/MacroscopicQuantitiesTests.cpp +++ b/src/lbm/MacroscopicQuantitiesTests.cpp @@ -1,30 +1,43 @@ #include <gmock/gmock.h> +#include <array> #include "MacroscopicQuantities.h" #include "constants/D3Q27.h" +#include <basics/tests/testUtilities.h> + /* * given distributions, which are all one. */ -real f[27] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; +// real f[27] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; + +class MacroscopicQuantitiesTest : public testing::Test { + + void SetUp() override { + f = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; + } + + public: + std::array<real, 27> f; +}; using namespace vf::lbm; -TEST(MacroscopicQuantitiesTest, check_density) +TEST_F(MacroscopicQuantitiesTest, check_density) { - const double density = getDensity(f); + const double density = getDensity(f.data()); const double expected_density = 27.; ASSERT_THAT(density, testing::DoubleEq(expected_density)); } -TEST(MacroscopicQuantitiesTest, whenFsAreEqual_velocityInEachDirectionShouldBeZero) +TEST_F(MacroscopicQuantitiesTest, whenFsAreEqual_velocityInEachDirectionShouldBeZero) { - const double velocityX1 = getIncompressibleVelocityX1(f); - const double velocityX2 = getIncompressibleVelocityX2(f); - const double velocityX3 = getIncompressibleVelocityX3(f); + const double velocityX1 = getIncompressibleVelocityX1(f.data()); + const double velocityX2 = getIncompressibleVelocityX2(f.data()); + const double velocityX3 = getIncompressibleVelocityX3(f.data()); const double expected_velocity = 0.; EXPECT_THAT(velocityX1, testing::DoubleEq(expected_velocity)); @@ -32,13 +45,13 @@ TEST(MacroscopicQuantitiesTest, whenFsAreEqual_velocityInEachDirectionShouldBeZe EXPECT_THAT(velocityX3, testing::DoubleEq(expected_velocity)); } -TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Eis2_velocityInX1ShouldBeOne) +TEST_F(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Eis2_velocityInX1ShouldBeOne) { f[dir::DIR_P00] = 2.; - const double velocityX1 = getIncompressibleVelocityX1(f); - const double velocityX2 = getIncompressibleVelocityX2(f); - const double velocityX3 = getIncompressibleVelocityX3(f); + const double velocityX1 = getIncompressibleVelocityX1(f.data()); + const double velocityX2 = getIncompressibleVelocityX2(f.data()); + const double velocityX3 = getIncompressibleVelocityX3(f.data()); const double expected_velocity_x1 = 1.; const double expected_velocity_x2 = 0.; @@ -49,23 +62,41 @@ TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Eis2_velocityInX1ShouldBeO EXPECT_THAT(velocityX3, testing::DoubleEq(expected_velocity_x3)); } -TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Nis2_velocityInX2ShouldBeOne) +TEST_F(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Nis2_velocityInX2ShouldBeOne) { f[dir::DIR_0P0] = 2.; - const double velocity = getIncompressibleVelocityX2(f); + const double velocity = getIncompressibleVelocityX2(f.data()); const double expected_velocity = 1.; ASSERT_THAT(velocity, testing::DoubleEq(expected_velocity)); } -TEST(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Tis2_velocityInX3ShouldBeOne) +TEST_F(MacroscopicQuantitiesTest, givenAllFsAreOne_when_Tis2_velocityInX3ShouldBeOne) { f[dir::DIR_00P] = 2.; - const double velocity = getIncompressibleVelocityX3(f); + const double velocity = getIncompressibleVelocityX3(f.data()); const double expected_velocity = 1.; ASSERT_THAT(velocity, testing::DoubleEq(expected_velocity)); } + +TEST_F(MacroscopicQuantitiesTest, givenAllFsAreOne_checkCompressibleValues) +{ + f[dir::DIR_P00] = 2.; + + real rho{0}, vx1{0}, vx2{0}, vx3{0}; + getCompressibleMacroscopicValues(f.data(), rho, vx1, vx2, vx3); + + std::cout << getIncompressibleVelocityX1(f.data()) << std::endl; + + const real expected_rho = 28.; + const real expected_velocity = (1. / (1 + expected_rho)); + + EXPECT_THAT(rho, RealEq(expected_rho)); + EXPECT_THAT(vx1, RealEq(expected_velocity)); + EXPECT_THAT(vx2, RealEq(0.)); + EXPECT_THAT(vx3, RealEq(0.)); +} diff --git a/src/lbm/refinement/Coefficients.h b/src/lbm/refinement/Coefficients.h new file mode 100644 index 0000000000000000000000000000000000000000..78790f758f597a49caaad5e719641cf3df08afca --- /dev/null +++ b/src/lbm/refinement/Coefficients.h @@ -0,0 +1,436 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//======================================================================================= +#ifndef LBM_SCALING_HELPER_FUNCTIONS_H +#define LBM_SCALING_HELPER_FUNCTIONS_H + +#ifndef __host__ +#define __host__ +#endif +#ifndef __device__ +#define __device__ +#endif + + +#include "lbm/constants/D3Q27.h" +#include <basics/constants/NumericConstants.h> + +#include "lbm/KernelParameter.h" +#include "lbm/MacroscopicQuantities.h" + + +using namespace vf::basics::constant; +using namespace vf::lbm::dir; + +namespace vf::lbm +{ + +// The Coefficients struct needs be created like this: +// Coefficients coeffs; +// MomentsOnSourceNodeSet momentsSet; +// momentsSet.calculatePPP(f, omega); +// ... and so on +// Coefficients coeffs; +// momentsSet.calculateCoefficients(coeffs); + +// Coefficients of the interpolation polynomial +struct Coefficients +{ + real a000, a100, a010, a001, a200, a020, a002, a110, a101, a011; + real b000, b100, b010, b001, b200, b020, b002, b110, b101, b011; + real c000, c100, c010, c001, c200, c020, c002, c110, c101, c011; + real d000, d100, d010, d001, d110, d101, d011; + real a111, b111, c111, d111; + real LaplaceRho; +}; + + +// Private struct - is only used within the MomentsOnSourceNodeSet +struct MomentsOnSourceNode +{ + real drho; + real velocityX; + real velocityY; + real velocityZ; + real kxyFromfcNEQ; + real kyzFromfcNEQ; + real kxzFromfcNEQ; + real kxxMyyFromfcNEQ; + real kxxMzzFromfcNEQ; + + __host__ __device__ void calculate(const real* const f, const real omega) + { + // const real f_000 = f[dir::DIR_000]; + const real fP00 = f[dir::DIR_P00]; + const real fM00 = f[dir::DIR_M00]; + const real f0P0 = f[dir::DIR_0P0]; + const real f0M0 = f[dir::DIR_0M0]; + const real f00P = f[dir::DIR_00P]; + const real f00M = f[dir::DIR_00M]; + const real fPP0 = f[dir::DIR_PP0]; + const real fMM0 = f[dir::DIR_MM0]; + const real fPM0 = f[dir::DIR_PM0]; + const real fMP0 = f[dir::DIR_MP0]; + const real fP0P = f[dir::DIR_P0P]; + const real fM0M = f[dir::DIR_M0M]; + const real fP0M = f[dir::DIR_P0M]; + const real fM0P = f[dir::DIR_M0P]; + const real f0PP = f[dir::DIR_0PP]; + const real f0MM = f[dir::DIR_0MM]; + const real f0PM = f[dir::DIR_0PM]; + const real f0MP = f[dir::DIR_0MP]; + const real fPPP = f[dir::DIR_PPP]; + const real fMPP = f[dir::DIR_MPP]; + const real fPMP = f[dir::DIR_PMP]; + const real fMMP = f[dir::DIR_MMP]; + const real fPPM = f[dir::DIR_PPM]; + const real fMPM = f[dir::DIR_MPM]; + const real fPMM = f[dir::DIR_PMM]; + const real fMMM = f[dir::DIR_MMM]; + + real oneOverRho; + getCompressibleMacroscopicValues(f, this->drho, oneOverRho, this->velocityX, this->velocityY, this->velocityZ); + + //////////////////////////////////////////////////////////////////////////////////// + //! - Calculate second order moments for interpolation + //! + // example: kxxMzz: moment, second derivative in x direction minus the second derivative in z direction + + this->kxyFromfcNEQ = -c3o1 * omega * + ((fMM0 + fMMM + fMMP - fMP0 - fMPM - fMPP - fPM0 - fPMM - fPMP + fPP0 + fPPM + fPPP) * + oneOverRho - + ((this->velocityX * this->velocityY))); + this->kyzFromfcNEQ = -c3o1 * omega * + ((f0MM + fPMM + fMMM - f0MP - fPMP - fMMP - f0PM - fPPM - fMPM + f0PP + fPPP + fMPP) * + oneOverRho - + ((this->velocityY * this->velocityZ))); + this->kxzFromfcNEQ = -c3o1 * omega * + ((fM0M + fMMM + fMPM - fM0P - fMMP - fMPP - fP0M - fPMM - fPPM + fP0P + fPMP + fPPP) * + oneOverRho - + ((this->velocityX * this->velocityZ))); + this->kxxMyyFromfcNEQ = -c3o2 * omega * + ((fM0M + fM00 + fM0P - f0MM - f0M0 - f0MP - f0PM - f0P0 - f0PP + fP0M + fP00 + fP0P) * + oneOverRho - + ((this->velocityX * this->velocityX - this->velocityY * this->velocityY))); + this->kxxMzzFromfcNEQ = -c3o2 * omega * + ((fMM0 + fM00 + fMP0 - f0MM - f0MP - f00M - f00P - f0PM - f0PP + fPM0 + fP00 + fPP0) * + oneOverRho - + ((this->velocityX * this->velocityX - this->velocityZ * this->velocityZ))); + } + +}; + +class MomentsOnSourceNodeSet +{ +private: + vf::lbm::MomentsOnSourceNode momentsPPP; + vf::lbm::MomentsOnSourceNode momentsMPP; + vf::lbm::MomentsOnSourceNode momentsPMP; + vf::lbm::MomentsOnSourceNode momentsMMP; + vf::lbm::MomentsOnSourceNode momentsPPM; + vf::lbm::MomentsOnSourceNode momentsMPM; + vf::lbm::MomentsOnSourceNode momentsPMM; + vf::lbm::MomentsOnSourceNode momentsMMM; + +public: + __host__ __device__ void calculatePPP(const real *const f, const real omega) + { + momentsPPP.calculate(f, omega); + } + + __host__ __device__ void calculateMPP(const real *const f, const real omega) + { + momentsMPP.calculate(f, omega); + } + + __host__ __device__ void calculatePMP(const real *const f, const real omega) + { + momentsPMP.calculate(f, omega); + } + + __host__ __device__ void calculateMMP(const real *const f, const real omega) + { + momentsMMP.calculate(f, omega); + } + + __host__ __device__ void calculatePPM(const real *const f, const real omega) + { + momentsPPM.calculate(f, omega); + } + + __host__ __device__ void calculateMPM(const real *const f, const real omega) + { + momentsMPM.calculate(f, omega); + } + + __host__ __device__ void calculatePMM(const real *const f, const real omega) + { + momentsPMM.calculate(f, omega); + } + + __host__ __device__ void calculateMMM(const real *const f, const real omega) + { + momentsMMM.calculate(f, omega); + } + + __host__ __device__ void calculateCoefficients(Coefficients &coefficients, real xoff, real yoff, real zoff) const + { + real& a000 = coefficients.a000; + real& b000 = coefficients.b000; + real& c000 = coefficients.c000; + real& d000 = coefficients.d000; + + real& a100 = coefficients.a100; + real& b100 = coefficients.b100; + real& c100 = coefficients.c100; + real& d100 = coefficients.d100; + + real& a010 = coefficients.a010; + real& b010 = coefficients.b010; + real& c010 = coefficients.c010; + real& d010 = coefficients.d010; + + real& a001 = coefficients.a001; + real& b001 = coefficients.b001; + real& c001 = coefficients.c001; + real& d001 = coefficients.d001; + + real& d110 = coefficients.d110, &d101 = coefficients.d101, &d011 = coefficients.d011; + + real& a200 = coefficients.a200, &a020 = coefficients.a020, &a002 = coefficients.a002; + real& b200 = coefficients.b200, &b020 = coefficients.b020, &b002 = coefficients.b002; + real& c200 = coefficients.c200, &c020 = coefficients.c020, &c002 = coefficients.c002; + + real& a110 = coefficients.a110, &a101 = coefficients.a101, &a011 = coefficients.a011; + real& b110 = coefficients.b110, &b101 = coefficients.b101, &b011 = coefficients.b011; + real& c110 = coefficients.c110, &c101 = coefficients.c101, &c011 = coefficients.c011; + + real &a111 = coefficients.a111, &b111 = coefficients.b111, &c111 = coefficients.c111, &d111 = coefficients.d111; + + real &LaplaceRho = coefficients.LaplaceRho; + + const real xoffsq = xoff * xoff; + const real yoffsq = yoff * yoff; + const real zoffsq = zoff * zoff; + + const real drhoPPP = momentsPPP.drho, vx1PPP = momentsPPP.velocityX, vx2PPP = momentsPPP.velocityY, vx3PPP = momentsPPP.velocityZ; + const real drhoMPP = momentsMPP.drho, vx1MPP = momentsMPP.velocityX, vx2MPP = momentsMPP.velocityY, vx3MPP = momentsMPP.velocityZ; + const real drhoPMP = momentsPMP.drho, vx1PMP = momentsPMP.velocityX, vx2PMP = momentsPMP.velocityY, vx3PMP = momentsPMP.velocityZ; + const real drhoMMP = momentsMMP.drho, vx1MMP = momentsMMP.velocityX, vx2MMP = momentsMMP.velocityY, vx3MMP = momentsMMP.velocityZ; + const real drhoPPM = momentsPPM.drho, vx1PPM = momentsPPM.velocityX, vx2PPM = momentsPPM.velocityY, vx3PPM = momentsPPM.velocityZ; + const real drhoMPM = momentsMPM.drho, vx1MPM = momentsMPM.velocityX, vx2MPM = momentsMPM.velocityY, vx3MPM = momentsMPM.velocityZ; + const real drhoPMM = momentsPMM.drho, vx1PMM = momentsPMM.velocityX, vx2PMM = momentsPMM.velocityY, vx3PMM = momentsPMM.velocityZ; + const real drhoMMM = momentsMMM.drho, vx1MMM = momentsMMM.velocityX, vx2MMM = momentsMMM.velocityY, vx3MMM = momentsMMM.velocityZ; + + // second order moments at the source nodes + const real kxyFromfcNEQPPP = momentsPPP.kxyFromfcNEQ, kyzFromfcNEQPPP = momentsPPP.kyzFromfcNEQ, kxzFromfcNEQPPP = momentsPPP.kxzFromfcNEQ, kxxMyyFromfcNEQPPP = momentsPPP.kxxMyyFromfcNEQ, kxxMzzFromfcNEQPPP = momentsPPP.kxxMzzFromfcNEQ; + const real kxyFromfcNEQMPP = momentsMPP.kxyFromfcNEQ, kyzFromfcNEQMPP = momentsMPP.kyzFromfcNEQ, kxzFromfcNEQMPP = momentsMPP.kxzFromfcNEQ, kxxMyyFromfcNEQMPP = momentsMPP.kxxMyyFromfcNEQ, kxxMzzFromfcNEQMPP = momentsMPP.kxxMzzFromfcNEQ; + const real kxyFromfcNEQPMP = momentsPMP.kxyFromfcNEQ, kyzFromfcNEQPMP = momentsPMP.kyzFromfcNEQ, kxzFromfcNEQPMP = momentsPMP.kxzFromfcNEQ, kxxMyyFromfcNEQPMP = momentsPMP.kxxMyyFromfcNEQ, kxxMzzFromfcNEQPMP = momentsPMP.kxxMzzFromfcNEQ; + const real kxyFromfcNEQMMP = momentsMMP.kxyFromfcNEQ, kyzFromfcNEQMMP = momentsMMP.kyzFromfcNEQ, kxzFromfcNEQMMP = momentsMMP.kxzFromfcNEQ, kxxMyyFromfcNEQMMP = momentsMMP.kxxMyyFromfcNEQ, kxxMzzFromfcNEQMMP = momentsMMP.kxxMzzFromfcNEQ; + const real kxyFromfcNEQPPM = momentsPPM.kxyFromfcNEQ, kyzFromfcNEQPPM = momentsPPM.kyzFromfcNEQ, kxzFromfcNEQPPM = momentsPPM.kxzFromfcNEQ, kxxMyyFromfcNEQPPM = momentsPPM.kxxMyyFromfcNEQ, kxxMzzFromfcNEQPPM = momentsPPM.kxxMzzFromfcNEQ; + const real kxyFromfcNEQMPM = momentsMPM.kxyFromfcNEQ, kyzFromfcNEQMPM = momentsMPM.kyzFromfcNEQ, kxzFromfcNEQMPM = momentsMPM.kxzFromfcNEQ, kxxMyyFromfcNEQMPM = momentsMPM.kxxMyyFromfcNEQ, kxxMzzFromfcNEQMPM = momentsMPM.kxxMzzFromfcNEQ; + const real kxyFromfcNEQPMM = momentsPMM.kxyFromfcNEQ, kyzFromfcNEQPMM = momentsPMM.kyzFromfcNEQ, kxzFromfcNEQPMM = momentsPMM.kxzFromfcNEQ, kxxMyyFromfcNEQPMM = momentsPMM.kxxMyyFromfcNEQ, kxxMzzFromfcNEQPMM = momentsPMM.kxxMzzFromfcNEQ; + const real kxyFromfcNEQMMM = momentsMMM.kxyFromfcNEQ, kyzFromfcNEQMMM = momentsMMM.kyzFromfcNEQ, kxzFromfcNEQMMM = momentsMMM.kxzFromfcNEQ, kxxMyyFromfcNEQMMM = momentsMMM.kxxMyyFromfcNEQ, kxxMzzFromfcNEQMMM = momentsMMM.kxxMzzFromfcNEQ; + + a000 = c1o64 * ( + c2o1 * ( + ((kxyFromfcNEQMMM - kxyFromfcNEQPPP) + (kxyFromfcNEQMMP - kxyFromfcNEQPPM)) + ((kxyFromfcNEQPMM - kxyFromfcNEQMPP) + (kxyFromfcNEQPMP - kxyFromfcNEQMPM)) + + ((kxzFromfcNEQMMM - kxzFromfcNEQPPP) + (kxzFromfcNEQPPM - kxzFromfcNEQMMP)) + ((kxzFromfcNEQPMM - kxzFromfcNEQMPP) + (kxzFromfcNEQMPM - kxzFromfcNEQPMP)) + + ((vx2PPP + vx2MMM) + (vx2PPM + vx2MMP)) - ((vx2MPP + vx2PMM) + (vx2MPM + vx2PMP)) + + ((vx3PPP + vx3MMM) - (vx3PPM + vx3MMP)) + ((vx3PMP + vx3MPM) - (vx3MPP + vx3PMM))) + + c8o1 * (((vx1PPP + vx1MMM) + (vx1PPM + vx1MMP)) + ((vx1MPP + vx1PMM) + (vx1PMP + vx1MPM))) + + ((kxxMyyFromfcNEQMMM - kxxMyyFromfcNEQPPP) + (kxxMyyFromfcNEQMMP - kxxMyyFromfcNEQPPM)) + + ((kxxMyyFromfcNEQMPP - kxxMyyFromfcNEQPMM) + (kxxMyyFromfcNEQMPM - kxxMyyFromfcNEQPMP)) + + ((kxxMzzFromfcNEQMMM - kxxMzzFromfcNEQPPP) + (kxxMzzFromfcNEQMMP - kxxMzzFromfcNEQPPM)) + + ((kxxMzzFromfcNEQMPP - kxxMzzFromfcNEQPMM) + (kxxMzzFromfcNEQMPM - kxxMzzFromfcNEQPMP))); + b000 = c1o64 * ( + c2o1 * ( + ((kxxMyyFromfcNEQPPP - kxxMyyFromfcNEQMMM) + (kxxMyyFromfcNEQPPM - kxxMyyFromfcNEQMMP)) + + ((kxxMyyFromfcNEQMPP - kxxMyyFromfcNEQPMM) + (kxxMyyFromfcNEQMPM - kxxMyyFromfcNEQPMP)) + + ((kxyFromfcNEQMMM - kxyFromfcNEQPPP) + (kxyFromfcNEQMMP - kxyFromfcNEQPPM)) + + ((kxyFromfcNEQMPP - kxyFromfcNEQPMM) + (kxyFromfcNEQMPM - kxyFromfcNEQPMP)) + + ((kyzFromfcNEQMMM - kyzFromfcNEQPPP) + (kyzFromfcNEQPPM - kyzFromfcNEQMMP)) + + ((kyzFromfcNEQPMM - kyzFromfcNEQMPP) + (kyzFromfcNEQMPM - kyzFromfcNEQPMP)) + + ((vx1PPP + vx1MMM) + (vx1PPM + vx1MMP)) - ((vx1MPM + vx1MPP) + (vx1PMM + vx1PMP)) + + ((vx3PPP + vx3MMM) - (vx3PPM + vx3MMP)) + ((vx3MPP + vx3PMM) - (vx3MPM + vx3PMP))) + + c8o1 * (((vx2PPP + vx2MMM) + (vx2PPM + vx2MMP)) + ((vx2MPP + vx2PMM) + (vx2MPM + vx2PMP))) + + ((kxxMzzFromfcNEQMMM - kxxMzzFromfcNEQPPP) + (kxxMzzFromfcNEQMMP - kxxMzzFromfcNEQPPM)) + + ((kxxMzzFromfcNEQPMM - kxxMzzFromfcNEQMPP) + (kxxMzzFromfcNEQPMP - kxxMzzFromfcNEQMPM))); + c000 = c1o64 * ( + c2o1 * ( + ((kxxMzzFromfcNEQPPP - kxxMzzFromfcNEQMMM) + (kxxMzzFromfcNEQMMP - kxxMzzFromfcNEQPPM)) + + ((kxxMzzFromfcNEQMPP - kxxMzzFromfcNEQPMM) + (kxxMzzFromfcNEQPMP - kxxMzzFromfcNEQMPM)) + + ((kxzFromfcNEQMMM - kxzFromfcNEQPPP) + (kxzFromfcNEQMMP - kxzFromfcNEQPPM)) + + ((kxzFromfcNEQMPP - kxzFromfcNEQPMM) + (kxzFromfcNEQMPM - kxzFromfcNEQPMP)) + + ((kyzFromfcNEQMMM - kyzFromfcNEQPPP) + (kyzFromfcNEQMMP - kyzFromfcNEQPPM)) + + ((kyzFromfcNEQPMM - kyzFromfcNEQMPP) + (kyzFromfcNEQPMP - kyzFromfcNEQMPM)) + + ((vx1PPP + vx1MMM) - (vx1MMP + vx1PPM)) + ((vx1MPM + vx1PMP) - (vx1MPP + vx1PMM)) + + ((vx2PPP + vx2MMM) - (vx2MMP + vx2PPM)) + ((vx2MPP + vx2PMM) - (vx2MPM + vx2PMP))) + + c8o1 * (((vx3PPP + vx3MMM) + (vx3PPM + vx3MMP)) + ((vx3PMM + vx3MPP) + (vx3PMP + vx3MPM))) + + ((kxxMyyFromfcNEQMMM - kxxMyyFromfcNEQPPP) + (kxxMyyFromfcNEQPPM - kxxMyyFromfcNEQMMP)) + + ((kxxMyyFromfcNEQPMM - kxxMyyFromfcNEQMPP) + (kxxMyyFromfcNEQMPM - kxxMyyFromfcNEQPMP))); + + a100 = c1o4 * (((vx1PPP - vx1MMM) + (vx1PPM - vx1MMP)) + ((vx1PMM - vx1MPP) + (vx1PMP - vx1MPM))); + b100 = c1o4 * (((vx2PPP - vx2MMM) + (vx2PPM - vx2MMP)) + ((vx2PMM - vx2MPP) + (vx2PMP - vx2MPM))); + c100 = c1o4 * (((vx3PPP - vx3MMM) + (vx3PPM - vx3MMP)) + ((vx3PMM - vx3MPP) + (vx3PMP - vx3MPM))); + + a200 = c1o16 * ( + c2o1 * ( + ((vx2PPP + vx2MMM) + (vx2PPM - vx2MPP)) + ((vx2MMP - vx2PMM) - (vx2MPM + vx2PMP)) + + ((vx3PPP + vx3MMM) - (vx3PPM + vx3MPP)) + ((vx3MPM + vx3PMP) - (vx3MMP + vx3PMM))) + + ((kxxMyyFromfcNEQPPP - kxxMyyFromfcNEQMMM) + (kxxMyyFromfcNEQPPM - kxxMyyFromfcNEQMMP)) + + ((kxxMyyFromfcNEQPMM - kxxMyyFromfcNEQMPP) + (kxxMyyFromfcNEQPMP - kxxMyyFromfcNEQMPM)) + + ((kxxMzzFromfcNEQPPP - kxxMzzFromfcNEQMMM) + (kxxMzzFromfcNEQPPM - kxxMzzFromfcNEQMMP)) + + ((kxxMzzFromfcNEQPMM - kxxMzzFromfcNEQMPP) + (kxxMzzFromfcNEQPMP - kxxMzzFromfcNEQMPM))); + b200 = c1o8 * ( + c2o1 * ( + -((vx1PPP + vx1MMM) + (vx1PPM + vx1MMP)) + ((vx1MPP + vx1PMM) + (vx1MPM + vx1PMP))) + + ((kxyFromfcNEQPPP - kxyFromfcNEQMMM) + (kxyFromfcNEQPPM - kxyFromfcNEQMMP)) + + ((kxyFromfcNEQPMM - kxyFromfcNEQMPP) + (kxyFromfcNEQPMP - kxyFromfcNEQMPM))); + c200 = c1o8 * ( + c2o1 * ( + ((vx1PPM + vx1MMP) - (vx1PPP + vx1MMM)) + ((vx1MPP + vx1PMM) - (vx1MPM + vx1PMP))) + + ((kxzFromfcNEQPPP - kxzFromfcNEQMMM) + (kxzFromfcNEQPPM - kxzFromfcNEQMMP)) + + ((kxzFromfcNEQPMM - kxzFromfcNEQMPP) + (kxzFromfcNEQPMP - kxzFromfcNEQMPM))); + + a010 = c1o4 * (((vx1PPP - vx1MMM) + (vx1PPM - vx1MMP)) + ((vx1MPP - vx1PMM) + (vx1MPM - vx1PMP))); + b010 = c1o4 * (((vx2PPP - vx2MMM) + (vx2PPM - vx2MMP)) + ((vx2MPP - vx2PMM) + (vx2MPM - vx2PMP))); + c010 = c1o4 * (((vx3PPP - vx3MMM) + (vx3PPM - vx3MMP)) + ((vx3MPP - vx3PMM) + (vx3MPM - vx3PMP))); + + a020 = c1o8 * ( + c2o1 * (-((vx2PPP + vx2MMM) + (vx2MMP + vx2PPM)) + ((vx2MPP + vx2PMM) + (vx2MPM + vx2PMP))) + + ((kxyFromfcNEQPPP - kxyFromfcNEQMMM) + (kxyFromfcNEQPPM - kxyFromfcNEQMMP)) + + ((kxyFromfcNEQMPP - kxyFromfcNEQPMM) + (kxyFromfcNEQMPM - kxyFromfcNEQPMP))); + b020 = c1o16 * ( + c2o1 * ( + ((kxxMyyFromfcNEQMMM - kxxMyyFromfcNEQPPP) + (kxxMyyFromfcNEQMMP - kxxMyyFromfcNEQPPM)) + + ((kxxMyyFromfcNEQPMM - kxxMyyFromfcNEQMPP) + (kxxMyyFromfcNEQPMP - kxxMyyFromfcNEQMPM)) + + ((vx1PPP + vx1MMM) + (vx1PPM + vx1MMP)) - ((vx1MPP + vx1PMM) + (vx1PMP + vx1MPM)) + + ((vx3PPP + vx3MMM) - (vx3PPM + vx3MMP)) + ((vx3MPP + vx3PMM) - (vx3MPM + vx3PMP))) + + ((kxxMzzFromfcNEQPPP - kxxMzzFromfcNEQMMM) + (kxxMzzFromfcNEQPPM - kxxMzzFromfcNEQMMP)) + + ((kxxMzzFromfcNEQMPP - kxxMzzFromfcNEQPMM) + (kxxMzzFromfcNEQMPM - kxxMzzFromfcNEQPMP))); + c020 = c1o8 * ( + c2o1 * (((vx2MMP + vx2PPM) - (vx2PPP + vx2MMM)) + ((vx2PMP + vx2MPM) - (vx2MPP + vx2PMM))) + + ((kyzFromfcNEQPPP - kyzFromfcNEQMMM) + (kyzFromfcNEQPPM - kyzFromfcNEQMMP)) + + ((kyzFromfcNEQMPP - kyzFromfcNEQPMM) + (kyzFromfcNEQMPM - kyzFromfcNEQPMP))); + + a001 = c1o4 * (((vx1PPP - vx1MMM) + (vx1MMP - vx1PPM)) + ((vx1MPP - vx1PMM) + (vx1PMP - vx1MPM))); + b001 = c1o4 * (((vx2PPP - vx2MMM) + (vx2MMP - vx2PPM)) + ((vx2MPP - vx2PMM) + (vx2PMP - vx2MPM))); + c001 = c1o4 * (((vx3PPP - vx3MMM) + (vx3MMP - vx3PPM)) + ((vx3MPP - vx3PMM) + (vx3PMP - vx3MPM))); + + a002 = c1o8 * ( + c2o1 * (((vx3PPM + vx3MMP) - (vx3PPP + vx3MMM)) + ((vx3MPP + vx3PMM) - (vx3PMP + vx3MPM))) + + ((kxzFromfcNEQPPP - kxzFromfcNEQMMM) + (kxzFromfcNEQMMP - kxzFromfcNEQPPM)) + + ((kxzFromfcNEQPMP - kxzFromfcNEQMPM) + (kxzFromfcNEQMPP - kxzFromfcNEQPMM))); + b002 = c1o8 * ( + c2o1 * (((vx3PPM + vx3MMP) - (vx3PPP + vx3MMM)) + ((vx3MPM + vx3PMP) - (vx3PMM + vx3MPP))) + + ((kyzFromfcNEQPPP - kyzFromfcNEQMMM) + (kyzFromfcNEQMMP - kyzFromfcNEQPPM)) + + ((kyzFromfcNEQPMP - kyzFromfcNEQMPM) + (kyzFromfcNEQMPP - kyzFromfcNEQPMM))); + c002 = c1o16 * ( + c2o1 * ( + ((kxxMzzFromfcNEQMMM - kxxMzzFromfcNEQPPP) + (kxxMzzFromfcNEQPPM - kxxMzzFromfcNEQMMP)) + + ((kxxMzzFromfcNEQMPM - kxxMzzFromfcNEQPMP) + (kxxMzzFromfcNEQPMM - kxxMzzFromfcNEQMPP)) + + ((vx1PPP + vx1MMM) - (vx1MMP + vx1PPM)) + ((vx1MPM + vx1PMP) - (vx1PMM + vx1MPP)) + + ((vx2PPP + vx2MMM) - (vx2MMP + vx2PPM)) + ((vx2PMM + vx2MPP) - (vx2MPM + vx2PMP))) + + ((kxxMyyFromfcNEQPPP - kxxMyyFromfcNEQMMM) + (kxxMyyFromfcNEQMMP - kxxMyyFromfcNEQPPM)) + + ((kxxMyyFromfcNEQPMP - kxxMyyFromfcNEQMPM) + (kxxMyyFromfcNEQMPP - kxxMyyFromfcNEQPMM))); + + a110 = c1o2 * (((vx1PPP + vx1MMM) + (vx1MMP + vx1PPM)) - ((vx1MPM + vx1PMP) + (vx1PMM + vx1MPP))); + b110 = c1o2 * (((vx2PPP + vx2MMM) + (vx2MMP + vx2PPM)) - ((vx2MPM + vx2PMP) + (vx2PMM + vx2MPP))); + c110 = c1o2 * (((vx3PPP + vx3MMM) + (vx3MMP + vx3PPM)) - ((vx3MPM + vx3PMP) + (vx3PMM + vx3MPP))); + + a101 = c1o2 * (((vx1PPP + vx1MMM) - (vx1MMP + vx1PPM)) + ((vx1MPM + vx1PMP) - (vx1PMM + vx1MPP))); + b101 = c1o2 * (((vx2PPP + vx2MMM) - (vx2MMP + vx2PPM)) + ((vx2MPM + vx2PMP) - (vx2PMM + vx2MPP))); + c101 = c1o2 * (((vx3PPP + vx3MMM) - (vx3MMP + vx3PPM)) + ((vx3MPM + vx3PMP) - (vx3PMM + vx3MPP))); + + a011 = c1o2 * (((vx1PPP + vx1MMM) - (vx1MMP + vx1PPM)) + ((vx1PMM + vx1MPP) - (vx1MPM + vx1PMP))); + b011 = c1o2 * (((vx2PPP + vx2MMM) - (vx2MMP + vx2PPM)) + ((vx2PMM + vx2MPP) - (vx2MPM + vx2PMP))); + c011 = c1o2 * (((vx3PPP + vx3MMM) - (vx3MMP + vx3PPM)) + ((vx3PMM + vx3MPP) - (vx3MPM + vx3PMP))); + + a111 = ((vx1PPP - vx1MMM) + (vx1MMP - vx1PPM)) + ((vx1MPM - vx1PMP) + (vx1PMM - vx1MPP)); + b111 = ((vx2PPP - vx2MMM) + (vx2MMP - vx2PPM)) + ((vx2MPM - vx2PMP) + (vx2PMM - vx2MPP)); + c111 = ((vx3PPP - vx3MMM) + (vx3MMP - vx3PPM)) + ((vx3MPM - vx3PMP) + (vx3PMM - vx3MPP)); + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //!- Calculate coefficients for the polynomial interpolation of the pressure + //! + LaplaceRho = + ((xoff != c0o1) || (yoff != c0o1) || (zoff != c0o1)) + ? c0o1 : -c3o1 * (a100 * a100 + b010 * b010 + c001 * c001) - c6o1 * (b100 * a010 + c100 * a001 + c010 * b001); + d000 = c1o8 * (((drhoPPP + drhoMMM) + (drhoPPM + drhoMMP)) + ((drhoPMM + drhoMPP) + (drhoPMP + drhoMPM))); + d100 = c1o4 * (((drhoPPP - drhoMMM) + (drhoPPM - drhoMMP)) + ((drhoPMM - drhoMPP) + (drhoPMP - drhoMPM))); + d010 = c1o4 * (((drhoPPP - drhoMMM) + (drhoPPM - drhoMMP)) + ((drhoMPP - drhoPMM) + (drhoMPM - drhoPMP))); + d001 = c1o4 * (((drhoPPP - drhoMMM) + (drhoMMP - drhoPPM)) + ((drhoMPP - drhoPMM) + (drhoPMP - drhoMPM))); + d110 = c1o2 * (((drhoPPP + drhoMMM) + (drhoPPM + drhoMMP)) - ((drhoPMM + drhoMPP) + (drhoPMP + drhoMPM))); + d101 = c1o2 * (((drhoPPP + drhoMMM) - (drhoPPM + drhoMMP)) + ((drhoPMP + drhoMPM) - (drhoPMM + drhoMPP))); + d011 = c1o2 * (((drhoPPP + drhoMMM) - (drhoPPM + drhoMMP)) + ((drhoPMM + drhoMPP) - (drhoPMP + drhoMPM))); + + d111 = (((drhoPPP - drhoMMM) + (drhoMMP - drhoPPM)) + ((drhoPMM - drhoMPP) + (drhoMPM - drhoPMP))); + + ////////////////////////////////////////////////////////////////////////// + //! - Extrapolation for refinement in to the wall (polynomial coefficients) + //! + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // x------x + // | | + // | ---+--->X + // | | | + // x------x | + // offset-vector + // + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + a000 = a000 + xoff * a100 + yoff * a010 + zoff * a001 + xoffsq * a200 + yoffsq * a020 + zoffsq * a002 + + xoff * yoff * a110 + xoff * zoff * a101 + yoff * zoff * a011; + a100 = a100 + c2o1 * xoff * a200 + yoff * a110 + zoff * a101; + a010 = a010 + c2o1 * yoff * a020 + xoff * a110 + zoff * a011; + a001 = a001 + c2o1 * zoff * a002 + xoff * a101 + yoff * a011; + b000 = b000 + xoff * b100 + yoff * b010 + zoff * b001 + xoffsq * b200 + yoffsq * b020 + zoffsq * b002 + + xoff * yoff * b110 + xoff * zoff * b101 + yoff * zoff * b011; + b100 = b100 + c2o1 * xoff * b200 + yoff * b110 + zoff * b101; + b010 = b010 + c2o1 * yoff * b020 + xoff * b110 + zoff * b011; + b001 = b001 + c2o1 * zoff * b002 + xoff * b101 + yoff * b011; + c000 = c000 + xoff * c100 + yoff * c010 + zoff * c001 + xoffsq * c200 + yoffsq * c020 + zoffsq * c002 + + xoff * yoff * c110 + xoff * zoff * c101 + yoff * zoff * c011; + c100 = c100 + c2o1 * xoff * c200 + yoff * c110 + zoff * c101; + c010 = c010 + c2o1 * yoff * c020 + xoff * c110 + zoff * c011; + c001 = c001 + c2o1 * zoff * c002 + xoff * c101 + yoff * c011; + d000 = d000 + xoff * d100 + yoff * d010 + zoff * d001 + + xoff * yoff * d110 + xoff * zoff * d101 + yoff * zoff * d011; + + d100 = d100 + yoff * d110 + zoff * d101; + d010 = d010 + xoff * d110 + zoff * d011; + d001 = d001 + xoff * d101 + yoff * d011; + } + +}; + +} + +#endif diff --git a/src/lbm/refinement/InterpolationCF.h b/src/lbm/refinement/InterpolationCF.h new file mode 100644 index 0000000000000000000000000000000000000000..82b8df256ce8ebecdc37e202e0dbe763331a1a65 --- /dev/null +++ b/src/lbm/refinement/InterpolationCF.h @@ -0,0 +1,310 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//======================================================================================= +#ifndef LBM_INTERPOLATION_CF_H +#define LBM_INTERPOLATION_CF_H + +#ifndef __host__ +#define __host__ +#endif +#ifndef __device__ +#define __device__ +#endif + +#include <basics/constants/NumericConstants.h> + +#include "lbm/constants/D3Q27.h" + +#include "lbm/KernelParameter.h" +#include "lbm/Chimera.h" + +#include "lbm/refinement/Coefficients.h" + +using namespace vf::basics::constant; +using namespace vf::lbm::dir; + +namespace vf::lbm +{ + +inline __host__ __device__ void interpolateCF(real* const f, const real& omegaF, const real& epsnew, const Coefficients &coefficients, const real& x, const real& y, const real& z) +{ + const real useNEQ = c1o1; + + const real kxyAverage = c0o1; + const real kyzAverage = c0o1; + const real kxzAverage = c0o1; + const real kxxMyyAverage = c0o1; + const real kxxMzzAverage = c0o1; + + const real& a000 = coefficients.a000; + const real& b000 = coefficients.b000; + const real& c000 = coefficients.c000; + const real& d000 = coefficients.d000; + + const real& a100 = coefficients.a100; + const real& b100 = coefficients.b100; + const real& c100 = coefficients.c100; + const real& d100 = coefficients.d100; + + const real& a010 = coefficients.a010; + const real& b010 = coefficients.b010; + const real& c010 = coefficients.c010; + const real& d010 = coefficients.d010; + + const real& a001 = coefficients.a001; + const real& b001 = coefficients.b001; + const real& c001 = coefficients.c001; + const real& d001 = coefficients.d001; + + const real& d110 = coefficients.d110, &d101 = coefficients.d101, &d011 = coefficients.d011; + + const real& a200 = coefficients.a200, &a020 = coefficients.a020, &a002 = coefficients.a002; + const real& b200 = coefficients.b200, &b020 = coefficients.b020, &b002 = coefficients.b002; + const real& c200 = coefficients.c200, &c020 = coefficients.c020, &c002 = coefficients.c002; + + const real& a110 = coefficients.a110, &a101 = coefficients.a101, &a011 = coefficients.a011; + const real& b110 = coefficients.b110, &b101 = coefficients.b101, &b011 = coefficients.b011; + const real& c110 = coefficients.c110, &c101 = coefficients.c101, &c011 = coefficients.c011; + + const real &a111 = coefficients.a111, &b111 = coefficients.b111, &c111 = coefficients.c111, &d111 = coefficients.d111; + + const real &LaplaceRho = coefficients.LaplaceRho; + + + //////////////////////////////////////////////////////////////////////////////////// + //! - Set all moments to zero + //! + real m111 = c0o1; + real m211 = c0o1; + real m011 = c0o1; + real m121 = c0o1; + real m101 = c0o1; + real m112 = c0o1; + real m110 = c0o1; + real m221 = c0o1; + real m001 = c0o1; + real m201 = c0o1; + real m021 = c0o1; + real m212 = c0o1; + real m010 = c0o1; + real m210 = c0o1; + real m012 = c0o1; + real m122 = c0o1; + real m100 = c0o1; + real m120 = c0o1; + real m102 = c0o1; + real m222 = c0o1; + real m022 = c0o1; + real m202 = c0o1; + real m002 = c0o1; + real m220 = c0o1; + real m020 = c0o1; + real m200 = c0o1; + real m000 = c0o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the distributions (f's): + //! + real& f000 = m111; + real& fP00 = m211; + real& fM00 = m011; + real& f0P0 = m121; + real& f0M0 = m101; + real& f00P = m112; + real& f00M = m110; + real& fPP0 = m221; + real& fMM0 = m001; + real& fPM0 = m201; + real& fMP0 = m021; + real& fP0P = m212; + real& fM0M = m010; + real& fP0M = m210; + real& fM0P = m012; + real& f0PP = m122; + real& f0MM = m100; + real& f0PM = m120; + real& f0MP = m102; + real& fPPP = m222; + real& fMPP = m022; + real& fPMP = m202; + real& fMMP = m002; + real& fPPM = m220; + real& fMPM = m020; + real& fPMM = m200; + real& fMMM = m000; + + + //////////////////////////////////////////////////////////////////////////////// + //! - Set macroscopic values on destination node (zeroth and first order moments) + //! + real press = d000 + x * d100 + y * d010 + z * d001 + + x * y * d110 + x * z * d101 + y * z * d011 + x * y * z * d111 + c3o1 * x * x * LaplaceRho; + real vvx = a000 + x * a100 + y * a010 + z * a001 + + x * x * a200 + y * y * a020 + z * z * a002 + + x * y * a110 + x * z * a101 + y * z * a011 + x * y * z * a111; + real vvy = b000 + x * b100 + y * b010 + z * b001 + + x * x * b200 + y * y * b020 + z * z * b002 + + x * y * b110 + x * z * b101 + y * z * b011 + x * y * z * b111; + real vvz = c000 + x * c100 + y * c010 + z * c001 + + x * x * c200 + y * y * c020 + z * z * c002 + + x * y * c110 + x * z * c101 + y * z * c011 + x * y * z * c111; + + m000 = press; // m000 is press, if drho is interpolated directly + + //////////////////////////////////////////////////////////////////////////////// + //! - Set moments (second to sixth order) on destination node + //! + // linear combinations for second order moments + real mxxPyyPzz = m000; + + real mxxMyy = -c2o3 * (a100 - b010 + kxxMyyAverage + c2o1 * a200 * x - b110 * x + a110 * y + -c2o1 * b020 * y + a101 * z - b011 * z - b111 * x * z + a111 * y * z) * epsnew/ omegaF * (c1o1 + press); + real mxxMzz = -c2o3 * (a100 - c001 + kxxMzzAverage + c2o1 * a200 * x - c101 * x + a110 * y + -c011 * y - c111 * x * y + a101 * z - c2o1 * c002 * z + a111 * y * z) * epsnew/ omegaF * (c1o1 + press); + + m011 = -c1o3 * (b001 + c010 + kyzAverage + b101 * x + c110 * x + b011 * y + c2o1 * c020 * y + + b111 * x * y + c2o1 * b002 * z + c011 * z + c111 * x * z) * epsnew / omegaF * (c1o1 + press); + m101 = -c1o3 * (a001 + c100 + kxzAverage + a101 * x + c2o1 * c200 * x + a011 * y + c110 * y + + a111 * x * y + c2o1 * a002 * z + c101 * z + c111 * y * z) * epsnew / omegaF * (c1o1 + press); + m110 = -c1o3 * (a010 + b100 + kxyAverage + a110 * x + c2o1 * b200 * x + c2o1 * a020 * y + + b110 * y + a011 * z + b101 * z + a111 * x * z + b111 * y * z) * epsnew / omegaF * (c1o1 + press); + + m200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; + + // linear combinations for third order moments + m111 = c0o1; + + real mxxyPyzz = c0o1; + real mxxyMyzz = c0o1; + real mxxzPyyz = c0o1; + real mxxzMyyz = c0o1; + real mxyyPxzz = c0o1; + real mxyyMxzz = c0o1; + + m210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // fourth order moments + m022 = m000 * c1o9; + m202 = m022; + m220 = m022; + + // fifth order moments + + // sixth order moment + m222 = m000 * c1o27; + + real vxsq = vvx * vvx; + real vysq = vvy * vvy; + real vzsq = vvz * vvz; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m000, m100, m200, vvx, vxsq, c1o1, c1o1); + backwardChimera( m010, m110, m210, vvx, vxsq); + backwardInverseChimeraWithK(m020, m120, m220, vvx, vxsq, c3o1, c1o3); + backwardChimera( m001, m101, m201, vvx, vxsq); + backwardChimera( m011, m111, m211, vvx, vxsq); + backwardChimera( m021, m121, m221, vvx, vxsq); + backwardInverseChimeraWithK(m002, m102, m202, vvx, vxsq, c3o1, c1o3); + backwardChimera( m012, m112, m212, vvx, vxsq); + backwardInverseChimeraWithK(m022, m122, m222, vvx, vxsq, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m000, m010, m020, vvy, vysq, c6o1, c1o6); + backwardChimera( m001, m011, m021, vvy, vysq); + backwardInverseChimeraWithK(m002, m012, m022, vvy, vysq, c18o1, c1o18); + backwardInverseChimeraWithK(m100, m110, m120, vvy, vysq, c3o2, c2o3); + backwardChimera( m101, m111, m121, vvy, vysq); + backwardInverseChimeraWithK(m102, m112, m122, vvy, vysq, c9o2, c2o9); + backwardInverseChimeraWithK(m200, m210, m220, vvy, vysq, c6o1, c1o6); + backwardChimera( m201, m211, m221, vvy, vysq); + backwardInverseChimeraWithK(m202, m212, m222, vvy, vysq, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m000, m001, m002, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m010, m011, m012, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m020, m021, m022, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m100, m101, m102, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m110, m111, m112, vvz, vzsq, c9o4, c4o9); + backwardInverseChimeraWithK(m120, m121, m122, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m200, m201, m202, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m210, m211, m212, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m220, m221, m222, vvz, vzsq, c36o1, c1o36); + + f[DIR_000] = f000; + f[DIR_P00] = fP00; + f[DIR_M00] = fM00; + f[DIR_0P0] = f0P0; + f[DIR_0M0] = f0M0; + f[DIR_00P] = f00P; + f[DIR_00M] = f00M; + f[DIR_PP0] = fPP0; + f[DIR_MM0] = fMM0; + f[DIR_PM0] = fPM0; + f[DIR_MP0] = fMP0; + f[DIR_P0P] = fP0P; + f[DIR_M0M] = fM0M; + f[DIR_P0M] = fP0M; + f[DIR_M0P] = fM0P; + f[DIR_0PP] = f0PP; + f[DIR_0MM] = f0MM; + f[DIR_0PM] = f0PM; + f[DIR_0MP] = f0MP; + f[DIR_PPP] = fPPP; + f[DIR_MPP] = fMPP; + f[DIR_PMP] = fPMP; + f[DIR_MMP] = fMMP; + f[DIR_PPM] = fPPM; + f[DIR_MPM] = fMPM; + f[DIR_PMM] = fPMM; + f[DIR_MMM] = fMMM; +} + + + +} + +#endif diff --git a/src/lbm/refinement/InterpolationFC.h b/src/lbm/refinement/InterpolationFC.h new file mode 100644 index 0000000000000000000000000000000000000000..f3e6384476033880c40b4b6f4c73890ba1e33ae7 --- /dev/null +++ b/src/lbm/refinement/InterpolationFC.h @@ -0,0 +1,265 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//======================================================================================= +#ifndef LBM_INTERPOLATION_FC_H +#define LBM_INTERPOLATION_FC_H + +#ifndef __host__ +#define __host__ +#endif +#ifndef __device__ +#define __device__ +#endif + +#include <basics/constants/NumericConstants.h> + +#include "lbm/constants/D3Q27.h" +#include "lbm/KernelParameter.h" +#include "lbm/Chimera.h" + +#include "lbm/refinement/Coefficients.h" + +using namespace vf::basics::constant; +using namespace vf::lbm::dir; + +namespace vf::lbm +{ + +inline __host__ __device__ void interpolateFC(real* const f, const real epsnew, const real omegaC, const Coefficients& coefficients) +{ + + const real kxyAverage = c0o1; + const real kyzAverage = c0o1; + const real kxzAverage = c0o1; + const real kxxMyyAverage = c0o1; + const real kxxMzzAverage = c0o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Set all moments to zero + //! + real m111 = c0o1; + real m211 = c0o1; + real m011 = c0o1; + real m121 = c0o1; + real m101 = c0o1; + real m112 = c0o1; + real m110 = c0o1; + real m221 = c0o1; + real m001 = c0o1; + real m201 = c0o1; + real m021 = c0o1; + real m212 = c0o1; + real m010 = c0o1; + real m210 = c0o1; + real m012 = c0o1; + real m122 = c0o1; + real m100 = c0o1; + real m120 = c0o1; + real m102 = c0o1; + real m222 = c0o1; + real m022 = c0o1; + real m202 = c0o1; + real m002 = c0o1; + real m220 = c0o1; + real m020 = c0o1; + real m200 = c0o1; + real m000 = c0o1; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Define aliases to use the same variable for the distributions (f's): + //! + real& f000 = m111; + real& fP00 = m211; + real& fM00 = m011; + real& f0P0 = m121; + real& f0M0 = m101; + real& f00P = m112; + real& f00M = m110; + real& fPP0 = m221; + real& fMM0 = m001; + real& fPM0 = m201; + real& fMP0 = m021; + real& fP0P = m212; + real& fM0M = m010; + real& fP0M = m210; + real& fM0P = m012; + real& f0PP = m122; + real& f0MM = m100; + real& f0PM = m120; + real& f0MP = m102; + real& fPPP = m222; + real& fMPP = m022; + real& fPMP = m202; + real& fMMP = m002; + real& fPPM = m220; + real& fMPM = m020; + real& fPMM = m200; + real& fMMM = m000; + + //////////////////////////////////////////////////////////////////////////////// + //! - Declare local variables for destination nodes + //! + real vvx, vvy, vvz, vxsq, vysq, vzsq; + real mxxPyyPzz, mxxMyy, mxxMzz, mxxyPyzz, mxxyMyzz, mxxzPyyz, mxxzMyyz, mxyyPxzz, mxyyMxzz; + real useNEQ = c1o1; // zero; //one; //.... one = on ..... zero = off + real press; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set macroscopic values on destination node (zeroth and first order moments) + //! + press = coefficients.d000 - c2o1 * coefficients.LaplaceRho * c1o8; + vvx = coefficients.a000; + vvy = coefficients.b000; + vvz = coefficients.c000; + + m000 = press; // m000 is press, if drho is interpolated directly + + vxsq = vvx * vvx; + vysq = vvy * vvy; + vzsq = vvz * vvz; + + //////////////////////////////////////////////////////////////////////////////// + //! - Set moments (second to sixth order) on destination node + //! + // linear combinations for second order moments + mxxPyyPzz = m000; + + mxxMyy = -c2o3 * ((coefficients.a100 - coefficients.b010) + kxxMyyAverage) * epsnew / omegaC * (c1o1 + press); + mxxMzz = -c2o3 * ((coefficients.a100 - coefficients.c001) + kxxMzzAverage) * epsnew / omegaC * (c1o1 + press); + + m011 = -c1o3 * ((coefficients.b001 + coefficients.c010) + kyzAverage) * epsnew / omegaC * (c1o1 + press); + m101 = -c1o3 * ((coefficients.a001 + coefficients.c100) + kxzAverage) * epsnew / omegaC * (c1o1 + press); + m110 = -c1o3 * ((coefficients.a010 + coefficients.b100) + kxyAverage) * epsnew / omegaC * (c1o1 + press); + + m200 = c1o3 * ( mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m020 = c1o3 * (-c2o1 * mxxMyy + mxxMzz + mxxPyyPzz) * useNEQ; + m002 = c1o3 * ( mxxMyy - c2o1 * mxxMzz + mxxPyyPzz) * useNEQ; + + // linear combinations for third order moments + m111 = c0o1; + + mxxyPyzz = c0o1; + mxxyMyzz = c0o1; + mxxzPyyz = c0o1; + mxxzMyyz = c0o1; + mxyyPxzz = c0o1; + mxyyMxzz = c0o1; + + m210 = ( mxxyMyzz + mxxyPyzz) * c1o2; + m012 = (-mxxyMyzz + mxxyPyzz) * c1o2; + m201 = ( mxxzMyyz + mxxzPyyz) * c1o2; + m021 = (-mxxzMyyz + mxxzPyyz) * c1o2; + m120 = ( mxyyMxzz + mxyyPxzz) * c1o2; + m102 = (-mxyyMxzz + mxyyPxzz) * c1o2; + + // fourth order moments + m022 = m000 * c1o9; + m202 = m022; + m220 = m022; + + // fifth order moments + + // sixth order moments + m222 = m000 * c1o27; + + //////////////////////////////////////////////////////////////////////////////////// + //! - Chimera transform from central moments to well conditioned distributions as defined in Appendix J in + //! <a href="https://doi.org/10.1016/j.camwa.2015.05.001"><b>[ M. Geier et al. (2015), + //! DOI:10.1016/j.camwa.2015.05.001 ]</b></a> see also Eq. (88)-(96) in <a + //! href="https://doi.org/10.1016/j.jcp.2017.05.040"><b>[ M. Geier et al. (2017), DOI:10.1016/j.jcp.2017.05.040 + //! ]</b></a> + //! + //////////////////////////////////////////////////////////////////////////////////// + // X - Dir + backwardInverseChimeraWithK(m000, m100, m200, vvx, vxsq, c1o1, c1o1); + backwardChimera( m010, m110, m210, vvx, vxsq); + backwardInverseChimeraWithK(m020, m120, m220, vvx, vxsq, c3o1, c1o3); + backwardChimera( m001, m101, m201, vvx, vxsq); + backwardChimera( m011, m111, m211, vvx, vxsq); + backwardChimera( m021, m121, m221, vvx, vxsq); + backwardInverseChimeraWithK(m002, m102, m202, vvx, vxsq, c3o1, c1o3); + backwardChimera( m012, m112, m212, vvx, vxsq); + backwardInverseChimeraWithK(m022, m122, m222, vvx, vxsq, c9o1, c1o9); + + //////////////////////////////////////////////////////////////////////////////////// + // Y - Dir + backwardInverseChimeraWithK(m000, m010, m020, vvy, vysq, c6o1, c1o6); + backwardChimera( m001, m011, m021, vvy, vysq); + backwardInverseChimeraWithK(m002, m012, m022, vvy, vysq, c18o1, c1o18); + backwardInverseChimeraWithK(m100, m110, m120, vvy, vysq, c3o2, c2o3); + backwardChimera( m101, m111, m121, vvy, vysq); + backwardInverseChimeraWithK(m102, m112, m122, vvy, vysq, c9o2, c2o9); + backwardInverseChimeraWithK(m200, m210, m220, vvy, vysq, c6o1, c1o6); + backwardChimera( m201, m211, m221, vvy, vysq); + backwardInverseChimeraWithK(m202, m212, m222, vvy, vysq, c18o1, c1o18); + + //////////////////////////////////////////////////////////////////////////////////// + // Z - Dir + backwardInverseChimeraWithK(m000, m001, m002, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m010, m011, m012, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m020, m021, m022, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m100, m101, m102, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m110, m111, m112, vvz, vzsq, c9o4, c4o9); + backwardInverseChimeraWithK(m120, m121, m122, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m200, m201, m202, vvz, vzsq, c36o1, c1o36); + backwardInverseChimeraWithK(m210, m211, m212, vvz, vzsq, c9o1, c1o9); + backwardInverseChimeraWithK(m220, m221, m222, vvz, vzsq, c36o1, c1o36); + + f[DIR_000] = f000; + f[DIR_P00] = fP00; + f[DIR_M00] = fM00; + f[DIR_0P0] = f0P0; + f[DIR_0M0] = f0M0; + f[DIR_00P] = f00P; + f[DIR_00M] = f00M; + f[DIR_PP0] = fPP0; + f[DIR_MM0] = fMM0; + f[DIR_PM0] = fPM0; + f[DIR_MP0] = fMP0; + f[DIR_P0P] = fP0P; + f[DIR_M0M] = fM0M; + f[DIR_P0M] = fP0M; + f[DIR_M0P] = fM0P; + f[DIR_0PP] = f0PP; + f[DIR_0MM] = f0MM; + f[DIR_0PM] = f0PM; + f[DIR_0MP] = f0MP; + f[DIR_PPP] = fPPP; + f[DIR_MPP] = fMPP; + f[DIR_PMP] = fPMP; + f[DIR_MMP] = fMMP; + f[DIR_PPM] = fPPM; + f[DIR_MPM] = fMPM; + f[DIR_PMM] = fPMM; + f[DIR_MMM] = fMMM; +} + +} + +#endif diff --git a/src/logger/Logger.h b/src/logger/Logger.h index 3a25fea02eb7d5ea1ab9bffebea08bfc9f512b04..f3c41c0e3bfb8aa12c94677040273fdaaaff64a3 100644 --- a/src/logger/Logger.h +++ b/src/logger/Logger.h @@ -39,10 +39,10 @@ // The default log level is set to trace. Supported levels: trace < debug < info < warning < critical // // The logging is realized in 3 different log sinks: -// 1. colorded console output +// 1. colored console output // 2. a daily log file // 3. a log file from the last run of VirtualFluids -// The default file path is relativ to executed command logs/ +// The default file path is relative to executed command logs/ // File path can be changed via changeLogPath() #define VF_LOG_TRACE(...) spdlog::trace(__VA_ARGS__) @@ -57,7 +57,7 @@ namespace vf::logging class Logger { public: - // initalizing the above named logger + // initializing the above named logger static void initializeLogger(); // changing the path of the log files diff --git a/src/mpi/CMakeLists.txt b/src/mpi/CMakeLists.txt deleted file mode 100644 index de1d58f5bd39e14742180b9cc6a77fb640d117f6..0000000000000000000000000000000000000000 --- a/src/mpi/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -vf_add_library(NAME mpi PUBLIC_LINK logger PRIVATE_LINK MPI::MPI_CXX basics) diff --git a/src/mpi/NullCommunicator.cpp b/src/mpi/NullCommunicator.cpp deleted file mode 100644 index 267942895df0afbfae7e2d528feb67ff7a2c6519..0000000000000000000000000000000000000000 --- a/src/mpi/NullCommunicator.cpp +++ /dev/null @@ -1,97 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file NullCommunicator.cpp -//! \ingroup Parallel -//! \author Konstantin Kutscher -//======================================================================================= - -#include "NullCommunicator.h" - -namespace vf::mpi -{ - - std::shared_ptr<Communicator> NullCommunicator::getInstance() - { - std::lock_guard<std::mutex> myLock(instantiation_mutex); - if (!instance){ - instance = std::shared_ptr<NullCommunicator>(new NullCommunicator); - } - return instance; - } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getBundleID() { return 0; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getNumberOfBundles() { return 0; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getProcessID() { return 0; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getNumberOfProcesses() { return 0; } - ////////////////////////////////////////////////////////////////////////// - void *NullCommunicator::getNativeCommunicator() { return NULL; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getRoot() { return 0; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getBundleRoot() { return 0; } - ////////////////////////////////////////////////////////////////////////// - int NullCommunicator::getProcessRoot() { return 0; } - ////////////////////////////////////////////////////////////////////////// - std::vector<std::string> NullCommunicator::gather(const std::string & /*str*/) { return std::vector<std::string>(); } - ////////////////////////////////////////////////////////////////////////// - - void NullCommunicator::sendSerializedObject(std::stringstream &ss, int target) {} - ////////////////////////////////////////////////////////////////////////// - void NullCommunicator::receiveSerializedObject(std::stringstream &ss, int source) {} - - int NullCommunicator::getProcessID(int bundle, int rank) { return 0; } - bool NullCommunicator::isRoot() {return true; } - - int NullCommunicator::getNumberOfProcessesInBundle(int bundle) {return 0;} - void NullCommunicator::barrier() {} - void NullCommunicator::abort(int errorcode) {} - - - std::vector<int> NullCommunicator::gather(std::vector<int> &values){ return std::vector<int>(); } - std::vector<float> NullCommunicator::gather(std::vector<float> &values){ return std::vector<float>(); } - std::vector<double> NullCommunicator::gather(std::vector<double> &values){ return std::vector<double>(); } - std::vector<unsigned long long> NullCommunicator::gather(std::vector<unsigned long long> &values){ return std::vector<unsigned long long>(); } - - void NullCommunicator::allGather(std::vector<int> &svalues, std::vector<int> &rvalues){ } - void NullCommunicator::allGather(std::vector<float> &svalues, std::vector<float> &rvalues){ } - void NullCommunicator::allGather(std::vector<double> &svalues, std::vector<double> &rvalues){ } - void NullCommunicator::allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues){ } - - void NullCommunicator::broadcast(int &value){ } - void NullCommunicator::broadcast(float &value){ } - void NullCommunicator::broadcast(double &value){ } - void NullCommunicator::broadcast(long int &value){ } - void NullCommunicator::broadcast(std::vector<int> &values){ } - void NullCommunicator::broadcast(std::vector<float> &values){ } - void NullCommunicator::broadcast(std::vector<double> &values){ } - void NullCommunicator::broadcast(std::vector<long int> &values){ } -} diff --git a/src/parallel/CMakeLists.txt b/src/parallel/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..742ebc3631ed3419bae3ebf1a67b40baf6a5be28 --- /dev/null +++ b/src/parallel/CMakeLists.txt @@ -0,0 +1,6 @@ + +vf_add_library(PUBLIC_LINK logger MPI::MPI_CXX basics) + +if(MSVC) + target_link_libraries(parallel PRIVATE ws2_32) +endif() diff --git a/src/mpi/Communicator.cpp b/src/parallel/Communicator.cpp similarity index 99% rename from src/mpi/Communicator.cpp rename to src/parallel/Communicator.cpp index 937f4d819f67804380d807bfe5ef6048ff507058..b7708cb5ab79ce4acee9c76b6ba26e001b655c17 100644 --- a/src/mpi/Communicator.cpp +++ b/src/parallel/Communicator.cpp @@ -34,7 +34,7 @@ #include "Communicator.h" #include <basics/utilities/UbException.h> -namespace vf::mpi +namespace vf::parallel { std::mutex Communicator::instantiation_mutex = std::mutex(); std::shared_ptr<Communicator> Communicator::instance = std::shared_ptr<Communicator>(); diff --git a/src/mpi/Communicator.h b/src/parallel/Communicator.h similarity index 68% rename from src/mpi/Communicator.h rename to src/parallel/Communicator.h index bcec064a23801c7b597d91deb601b44a1d9c7a71..23a760981944cfa143d7521275255f39a92bb7fe 100644 --- a/src/mpi/Communicator.h +++ b/src/parallel/Communicator.h @@ -34,43 +34,43 @@ #ifndef MPI_COMMUNICATOR_H #define MPI_COMMUNICATOR_H -#include <string> -#include <vector> #include <memory> -#include <sstream> #include <mutex> +#include <sstream> +#include <string> +#include <vector> +#include <basics/DataTypes.h> -namespace vf::mpi +namespace vf::parallel { //! \brief An abstract class for communication between processes in parallel computation class Communicator { public: - Communicator(const Communicator&) = delete; - Communicator & operator=(const Communicator& rhs) = delete; + Communicator(const Communicator &) = delete; + Communicator &operator=(const Communicator &rhs) = delete; static std::shared_ptr<Communicator> getInstance(); virtual ~Communicator() = default; - virtual int getBundleID() = 0; - virtual int getNumberOfBundles() = 0; - virtual int getProcessID() = 0; - virtual int getProcessID(int bundle, int rank) = 0; - virtual int getNumberOfProcesses() = 0; - virtual bool isRoot() = 0; - virtual void *getNativeCommunicator() = 0; + virtual int getBundleID() const = 0; + virtual int getNumberOfBundles() const = 0; + virtual int getProcessID() const = 0; + virtual int getProcessID(int bundle, int rank) const = 0; + virtual bool isRoot() const = 0; + virtual void *getNativeCommunicator() = 0; virtual void sendSerializedObject(std::stringstream &ss, int target) = 0; virtual void receiveSerializedObject(std::stringstream &ss, int source) = 0; - virtual int getRoot() = 0; - virtual int getBundleRoot() = 0; - virtual int getProcessRoot() = 0; - virtual int getNumberOfProcessesInBundle(int bundle) = 0; - virtual void barrier() = 0; - virtual void abort(int errorcode) = 0; + virtual int getRoot() const = 0; + virtual int getBundleRoot() const = 0; + virtual int getProcessRoot() const = 0; + virtual int getNumberOfProcessesInBundle(int bundle) const = 0; + virtual void barrier() = 0; + virtual void abort(int errorcode) = 0; virtual std::vector<std::string> gather(const std::string &str) = 0; virtual std::vector<int> gather(std::vector<int> &values) = 0; @@ -92,6 +92,20 @@ public: virtual void broadcast(std::vector<double> &values) = 0; virtual void broadcast(std::vector<long int> &values) = 0; + virtual void receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const = 0; + virtual int getNumberOfProcesses() const = 0; + virtual void send(real *sbuf, int count_s, int nb_rank) const = 0; + virtual double reduceSum(double quantityPerProcess) const = 0; + virtual int mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const = 0; + virtual void receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const = 0; + virtual void receiveNonBlocking(real *rbuf, int count_r, int sourceRank) = 0; + virtual void sendNonBlocking(real *sbuf, int count_s, int destinationRank) = 0; + virtual void send(real *sbuf, int count_s, int destinationRank) = 0; + virtual void waitAll() = 0; + virtual void resetRequests() = 0; + protected: Communicator() = default; diff --git a/src/mpi/MPICommunicator.cpp b/src/parallel/MPICommunicator.cpp similarity index 58% rename from src/mpi/MPICommunicator.cpp rename to src/parallel/MPICommunicator.cpp index 4e7a155ef3b78f7daa0a582f84f2ef8af83886c8..8ae7ea66387f5e02b2e90dcacefbc324e81ca564 100644 --- a/src/mpi/MPICommunicator.cpp +++ b/src/parallel/MPICommunicator.cpp @@ -1,17 +1,26 @@ #if defined VF_MPI +#if defined (_WIN32) || defined (_WIN64) + #include <Winsock2.h> +#elif defined (__unix__) + #include <unistd.h> +#endif #include "MPICommunicator.h" + #include <mpi.h> #include <sstream> + +#include <logger/Logger.h> + using namespace std; -namespace vf::mpi +namespace vf::parallel { std::shared_ptr<Communicator> MPICommunicator::getInstance() { std::lock_guard<std::mutex> myLock(instantiation_mutex); - if (!instance){ + if (!instance) { instance = std::shared_ptr<MPICommunicator>(new MPICommunicator); } return instance; @@ -22,13 +31,11 @@ MPICommunicator::MPICommunicator() // proof if MPI is initialized int mpiInitialized = 0; // false MPI_Initialized(&mpiInitialized); - if (!mpiInitialized) { + if (mpiInitialized == 0) { MPI_Init(NULL, NULL); - // MPI_Init_thread(NULL, NULL, MPI_THREAD_FUNNELED, NULL); } MPI_Comm_rank(MPI_COMM_WORLD, &PID); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); - // numprocs = 1000; comm = MPI_COMM_WORLD; root = 0; } @@ -38,9 +45,8 @@ MPICommunicator::~MPICommunicator() // proof if MPI is finalized int _mpiFinalized = 0; // false MPI_Finalized(&_mpiFinalized); - if (!_mpiFinalized) { + if (_mpiFinalized == 0) { MPI_Finalize(); - // UBLOG(logINFO, "MPI_Finalize()"); } } ////////////////////////////////////////////////////////////////////////// @@ -88,27 +94,27 @@ std::vector<unsigned long long> MPICommunicator::gather(std::vector<unsigned lon return gather<unsigned long long>(values); } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessID() { return PID; } +int MPICommunicator::getProcessID() const { return PID; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessID(int /*bundle*/, int /*rank*/) { return PID; } +int MPICommunicator::getProcessID(int /*bundle*/, int /*rank*/) const { return PID; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfProcesses() { return numprocs; } +int MPICommunicator::getNumberOfProcesses() const { return numprocs; } ////////////////////////////////////////////////////////////////////////// void *MPICommunicator::getNativeCommunicator() { return &comm; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getBundleID() { return 0; } +int MPICommunicator::getBundleID() const { return 0; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfBundles() { return 1; } +int MPICommunicator::getNumberOfBundles() const { return 1; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getRoot() { return root; } +int MPICommunicator::getRoot() const { return root; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getBundleRoot() { return 0; } +int MPICommunicator::getBundleRoot() const { return 0; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getProcessRoot() { return 0; } +int MPICommunicator::getProcessRoot() const { return 0; } ////////////////////////////////////////////////////////////////////////// -int MPICommunicator::getNumberOfProcessesInBundle(int /*bundle*/) { return numprocs; } +int MPICommunicator::getNumberOfProcessesInBundle(int /*bundle*/) const { return numprocs; } ////////////////////////////////////////////////////////////////////////// -bool MPICommunicator::isRoot() { return PID == root; } +bool MPICommunicator::isRoot() const { return PID == root; } ////////////////////////////////////////////////////////////////////////// void MPICommunicator::sendSerializedObject(std::stringstream &ss, int target) { @@ -169,6 +175,120 @@ void MPICommunicator::broadcast(double &value) { broadcast<double>(value); } ////////////////////////////////////////////////////////////////////////// void MPICommunicator::broadcast(long int &value) { broadcast<long int>(value); } +void MPICommunicator::receiveSend(uint *buffer_receive, int size_buffer_recv, + int neighbor_rank_recv, uint *buffer_send, int size_buffer_send, + int neighbor_rank_send) const +{ + MPI_Request recv_request; + MPI_Irecv(buffer_receive, size_buffer_recv, MPI_UNSIGNED, neighbor_rank_recv, 0, comm, + &recv_request); + // printf("receive_send PID: %i, nbRev: nb_rank_recv: %i", this->getPID(), nb_rank_r); + // fflush(stdout); + MPI_Send(buffer_send, size_buffer_send, MPI_UNSIGNED, neighbor_rank_send, 0, comm); + // printf("receive_send PID: %i, sendUintGPU: nb_rank_send: %i", this->getPID(), nb_rank_s); + // fflush(stdout); + MPI_Wait(&recv_request, MPI_STATUSES_IGNORE); // TODO: Do we have a benefit here or could we simply do a blocking receiv. +} + +void MPICommunicator::receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const +{ + MPI_Send(buffer_send, size_buffer_send, VF_MPI_REAL, neighbor_rank, 0, comm); + MPI_Recv(buffer_receive, size_buffer_recv, VF_MPI_REAL, neighbor_rank, 0, comm, MPI_STATUS_IGNORE); +} + +void MPICommunicator::send(real *sbuf, int count_s, int nb_rank) const +{ + MPI_Send(sbuf, count_s, VF_MPI_REAL, nb_rank, 0, comm); +} + +double MPICommunicator::reduceSum(double quantityPerProcess) const +{ + double *buffer_send = &quantityPerProcess; + double *buffer_recv = (double *)malloc(sizeof(double)); + + MPI_Reduce(buffer_send, buffer_recv, 1, MPI_DOUBLE, MPI_SUM, 0, comm); + + return *buffer_recv; +} + +int MPICommunicator::mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const +{ + int device = -1; + char *host = (char *)malloc(sizeof(char) * getNumberOfProcesses() * 255); + unsigned int *map = (unsigned int *)malloc(sizeof(unsigned int) * getNumberOfProcesses()); + + char hostname[255]; + gethostname(hostname, 254); + hostname[254] = 0; + + MPI_Gather(hostname, 255, MPI_BYTE, host, 255, MPI_BYTE, 0, MPI_COMM_WORLD); + + int i, j; + if (isRoot()) { + for (i = 0; i < getNumberOfProcesses(); i++) { + int counter = 0; + for (j = 0; j < i; j++) { + if (strcmp(&host[i * 255], &host[j * 255]) == 0) + counter++; + } + if (counter >= numberOfDevices) { + VF_LOG_CRITICAL("More processes than GPUs!"); + exit(1); + } + map[i] = devices[counter]; + } + } + + MPI_Scatter(map, 1, MPI_UNSIGNED, &device, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD); + + VF_LOG_INFO("Rank: {} runs on host: {} with GPU: {}", getProcessID(), hostname, device); + + free(map); + free(host); + return device; +} + +void MPICommunicator::receiveNonBlocking(real *rbuf, int count_r, int sourceRank) +{ + // printf("\n Start Recv Rank: %d, neighbor Rank: %d, request = %d \n", PID, nb_rank, (int)requestGPU.size()); + // fflush(stdout); + + MPI_Request request; + MPI_Irecv(rbuf, count_r, VF_MPI_REAL, sourceRank, 0, comm, &request); + requests.push_back(request); + + // printf("\n End Recv - Rank: %d , neighbor Rank: %d \n", PID, nb_rank); + // fflush(stdout); +} + +void MPICommunicator::sendNonBlocking(real *sbuf, int count_s, int destinationRank) +{ + // printf("\n Start Send Rank: %d, neighbor Rank: %d, request = %d \n", PID, nb_rank, (int)requestGPU.size()); + // fflush(stdout); + + MPI_Request request; + MPI_Isend(sbuf, count_s, VF_MPI_REAL, destinationRank, 0, comm, &request); + requests.push_back(request); + // printf("\n End Send - Rank: %d , neighbor Rank: %d \n", PID, nb_rank); + // fflush(stdout); +} + +void MPICommunicator::send(real *sbuf, int count_s, int destinationRank) +{ + MPI_Send(sbuf, count_s, VF_MPI_REAL, destinationRank, 0, comm); +} + +void MPICommunicator::waitAll() +{ + MPI_Waitall((int)requests.size(), requests.data(), MPI_STATUSES_IGNORE); +} + +void MPICommunicator::resetRequests() +{ + requests.clear(); +} + } -#endif \ No newline at end of file +#endif diff --git a/src/mpi/MPICommunicator.h b/src/parallel/MPICommunicator.h similarity index 80% rename from src/mpi/MPICommunicator.h rename to src/parallel/MPICommunicator.h index 941bdac8f03d64184c17966ada27111193bbfa2d..466a3c3f8d311c743b546116a0a4ca9a23735488 100644 --- a/src/mpi/MPICommunicator.h +++ b/src/parallel/MPICommunicator.h @@ -4,14 +4,22 @@ #define MPI_MPICOMMUNICATOR_H #include "Communicator.h" -#include <PointerDefinitions.h> +#include <basics/PointerDefinitions.h> #include <basics/utilities/UbException.h> #include <basics/utilities/UbLogger.h> #include <mpi.h> #include <string> #include <vector> -namespace vf::mpi +////////////////////////////////// +#ifdef VF_DOUBLE_ACCURACY +#define VF_MPI_REAL MPI_DOUBLE +#else +#define VF_MPI_REAL MPI_FLOAT +#endif +////////////////////////////////// + +namespace vf::parallel { //! \brief A class uses MPI library to communication. @@ -25,17 +33,17 @@ public: ~MPICommunicator() override; static std::shared_ptr<Communicator> getInstance(); - int getBundleID() override; - int getNumberOfBundles() override; - int getProcessID() override; - int getProcessID(int bundle, int rank) override; - int getNumberOfProcesses() override; + int getBundleID() const override; + int getNumberOfBundles() const override; + int getProcessID() const override; + int getProcessID(int bundle, int rank) const override; + int getNumberOfProcesses() const override; void *getNativeCommunicator() override; - int getRoot() override; - int getBundleRoot() override; - int getProcessRoot() override; - int getNumberOfProcessesInBundle(int bundle) override; - bool isRoot() override; + int getRoot() const override; + int getBundleRoot() const override; + int getProcessRoot() const override; + int getNumberOfProcessesInBundle(int bundle) const override; + bool isRoot() const override; void abort(int errorcode) override; void sendSerializedObject(std::stringstream &ss, int target) override; @@ -75,12 +83,30 @@ public: template <class T> void broadcast(T &value); + void receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const override; + + void send(real *sbuf, int count_s, int nb_rank) const override; + double reduceSum(double quantityPerProcess) const override; + + int mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const override; + void receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const override; + + void receiveNonBlocking(real *rbuf, int count_r, int sourceRank) override; + void sendNonBlocking(real *sbuf, int count_s, int destinationRank) override; + void send(real *sbuf, int count_s, int destinationRank) override; + void waitAll() override; + void resetRequests() override; + private: MPICommunicator(); int numprocs, PID; MPI_Comm comm; int root; + + std::vector<MPI_Request> requests; }; ////////////////////////////////////////////////////////////////////////// @@ -96,6 +122,8 @@ std::vector<T> MPICommunicator::gather(std::vector<T> &values) mpiDataType = MPI_INT; else if ((std::string) typeid(T).name() == (std::string) typeid(unsigned long long).name()) mpiDataType = MPI_UNSIGNED_LONG_LONG; + else if ((std::string) typeid(T).name() == (std::string) typeid(char).name()) + mpiDataType = MPI_CHAR; else throw UbException(UB_EXARGS, "no MpiDataType for T" + (std::string) typeid(T).name()); @@ -209,6 +237,7 @@ void MPICommunicator::broadcast(T &value) } ////////////////////////////////////////////////////////////////////////// + #endif } diff --git a/src/parallel/NullCommunicator.cpp b/src/parallel/NullCommunicator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..56c17a8c3c466dae3299d0b32f9e918c68cc1610 --- /dev/null +++ b/src/parallel/NullCommunicator.cpp @@ -0,0 +1,217 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file NullCommunicator.cpp +//! \ingroup Parallel +//! \author Konstantin Kutscher +//======================================================================================= + +#include "NullCommunicator.h" + +#include <memory> + +namespace vf::parallel +{ + +std::shared_ptr<Communicator> NullCommunicator::getInstance() +{ + std::lock_guard<std::mutex> myLock(instantiation_mutex); + if (!instance) { + instance = std::make_shared<NullCommunicator>(); + } + return instance; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getBundleID() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getNumberOfBundles() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getProcessID() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getNumberOfProcesses() const +{ + return 1; +} +////////////////////////////////////////////////////////////////////////// +void *NullCommunicator::getNativeCommunicator() +{ + return NULL; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getRoot() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getBundleRoot() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +int NullCommunicator::getProcessRoot() const +{ + return 0; +} +////////////////////////////////////////////////////////////////////////// +std::vector<std::string> NullCommunicator::gather(const std::string & /*str*/) +{ + return {}; +} +////////////////////////////////////////////////////////////////////////// + +void NullCommunicator::sendSerializedObject(std::stringstream &stream, int target) +{ +} +////////////////////////////////////////////////////////////////////////// +void NullCommunicator::receiveSerializedObject(std::stringstream &stream, int source) +{ +} + +int NullCommunicator::getProcessID(int bundle, int rank) const +{ + return 0; +} +bool NullCommunicator::isRoot() const +{ + return true; +} + +int NullCommunicator::getNumberOfProcessesInBundle(int bundle) const +{ + return 0; +} +void NullCommunicator::barrier() +{ +} +void NullCommunicator::abort(int errorcode) +{ +} + +std::vector<int> NullCommunicator::gather(std::vector<int> &values) +{ + return {}; +} +std::vector<float> NullCommunicator::gather(std::vector<float> &values) +{ + return {}; +} +std::vector<double> NullCommunicator::gather(std::vector<double> &values) +{ + return {}; +} +std::vector<unsigned long long> NullCommunicator::gather(std::vector<unsigned long long> &values) +{ + return {}; +} + +void NullCommunicator::allGather(std::vector<int> &svalues, std::vector<int> &rvalues) +{ +} +void NullCommunicator::allGather(std::vector<float> &svalues, std::vector<float> &rvalues) +{ +} +void NullCommunicator::allGather(std::vector<double> &svalues, std::vector<double> &rvalues) +{ +} +void NullCommunicator::allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues) +{ +} + +void NullCommunicator::broadcast(int &value) +{ +} +void NullCommunicator::broadcast(float &value) +{ +} +void NullCommunicator::broadcast(double &value) +{ +} +void NullCommunicator::broadcast(long int &value) +{ +} +void NullCommunicator::broadcast(std::vector<int> &values) +{ +} +void NullCommunicator::broadcast(std::vector<float> &values) +{ +} +void NullCommunicator::broadcast(std::vector<double> &values) +{ +} +void NullCommunicator::broadcast(std::vector<long int> &values) +{ +} + +void NullCommunicator::receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const +{ +} + +void NullCommunicator::send(real *sbuf, int count_s, int nb_rank) const {}; +double NullCommunicator::reduceSum(double /*quantityPerProcess*/) const +{ + return 0.0; +}; +int NullCommunicator::mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const +{ + return 0; +} + +void NullCommunicator::receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const +{ +} + +void NullCommunicator::receiveNonBlocking(real *rbuf, int count_r, int sourceRank) +{ +} +void NullCommunicator::sendNonBlocking(real *sbuf, int count_s, int destinationRank) +{ +} + +void NullCommunicator::send(real *sbuf, int count_s, int destinationRank) +{ +} + +void NullCommunicator::waitAll() +{ +} + +void NullCommunicator::resetRequests() +{ +} +} // namespace vf::parallel diff --git a/src/mpi/NullCommunicator.h b/src/parallel/NullCommunicator.h similarity index 53% rename from src/mpi/NullCommunicator.h rename to src/parallel/NullCommunicator.h index 836f801ab6d15e377da8a34dfed8016b05f86e3a..295f946dbe8dd05c89ec57b733aa84867b5bea70 100644 --- a/src/mpi/NullCommunicator.h +++ b/src/parallel/NullCommunicator.h @@ -36,7 +36,7 @@ #include "Communicator.h" -namespace vf::mpi +namespace vf::parallel { //! \brief A class implements Communicator for shared memory. @@ -46,45 +46,62 @@ class NullCommunicator : public Communicator public: static std::shared_ptr<Communicator> getInstance(); - int getBundleID(); - int getNumberOfBundles(); - int getProcessID(); - int getProcessID(int bundle, int rank); - int getNumberOfProcesses(); - bool isRoot(); - void *getNativeCommunicator(); - - void sendSerializedObject(std::stringstream &ss, int target); - void receiveSerializedObject(std::stringstream &ss, int source); - - int getRoot(); - int getBundleRoot(); - int getProcessRoot(); - int getNumberOfProcessesInBundle(int bundle); - void barrier(); - void abort(int errorcode); - - std::vector<std::string> gather(const std::string &str); - std::vector<int> gather(std::vector<int> &values); - std::vector<float> gather(std::vector<float> &values); - std::vector<double> gather(std::vector<double> &values); - std::vector<unsigned long long> gather(std::vector<unsigned long long> &values); - - void allGather(std::vector<int> &svalues, std::vector<int> &rvalues); - void allGather(std::vector<float> &svalues, std::vector<float> &rvalues); - void allGather(std::vector<double> &svalues, std::vector<double> &rvalues); - void allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues); - - void broadcast(int &value); - void broadcast(float &value); - void broadcast(double &value); - void broadcast(long int &value); - void broadcast(std::vector<int> &values); - void broadcast(std::vector<float> &values); - void broadcast(std::vector<double> &values); - void broadcast(std::vector<long int> &values); + int getBundleID() const override; + int getNumberOfBundles() const override; + int getProcessID() const override; + int getProcessID(int bundle, int rank) const override; + int getNumberOfProcesses() const override; + bool isRoot() const override; + void *getNativeCommunicator() override; + + void sendSerializedObject(std::stringstream &stream, int target) override; + void receiveSerializedObject(std::stringstream &stream, int source) override; + + int getRoot() const override; + int getBundleRoot() const override; + int getProcessRoot() const override; + int getNumberOfProcessesInBundle(int bundle) const override; + void barrier() override; + void abort(int errorcode) override; + + std::vector<std::string> gather(const std::string &str) override; + std::vector<int> gather(std::vector<int> &values) override; + std::vector<float> gather(std::vector<float> &values) override; + std::vector<double> gather(std::vector<double> &values) override; + std::vector<unsigned long long> gather(std::vector<unsigned long long> &values) override; + + void allGather(std::vector<int> &svalues, std::vector<int> &rvalues) override; + void allGather(std::vector<float> &svalues, std::vector<float> &rvalues) override; + void allGather(std::vector<double> &svalues, std::vector<double> &rvalues) override; + void allGather(std::vector<unsigned long long> &svalues, std::vector<unsigned long long> &rvalues) override; + + void broadcast(int &value) override; + void broadcast(float &value) override; + void broadcast(double &value) override; + void broadcast(long int &value) override; + void broadcast(std::vector<int> &values) override; + void broadcast(std::vector<float> &values) override; + void broadcast(std::vector<double> &values) override; + void broadcast(std::vector<long int> &values) override; + + void receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, uint *buffer_send, + int size_buffer_send, int neighbor_rank_send) const override; + + void send(real *sbuf, int count_s, int nb_rank) const override; + + double reduceSum(double quantityPerProcess) const override; + int mapCudaDevicesOnHosts(const std::vector<unsigned int> &devices, int numberOfDevices) const override; + + void receiveSend(real *buffer_send, int size_buffer_send, real *buffer_receive, int size_buffer_recv, + int neighbor_rank) const override; + + void receiveNonBlocking(real *rbuf, int count_r, int sourceRank) override; + void sendNonBlocking(real *sbuf, int count_s, int destinationRank) override; + void send(real *sbuf, int count_s, int destinationRank) override; + void waitAll() override; + void resetRequests() override; }; -} +} // namespace vf::parallel #endif diff --git a/utilities/ci-regression-tests/regression-tests-ci.yml.j2 b/utilities/ci-regression-tests/regression-tests-ci.yml.j2 index 4367ad6c7d5f820ef8975c37dbf843e5342e4dbd..f162ff0c855130ffb8f2cc1c391a62360577b82a 100644 --- a/utilities/ci-regression-tests/regression-tests-ci.yml.j2 +++ b/utilities/ci-regression-tests/regression-tests-ci.yml.j2 @@ -1,4 +1,4 @@ -image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu20_04:1.5 +image: git.rz.tu-bs.de:4567/irmb/virtualfluids/ubuntu22_04:1.0 stages: - test diff --git a/utilities/install-cppcheck.sh b/utilities/install-cppcheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..e0a89854917b7378ac85fed0e3cc43dc624db598 --- /dev/null +++ b/utilities/install-cppcheck.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e + +cd /tmp +git clone https://github.com/danmar/cppcheck.git +cd cppcheck +git checkout 2.10.3 +make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" install +cd /tmp +rm -rf /tmp/cppcheck +ldconfig +cppcheck --version \ No newline at end of file