diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bab3d93620..85eb5f9e5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,12 @@ name: CI -# Controls when the action will run. +# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,7 +16,6 @@ env: # A workflow is made up of one or more jobs that can run sequentially or in parallel jobs: - ############################################################################### Linux-float: runs-on: ubuntu-22.04 @@ -47,7 +46,7 @@ jobs: key: ${{ github.job }} - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} - with: + with: committish: ${{ env.VCPKG_VERSION }} cache: false @@ -78,11 +77,11 @@ jobs: -D SPHINXSYS_CI=ON \ -S ${{github.workspace}} \ -B ${{github.workspace}}/build - + - name: Build using float run: cmake --build build --config Release --verbose - ############################################################################### + ############################################################################### Linux-build: runs-on: ubuntu-22.04 env: @@ -112,7 +111,7 @@ jobs: key: ${{ github.job }} - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} - with: + with: committish: ${{ env.VCPKG_VERSION }} cache-version: ${{env.VCPKG_VERSION}} @@ -144,7 +143,7 @@ jobs: -D SPHINXSYS_MODULE_OPENCASCADE=ON \ -S ${{github.workspace}} \ -B ${{github.workspace}}/build - + - name: Build using double run: cmake --build build --config Release --verbose @@ -183,7 +182,7 @@ jobs: libgl-dev - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} - with: + with: committish: ${{ env.VCPKG_VERSION }} cache-version: ${{env.VCPKG_VERSION}} @@ -219,7 +218,7 @@ jobs: - name: Test with the second try for failed cases id: second-try - if: ${{ steps.first-try.outcome == 'failure' }} + if: ${{ steps.first-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure @@ -227,7 +226,7 @@ jobs: - name: Test with the third try for failed cases id: third-try - if: ${{ steps.second-try.outcome == 'failure' }} + if: ${{ steps.second-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure @@ -235,40 +234,41 @@ jobs: - name: Test with the fourth try for failed cases id: fourth-try - if: ${{ steps.third-try.outcome == 'failure' }} + if: ${{ steps.third-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure continue-on-error: true - name: Test with the last try for failed cases - if: ${{ steps.fourth-try.outcome == 'failure' }} + if: ${{ steps.fourth-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure ############################################################################### - Windows: + Windows-build: runs-on: windows-latest env: VCPKG_DEFAULT_TRIPLET: x64-windows steps: - uses: actions/checkout@v3 # Checks-out the repository under ${{github.workspace}} - + - name: Update ccache and ninja # For correct caching with ccache on Windows shell: bash run: | choco install ccache choco install ninja - + choco install 7zip + - uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.job }} - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} - with: + with: committish: ${{ env.VCPKG_VERSION }} cache-version: ${{env.VCPKG_VERSION}} @@ -282,7 +282,7 @@ jobs: simbody ` gtest ` xsimd ` - pybind11 + pybind11 - uses: ilammy/msvc-dev-cmd@v1 @@ -296,10 +296,64 @@ jobs: -D TEST_STATE_RECORDING=OFF ` -S ${{github.workspace}} ` -B C:\build - + - name: Build run: cmake.exe --build C:\build --config Release --verbose + - name: Zip build folder + run: 7z.exe a C:\build.7z "C:\build" + + - uses: actions/upload-artifact@v3 + with: + name: Windows-build + path: C:\build.7z + if-no-files-found: error + retention-days: 1 + + Windows-test: + needs: Windows-build + runs-on: windows-latest + env: + VCPKG_DEFAULT_TRIPLET: x64-windows + + steps: + - uses: actions/checkout@v3 # Checks-out the repository under ${{github.workspace}} + + - name: Update ccache and ninja # For correct caching with ccache on Windows + shell: bash + run: | + choco install ccache + choco install ninja + choco install 7zip + + - uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }} + + - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} + with: + committish: ${{ env.VCPKG_VERSION }} + cache-version: ${{env.VCPKG_VERSION}} + + - name: Install dependencies + run: | + ${{github.workspace}}\vcpkg\vcpkg.exe install --clean-after-build ` + eigen3 ` + tbb ` + boost-program-options ` + boost-geometry ` + simbody ` + gtest ` + xsimd ` + pybind11 + + - uses: actions/download-artifact@v3 + with: + name: Windows-build + + - name: Unzip build folder + run: 7z.exe x build.7z -oC:\ + - name: Test with the first try id: first-try run: | @@ -309,7 +363,7 @@ jobs: - name: Test with the second try for failed cases id: second-try - if: ${{ steps.first-try.outcome == 'failure' }} + if: ${{ steps.first-try.outcome == 'failure' }} run: | cd C:\build ctest.exe --rerun-failed --output-on-failure @@ -317,7 +371,7 @@ jobs: - name: Test with the third try for failed cases id: third-try - if: ${{ steps.second-try.outcome == 'failure' }} + if: ${{ steps.second-try.outcome == 'failure' }} run: | cd C:\build ctest.exe --rerun-failed --output-on-failure @@ -325,21 +379,21 @@ jobs: - name: Test with the fourth try for failed cases id: fourth-try - if: ${{ steps.third-try.outcome == 'failure' }} + if: ${{ steps.third-try.outcome == 'failure' }} run: | cd C:\build ctest.exe --rerun-failed --output-on-failure continue-on-error: true - name: Test with the last try for failed cases - if: ${{ steps.fourth-try.outcome == 'failure' }} + if: ${{ steps.fourth-try.outcome == 'failure' }} run: | cd C:\build ctest.exe --rerun-failed --output-on-failure ############################################################################### - macOS: + macOS-build: runs-on: macos-12 env: VCPKG_DEFAULT_TRIPLET: x64-osx @@ -358,14 +412,16 @@ jobs: pkg-config `# for installing libraries with vcpkg`\ git \ cmake \ - ninja + ninja \ + zip \ + unzip - uses: hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.job }} - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} - with: + with: committish: ${{ env.VCPKG_VERSION }} cache-version: ${{env.VCPKG_VERSION}} @@ -397,6 +453,67 @@ jobs: - name: Build run: cmake --build build --config Release --verbose + - name: Zip build folder + run: zip -r build.zip ./build + + - uses: actions/upload-artifact@v3 + with: + name: macOS-build + path: ${{github.workspace}}/build.zip + if-no-files-found: error + retention-days: 1 + + macOS-test: + needs: macOS-build + runs-on: macos-12 + env: + VCPKG_DEFAULT_TRIPLET: x64-osx + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Install system dependencies + run: | + brew reinstall gfortran # to force having gfortran on PATH because github runners don't have it, just the versioned aliases, i.e. gfortran-11 + # https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md + # https://github.com/actions/runner-images/issues/3371#issuecomment-839882565 + # https://github.com/modflowpy/install-gfortran-action and https://github.com/awvwgk/setup-fortran + brew install \ + pkg-config `# for installing libraries with vcpkg`\ + git \ + cmake \ + ninja + + - uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }} + + - uses: friendlyanon/setup-vcpkg@v1 # Setup vcpkg into ${{github.workspace}} + with: + committish: ${{ env.VCPKG_VERSION }} + cache-version: ${{env.VCPKG_VERSION}} + + - name: Install dependencies + run: | + ${{github.workspace}}/vcpkg/vcpkg install --clean-after-build --allow-unsupported \ + eigen3 \ + tbb \ + boost-program-options \ + boost-geometry \ + gtest \ + simbody \ + xsimd \ + pybind11 \ + opencascade + + - uses: actions/download-artifact@v3 + with: + name: macOS-build + + - name: Unzip build folder + run: unzip build.zip + - name: Test with the first try id: first-try run: | @@ -406,7 +523,7 @@ jobs: - name: Test with the second try for failed cases id: second-try - if: ${{ steps.first-try.outcome == 'failure' }} + if: ${{ steps.first-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure @@ -414,7 +531,7 @@ jobs: - name: Test with the third try for failed cases id: third-try - if: ${{ steps.second-try.outcome == 'failure' }} + if: ${{ steps.second-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure @@ -422,14 +539,14 @@ jobs: - name: Test with the fourth try for failed cases id: fourth-try - if: ${{ steps.third-try.outcome == 'failure' }} + if: ${{ steps.third-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure continue-on-error: true - name: Test with the last try for failed cases - if: ${{ steps.fourth-try.outcome == 'failure' }} + if: ${{ steps.fourth-try.outcome == 'failure' }} run: | cd build ctest --rerun-failed --output-on-failure diff --git a/PythonScriptStore/RegressionTest/regression_test_base_tool.py b/PythonScriptStore/RegressionTest/regression_test_base_tool.py index 022ad83b98..206e175657 100644 --- a/PythonScriptStore/RegressionTest/regression_test_base_tool.py +++ b/PythonScriptStore/RegressionTest/regression_test_base_tool.py @@ -30,7 +30,7 @@ def compile_case(self) -> None: def run_particle_relaxation(self) -> None: print('Start particle relaxation for the simulation...') - command = f".{os.sep}{self.sphinxsys_case_name} --r=true" + command = f".{os.sep}{self.sphinxsys_case_name} --relax=true" os.system(self.enter_sphinxsys_exec_folder) os.system(command) print('Simulating case is finished...') @@ -38,7 +38,7 @@ def run_particle_relaxation(self) -> None: def run_case(self) -> None: print('Start case simulation...') print(self.enter_sphinxsys_exec_folder) - command = f".{os.sep}{self.sphinxsys_case_name} --r=false --rt=true" + command = f".{os.sep}{self.sphinxsys_case_name} --regression=true" os.system(self.enter_sphinxsys_exec_folder) os.system(command) print('Simulating case is finished...') @@ -46,7 +46,7 @@ def run_case(self) -> None: def run_case_with_reload(self) -> None: print('Start case simulation with particle reload...') print(self.enter_sphinxsys_exec_folder) - command = f".{os.sep}{self.sphinxsys_case_name} --r=false --i=true --rt=true" + command = f".{os.sep}{self.sphinxsys_case_name} --reload=true --regression=true" os.system(self.enter_sphinxsys_exec_folder) os.system(command) print('Simulating case is finished...') @@ -96,7 +96,7 @@ def copy_reload(self) -> None: def run_particle_relaxation(self) -> None: print('Start particle relaxation for the simulation...') - command = f".{os.sep}{self.sphinxsys_case_name} --r=true" + command = f".{os.sep}{self.sphinxsys_case_name} --relax=true" os.chdir(self.sphinxsys_exec_path) os.system(command) print('Simulating case is finished...') @@ -104,7 +104,7 @@ def run_particle_relaxation(self) -> None: def run_case(self) -> None: print('Start case simulation...') print(self.enter_sphinxsys_exec_folder) - command = f".{os.sep}{self.sphinxsys_case_name} --r=false --rt=true" + command = f".{os.sep}{self.sphinxsys_case_name} --regression=true" os.chdir(self.sphinxsys_exec_path) os.system(command) print('Simulating case is finished...') @@ -112,7 +112,7 @@ def run_case(self) -> None: def run_case_with_reload(self) -> None: print('Start case simulation with particle reload...') print(self.enter_sphinxsys_exec_folder) - command = f".{os.sep}{self.sphinxsys_case_name} --r=false --i=true --rt=true" + command = f".{os.sep}{self.sphinxsys_case_name} --reload=true --regression=true" os.chdir(self.sphinxsys_exec_path) os.system(command) print('Simulating case is finished...') diff --git a/src/shared/sphinxsys_system/sph_system.cpp b/src/shared/sphinxsys_system/sph_system.cpp index c5f906f5d4..1e6cae51aa 100644 --- a/src/shared/sphinxsys_system/sph_system.cpp +++ b/src/shared/sphinxsys_system/sph_system.cpp @@ -54,9 +54,9 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[]) po::options_description desc("Allowed options"); desc.add_options()("help", "produce help message"); - desc.add_options()("r", po::value(), "Particle relaxation."); - desc.add_options()("i", po::value(), "Particle reload from input file."); - desc.add_options()("rt", po::value(), "Regression test."); + desc.add_options()("relax", po::value(), "Particle relaxation."); + desc.add_options()("reload", po::value(), "Particle reload from input file."); + desc.add_options()("regression", po::value(), "Regression test."); desc.add_options()("state_recording", po::value(), "State recording in output folder."); desc.add_options()("restart_step", po::value(), "Run form a restart file."); @@ -70,11 +70,11 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[]) exit(0); } - if (vm.count("r")) + if (vm.count("relax")) { - run_particle_relaxation_ = vm["r"].as(); + run_particle_relaxation_ = vm["relax"].as(); std::cout << "Particle relaxation was set to " - << vm["r"].as() << ".\n"; + << vm["relax"].as() << ".\n"; } else { @@ -82,11 +82,11 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[]) << run_particle_relaxation_ << ").\n"; } - if (vm.count("i")) + if (vm.count("reload")) { - reload_particles_ = vm["i"].as(); + reload_particles_ = vm["reload"].as(); std::cout << "Particle reload from input file was set to " - << vm["i"].as() << ".\n"; + << vm["reload"].as() << ".\n"; } else { @@ -94,11 +94,11 @@ void SPHSystem::handleCommandlineOptions(int ac, char *av[]) << reload_particles_ << ").\n"; } - if (vm.count("rt")) + if (vm.count("regression")) { - generate_regression_data_ = vm["rt"].as(); + generate_regression_data_ = vm["regression"].as(); std::cout << "Generate regression test data set was set to " - << vm["rt"].as() << ".\n"; + << vm["regression"].as() << ".\n"; } else { diff --git a/tests/2d_examples/test_2d_airfoil/CMakeLists.txt b/tests/2d_examples/test_2d_airfoil/CMakeLists.txt index 99b3a3f7d7..3d90cbeea6 100644 --- a/tests/2d_examples/test_2d_airfoil/CMakeLists.txt +++ b/tests/2d_examples/test_2d_airfoil/CMakeLists.txt @@ -21,6 +21,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY " target_link_libraries(${PROJECT_NAME} sphinxsys_2d) add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME}_particle_relaxation PROPERTIES LABELS "particle relaxation") diff --git a/tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt b/tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt index 7a01241476..a0687b71a9 100644 --- a/tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt +++ b/tests/2d_examples/test_2d_ball_shell_collision/CMakeLists.txt @@ -19,9 +19,9 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") target_link_libraries(${PROJECT_NAME} sphinxsys_2d) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "particle_relaxation, thick_surface, solid_dynamics, contact") diff --git a/tests/2d_examples/test_2d_collision/CMakeLists.txt b/tests/2d_examples/test_2d_collision/CMakeLists.txt index da1fed2fc0..5fe3648448 100644 --- a/tests/2d_examples/test_2d_collision/CMakeLists.txt +++ b/tests/2d_examples/test_2d_collision/CMakeLists.txt @@ -19,7 +19,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") target_link_libraries(${PROJECT_NAME} sphinxsys_2d) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/2d_examples/test_2d_eulerian_flow_around_cylinder/CMakeLists.txt b/tests/2d_examples/test_2d_eulerian_flow_around_cylinder/CMakeLists.txt index eb626b0635..10f25aa7d8 100644 --- a/tests/2d_examples/test_2d_eulerian_flow_around_cylinder/CMakeLists.txt +++ b/tests/2d_examples/test_2d_eulerian_flow_around_cylinder/CMakeLists.txt @@ -17,10 +17,10 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) add_test(NAME ${PROJECT_NAME} - COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian") diff --git a/tests/2d_examples/test_2d_flow_around_cylinder/CMakeLists.txt b/tests/2d_examples/test_2d_flow_around_cylinder/CMakeLists.txt index 80da4f283b..791573d1ad 100644 --- a/tests/2d_examples/test_2d_flow_around_cylinder/CMakeLists.txt +++ b/tests/2d_examples/test_2d_flow_around_cylinder/CMakeLists.txt @@ -18,9 +18,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_ aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary") diff --git a/tests/2d_examples/test_2d_free_stream_around_cylinder/CMakeLists.txt b/tests/2d_examples/test_2d_free_stream_around_cylinder/CMakeLists.txt index 04b29a4e18..704b23c738 100644 --- a/tests/2d_examples/test_2d_free_stream_around_cylinder/CMakeLists.txt +++ b/tests/2d_examples/test_2d_free_stream_around_cylinder/CMakeLists.txt @@ -17,9 +17,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_ aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, free stream") diff --git a/tests/2d_examples/test_2d_free_stream_around_cylinder_mr/CMakeLists.txt b/tests/2d_examples/test_2d_free_stream_around_cylinder_mr/CMakeLists.txt index 04b29a4e18..704b23c738 100644 --- a/tests/2d_examples/test_2d_free_stream_around_cylinder_mr/CMakeLists.txt +++ b/tests/2d_examples/test_2d_free_stream_around_cylinder_mr/CMakeLists.txt @@ -17,9 +17,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_ aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, free stream") diff --git a/tests/2d_examples/test_2d_fsi2/CMakeLists.txt b/tests/2d_examples/test_2d_fsi2/CMakeLists.txt index 4ca3a9cfd5..8c3ec3ab56 100644 --- a/tests/2d_examples/test_2d_fsi2/CMakeLists.txt +++ b/tests/2d_examples/test_2d_fsi2/CMakeLists.txt @@ -16,9 +16,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_ aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary") diff --git a/tests/2d_examples/test_2d_shell_beam_collision/src/CMakeLists.txt b/tests/2d_examples/test_2d_shell_beam_collision/src/CMakeLists.txt index 206ae228bc..64d2eb9a13 100644 --- a/tests/2d_examples/test_2d_shell_beam_collision/src/CMakeLists.txt +++ b/tests/2d_examples/test_2d_shell_beam_collision/src/CMakeLists.txt @@ -10,9 +10,9 @@ SET(BUILD_RELOAD_PATH "${EXECUTABLE_OUTPUT_PATH}/reload") aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "contact, Simbody") diff --git a/tests/2d_examples/test_2d_taylor_green/CMakeLists.txt b/tests/2d_examples/test_2d_taylor_green/CMakeLists.txt index ba6ff7df69..eef5a13469 100644 --- a/tests/2d_examples/test_2d_taylor_green/CMakeLists.txt +++ b/tests/2d_examples/test_2d_taylor_green/CMakeLists.txt @@ -20,7 +20,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) add_test(NAME ${PROJECT_NAME}_lattice COMMAND ${PROJECT_NAME} --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") diff --git a/tests/3d_examples/test_3d_elasticSolid_shell_collision/CMakeLists.txt b/tests/3d_examples/test_3d_elasticSolid_shell_collision/CMakeLists.txt index f559e6cebc..de67e4b491 100644 --- a/tests/3d_examples/test_3d_elasticSolid_shell_collision/CMakeLists.txt +++ b/tests/3d_examples/test_3d_elasticSolid_shell_collision/CMakeLists.txt @@ -16,9 +16,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/3d_examples/test_3d_heart_electromechanics/CMakeLists.txt b/tests/3d_examples/test_3d_heart_electromechanics/CMakeLists.txt index 03f607fc7d..07452eebdd 100644 --- a/tests/3d_examples/test_3d_heart_electromechanics/CMakeLists.txt +++ b/tests/3d_examples/test_3d_heart_electromechanics/CMakeLists.txt @@ -17,9 +17,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/3d_examples/test_3d_heart_volume_change/CMakeLists.txt b/tests/3d_examples/test_3d_heart_volume_change/CMakeLists.txt index 03f607fc7d..07452eebdd 100644 --- a/tests/3d_examples/test_3d_heart_volume_change/CMakeLists.txt +++ b/tests/3d_examples/test_3d_heart_volume_change/CMakeLists.txt @@ -17,9 +17,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/3d_examples/test_3d_pkj_lv_electrocontraction/CMakeLists.txt b/tests/3d_examples/test_3d_pkj_lv_electrocontraction/CMakeLists.txt index 9a442369ce..c8e93097e0 100644 --- a/tests/3d_examples/test_3d_pkj_lv_electrocontraction/CMakeLists.txt +++ b/tests/3d_examples/test_3d_pkj_lv_electrocontraction/CMakeLists.txt @@ -16,9 +16,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/3d_examples/test_3d_self_contact/CMakeLists.txt b/tests/3d_examples/test_3d_self_contact/CMakeLists.txt index 7af5a718d6..791382e08e 100644 --- a/tests/3d_examples/test_3d_self_contact/CMakeLists.txt +++ b/tests/3d_examples/test_3d_self_contact/CMakeLists.txt @@ -16,9 +16,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/3d_examples/test_3d_taylor_bar/CMakeLists.txt b/tests/3d_examples/test_3d_taylor_bar/CMakeLists.txt index de70716a8f..a7924438eb 100644 --- a/tests/3d_examples/test_3d_taylor_bar/CMakeLists.txt +++ b/tests/3d_examples/test_3d_taylor_bar/CMakeLists.txt @@ -16,9 +16,9 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} sphinxsys_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") diff --git a/tests/unit_tests_src/for_3D_build/geometrices/test_3d_geometric_shape/CMakeLists.txt b/tests/unit_tests_src/for_3D_build/geometrices/test_3d_geometric_shape/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/for_3D_build/geometrices/test_3d_geometric_shape/CMakeLists.txt +++ b/tests/unit_tests_src/for_3D_build/geometrices/test_3d_geometric_shape/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/common/test_scalar_functions/CMakeLists.txt b/tests/unit_tests_src/shared/common/test_scalar_functions/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/common/test_scalar_functions/CMakeLists.txt +++ b/tests/unit_tests_src/shared/common/test_scalar_functions/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/common/test_sph_data_containers/CMakeLists.txt b/tests/unit_tests_src/shared/common/test_sph_data_containers/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/common/test_sph_data_containers/CMakeLists.txt +++ b/tests/unit_tests_src/shared/common/test_sph_data_containers/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/common/test_vector_functions/CMakeLists.txt b/tests/unit_tests_src/shared/common/test_vector_functions/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/common/test_vector_functions/CMakeLists.txt +++ b/tests/unit_tests_src/shared/common/test_vector_functions/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/geometries/test_complex_shape/CMakeLists.txt b/tests/unit_tests_src/shared/geometries/test_complex_shape/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/geometries/test_complex_shape/CMakeLists.txt +++ b/tests/unit_tests_src/shared/geometries/test_complex_shape/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/particle_dynamics/solid_dynamics/test_thin_structure_dynamics/CMakeLists.txt b/tests/unit_tests_src/shared/particle_dynamics/solid_dynamics/test_thin_structure_dynamics/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/particle_dynamics/solid_dynamics/test_thin_structure_dynamics/CMakeLists.txt +++ b/tests/unit_tests_src/shared/particle_dynamics/solid_dynamics/test_thin_structure_dynamics/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/test_kernels/test_kernel_cubic_B_spline/CMakeLists.txt b/tests/unit_tests_src/shared/test_kernels/test_kernel_cubic_B_spline/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/test_kernels/test_kernel_cubic_B_spline/CMakeLists.txt +++ b/tests/unit_tests_src/shared/test_kernels/test_kernel_cubic_B_spline/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/unit_tests_src/shared/test_vonMisesStrain/CMakeLists.txt b/tests/unit_tests_src/shared/test_vonMisesStrain/CMakeLists.txt index 588f056e5f..d9a298a2e7 100644 --- a/tests/unit_tests_src/shared/test_vonMisesStrain/CMakeLists.txt +++ b/tests/unit_tests_src/shared/test_vonMisesStrain/CMakeLists.txt @@ -12,5 +12,5 @@ target_link_libraries(${PROJECT_NAME} sphinxsys_3d GTest::gtest GTest::gtest_mai set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true + COMMAND ${PROJECT_NAME} --relax=true WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.cpp b/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.cpp index 037b7be579..efc7ea5716 100644 --- a/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.cpp +++ b/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.cpp @@ -2,14 +2,13 @@ namespace SPH { -//=====================================================================================================// namespace fluid_dynamics { //=================================================================================================// NonWettingSurfaceIndication:: NonWettingSurfaceIndication(BaseInnerRelation &inner_relation, - BaseContactRelation &contact_relation, Real threshold, Real criterion) - : FreeSurfaceIndicationComplex(inner_relation, contact_relation, threshold), wetting_criterion(criterion) + BaseContactRelation &contact_relation, Real threshold) + : FreeSurfaceIndicationComplex(inner_relation, contact_relation, threshold) { for (size_t k = 0; k != contact_particles_.size(); ++k) { @@ -18,12 +17,10 @@ NonWettingSurfaceIndication:: } //=================================================================================================// NonWettingSurfaceIndication:: - NonWettingSurfaceIndication(ComplexRelation &complex_relation, Real threshold, Real criterion) + NonWettingSurfaceIndication(ComplexRelation &complex_relation, Real threshold) : NonWettingSurfaceIndication(complex_relation.getInnerRelation(), - complex_relation.getContactRelation(), threshold, criterion) {} + complex_relation.getContactRelation(), threshold) {} //=================================================================================================// } // namespace fluid_dynamics - //=================================================================================================// } // namespace SPH - //=================================================================================================// \ No newline at end of file diff --git a/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.h b/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.h index bed6605bfd..29e0fb6d54 100644 --- a/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.h +++ b/tests/user_examples/extra_src/shared/wetting_coupled_spatial_temporal_method.h @@ -40,16 +40,16 @@ namespace fluid_dynamics /** * @class NonWettingSurfaceIndication * @brief Non wetting surface particles include free-surface ones and interfacial ones near the non-wetted structure. - * @brief Even the position divergence of interfacial fluid pariticles has satisfied with the threshold of spatial-temporal - identification approach to be identified as internal ones,they will remain as free-surface ones if without + * @brief Even the position divergence of interfacial fluid pariticles has satisfied with the threshold of spatial-temporal + identification approach to be identified as internal ones,they will remain as free-surface ones if without any wetted neighboring solid particles. */ class NonWettingSurfaceIndication : public FreeSurfaceIndicationComplex { public: NonWettingSurfaceIndication(BaseInnerRelation &inner_relation, - BaseContactRelation &contact_relation, Real threshold = 0.75, Real criterion = 0.99); - explicit NonWettingSurfaceIndication(ComplexRelation &complex_relation, Real threshold = 0.75, Real criterion = 0.99); + BaseContactRelation &contact_relation, Real threshold = 0.75); + explicit NonWettingSurfaceIndication(ComplexRelation &complex_relation, Real threshold = 0.75); virtual ~NonWettingSurfaceIndication(){}; inline void interaction(size_t index_i, Real dt = 0.0) @@ -59,40 +59,18 @@ class NonWettingSurfaceIndication : public FreeSurfaceIndicationComplex Real pos_div = 0.0; for (size_t k = 0; k < contact_configuration_.size(); ++k) { + StdLargeVec &wetting_k = *(contact_phi_[k]); Neighborhood &contact_neighborhood = (*contact_configuration_[k])[index_i]; for (size_t n = 0; n != contact_neighborhood.current_size_; ++n) { - pos_div -= contact_neighborhood.dW_ijV_j_[n] * contact_neighborhood.r_ij_[n]; + size_t index_j = contact_neighborhood.j_[n]; + pos_div -= wetting_k[index_j] * contact_neighborhood.dW_ijV_j_[n] * contact_neighborhood.r_ij_[n]; } } pos_div_[index_i] += pos_div; - - if (pos_div_[index_i] > this->threshold_by_dimensions_) - { - for (size_t k = 0; k < contact_configuration_.size(); ++k) - { - Neighborhood &contact_neighborhood = (*contact_configuration_[k])[index_i]; - for (size_t n = 0; n != contact_neighborhood.current_size_; ++n) - { - size_t j = contact_neighborhood.j_[n]; - if ((*(contact_phi_[k]))[j] > wetting_criterion) - { - pos_div_[index_i] = 2.0 * this->threshold_by_dimensions_; - break; - } - else - { - pos_div_[index_i] = 0.5 * this->threshold_by_dimensions_; - } - } - if (pos_div_[index_i] == 2.0 * this->threshold_by_dimensions_) - break; - } - } }; protected: - Real wetting_criterion; StdVec *> contact_phi_; }; @@ -101,7 +79,6 @@ using WettingCoupledSpatialTemporalFreeSurfaceIdentificationComplex = using SpatialTemporalFreeSurfaceIdentificationComplex = SpatialTemporalFreeSurfaceIdentification; - } // namespace fluid_dynamics } // namespace SPH -#endif // WETTING_COUPLED_SPATIAL_TEMPORAL_COMPLEX_H \ No newline at end of file +#endif // WETTING_COUPLED_SPATIAL_TEMPORAL_COMPLEX_H diff --git a/tests/user_examples/test_2d_FVM_double_mach_reflection/CMakeLists.txt b/tests/user_examples/test_2d_FVM_double_mach_reflection/CMakeLists.txt index 910a98f24c..221d65a8d4 100644 --- a/tests/user_examples/test_2d_FVM_double_mach_reflection/CMakeLists.txt +++ b/tests/user_examples/test_2d_FVM_double_mach_reflection/CMakeLists.txt @@ -17,10 +17,10 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) add_test(NAME ${PROJECT_NAME} - COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian") diff --git a/tests/user_examples/test_2d_FVM_flow_around_cylinder/CMakeLists.txt b/tests/user_examples/test_2d_FVM_flow_around_cylinder/CMakeLists.txt index 831d16d20b..88419ca5e9 100644 --- a/tests/user_examples/test_2d_FVM_flow_around_cylinder/CMakeLists.txt +++ b/tests/user_examples/test_2d_FVM_flow_around_cylinder/CMakeLists.txt @@ -19,10 +19,10 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) add_test(NAME ${PROJECT_NAME} - COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian") diff --git a/tests/user_examples/test_2d_eulerian_flow_around_cylinder_LG/CMakeLists.txt b/tests/user_examples/test_2d_eulerian_flow_around_cylinder_LG/CMakeLists.txt index a0fba24567..911d077bdb 100644 --- a/tests/user_examples/test_2d_eulerian_flow_around_cylinder_LG/CMakeLists.txt +++ b/tests/user_examples/test_2d_eulerian_flow_around_cylinder_LG/CMakeLists.txt @@ -17,10 +17,10 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") add_test(NAME ${PROJECT_NAME}_particle_relaxation - COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) add_test(NAME ${PROJECT_NAME} - COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} + COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES DEPENDS "${PROJECT_NAME}_particle_relaxation") set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "periodic boundary, Eulerian") diff --git a/tests/user_examples/test_2d_flow_stream_around_fish/CMakeLists.txt b/tests/user_examples/test_2d_flow_stream_around_fish/CMakeLists.txt index 67afd07e84..740499fdcf 100644 --- a/tests/user_examples/test_2d_flow_stream_around_fish/CMakeLists.txt +++ b/tests/user_examples/test_2d_flow_stream_around_fish/CMakeLists.txt @@ -13,9 +13,9 @@ SET(BUILD_RELOAD_PATH "${EXECUTABLE_OUTPUT_PATH}/reload") aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") diff --git a/tests/user_examples/xj_stretching/CMakeLists.txt b/tests/user_examples/test_2d_stretching/CMakeLists.txt similarity index 66% rename from tests/user_examples/xj_stretching/CMakeLists.txt rename to tests/user_examples/test_2d_stretching/CMakeLists.txt index 7434f894db..63dd6a3ac8 100644 --- a/tests/user_examples/xj_stretching/CMakeLists.txt +++ b/tests/user_examples/test_2d_stretching/CMakeLists.txt @@ -22,14 +22,7 @@ target_link_libraries(${PROJECT_NAME} extra_sources_2d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) - add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -else() - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh - DESTINATION ${EXECUTABLE_OUTPUT_PATH}) - add_test(NAME ${PROJECT_NAME} COMMAND bash ${EXECUTABLE_OUTPUT_PATH}/run_test.sh - WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -endif() diff --git a/tests/user_examples/test_2d_stretching/stretching.cpp b/tests/user_examples/test_2d_stretching/stretching.cpp new file mode 100644 index 0000000000..8175e0aaf9 --- /dev/null +++ b/tests/user_examples/test_2d_stretching/stretching.cpp @@ -0,0 +1,367 @@ +/* ---------------------------------------------------------------------------* + * SPHinXsys: 2D oscillation beam example-one body version * + * ----------------------------------------------------------------------------* + * This is the one of the basic test cases, also the first case for * + * understanding SPH method for solid simulation. * + * In this case, the constraint of the beam is implemented with * + * internal constrained subregion. * + * ----------------------------------------------------------------------------*/ +#include "inelastic_solid_hardening.h" +#include "sphinxsys.h" + +using namespace SPH; +//------------------------------------------------------------------------------ +// global parameters for the case +//------------------------------------------------------------------------------ +Real PL = 0.05334; // beam length +Real PH = 0.012826; // for thick plate; + +// reference particle spacing +Real resolution_ref = PH / 30; +Real BW = resolution_ref * 4.0; // boundary width, at least three particles + +/** Domain bounds of the system. */ +BoundingBox system_domain_bounds(Vec2d(-PL / 2.0, -PL / 2.0), + Vec2d(2.0 * PL, PL / 2.0)); +// two dimensional should be circle smooth between two parts. +//---------------------------------------------------------------------- +Real rho0_s = 7850.0; /**< Reference density. */ +Real Shear_modulus = 80.1938e9; /**< Poisson ratio. */ +Real Bulk_modulus = 164.21e9; + +Real poisson = (3.0 * Bulk_modulus - 2.0 * Shear_modulus) / (6.0 * Bulk_modulus + 2.0 * Shear_modulus); /**< Poisson ratio. */ +Real Youngs_modulus = (9.0 * Shear_modulus * Bulk_modulus) / (3.0 * Bulk_modulus + Shear_modulus); + +Real yield_stress = 0.45e9; +Real hardening_modulus = 1.2924e8; +Real saturation_flow_stress = 7.15e8; +Real saturation_exponent = 16.93; + +Real physical_viscosity = 1.0e4; +Real refer_energy = 0.5 * 8000 * 0.01; // 40 + +Vecd norm_(1.0, 0.0); +Vecd upper_face_point_(0.02 + 3.0 * resolution_ref, 0.0); +Vecd lower_face_point_(0.02, 0.0); + +Vecd norm_4(1.0, 0.0); +Vecd upper_face_point_4(0.04 + 3.0 * resolution_ref, 0.0); +Vecd lower_face_point_4(0.04, 0.0); + +// Beam observer location +StdVec observation_location = {Vecd(PL / 2.0, PH / 2.0 - PH * 0.01)}; + +//---------------------------------------------------------------------- +// Geometric shapes used in the system. +//---------------------------------------------------------------------- + +std::vector beam_left_stretch_shape{ + Vecd(-BW, -PH / 2), Vecd(-BW, PH / 2), Vecd(0.0, PH / 2), + Vecd(0.0, -PH / 2), Vecd(-BW, -PH / 2)}; + +// a beam shape +std::vector beam_shape{ + Vecd(0.0, -PH / 2), Vecd(0.0, PH / 2), + Vecd(PL / 2.0, PH / 2 - PH * 0.01), + Vecd(PL, PH / 2), Vecd(PL, -PH / 2), + Vecd(PL / 2.0, -PH / 2 + PH * 0.01), + Vecd(0.0, -PH / 2)}; + +std::vector beam_right_stretch_shape{ + Vecd(PL, -PH / 2), Vecd(PL, PH / 2), Vecd(PL + BW, PH / 2), + Vecd(PL + BW, -PH / 2), Vecd(PL, -PH / 2)}; + +//---------------------------------------------------------------------- +// Define the beam body +//---------------------------------------------------------------------- +class Beam : public MultiPolygonShape +{ + public: + explicit Beam(const std::string &shape_name) : MultiPolygonShape(shape_name) + { + multi_polygon_.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); + multi_polygon_.addAPolygon(beam_shape, ShapeBooleanOps::add); + multi_polygon_.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); + } +}; + +class LeftStretchSolidBodyRegion : public solid_dynamics::BaseMotionConstraint +{ + public: + // TODO: use only body part as argment since body can be referred from it already + LeftStretchSolidBodyRegion(BodyPartByParticle &body_part) + : solid_dynamics::BaseMotionConstraint(body_part), + vel_(particles_->vel_), pos_(particles_->pos_){}; + + virtual ~LeftStretchSolidBodyRegion(){}; + + protected: + StdLargeVec &vel_; + StdLargeVec &pos_; + virtual void update(size_t index_i, Real Dt = 0.0) + { + pos_[index_i][0] -= 0.5e-4 * Dt; + }; +}; + +class RightStretchSolidBodyRegion : public solid_dynamics::BaseMotionConstraint +{ + public: + // TODO: use only body part as argment since body can be referred from it already + RightStretchSolidBodyRegion(BodyPartByParticle &body_part) + : solid_dynamics::BaseMotionConstraint(body_part), + vel_(particles_->vel_), pos_(particles_->pos_){}; + + virtual ~RightStretchSolidBodyRegion(){}; + + protected: + StdLargeVec &vel_; + StdLargeVec &pos_; + virtual void update(size_t index_i, Real Dt = 0.0) + { + pos_[index_i][0] += 0.5e-4 * Dt; + }; +}; + +MultiPolygon createBeamRightStretchShape() +{ + MultiPolygon multi_polygon; + multi_polygon.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); + return multi_polygon; +}; + +MultiPolygon createBeamLeftStretchShape() +{ + MultiPolygon multi_polygon; + multi_polygon.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); + return multi_polygon; +}; + +MultiPolygon createConstrainBeamShape() +{ + MultiPolygon multi_polygon; + multi_polygon.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); + multi_polygon.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); + + return multi_polygon; +}; + +class ConstrainXVelocity : public solid_dynamics::BaseMotionConstraint +{ + public: + // TODO: use only body part as argment since body can be referred from it already + ConstrainXVelocity(BodyPartByParticle &body_part) + : solid_dynamics::BaseMotionConstraint(body_part), + vel_(particles_->vel_), pos_(particles_->pos_){}; + + virtual ~ConstrainXVelocity(){}; + + protected: + StdLargeVec &vel_; + StdLargeVec &pos_; + virtual void update(size_t index_i, Real dt = 0.0) + { + vel_[index_i] = Vecd(0.0, vel_[index_i][1]); + }; +}; + +//------------------------------------------------------------------------------ +// the main program +//------------------------------------------------------------------------------ +int main(int ac, char *av[]) +{ + //---------------------------------------------------------------------- + // Build up the environment of a SPHSystem with global controls. + //---------------------------------------------------------------------- + SPHSystem system(system_domain_bounds, resolution_ref); + /** Tag for running particle relaxation for the initially body-fitted distribution */ + system.setRunParticleRelaxation(false); + /** Tag for starting with relaxed body-fitted particles distribution */ + system.setReloadParticles(true); + system.handleCommandlineOptions(ac, av); + IOEnvironment io_environment(system); + + //---------------------------------------------------------------------- + // Creating body, materials and particles. + //---------------------------------------------------------------------- + SolidBody beam_body(system, makeShared("StretchingBody")); + beam_body.defineBodyLevelSetShape(); + beam_body.defineParticlesAndMaterial( + rho0_s, Youngs_modulus, poisson, yield_stress, hardening_modulus, saturation_flow_stress, saturation_exponent); + + (!system.RunParticleRelaxation() && system.ReloadParticles()) + ? beam_body.generateParticles(io_environment, beam_body.getName()) + : beam_body.generateParticles(); + + ObserverBody beam_observer(system, "BeamObserver"); + beam_observer.generateParticles(observation_location); + //---------------------------------------------------------------------- + // Define body relation map. + // The contact map gives the topological connections between the bodies. + // Basically the the range of bodies to build neighbor particle lists. + //---------------------------------------------------------------------- + if (system.RunParticleRelaxation()) + { + //---------------------------------------------------------------------- + // Define body relation map used for particle relaxation. + //---------------------------------------------------------------------- + InnerRelation beam_body_inner(beam_body); + //---------------------------------------------------------------------- + // Define the methods for particle relaxation. + //---------------------------------------------------------------------- + SimpleDynamics beam_body_random_particles(beam_body); + relax_dynamics::RelaxationStepInner beam_body_relaxation_step_inner(beam_body_inner); + //---------------------------------------------------------------------- + // Output for particle relaxation. + //---------------------------------------------------------------------- + BodyStatesRecordingToVtp write_ball_state(io_environment, system.real_bodies_); + ReloadParticleIO write_particle_reload_files(io_environment, {&beam_body}); + //---------------------------------------------------------------------- + // Particle relaxation starts here. + //---------------------------------------------------------------------- + beam_body_random_particles.exec(0.25); + write_ball_state.writeToFile(0); + //---------------------------------------------------------------------- + // From here iteration for particle relaxation begins. + //---------------------------------------------------------------------- + int ite = 0; + int relax_step = 1000; + while (ite < relax_step) + { + beam_body_relaxation_step_inner.exec(); + ite += 1; + if (ite % 100 == 0) + { + std::cout << std::fixed << std::setprecision(9) << "Relaxation steps N = " << ite << "\n"; + write_ball_state.writeToFile(ite); + } + } + std::cout << "The physics relaxation process of particles finish !" << std::endl; + write_particle_reload_files.writeToFile(0); + return 0; + } + + InnerRelation beam_body_inner(beam_body); + ContactRelation beam_observer_contact(beam_observer, {&beam_body}); + //----------------------------------------------------------------------------- + // this section define all numerical methods will be used in this case + //----------------------------------------------------------------------------- + + // corrected strong configuration + InteractionWithUpdate beam_corrected_configuration(beam_body_inner); + + // time step size calculation + ReduceDynamics computing_time_step_size(beam_body); + // stress relaxation for the beam + Dynamics1Level stress_relaxation_first_half(beam_body_inner); + Dynamics1Level stress_relaxation_second_half(beam_body_inner); + ReduceDynamics get_kinetic_energy(beam_body); + + BodyRegionByParticle beam_left_stretch(beam_body, makeShared(createBeamLeftStretchShape())); + SimpleDynamics stretch_beam_left_end(beam_left_stretch); + BodyRegionByParticle beam_right_stretch(beam_body, makeShared(createBeamRightStretchShape())); + SimpleDynamics stretch_beam_right_end(beam_right_stretch); + BodyRegionByParticle beam_constrain(beam_body, makeShared(createConstrainBeamShape())); + SimpleDynamics constrain_beam_end(beam_constrain); + + InteractionDynamics beam_deformation_gradient_tensor(beam_body_inner); + DampingWithRandomChoice>> + damping(0.5, beam_body_inner, "Velocity", physical_viscosity); + + //----------------------------------------------------------------------------- + // outputs + //----------------------------------------------------------------------------- + + BodyStatesRecordingToVtp write_beam_states(io_environment, system.real_bodies_); + ReducedQuantityRecording> + write_total_mechanical_energy(io_environment, beam_body); + //---------------------------------------------------------------------- + // Setup computing and initial conditions. + //---------------------------------------------------------------------- + system.initializeSystemCellLinkedLists(); + system.initializeSystemConfigurations(); + beam_corrected_configuration.exec(); + + //---------------------------------------------------------------------- + // Setup computing time-step controls. + //---------------------------------------------------------------------- + int ite = 0; + int Dt_ite = 0; + Real End_Time = 100.0; + + Real D_Time = End_Time / 100.0; // time step size for output file + Real Dt = End_Time / 10000.0; /**< Time period for stretching */ + Real dt = 0.0; // default acoustic time step sizes + + // statistics for computing time + TickCount t1 = TickCount::now(); + TimeInterval interval; + //----------------------------------------------------------------------------- + // from here the time stepping begins + //----------------------------------------------------------------------------- + write_beam_states.writeToFile(0); + write_total_mechanical_energy.writeToFile(0); + + // computation loop starts + while (GlobalStaticVariables::physical_time_ < End_Time) + { + Real integration_time = 0.0; + // integrate time (loop) until the next output time + while (integration_time < D_Time) + { + Real relaxation_time = 0.0; + stretch_beam_left_end.exec(Dt); + stretch_beam_right_end.exec(Dt); + beam_deformation_gradient_tensor.exec(Dt); + Dt_ite++; + + int stress_ite = 0; + Real refer_total_kinetic_energy = 10000.0; + while (relaxation_time < Dt) + { + if (refer_total_kinetic_energy > 0.005) + { + stress_relaxation_first_half.exec(dt); + constrain_beam_end.exec(dt); + damping.exec(Dt); + constrain_beam_end.exec(dt); + stress_relaxation_second_half.exec(dt); + + refer_total_kinetic_energy = get_kinetic_energy.exec() / refer_energy; + + ite++; + stress_ite++; + + dt = computing_time_step_size.exec(); + if (ite % 500 == 0) + { + std::cout << "N=" << ite << " Time: " + << GlobalStaticVariables::physical_time_ + << " Dt: " << Dt << " dt: " << dt + << " Dt:dt = " << Dt / dt << "\n"; + } + } + relaxation_time += dt; + integration_time += dt; + GlobalStaticVariables::physical_time_ += dt; + } + + std::cout << "refer_total_kinetic_energy " << refer_total_kinetic_energy + << " stress_ite " << stress_ite << std::endl; + } + + TickCount t2 = TickCount::now(); + write_beam_states.writeToFile(); + TickCount t3 = TickCount::now(); + interval += t3 - t2; + } + TickCount t4 = TickCount::now(); + + TimeInterval tt; + tt = t4 - t1 - interval; + std::cout << "Total wall time for computation: " << tt.seconds() << " seconds." + << " Iterations: " << ite << std::endl; + std::cout << "Total iterations computation: " << GlobalStaticVariables::physical_time_ / dt + << std::endl; + return 0; +} diff --git a/tests/user_examples/test_2d_water_entry_exit/CMakeLists.txt b/tests/user_examples/test_2d_water_entry_exit/CMakeLists.txt index b00933fc10..e6889b272e 100644 --- a/tests/user_examples/test_2d_water_entry_exit/CMakeLists.txt +++ b/tests/user_examples/test_2d_water_entry_exit/CMakeLists.txt @@ -17,9 +17,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/regression_test_tool/ DESTINATION ${BUILD_ aux_source_directory(. DIR_SRCS) ADD_EXECUTABLE(${PROJECT_NAME} ${EXECUTABLE_OUTPUT_PATH} ${DIR_SRCS}) -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "spatial_temporal_identification") diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_0_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_0_result.xml new file mode 100644 index 0000000000..d065a6bee5 --- /dev/null +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_0_result.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_14_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_14_result.xml new file mode 100644 index 0000000000..fe712a2ca6 --- /dev/null +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_14_result.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_7_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_7_result.xml new file mode 100644 index 0000000000..e05d102fb9 --- /dev/null +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_Run_7_result.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_dtwdistance.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_dtwdistance.xml similarity index 58% rename from tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_dtwdistance.xml rename to tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_dtwdistance.xml index eaf89cd547..ead45a7e4c 100644 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_dtwdistance.xml +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_dtwdistance.xml @@ -1,4 +1,4 @@ - + diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_runtimes.dat b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_runtimes.dat similarity index 66% rename from tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_runtimes.dat rename to tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_runtimes.dat index fd8ad08880..9c41804468 100644 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_runtimes.dat +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/CylinderObserver_Position_runtimes.dat @@ -1,3 +1,3 @@ true -21 +15 4 \ No newline at end of file diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_0_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_0_result.xml deleted file mode 100644 index 8c7499408f..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_0_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_10_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_10_result.xml deleted file mode 100644 index 30e1e009d6..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_10_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_20_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_20_result.xml deleted file mode 100644 index 4e82ba0c88..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_Run_20_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_dtwdistance.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_dtwdistance.xml deleted file mode 100644 index 937895ceed..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/FluidObserver_Pressure_dtwdistance.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_0_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_0_result.xml deleted file mode 100644 index 040faac7d7..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_0_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_11_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_11_result.xml deleted file mode 100644 index a4f9d99f27..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_11_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_6_result.xml b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_6_result.xml deleted file mode 100644 index 2b0252d34c..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_Run_6_result.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_runtimes.dat b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_runtimes.dat deleted file mode 100644 index 5cc2fa0e29..0000000000 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/WaterBody_TotalMechanicalEnergy_runtimes.dat +++ /dev/null @@ -1,3 +0,0 @@ -true -12 -4 \ No newline at end of file diff --git a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/regression_test_tool.py b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/regression_test_tool.py index bedffb1c37..ca702a5150 100644 --- a/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/regression_test_tool.py +++ b/tests/user_examples/test_2d_water_entry_exit/regression_test_tool/regression_test_tool.py @@ -7,20 +7,16 @@ from regression_test_base_tool import SphinxsysRegressionTest """ -case name: test_2d_dambreak +case name: test_2d_water_entry_exit """ -case_name = "test_2d_dambreak" -body_name = "WaterBody" -parameter_name = "TotalMechanicalEnergy" -body_name_1 = "FluidObserver" -parameter_name_1 = "Pressure" +case_name = "test_2d_water_entry_exit" +body_name = "CylinderObserver" +parameter_name = "Position" number_of_run_times = 0 converged = 0 sphinxsys = SphinxsysRegressionTest(case_name, body_name, parameter_name) -sphinxsys_1 = SphinxsysRegressionTest(case_name, body_name_1, parameter_name_1) - while True: print("Now start a new run......") @@ -28,18 +24,14 @@ sphinxsys.run_case_with_reload() number_of_run_times += 1 converged = sphinxsys.read_dat_file() - converged_1 = sphinxsys_1.read_dat_file() print("Please note: This is the", number_of_run_times, "run!") if number_of_run_times <= 200: - if (converged == "true") and (converged_1 == "true"): + if (converged == "true"): print("The tested parameters of all variables are converged, and the run will stop here!") break elif converged != "true": print("The tested parameters of", sphinxsys.sphinxsys_parameter_name, "are not converged!") continue - elif converged_1 != "true": - print("The tested parameters of", sphinxsys_1.sphinxsys_parameter_name, "are not converged!") - continue else: print("It's too many runs but still not converged, please try again!") break diff --git a/tests/user_examples/test_2d_water_entry_exit/test_2d_water_entry_exit.cpp b/tests/user_examples/test_2d_water_entry_exit/test_2d_water_entry_exit.cpp index 9a89aa81c7..670072f759 100644 --- a/tests/user_examples/test_2d_water_entry_exit/test_2d_water_entry_exit.cpp +++ b/tests/user_examples/test_2d_water_entry_exit/test_2d_water_entry_exit.cpp @@ -35,10 +35,10 @@ Real mu_f = 8.9e-7; /**< Water dynamics viscosity. */ //---------------------------------------------------------------------- // Wetting parameters //---------------------------------------------------------------------- -Real diffusion_coeff = 330.578 * pow(particle_spacing_ref, 2); /**< Wetting coefficient. */ -Real fluid_moisture = 1.0; /**< fluid moisture. */ -Real cylinder_moisture = 0.0; /**< cylinder moisture. */ -Real wall_moisture = 1.0; /**< wall moisture. */ +Real diffusion_coeff = 100.0 * pow(particle_spacing_ref, 2); /**< Wetting coefficient. */ +Real fluid_moisture = 1.0; /**< fluid moisture. */ +Real cylinder_moisture = 0.0; /**< cylinder moisture. */ +Real wall_moisture = 1.0; /**< wall moisture. */ //---------------------------------------------------------------------- // Definition for water body //---------------------------------------------------------------------- @@ -246,8 +246,8 @@ int main(int ac, char *av[]) ? cylinder.generateParticles(io_environment, cylinder.getName()) : cylinder.generateParticles(); - ObserverBody fluid_observer(sph_system, "FluidObserver"); - fluid_observer.generateParticles(observer_location); + ObserverBody cylinder_observer(sph_system, "CylinderObserver"); + cylinder_observer.generateParticles(observer_location); //---------------------------------------------------------------------- // Define body relation map. // The contact map gives the topological connections between the bodies. @@ -257,7 +257,7 @@ int main(int ac, char *av[]) InnerRelation cylinder_inner(cylinder); ComplexRelation water_block_complex(water_block_inner, {&wall_boundary, &cylinder}); ContactRelation cylinder_contact(cylinder, {&water_block}); - ContactRelation fluid_observer_contact(fluid_observer, {&cylinder}); + ContactRelation cylinder_observer_contact(cylinder_observer, {&cylinder}); //---------------------------------------------------------------------- // Run particle relaxation for body-fitted distribution if chosen. //---------------------------------------------------------------------- @@ -309,7 +309,7 @@ int main(int ac, char *av[]) SimpleDynamics fluid_step_initialization(water_block, gravity_ptr); InteractionWithUpdate free_stream_surface_indicator(water_block_complex); - InteractionWithUpdate fluid_density_by_summation(water_block_complex); + InteractionWithUpdate fluid_density_by_summation(water_block_complex); water_block.addBodyStateForRecording("Pressure"); water_block.addBodyStateForRecording("Density"); water_block.addBodyStateForRecording("Indicator"); @@ -384,7 +384,7 @@ int main(int ac, char *av[]) BodyStatesRecordingToVtp body_states_recording(io_environment, sph_system.real_bodies_); RestartIO restart_io(io_environment, sph_system.real_bodies_); RegressionTestDynamicTimeWarping> - write_cylinder_displacement("Position", io_environment, fluid_observer_contact); + write_cylinder_displacement("Position", io_environment, cylinder_observer_contact); //---------------------------------------------------------------------- // Prepare the simulation with cell linked list, configuration // and case specified initial condition if necessary. @@ -406,7 +406,6 @@ int main(int ac, char *av[]) GlobalStaticVariables::physical_time_ = restart_io.readRestartFiles(sph_system.RestartStep()); water_block.updateCellLinkedList(); water_block_complex.updateConfiguration(); - fluid_observer_contact.updateConfiguration(); cylinder.updateCellLinkedList(); water_block_inner.updateConfiguration(); cylinder_inner.updateConfiguration(); @@ -419,7 +418,7 @@ int main(int ac, char *av[]) int screen_output_interval = 100; int observation_sample_interval = screen_output_interval * 2; int restart_output_interval = screen_output_interval * 10; - Real end_time = 0.7; + Real end_time = 1.0; Real output_interval = end_time / 70.0; //---------------------------------------------------------------------- // Statistics for CPU time @@ -503,7 +502,6 @@ int main(int ac, char *av[]) cylinder_inner.updateConfiguration(); cylinder_contact.updateConfiguration(); water_block_complex.updateConfiguration(); - fluid_observer_contact.updateConfiguration(); free_stream_surface_indicator.exec(); interval_updating_configuration += TickCount::now() - time_instance; } @@ -535,6 +533,5 @@ int main(int ac, char *av[]) write_cylinder_displacement.testResult(); } - return 0; }; diff --git a/tests/user_examples/test_3d_repose_angle/CMakeLists.txt b/tests/user_examples/test_3d_repose_angle/CMakeLists.txt index 79ed1a178e..81b352c2e4 100644 --- a/tests/user_examples/test_3d_repose_angle/CMakeLists.txt +++ b/tests/user_examples/test_3d_repose_angle/CMakeLists.txt @@ -16,7 +16,7 @@ target_sources(${PROJECT_NAME} PRIVATE ${DIR_SRCS}) target_link_libraries(${PROJECT_NAME} extra_sources_3d) set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}") -add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --r=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME}_particle_relaxation COMMAND ${PROJECT_NAME} --relax=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --r=false --i=true --state_recording=${TEST_STATE_RECORDING} +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} --reload=true --state_recording=${TEST_STATE_RECORDING} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) diff --git a/tests/user_examples/xj_stretching/run_test.sh b/tests/user_examples/xj_stretching/run_test.sh deleted file mode 100644 index 8aaa13ab55..0000000000 --- a/tests/user_examples/xj_stretching/run_test.sh +++ /dev/null @@ -1,2 +0,0 @@ -./xj_stretching --r=true -./xj_stretching --r=false --i=true diff --git a/tests/user_examples/xj_stretching/xj_stretching.cpp b/tests/user_examples/xj_stretching/xj_stretching.cpp deleted file mode 100644 index 7233b7e595..0000000000 --- a/tests/user_examples/xj_stretching/xj_stretching.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* ---------------------------------------------------------------------------* -* SPHinXsys: 2D oscillation beam example-one body version * -* ----------------------------------------------------------------------------* -* This is the one of the basic test cases, also the first case for * -* understanding SPH method for solid simulation. * -* In this case, the constraint of the beam is implemented with * -* internal constrained subregion. * -* ----------------------------------------------------------------------------*/ -#include "sphinxsys.h" -#include "inelastic_solid_hardening.h" - -using namespace SPH; -//------------------------------------------------------------------------------ -//global parameters for the case -//------------------------------------------------------------------------------ -Real PL = 0.05334; //beam length -Real PH = 0.012826; //for thick plate; - -//reference particle spacing -Real resolution_ref = PH / 30; -Real BW = resolution_ref * 4.0 ; //boundary width, at least three particles - -/** Domain bounds of the system. */ -BoundingBox system_domain_bounds(Vec2d(-PL / 2.0, -PL / 2.0), - Vec2d(2.0*PL , PL / 2.0)); -// two dimensional should be circle smooth between two parts. -//---------------------------------------------------------------------- -Real rho0_s = 7850.0; /**< Reference density. */ -Real Shear_modulus = 80.1938e9; /**< Poisson ratio. */ -Real Bulk_modulus = 164.21e9; - -Real poisson = (3.0 * Bulk_modulus -2.0 * Shear_modulus)/(6.0 * Bulk_modulus + 2.0 * Shear_modulus); /**< Poisson ratio. */ -Real Youngs_modulus = (9.0 * Shear_modulus * Bulk_modulus)/(3.0* Bulk_modulus + Shear_modulus); - - -Real yield_stress = 0.45e9; -Real hardening_modulus = 1.2924e8; -Real saturation_flow_stress = 7.15e8; -Real saturation_exponent = 16.93; - -Real physical_viscosity = 1.0e4; -Real refer_energy = 0.5*8000*0.01; //40 - -Vecd norm_(1.0, 0.0); -Vecd upper_face_point_(0.02 + 3.0 * resolution_ref, 0.0); -Vecd lower_face_point_(0.02, 0.0); - - -Vecd norm_4(1.0, 0.0); -Vecd upper_face_point_4(0.04 + 3.0 * resolution_ref, 0.0); -Vecd lower_face_point_4(0.04, 0.0); - -//Beam observer location -StdVec observation_location = { Vecd( PL / 2.0 , PH / 2.0 - PH * 0.01) }; - -//---------------------------------------------------------------------- -// Geometric shapes used in the system. -//---------------------------------------------------------------------- - -std::vector beam_left_stretch_shape{ - Vecd(-BW , -PH / 2 ), Vecd(-BW, PH / 2 ), Vecd(0.0, PH / 2 ), - Vecd(0.0, -PH / 2 ), Vecd(-BW, -PH / 2 )}; - -//a beam shape -std::vector beam_shape{ - Vecd(0.0, -PH / 2), Vecd(0.0, PH / 2), - Vecd(PL / 2.0 , PH / 2 - PH * 0.01), - Vecd(PL, PH / 2), Vecd(PL , -PH / 2), - Vecd(PL / 2.0 , -PH / 2 + PH * 0.01), - Vecd(0.0, -PH / 2) }; - -std::vector beam_right_stretch_shape{ - Vecd(PL, -PH / 2 ), Vecd(PL, PH / 2 ), Vecd(PL +BW , PH / 2 ), - Vecd(PL+BW, -PH / 2 ), Vecd(PL, -PH / 2 ) }; - -//---------------------------------------------------------------------- -// Define the beam body -//---------------------------------------------------------------------- -class Beam : public MultiPolygonShape -{ -public: - explicit Beam(const std::string &shape_name) : MultiPolygonShape(shape_name) - { - multi_polygon_.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); - multi_polygon_.addAPolygon(beam_shape, ShapeBooleanOps::add); - multi_polygon_.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); - - } -}; - -class LeftStretchSolidBodyRegion : public solid_dynamics::BaseMotionConstraint -{ -public: - // TODO: use only body part as argment since body can be referred from it already - LeftStretchSolidBodyRegion(BodyPartByParticle &body_part) - :solid_dynamics::BaseMotionConstraint(body_part), - vel_(particles_->vel_), pos_(particles_->pos_){}; - - virtual ~LeftStretchSolidBodyRegion() {}; -protected: - StdLargeVec &vel_; - StdLargeVec &pos_; - virtual void update(size_t index_i, Real Dt = 0.0) - { - pos_[index_i][0] -= 0.5e-4 * Dt; - }; -}; - -class RightStretchSolidBodyRegion : public solid_dynamics::BaseMotionConstraint -{ -public: - // TODO: use only body part as argment since body can be referred from it already - RightStretchSolidBodyRegion(BodyPartByParticle &body_part) - :solid_dynamics::BaseMotionConstraint(body_part), - vel_(particles_->vel_), pos_(particles_->pos_){}; - - virtual ~RightStretchSolidBodyRegion() {}; - -protected: - StdLargeVec &vel_; - StdLargeVec &pos_; - virtual void update(size_t index_i, Real Dt = 0.0) - { - pos_[index_i][0] += 0.5e-4 * Dt; - }; -}; - -MultiPolygon createBeamRightStretchShape() -{ - MultiPolygon multi_polygon; - multi_polygon.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); - return multi_polygon; -}; - -MultiPolygon createBeamLeftStretchShape() -{ - MultiPolygon multi_polygon; - multi_polygon.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); - return multi_polygon; -}; - - -MultiPolygon createConstrainBeamShape() -{ - MultiPolygon multi_polygon; - multi_polygon.addAPolygon(beam_left_stretch_shape, ShapeBooleanOps::add); - multi_polygon.addAPolygon(beam_right_stretch_shape, ShapeBooleanOps::add); - - return multi_polygon; -}; - -class ConstrainXVelocity : public solid_dynamics::BaseMotionConstraint -{ -public: - // TODO: use only body part as argment since body can be referred from it already - ConstrainXVelocity(BodyPartByParticle &body_part) - :solid_dynamics::BaseMotionConstraint(body_part), - vel_(particles_->vel_), pos_(particles_->pos_){}; - - virtual ~ConstrainXVelocity() {}; -protected: - StdLargeVec &vel_; - StdLargeVec &pos_; - virtual void update(size_t index_i, Real dt = 0.0) - { - vel_[index_i] = Vecd(0.0, vel_[index_i][1]); - }; -}; - -//------------------------------------------------------------------------------ -//the main program -//------------------------------------------------------------------------------ -int main(int ac, char *av[]) -{ - //---------------------------------------------------------------------- - // Build up the environment of a SPHSystem with global controls. - //---------------------------------------------------------------------- - SPHSystem system(system_domain_bounds, resolution_ref); - /** Tag for running particle relaxation for the initially body-fitted distribution */ - system.setRunParticleRelaxation(false); - /** Tag for starting with relaxed body-fitted particles distribution */ - system.setReloadParticles(true); - system.handleCommandlineOptions(ac, av); - IOEnvironment io_environment(system); - - //---------------------------------------------------------------------- - // Creating body, materials and particles. - //---------------------------------------------------------------------- - SolidBody beam_body(system, makeShared("StretchingBody")); - beam_body.defineBodyLevelSetShape(); - beam_body.defineParticlesAndMaterial( - rho0_s, Youngs_modulus, poisson, yield_stress, hardening_modulus, saturation_flow_stress, saturation_exponent); - - (!system.RunParticleRelaxation() && system.ReloadParticles()) - ? beam_body.generateParticles(io_environment, beam_body.getName()) - : beam_body.generateParticles(); - - - ObserverBody beam_observer(system, "BeamObserver"); - beam_observer.generateParticles(observation_location); - //---------------------------------------------------------------------- - // Define body relation map. - // The contact map gives the topological connections between the bodies. - // Basically the the range of bodies to build neighbor particle lists. - //---------------------------------------------------------------------- - if (system.RunParticleRelaxation()) - { - //---------------------------------------------------------------------- - // Define body relation map used for particle relaxation. - //---------------------------------------------------------------------- - InnerRelation beam_body_inner(beam_body); - //---------------------------------------------------------------------- - // Define the methods for particle relaxation. - //---------------------------------------------------------------------- - SimpleDynamics beam_body_random_particles(beam_body); - relax_dynamics::RelaxationStepInner beam_body_relaxation_step_inner(beam_body_inner); - //---------------------------------------------------------------------- - // Output for particle relaxation. - //---------------------------------------------------------------------- - BodyStatesRecordingToVtp write_ball_state(io_environment, system.real_bodies_); - ReloadParticleIO write_particle_reload_files(io_environment, { &beam_body }); - //---------------------------------------------------------------------- - // Particle relaxation starts here. - //---------------------------------------------------------------------- - beam_body_random_particles.exec(0.25); - write_ball_state.writeToFile(0); - //---------------------------------------------------------------------- - // From here iteration for particle relaxation begins. - //---------------------------------------------------------------------- - int ite = 0; - int relax_step = 1000; - while (ite < relax_step) - { - beam_body_relaxation_step_inner.exec(); - ite += 1; - if (ite % 100 == 0) - { - std::cout << std::fixed << std::setprecision(9) << "Relaxation steps N = " << ite << "\n"; - write_ball_state.writeToFile(ite); - } - } - std::cout << "The physics relaxation process of particles finish !" << std::endl; - write_particle_reload_files.writeToFile(0); - return 0; - } - - InnerRelation beam_body_inner(beam_body); - ContactRelation beam_observer_contact(beam_observer, {&beam_body}); - //----------------------------------------------------------------------------- - //this section define all numerical methods will be used in this case - //----------------------------------------------------------------------------- - - //corrected strong configuration - InteractionWithUpdate beam_corrected_configuration(beam_body_inner); - - //time step size calculation - ReduceDynamics computing_time_step_size(beam_body); - //stress relaxation for the beam - Dynamics1Level stress_relaxation_first_half(beam_body_inner); - Dynamics1Level stress_relaxation_second_half(beam_body_inner); - ReduceDynamics get_kinetic_energy(beam_body); - - BodyRegionByParticle beam_left_stretch(beam_body, makeShared(createBeamLeftStretchShape())); - SimpleDynamics stretch_beam_left_end(beam_left_stretch); - BodyRegionByParticle beam_right_stretch(beam_body, makeShared(createBeamRightStretchShape())); - SimpleDynamics stretch_beam_right_end(beam_right_stretch); - BodyRegionByParticle beam_constrain(beam_body, makeShared(createConstrainBeamShape())); - SimpleDynamics constrain_beam_end(beam_constrain); - - InteractionDynamics beam_deformation_gradient_tensor(beam_body_inner); - DampingWithRandomChoice>> - damping(0.5, beam_body_inner, "Velocity", physical_viscosity); - - //----------------------------------------------------------------------------- - //outputs - //----------------------------------------------------------------------------- - - BodyStatesRecordingToVtp write_beam_states(io_environment, system.real_bodies_); - ReducedQuantityRecording> - write_total_mechanical_energy(io_environment, beam_body); - //---------------------------------------------------------------------- - // Setup computing and initial conditions. - //---------------------------------------------------------------------- - system.initializeSystemCellLinkedLists(); - system.initializeSystemConfigurations(); - beam_corrected_configuration.exec(); - - //---------------------------------------------------------------------- - // Setup computing time-step controls. - //---------------------------------------------------------------------- - int ite = 0; - int Dt_ite = 0; - Real End_Time = 100.0; - - Real D_Time = End_Time /100.0;//time step size for output file - Real Dt = End_Time /10000.0; /**< Time period for stretching */ - Real dt = 0.0; //default acoustic time step sizes - - // statistics for computing time - TickCount t1 = TickCount::now(); - TimeInterval interval; - //----------------------------------------------------------------------------- - //from here the time stepping begines - //----------------------------------------------------------------------------- - write_beam_states.writeToFile(0); - write_total_mechanical_energy.writeToFile(0); - - //computation loop starts - while (GlobalStaticVariables::physical_time_ < End_Time) - { - Real integration_time = 0.0; - //integrate time (loop) until the next output time - while (integration_time < D_Time) - { - Real relaxation_time = 0.0; - stretch_beam_left_end.exec(Dt); - stretch_beam_right_end.exec(Dt); - beam_deformation_gradient_tensor.exec(Dt); - Dt_ite ++; - - int stress_ite = 0; - Real refer_total_kinetic_energy = 10000.0; - while (relaxation_time < Dt) - { - if (refer_total_kinetic_energy > 0.005) - { - stress_relaxation_first_half.exec(dt); - constrain_beam_end.exec(dt); - damping.exec(Dt); - constrain_beam_end.exec(dt); - stress_relaxation_second_half.exec(dt); - - refer_total_kinetic_energy = get_kinetic_energy.exec() / refer_energy; - - ite++; - stress_ite++; - - dt = computing_time_step_size.exec(); - if (ite % 500 == 0) - { - std::cout << "N=" << ite << " Time: " - << GlobalStaticVariables::physical_time_ - << " Dt: " << Dt << " dt: " << dt - << " Dt:dt = " << Dt / dt << - "\n"; - } - } - relaxation_time += dt; - integration_time += dt; - GlobalStaticVariables::physical_time_ += dt; - } - - - std::cout << "refer_total_kinetic_energy " << refer_total_kinetic_energy - << " stress_ite " << stress_ite <