From ce53e595e32198f60ba2fab3e91b2667b90b8449 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya <7856520+sunethwarna@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:15:46 +0100 Subject: [PATCH 1/9] Add SIApp to Linux CI --- .github/workflows/configure_research_applications.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/configure_research_applications.sh b/.github/workflows/configure_research_applications.sh index 298b1c83846e..af551ff4b5b8 100644 --- a/.github/workflows/configure_research_applications.sh +++ b/.github/workflows/configure_research_applications.sh @@ -40,6 +40,7 @@ add_app ${KRATOS_APP_DIR}/RANSApplication; add_app ${KRATOS_APP_DIR}/ShallowWaterApplication; add_app ${KRATOS_APP_DIR}/ShapeOptimizationApplication; add_app ${KRATOS_APP_DIR}/SwimmingDEMApplication; +add_app ${KRATOS_APP_DIR}/SystemIdentificationApplication; # Clean clear From fb9864d77253905873d5ce89aac4606946866de6 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Wed, 20 Nov 2024 11:22:24 +0100 Subject: [PATCH 2/9] fix warning --- .../custom_utilities/smooth_clamper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp index 692ec9bf0219..393b8ca6614c 100644 --- a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp +++ b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp @@ -98,7 +98,7 @@ ContainerExpression SmoothClamper::CalculateForw auto p_result_exp = LiteralFlatExpression::Create(number_of_entities, {}); - IndexPartition(number_of_entities).for_each([&p_result_exp, &r_input_exp, min, delta](const auto Index) { + IndexPartition(number_of_entities).for_each([&p_result_exp, &r_input_exp, delta](const auto Index) { const double x = r_input_exp.Evaluate(Index, Index, 0); double& value = *(p_result_exp->begin() + Index); if (x < 0.0) { From 2c86b6198d9f9d7eeabf50f3616791de29b07a14 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Thu, 21 Nov 2024 08:15:51 +0100 Subject: [PATCH 3/9] minor --- .../custom_utilities/smooth_clamper.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp index 393b8ca6614c..cadca12a6239 100644 --- a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp +++ b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp @@ -87,7 +87,6 @@ ContainerExpression SmoothClamper::CalculateForw // y = 3x^2 - 2x^3 // dy/dx = 3.2.x - 2.3.x^2 - const auto min = mMin; const auto delta = mMax - mMin; const auto& r_input_exp = rInput.GetExpression(); const auto number_of_entities = r_input_exp.NumberOfEntities(); From 1128ae90f2ea55aff3b0feb1cc46d0c2333630fd Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Fri, 10 Jan 2025 10:45:54 +0100 Subject: [PATCH 4/9] fix for windows tol failure --- .../tests/test_system_identification.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/SystemIdentificationApplication/tests/test_system_identification.py b/applications/SystemIdentificationApplication/tests/test_system_identification.py index 1ea3f43da52c..1845d0e73f6b 100644 --- a/applications/SystemIdentificationApplication/tests/test_system_identification.py +++ b/applications/SystemIdentificationApplication/tests/test_system_identification.py @@ -34,7 +34,7 @@ def test_SystemIdentification(self): "remove_output_file" : true, "comparison_type" : "csv_file", "tolerance" : 1e-2, - "relative_tolerance" : 1e-3, + "relative_tolerance" : 1e-2, "dimension" : 3 }""") CompareTwoFilesCheckProcess(params).Execute() From bde30c91019bdaad89cde815f5667e2225db2c33 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Tue, 14 Jan 2025 08:40:20 +0100 Subject: [PATCH 5/9] remove kratos_api --- .../custom_sensors/sensor_view.cpp | 6 +++--- .../custom_utilities/smooth_clamper.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/SystemIdentificationApplication/custom_sensors/sensor_view.cpp b/applications/SystemIdentificationApplication/custom_sensors/sensor_view.cpp index eb04b41469c5..cbbaef6687ff 100644 --- a/applications/SystemIdentificationApplication/custom_sensors/sensor_view.cpp +++ b/applications/SystemIdentificationApplication/custom_sensors/sensor_view.cpp @@ -142,8 +142,8 @@ void SensorView::PrintData(std::ostream& rOStream) const } // template insantiations -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SensorView; -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SensorView; -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SensorView; +template class SensorView; +template class SensorView; +template class SensorView; } /* namespace Kratos.*/ \ No newline at end of file diff --git a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp index cadca12a6239..b8b1459caea2 100644 --- a/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp +++ b/applications/SystemIdentificationApplication/custom_utilities/smooth_clamper.cpp @@ -155,8 +155,8 @@ ContainerExpression SmoothClamper::ProjectBackwa // template instantiations -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SmoothClamper; -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SmoothClamper; -template KRATOS_API(SYSTEM_IDENTIFICATION_APPLICATION) class SmoothClamper; +template class SmoothClamper; +template class SmoothClamper; +template class SmoothClamper; } /* namespace Kratos.*/ \ No newline at end of file From 260c5ebb2e0445079f749a4bd8987478755b455f Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Wed, 15 Jan 2025 09:02:22 +0100 Subject: [PATCH 6/9] fix test tolerance --- .../optimization_parameters.json | 5 ++++- .../system_identification_summary_ref.csv | 15 +++++++-------- .../tests/test_system_identification.py | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json index 3b146e15bf00..fbc480d402f3 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json @@ -124,7 +124,10 @@ "settings": { "output_file_name": "auxiliary_files/summary.csv", "write_kratos_version": false, - "write_time_stamp": false + "write_time_stamp": false, + "list_of_output_components": [ + "response_function.damage_response" + ] } } ] diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv index 371789691a66..787517380d93 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv @@ -3,18 +3,17 @@ # Timestamp : not_specified # ----------------------------------------------- # --------------- Initial values ---------------- -# algorithm: # damage_response: # initial_value: 7.924977798e-04 # ------------ End of initial values ------------ # ----------------------------------------------- # ------------ Start of step values ------------- # Headers: -# STEP, algorithm:std_obj_value, algorithm:rel_obj[%], algorithm:abs_obj[%], damage_response:value - 0, 7.924977798e-04, 0.000000000e+00, 0.000000000e+00, 7.924977798e-04 - 1, 7.578660738e-04, -4.369943603e+00, -4.369943603e+00, 7.578660738e-04 - 2, 7.244679929e-04, -4.406857889e+00, -8.584224288e+00, 7.244679929e-04 - 3, 6.922659728e-04, -4.444919640e+00, -1.264758206e+01, 6.922659728e-04 - 4, 6.612241562e-04, -4.484088173e+00, -1.656454150e+01, 6.612241562e-04 - 5, 6.313082940e-04, -4.524314774e+00, -2.033942428e+01, 6.313082940e-04 +# STEP, damage_response:value + 0, 7.924977798e-04 + 1, 7.578660738e-04 + 2, 7.244679929e-04 + 3, 6.922659728e-04 + 4, 6.612241562e-04 + 5, 6.313082940e-04 # End of file \ No newline at end of file diff --git a/applications/SystemIdentificationApplication/tests/test_system_identification.py b/applications/SystemIdentificationApplication/tests/test_system_identification.py index 1845d0e73f6b..264c996a9bab 100644 --- a/applications/SystemIdentificationApplication/tests/test_system_identification.py +++ b/applications/SystemIdentificationApplication/tests/test_system_identification.py @@ -33,8 +33,8 @@ def test_SystemIdentification(self): "output_file_name" : "auxiliary_files/summary.csv", "remove_output_file" : true, "comparison_type" : "csv_file", - "tolerance" : 1e-2, - "relative_tolerance" : 1e-2, + "tolerance" : 1e-8, + "relative_tolerance" : 1e-8, "dimension" : 3 }""") CompareTwoFilesCheckProcess(params).Execute() From 4098bb466c94a4d15a9e62e9ca0a7ff04c63f192 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Wed, 15 Jan 2025 11:04:24 +0100 Subject: [PATCH 7/9] minor --- .../tests/test_system_identification.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/SystemIdentificationApplication/tests/test_system_identification.py b/applications/SystemIdentificationApplication/tests/test_system_identification.py index 264c996a9bab..a77e50671429 100644 --- a/applications/SystemIdentificationApplication/tests/test_system_identification.py +++ b/applications/SystemIdentificationApplication/tests/test_system_identification.py @@ -33,8 +33,8 @@ def test_SystemIdentification(self): "output_file_name" : "auxiliary_files/summary.csv", "remove_output_file" : true, "comparison_type" : "csv_file", - "tolerance" : 1e-8, - "relative_tolerance" : 1e-8, + "tolerance" : 1e-6, + "relative_tolerance" : 1e-6, "dimension" : 3 }""") CompareTwoFilesCheckProcess(params).Execute() From ef35788df23632940d0444091aea9e9ffd2c062d Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Sun, 19 Jan 2025 15:23:16 +0100 Subject: [PATCH 8/9] tighten the overall test tolerances --- .../tests/test_system_identification.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/SystemIdentificationApplication/tests/test_system_identification.py b/applications/SystemIdentificationApplication/tests/test_system_identification.py index a77e50671429..7518810c406b 100644 --- a/applications/SystemIdentificationApplication/tests/test_system_identification.py +++ b/applications/SystemIdentificationApplication/tests/test_system_identification.py @@ -52,8 +52,8 @@ def test_SystemIdentificationPNorm(self): "output_file_name" : "auxiliary_files/summary_p_norm.csv", "remove_output_file" : true, "comparison_type" : "csv_file", - "tolerance" : 1e-2, - "relative_tolerance" : 1e-3, + "tolerance" : 1e-6, + "relative_tolerance" : 1e-6, "dimension" : 3 }""") CompareTwoFilesCheckProcess(params).Execute() From 5befa4604782d13f441927b722aaf31ce3d6dba8 Mon Sep 17 00:00:00 2001 From: Suneth Warnakulasuriya Date: Sun, 19 Jan 2025 15:23:27 +0100 Subject: [PATCH 9/9] change outputs and ref files --- .../optimization_parameters.json | 1 + .../optimization_parameters.json | 6 +++++- ...stem_identification_p_norm_summary_ref.csv | 20 +++++++------------ .../system_identification_summary_ref.csv | 15 +++++--------- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json index fbc480d402f3..39394202ba22 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification/optimization_parameters.json @@ -125,6 +125,7 @@ "output_file_name": "auxiliary_files/summary.csv", "write_kratos_version": false, "write_time_stamp": false, + "write_initial_values": false, "list_of_output_components": [ "response_function.damage_response" ] diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm/optimization_parameters.json b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm/optimization_parameters.json index b2903ff8c6a0..3a64a4e0a42a 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm/optimization_parameters.json +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm/optimization_parameters.json @@ -124,7 +124,11 @@ "settings": { "output_file_name": "auxiliary_files/summary_p_norm.csv", "write_kratos_version": false, - "write_time_stamp": false + "write_time_stamp": false, + "write_initial_values": false, + "list_of_output_components": [ + "response_function.damage_response" + ] } } ] diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm_summary_ref.csv b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm_summary_ref.csv index 13a44fc9fe69..beea8b7947ae 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm_summary_ref.csv +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_p_norm_summary_ref.csv @@ -2,19 +2,13 @@ # Kratos version: not_given # Timestamp : not_specified # ----------------------------------------------- -# --------------- Initial values ---------------- -# algorithm: -# damage_response: -# initial_value: 2.148297976e-04 -# ------------ End of initial values ------------ -# ----------------------------------------------- # ------------ Start of step values ------------- # Headers: -# STEP, algorithm:std_obj_value, algorithm:rel_obj[%], algorithm:abs_obj[%], damage_response:value - 0, 2.148297976e-04, 0.000000000e+00, 0.000000000e+00, 2.148297976e-04 - 1, 2.050244372e-04, -4.564245970e+00, -4.564245970e+00, 2.050244372e-04 - 2, 1.955625237e-04, -4.615017463e+00, -8.968622685e+00, 1.955625237e-04 - 3, 1.864375960e-04, -4.665989922e+00, -1.321613758e+01, 1.864375960e-04 - 4, 1.776430951e-04, -4.717128485e+00, -1.730984387e+01, 1.776430951e-04 - 5, 1.691723537e-04, -4.768404519e+00, -2.125284501e+01, 1.691723537e-04 +# STEP, damage_response:value + 0, 2.148297976e-04 + 1, 2.050244371e-04 + 2, 1.955625238e-04 + 3, 1.864375950e-04 + 4, 1.776430946e-04 + 5, 1.691723531e-04 # End of file \ No newline at end of file diff --git a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv index 787517380d93..fe5c5caa957b 100644 --- a/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv +++ b/applications/SystemIdentificationApplication/tests/auxiliary_files/system_identification_summary_ref.csv @@ -2,18 +2,13 @@ # Kratos version: not_given # Timestamp : not_specified # ----------------------------------------------- -# --------------- Initial values ---------------- -# damage_response: -# initial_value: 7.924977798e-04 -# ------------ End of initial values ------------ -# ----------------------------------------------- # ------------ Start of step values ------------- # Headers: # STEP, damage_response:value 0, 7.924977798e-04 - 1, 7.578660738e-04 - 2, 7.244679929e-04 - 3, 6.922659728e-04 - 4, 6.612241562e-04 - 5, 6.313082940e-04 + 1, 7.578660739e-04 + 2, 7.244679939e-04 + 3, 6.922659760e-04 + 4, 6.612241591e-04 + 5, 6.313082973e-04 # End of file \ No newline at end of file