Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GeoMechanicsApplycation] Settlement API #11701

Merged
merged 97 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
8c1fa6a
WPK first attempt time loop executor
WPK4FEM Sep 29, 2023
294c2ff
also complementary to WPK first attempt time loop executor
WPK4FEM Sep 29, 2023
bdcadbc
Removed yet unused things. Added first unit test: TimeLoopReturnsPerf…
WPK4FEM Oct 9, 2023
9f47ad5
Added a StrategyWrapper with an always converging solver strategy for…
WPK4FEM Oct 9, 2023
0bfebf1
Added constructor with convergence argument to DummySolverStrategy. A…
WPK4FEM Oct 9, 2023
afb17c5
Give time loop executor a TimeStepEndState to start from. Keep track …
WPK4FEM Oct 9, 2023
81000b3
Use the time step executor. ( only one available so default construct…
WPK4FEM Oct 10, 2023
767fb7c
Keep track of used number of cycles. Added tests using a test time in…
WPK4FEM Oct 10, 2023
5476cbd
Removed a few unused dummy classes for testing
avdg81 Oct 10, 2023
e74ad60
Test the time loop executor using a prescribed time incrementor
avdg81 Oct 10, 2023
3f491e8
Added the strategy wrapper as a member of the time loop executor
avdg81 Oct 10, 2023
712c6c0
When running the time loop, increment the step number
avdg81 Oct 10, 2023
79147cd
Added test for and implementation of CloneTimeStep, in the strategy w…
WPK4FEM Oct 11, 2023
ba64d48
Merge branch 'master' into settlement_test
rfaasse Oct 11, 2023
916242f
Added method and tests for RestorePositionsAndDOFVectorToStartOfStep …
WPK4FEM Oct 11, 2023
6bc0546
First implementation of the strategy wrapper implementation
rfaasse Oct 11, 2023
10cab94
Added unit tests for all non-trivial functionality of the wrapper
rfaasse Oct 12, 2023
4b42c62
Fix pipeline build
rfaasse Oct 12, 2023
9753302
SaveTotalDisplacementFieldAtStartOfStage and AccumulateTotalDisplacem…
WPK4FEM Oct 12, 2023
9ba7a26
OutputProcess implementation and unit test added to time_loop_executor.
WPK4FEM Oct 12, 2023
f98bb53
FinalizeSolutionStep should be called outside the cycle loop. This ch…
WPK4FEM Oct 12, 2023
19d600f
Small things from review by Richard adapted.
WPK4FEM Oct 12, 2023
90a341d
Pass on process observables from TimeLoopExecutor to TimeStepExecutor.
WPK4FEM Oct 12, 2023
46b2597
Less code repetition in test_time_loop_executor
WPK4FEM Oct 12, 2023
c071354
interface class for TimeLoopExecutor as requested in review by Richard.
WPK4FEM Oct 12, 2023
16eb498
merge from master
WPK4FEM Oct 12, 2023
a0feda0
Added all the new strategy wrapper functions
rfaasse Oct 12, 2023
b832147
forgotten interface.h
WPK4FEM Oct 12, 2023
588b0ed
Code smell remarks from SonarCloud almost all resolved
WPK4FEM Oct 13, 2023
5795628
Added UTs for Getters, setters and Save and Accumulate
rfaasse Oct 13, 2023
c76b7ff
Added output process to strategy wrapper
rfaasse Oct 13, 2023
ae70275
Added functionality for restore positions and dof vector
rfaasse Oct 13, 2023
dfcdffb
Implemented suggestions from review by Anne.
WPK4FEM Oct 13, 2023
e8d0b77
Last? SonarCloud code smell fixed
WPK4FEM Oct 13, 2023
82c2fa8
Added unit test Restoring DoFs
rfaasse Oct 13, 2023
a047569
Merge branch 'geo/time-step-loop' into geo/strategy_wrapper_implement…
rfaasse Oct 13, 2023
5c2fead
Merge time loop executor work into feature branch
rfaasse Oct 13, 2023
90bdea4
Added test
rfaasse Oct 13, 2023
4029007
Merge branch 'settlement_test' into geo/strategy_wrapper_implementation
rfaasse Oct 13, 2023
b2d1fe4
Added integration tests
rfaasse Oct 13, 2023
beb7582
Merge branch 'master' into geo/strategy_wrapper_implementation
Oct 16, 2023
afc373d
Add logging when new time step is executed
Oct 16, 2023
6e0e3f8
Added linear solvers application link to settlement and geomechanics
rfaasse Oct 16, 2023
87d09f8
Several small improvements
avdg81 Oct 13, 2023
209d454
Extracted copying of nodal solution step values
avdg81 Oct 14, 2023
663570c
Refactored and improved some unit tests
avdg81 Oct 14, 2023
163cd5a
Refactored and improved some unit tests
avdg81 Oct 14, 2023
6abdd37
Added the adaptive time incrementor to the settlement workflow
avdg81 Oct 14, 2023
1dd5fe1
Added a working solving strategy wrapper to the settlement workflow
avdg81 Oct 16, 2023
86ae6f4
The settlement workflow now tries to run the time loop executor
avdg81 Oct 16, 2023
8275307
Corrected a mistake when creating the linear solvers application
avdg81 Oct 16, 2023
28c7e23
Add degrees of freedom to after reading the `.mdpa` file
avdg81 Oct 16, 2023
7249981
Print lots of debug messages and fixed a few minor issues
avdg81 Oct 18, 2023
e83c1bd
Added missing gauss parameters to writing the output. The settlement …
rfaasse Oct 18, 2023
f5b66d9
Restored the conditions and several submodel parts
avdg81 Oct 18, 2023
da618e8
Made fix for option to omit hydraulic head at nodes and removed log f…
rfaasse Oct 18, 2023
2329d33
Added python res files
rfaasse Oct 18, 2023
596f7d4
Removed logging from core library
rfaasse Oct 20, 2023
de91a14
reverting core files to master state
rfaasse Oct 20, 2023
299df85
Create a computational model part
avdg81 Oct 19, 2023
9dfeef2
Fixed the times written to the GiD output files
avdg81 Oct 20, 2023
c6db0ff
Fix GCC build
rfaasse Oct 20, 2023
c96d8f6
Removed unnecessary logging
rfaasse Oct 20, 2023
4ac479b
Extracted duplicate code to fix build
rfaasse Oct 20, 2023
3049f37
Merge branch 'master' into geo/strategy_wrapper_implementation
rfaasse Oct 20, 2023
7f2c85b
Small fix after merge
rfaasse Oct 20, 2023
716abae
Introduced the spatial tables of Marjan into the settlement test model
WPK4FEM Oct 20, 2023
69160f6
Merge remote-tracking branch 'refs/remotes/origin/geo/strategy_wrappe…
WPK4FEM Oct 20, 2023
b0332f4
Reduced code smells
rfaasse Oct 20, 2023
b3a942e
GeoElementUtilities::CalculateNodalHydraulicHeadFromWaterPressures no…
WPK4FEM Oct 20, 2023
bb1d0f5
Merge remote-tracking branch 'refs/remotes/origin/geo/strategy_wrappe…
WPK4FEM Oct 20, 2023
f710f4e
Fixed several code smells reported by SonarQube
avdg81 Oct 20, 2023
1ed4d3e
Remove redundant print statement
rfaasse Oct 20, 2023
7c35575
Merge branch 'geo/strategy_wrapper_implementation' of github.com:Krat…
avdg81 Oct 20, 2023
cfd0b8f
Simplified the writing of integration point (and nodal) results
avdg81 Oct 20, 2023
0aa408f
Added copying properties
rfaasse Oct 23, 2023
6a126bc
removed redundant log file
rfaasse Oct 23, 2023
2b51bc5
Removed a redundant blank line
avdg81 Oct 23, 2023
568103c
Cleaning up
rfaasse Oct 23, 2023
41ead0a
Merge branch 'geo/strategy_wrapper_implementation' of https://github.…
rfaasse Oct 23, 2023
529506f
Moved settlement workflow test to integration suite of cpp tests
rfaasse Oct 23, 2023
fd90b0e
Reordered a few lines to make the flow more logical
avdg81 Oct 23, 2023
b57a5b6
Removing SQ issues
rfaasse Oct 23, 2023
9c5b4c1
Merge remote-tracking branch 'origin/geo/strategy_wrapper_implementat…
rfaasse Oct 23, 2023
9b119b2
Two minor enhancements
avdg81 Oct 23, 2023
1cb6b02
Removed several log statements
avdg81 Oct 23, 2023
5084658
Removed a redundant statement
avdg81 Oct 23, 2023
362af55
Removed a redundant destructor
avdg81 Oct 23, 2023
cd1e427
Added test for saving total replacements twice and other minor fixes
rfaasse Oct 23, 2023
cc0cc0a
Fix Codacy complaint
rfaasse Oct 23, 2023
708c35c
Fix UT
rfaasse Oct 23, 2023
3522d0f
Only run stage 1-3 in the workflow test, since stage 4 has known issues
rfaasse Oct 23, 2023
2c3373a
Merge branch 'master' into geo/strategy_wrapper_implementation
rfaasse Oct 24, 2023
60492ee
Possible fix for pipeline test failure
rfaasse Oct 25, 2023
c33b4de
Another attempt at fixing the pipeline test
rfaasse Oct 25, 2023
f6d565b
Skipping workflow test temporarily due to discussed pipeline issues
rfaasse Oct 25, 2023
0ebdfca
Disabling workflow test temporarily due to discussed pipeline issues
rfaasse Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion applications/GeoMechanicsApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ include(pybind11Tools)
add_compile_definitions(_USE_MATH_DEFINES)

kratos_add_dependency(${KRATOS_SOURCE_DIR}/applications/StructuralMechanicsApplication)
kratos_add_dependency(${KRATOS_SOURCE_DIR}/applications/LinearSolversApplication)

include_directories( ${CMAKE_SOURCE_DIR}/kratos )
include_directories( ${CMAKE_SOURCE_DIR}/applications/StructuralMechanicsApplication )
include_directories( ${CMAKE_SOURCE_DIR}/applications/LinearSolversApplication )
include_directories( ${CMAKE_SOURCE_DIR}/applications/GeoMechanicsApplication )

## GeoMechanics Core sources
Expand Down Expand Up @@ -40,7 +42,7 @@ endif(${KRATOS_BUILD_TESTING} MATCHES ON)
file(GLOB_RECURSE KRATOS_GEO_MECHANICS_APPLICATION_PYTHON_INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/custom_python/*.cpp)

add_library(KratosGeoMechanicsCore SHARED ${KRATOS_GEO_MECHANICS_APPLICATION_CORE} ${KRATOS_GEO_MECHANICS_APPLICATION_TESTING_SOURCES})
target_link_libraries(KratosGeoMechanicsCore PUBLIC KratosCore KratosStructuralMechanicsCore ${CMAKE_DL_LIBS})
target_link_libraries(KratosGeoMechanicsCore PUBLIC KratosCore KratosStructuralMechanicsCore KratosLinearSolversCore ${CMAKE_DL_LIBS})
set_target_properties(KratosGeoMechanicsCore PROPERTIES COMPILE_DEFINITIONS "GEO_MECHANICS_APPLICATION=EXPORT,API")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ void UPwSmallStrainElement<TDim,TNumNodes>::CalculateOnIntegrationPoints(const V
//Defining the shape functions, the Jacobian and the shape functions local gradients Containers
const Matrix& NContainer = rGeom.ShapeFunctionsValues( mThisIntegrationMethod );

const auto NodalHydraulicHead = GeoElementUtilities::CalculateNodalHydraulicHeadFromWaterPressures<TNumNodes>(rGeom, rProp);
const auto NodalHydraulicHead = GeoElementUtilities::CalculateNodalHydraulicHeadFromWaterPressures(rGeom, rProp);

//Loop over integration points
for ( unsigned int GPoint = 0; GPoint < NumGPoints; ++GPoint ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void SteadyStatePwPipingElement<TDim,TNumNodes>::
template< >
double SteadyStatePwPipingElement<2, 4>::CalculateHeadGradient(const PropertiesType& Prop, const GeometryType& Geom, double dx)
{
auto nodalHead = GeoElementUtilities::CalculateNodalHydraulicHeadFromWaterPressures<4>(Geom, Prop);
const auto nodalHead = GeoElementUtilities::CalculateNodalHydraulicHeadFromWaterPressures(Geom, Prop);
return std::abs((nodalHead[3] + nodalHead[0]) / 2 - (nodalHead[2] + nodalHead[1])/2) / dx;
}
template< >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ class ApplyK0ProcedureProcess : public Process
KRATOS_CATCH("")
}

std::string Info() const override
{
return "ApplyK0ProcedureProcess";
}

private:
ModelPart& mrModelPart;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,9 @@ void ApplyScalarConstraintTableProcess::ExecuteInitializeSolutionStep()
mProcess->ExecuteInitializeSolutionStep();
}

std::string ApplyScalarConstraintTableProcess::Info() const
{
return "ApplyScalarConstraintTableProcess";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) ApplyScalarConstraintTableProcess :
void ExecuteInitialize() override;
void ExecuteInitializeSolutionStep() override;

std::string Info() const override;

private:
void MakeInternalProcess(const Parameters& rProcessSettings);
void MakeProcessForFluidPressureType(const Parameters& rProcessSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ void ApplyVectorConstraintTableProcess::ExecuteInitializeSolutionStep()
}
}

std::string ApplyVectorConstraintTableProcess::Info() const
{
return "ApplyVectorConstraintTableProcess";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) ApplyVectorConstraintTableProcess :
void ExecuteInitialize() override;
void ExecuteInitializeSolutionStep() override;

std::string Info() const override;

private:
static std::vector<Parameters> CreateParametersForActiveComponents(const Parameters& rSettings);
static std::vector<char> ActiveComponents(const Parameters& rSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class BackwardEulerQuasistaticUPwScheme : public NewmarkQuasistaticUPwScheme<TSp

KRATOS_CATCH( "" )
}

std::string Info() const override
{
return "BackwardEulerQuasistaticUPwScheme";
}
}; // Class BackwardEulerQuasistaticUPwScheme

}
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,13 @@ typedef std::size_t IndexType;

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

template< unsigned int TNumNodes >
static array_1d<double, TNumNodes> CalculateNodalHydraulicHeadFromWaterPressures(const GeometryType& rGeom, const Properties& rProp)
static Vector CalculateNodalHydraulicHeadFromWaterPressures(const GeometryType& rGeom, const Properties& rProp)
{
const auto NumericalLimit = std::numeric_limits<double>::epsilon();
//Defining necessary variables
array_1d<double, TNumNodes> nodal_hydraulic_heads;
for (unsigned int node = 0; node < TNumNodes; ++node) {

Vector nodal_hydraulic_heads(rGeom.PointsNumber());
for (unsigned int node = 0; node < rGeom.PointsNumber(); ++node) {
array_1d<double, 3> node_volume_acceleration;
noalias(node_volume_acceleration) = rGeom[node].FastGetSolutionStepValue(VOLUME_ACCELERATION, 0);
const double g = norm_2(node_volume_acceleration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,31 @@ class SolvingStrategyFactory
KRATOS_ERROR_IF_NOT(rSolverSettings.Has(strategy_type))
<< "The parameter strategy_type is undefined, aborting.";

const auto echo_level = rSolverSettings["echo_level"].GetInt();

auto solver = LinearSolverFactory<TSparseSpace, TDenseSpace>().Create(rSolverSettings["linear_solver_settings"]);
KRATOS_ERROR_IF_NOT(solver) << "Failed to create a linear solver" << std::endl;

auto scheme = SchemeFactory<TSparseSpace, TDenseSpace>::Create(rSolverSettings);
KRATOS_ERROR_IF_NOT(scheme) << "Failed to create a scheme" << std::endl;

auto builder_and_solver = BuilderAndSolverFactory<TSparseSpace, TDenseSpace, TLinearSolver>::Create(rSolverSettings, solver);
KRATOS_ERROR_IF_NOT(builder_and_solver) << "Failed to create a builder-and-solver" << std::endl;
builder_and_solver->SetEchoLevel(echo_level);

auto criteria = ConvergenceCriteriaFactory<TSparseSpace, TDenseSpace>::Create(rSolverSettings);
KRATOS_ERROR_IF_NOT(criteria) << "Failed to create convergence criteria" << std::endl;
criteria->SetEchoLevel(echo_level);

if (rSolverSettings[strategy_type].GetString() ==
GeoMechanicsNewtonRaphsonStrategy<TSparseSpace, TDenseSpace, TLinearSolver>::Name())
if (rSolverSettings[strategy_type].GetString() == "newton_raphson")
{
const auto max_iterations = rSolverSettings["max_iterations"].GetInt();
const auto calculate_reactions = rSolverSettings["calculate_reactions"].GetBool();
const auto reform_dof_set_at_each_step = rSolverSettings["reform_dofs_at_each_step"].GetBool();
const auto move_mesh_flag = rSolverSettings["move_mesh_flag"].GetBool();

auto strategy_parameters = ExtractStrategyParameters(rSolverSettings);
return std::make_unique<GeoMechanicsNewtonRaphsonStrategy<TSparseSpace,
auto result = std::make_unique<GeoMechanicsNewtonRaphsonStrategy<TSparseSpace,
TDenseSpace,
TLinearSolver>>(rModelPart,
scheme,
Expand All @@ -62,6 +72,8 @@ class SolvingStrategyFactory
calculate_reactions,
reform_dof_set_at_each_step,
move_mesh_flag);
result->SetEchoLevel(echo_level);
return result;
}

return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ namespace Kratos

KratosGeoSettlement* CustomWorkflowFactory::CreateKratosGeoSettlement()
{
return new KratosGeoSettlement{std::make_unique<FileInputUtility>(), std::make_unique<JsonProcessInfoParser>(), {}};
return new KratosGeoSettlement{std::make_unique<FileInputUtility>(),
std::make_unique<JsonProcessInfoParser>(),
std::make_unique<TimeLoopExecutor>()};
}

}
Loading
Loading