26 template <
class TSparseSpace,
class TDenseSpace>
31 bool ResetDisplacements =
false,
34 : mpStrategy(std::move(strategy)),
35 mrModelPart(mpStrategy->GetModelPart()),
36 mResetDisplacements{ResetDisplacements},
37 mProjectParameters{rProjectParameters},
38 mWorkingDirectory{rWorkingDirectory}
55 const auto gid_output_settings =
56 mProjectParameters[
"output_processes"][
"gid_output"][0][
"Parameters"];
57 mWriter = std::make_unique<GeoOutputWriter>(
58 gid_output_settings, mWorkingDirectory.generic_string(), mrModelPart);
63 void Predict()
override { mpStrategy->Predict(); }
76 return static_cast<std::size_t
>(mrModelPart.
GetProcessInfo()[STEP]);
93 CopyNodalSolutionStepValues(DISPLACEMENT, index_of_old_value, index_of_new_value);
94 CopyNodalSolutionStepValues(WATER_PRESSURE, index_of_old_value, index_of_new_value);
95 CopyNodalSolutionStepValues(ROTATION, index_of_old_value, index_of_new_value);
100 if (mResetDisplacements) {
101 mOldTotalDisplacements.clear();
102 for (
const auto&
node : mrModelPart.
Nodes()) {
103 mOldTotalDisplacements.emplace_back(
node.GetSolutionStepValue(TOTAL_DISPLACEMENT));
110 if (mResetDisplacements) {
112 <<
"The number of old displacements (" << mOldTotalDisplacements.size()
113 <<
") does not match the current number of nodes (" << mrModelPart.
Nodes().size() <<
").";
114 std::size_t
count = 0;
116 node.GetSolutionStepValue(TOTAL_DISPLACEMENT) =
117 mOldTotalDisplacements[
count] +
node.GetSolutionStepValue(DISPLACEMENT);
126 const auto write_hydraulic_head_to_nodes =
false;
127 const auto gid_output_settings =
128 mProjectParameters[
"output_processes"][
"gid_output"][0][
"Parameters"];
129 mWriter->WriteGiDOutput(mrModelPart, gid_output_settings, write_hydraulic_head_to_nodes);
145 mWriter->FinalizeResults();
150 template <
typename TVariableType>
156 node.GetSolutionStepValue(rVariable, DestinationIndex) =
157 node.GetSolutionStepValue(rVariable, SourceIndex);
161 std::unique_ptr<SolvingStrategy<TSparseSpace, TDenseSpace>> mpStrategy;
163 bool mResetDisplacements;
164 std::vector<array_1d<double, 3>> mOldTotalDisplacements;
165 Parameters mProjectParameters;
167 std::unique_ptr<GeoOutputWriter> mWriter;
IndexType CloneTimeStep()
Definition: model_part.cpp:143
bool IsSubModelPart() const
Definition: model_part.h:1893
bool HasNodalSolutionStepVariable(VariableData const &ThisVariable) const
Definition: model_part.h:544
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ModelPart & GetRootModelPart()
Definition: model_part.cpp:510
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
std::size_t IndexType
The index type.
Definition: node.h:86
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
Definition: solving_strategy_wrapper.hpp:28
void AccumulateTotalDisplacementField() override
Definition: solving_strategy_wrapper.hpp:108
void FinalizeSolutionStep() override
Definition: solving_strategy_wrapper.hpp:140
void SaveTotalDisplacementFieldAtStartOfTimeLoop() override
Definition: solving_strategy_wrapper.hpp:98
~SolvingStrategyWrapper() override=default
size_t GetNumberOfIterations() const override
Definition: solving_strategy_wrapper.hpp:44
void InitializeOutput() override
Definition: solving_strategy_wrapper.hpp:53
size_t GetStepNumber() const override
Definition: solving_strategy_wrapper.hpp:74
void CloneTimeStep() override
Definition: solving_strategy_wrapper.hpp:81
void Initialize() override
Definition: solving_strategy_wrapper.hpp:51
SolvingStrategyWrapper(std::unique_ptr< SolvingStrategy< TSparseSpace, TDenseSpace >> strategy, bool ResetDisplacements=false, const std::filesystem::path &rWorkingDirectory="", const Parameters &rProjectParameters={})
Definition: solving_strategy_wrapper.hpp:30
void OutputProcess() override
Definition: solving_strategy_wrapper.hpp:123
double GetTimeIncrement() const override
Definition: solving_strategy_wrapper.hpp:67
void RestorePositionsAndDOFVectorToStartOfStep() override
Definition: solving_strategy_wrapper.hpp:87
void InitializeSolutionStep() override
Definition: solving_strategy_wrapper.hpp:61
void Predict() override
Definition: solving_strategy_wrapper.hpp:63
void SetTimeIncrement(double TimeIncrement) override
Definition: solving_strategy_wrapper.hpp:69
void IncrementStepNumber() override
Definition: solving_strategy_wrapper.hpp:79
TimeStepEndState::ConvergenceState SolveSolutionStep() override
Definition: solving_strategy_wrapper.hpp:133
void FinalizeOutput() override
Definition: solving_strategy_wrapper.hpp:142
double GetEndTime() const override
Definition: solving_strategy_wrapper.hpp:49
void SetEndTime(double EndTime) override
Definition: solving_strategy_wrapper.hpp:65
Definition: strategy_wrapper.hpp:23
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void UpdateCurrentPosition(const ModelPart::NodesContainerType &rNodes, const ArrayVarType &rUpdateVariable=DISPLACEMENT, const IndexType BufferPosition=0)
This method updates the current coordinates For each node, this method takes the value of the provide...
Definition: variable_utils.cpp:273
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
string path
Definition: DEM_run_all_benchmarks_analysis.py:10
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
int count
Definition: generate_frictional_mortar_condition.py:212
ConvergenceState
Definition: time_step_end_state.hpp:24
Definition: mesh_converter.cpp:38