KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
1.03k stars 245 forks source link

compute_drag_process #8698

Closed demetrafabris closed 3 years ago

demetrafabris commented 3 years ago

Description I'm studying the behaviour of a bridge deck immersede in a flow of wind. I used a 2D model made with GiD 14 and I set the drag considitions, but I obtained only forces (Fx, Fy, Fz) with the pre-set script (compute_body_fitted_drag_process) How can I obtained moments too? In particular I need Mz

philbucher commented 3 years ago

@rubenzorrilla @mpentek

riccardotosi commented 3 years ago

Hi,

You can use the compute_body_fitted_drag_and_moment_process of the ExaquteSandboxApplication application. This means that you have to add the application to your configure.sh and compile again.

Such a process computes both the drag force (Fx, Fy, Fz) and the moment (Mx, My, Mz). An example of usage is the following:

"auxiliar_process_list"            : [{
                "python_module" : "compute_body_fitted_drag_and_moment_process",
                "kratos_module" : "KratosMultiphysics.ExaquteSandboxApplication",
                "process_name"  : "ComputeBodyFittedDragAndMomentProcess",
                "Parameters"    : {
                    "model_part_name"        : "FluidModelPart.NoSlip3D_structure",
                    "write_drag_output_file" : true,
                    "output_file_settings" :{
                        "file_name":  "drag_time_series",
                        "folder_name": "drag"
                    },
                    "print_drag_to_screen"   : false,
                    "reference_point"        : [0.0,0.0,0.0],
                    "interval"               : [0.0,"End"]
                }
        }]

that should be added to your project parameters, replacing compute_body_fitted_drag_process.

The only differences with respect to compute_body_fitted_drag_process should be: python_module, kratos_module and reference_point, where the latter defines the coordinates around which to compute the moment.

I do not know if at the moment there are other possibilities to compute the moment. If so, feel free to follow other suggestions!

mpentek commented 3 years ago

There is the option from the Exaqute Sandbox above or also having your own python script. For now a PR is pending (see here https://github.com/KratosMultiphysics/Kratos/pull/8644) which will make this functionality available from the core. You could try that branch or create for you an own branch to work on.

demetrafabris commented 3 years ago
auxiliar_process_list"            : [{
                "python_module" : "compute_body_fitted_drag_and_moment_process",
                "kratos_module" : "KratosMultiphysics.ExaquteSandboxApplication",
                "process_name"  : "ComputeBodyFittedDragAndMomentProcess",
                "Parameters"    : {
                    "model_part_name"        : "FluidModelPart.NoSlip3D_structure",
                    "write_drag_output_file" : true,
                    "output_file_settings" :{
                        "file_name":  "drag_time_series",
                        "folder_name": "drag"
                    },
                    "print_drag_to_screen"   : false,
                    "reference_point"        : [0.0,0.0,0.0],
                    "interval"               : [0.0,"End"]
                }
        }]

When i try to compile the configure.sh again this appear in the terminal:

`-- The C compiler identification is GNU 10.2.0 -- The CXX compiler identification is GNU 10.2.0 -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/g++ -- Check for working CXX compiler: /usr/bin/g++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- No KRATOS_SOURCE_DIR is defined, using: /home/kratos/Kratos -- No KRATOS_BINARY_DIR is defined, using: /home/kratos/Kratos/build/Release -- No INSTALL_RUNKRATOS is defined, setting to ON -- No KRATOS_INSTALL_PYTHON_USING_LINKS is defined, setting to OFF -- No KRATOS_BUILD_TESTING is defined. Setting to ON -- No CMAKE_INSTALL_MESSAGE is defined. Setting to NEVER -- Found Git: /usr/bin/git (found version "2.27.0") -- additional default options were set for gcc -- CMAKE_CXX_FLAGS = -funroll-loops -Wall -std=c++11 -Wsuggest-override -- CMAKE_C_FLAGS = -funroll-loops -Wall -- CMAKE_SYSTEM_NAME = Linux -- Found PythonInterp: /usr/bin/python3 (found version "3.8.6") -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so -- Standard install dir /home/kratos/Kratos/bin/Release "KRATOS_SHARED_MEMORY_PARALLELIZATION" not defined, defaulting to "OpenMP" -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
Using OpenMP for shared memory parallelization -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0")
-- Boost Include: /usr/include -- Boost Linkdir: -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") -- AMatrix not found. Please define the AMATRIX_DIR pointing to the AMatrix root directory.

CMAKE_BUILD_TYPE ........ Release

WARNING: YOUR GIDPOST IS BEING COMPILED WITHOUT DEBUG (ALL ASSERTS WILL BE AVOIDED) -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Configuring applications (ENV): Adding application '/home/kratos/Kratos/scripts/../applications/LinearSolversApplication' configuring KratosLinearSolversApplication Adding application '/home/kratos/Kratos/scripts/../applications/StructuralMechanicsApplication' configuring KratosStructuralMechanicsApplication Adding application '/home/kratos/Kratos/scripts/../applications/FluidDynamicsApplication' configuring KratosFluidDynamicsApplication Adding application '/home/kratos/Kratos/scripts/../applications/StatisticsApplication' configuring KratosStatisticsApplication Adding application '/home/kratos/Kratos/scripts/../applications/ExaquteSandboxApplication' configuring KratosExaquteSandboxApplication


    LIST OF APPLICATIONS THAT ARE GOING TO BE COMPILED:

    LinearSolversApplication
    StructuralMechanicsApplication
    FluidDynamicsApplication
    StatisticsApplication
    ExaquteSandboxApplication

    APPLICATIONS ADDED TO COMPILATION THROUGH DEPENDENCIES:

List of upcoming api-breaking changes: Making variables non-copiable: https://github.com/KratosMultiphysics/Kratos/pull/6339 Deprecation of NOT_FLAGS : https://github.com/KratosMultiphysics/Kratos/pull/6233 Removing long deprecated conditions : https://github.com/KratosMultiphysics/Kratos/pull/6475 Changing 'FindNodalNeighboursProcess' constructor signature: https://github.com/KratosMultiphysics/Kratos/pull/4947 Minor update of import mechanism for applications: https://github.com/KratosMultiphysics/Kratos/pull/6556 Update of Element, Condition and Scheme Interface: https://github.com/KratosMultiphysics/Kratos/issues/7381 VariableComponent and VectorComponentAdaptor are no longer used: https://github.com/KratosMultiphysics/Kratos/pull/6686 -- triangle : /home/kratos/Kratos/external_libraries/triangle python libraries to be installed are: /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0 -- Configuring done -- Generating done -- Build files have been written to: /home/kratos/Kratos/build/Release gmake[1]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 1%] Built target triangle [ 2%] Built target gidpost [ 2%] Built target runkratos [ 2%] Built target KratosVersion gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 50%] Built target KratosCore gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' [ 51%] Built target KratosLinearSolversCore gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 51%] Built target KratosStatisticsCore gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' [ 59%] Built target Kratos Scanning dependencies of target KratosExaquteSandboxCore gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 77%] Built target KratosStructuralMechanicsCore gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' [ 77%] Built target KratosLinearSolversApplication gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 93%] Built target KratosFluidDynamicsCore gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 94%] Built target KratosStatisticsApplication gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' gmake[2]: Entering directory '/home/kratos/Kratos/build/Release' [ 95%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/exaqute_sandbox_application_variables.cpp.o [ 95%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/exaqute_sandbox_application.cpp.o gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' [ 97%] Built target KratosStructuralMechanicsApplication [ 97%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/custom_processes/weighted_divergence_calculation_process.cpp.o [ 98%] Built target KratosFluidDynamicsApplication [ 98%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/custom_processes/metrics_divergencefree_process.cpp.o /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp: In instantiation of ‘void Kratos::MetricDivergenceFreeProcess::InitializeRefinementStrategy() [with long unsigned int TDim = 2]’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:385:16: required from here /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:141:21: warning: unused variable ‘nodes_array’ [-Wunused-variable] 141 | NodesArrayType& nodes_array = mrThisModelPart.Nodes(); | ^~~ /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp: In instantiation of ‘void Kratos::MetricDivergenceFreeProcess::CalculateMetric() [with long unsigned int TDim = 2]’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:385:16: required from here /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:275:21: warning: unused variable ‘r_reference_norm’ [-Wunused-variable] 275 | const auto& r_reference_norm = KratosComponents<Variable>::Get(mMeanStrategyReferenceNorm); | ^~~~ /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp: In instantiation of ‘void Kratos::MetricDivergenceFreeProcess::InitializeRefinementStrategy() [with long unsigned int TDim = 3]’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:386:16: required from here /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:141:21: warning: unused variable ‘nodes_array’ [-Wunused-variable] 141 | NodesArrayType& nodes_array = mrThisModelPart.Nodes(); | ^~~ /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp: In instantiation of ‘void Kratos::MetricDivergenceFreeProcess::CalculateMetric() [with long unsigned int TDim = 3]’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:386:16: required from here /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/metrics_divergencefree_process.cpp:275:21: warning: unused variable ‘r_reference_norm’ [-Wunused-variable] 275 | const auto& r_reference_norm = KratosComponents<Variable>::Get(mMeanStrategyReferenceNorm); | ^~~~ [ 98%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/custom_processes/calculate_divergence_process.cpp.o /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/weighted_divergence_calculation_process.cpp: In member function ‘double Kratos::WeightedDivergenceCalculationProcess::ComputeAuxiliaryElementDivergence(Kratos::Vector&, Kratos::Vector&, Kratos::Vector&)’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/weighted_divergence_calculation_process.cpp:195:16: warning: ‘aux_current_divergence’ may be used uninitialized in this function [-Wmaybe-uninitialized] 195 | return aux_current_divergence; | ^~~~~~ /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/weighted_divergence_calculation_process.cpp: In member function ‘double Kratos::WeightedDivergenceCalculationProcess::ComputeAuxiliaryElementVelocitySeminorm(Kratos::Vector&, Kratos::Vector&, Kratos::Vector&)’: /home/kratos/Kratos/applications/ExaquteSandboxApplication/custom_processes/weighted_divergence_calculation_process.cpp:209:16: warning: ‘aux_current_velocity_seminorm’ may be used uninitialized in this function [-Wmaybe-uninitialized] 209 | return aux_current_velocity_seminorm; | ^~~~~~~~~ [ 98%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/custom_utilities/drag_and_moment_utilities.cpp.o [ 98%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/tests/cpp_tests/test_divergence_process.cpp.o [ 99%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/tests/cpp_tests/test_metric_process.cpp.o [ 99%] Building CXX object applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/tests/cpp_tests/test_weighted_divergence_calculation.cpp.o [ 99%] Linking CXX shared library libKratosExaquteSandboxCore.so /usr/bin/ld: cannot find -lKratosMeshingCore collect2: error: ld returned 1 exit status gmake[2]: [applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/build.make:208: applications/ExaquteSandboxApplication/libKratosExaquteSandboxCore.so] Error 1 gmake[2]: Leaving directory '/home/kratos/Kratos/build/Release' gmake[1]: [CMakeFiles/Makefile2:653: applications/ExaquteSandboxApplication/CMakeFiles/KratosExaquteSandboxCore.dir/all] Error 2 gmake[1]: Leaving directory '/home/kratos/Kratos/build/Release' `

Screenshot from 2021-05-03 15-50-11

What could be the problem?

riccardotosi commented 3 years ago

This could be fixed by adding the MeshingApplication to the configure.sh as well. The ExaquteSandboxApplication depends on the MeshingApplication. Let us know if it works with this change.

riccardotosi commented 3 years ago

Is it working now?

demetrafabris commented 3 years ago

Yes, now it's working. Thanks