Kratos
Kratos copied to clipboard
Adding VariableUtils method: SetHistoricalVariableToPreviousInfo
📝 Description
Adding a new VariableUtils
method:
template< class TType >
void SetHistoricalVariableToPreviousInfo(
const Variable< TType >& rVariable,
NodesContainerType& rNodes,
const int PreviousStep = 1)
{
KRATOS_TRY
block_for_each(rNodes, [&](Node<3> &rNode) {
rNode.FastGetSolutionStepValue(rVariable) = rNode.FastGetSolutionStepValue(rVariable, PreviousStep);
});
KRATOS_CATCH("")
}
This is closely related to https://github.com/KratosMultiphysics/Kratos/issues/4594
If I'm not wrong, the same can be achieved with the
CopyModelPartNodalVar
. Besides this synchronization is missing.
hmm checking this method, I think that the previous time step issue is missing... Maybe adding DestinationBuffStep
should be enough (we do not want equal BuffStep
in this case)
If I'm not wrong, the same can be achieved with the
CopyModelPartNodalVar
. Besides this synchronization is missing.hmm checking this method, I think that the previous time step issue is missing... Maybe adding
DestinationBuffStep
should be enough (we do not want equalBuffStep
in this case)
You're right. I'd do this for the sake of flexibility.
@AlejandroCornejo have you taken a look at these lines?
https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/python/add_model_part_to_python.cpp#L1012
https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/sources/model_part.cpp#L179
If needed, this can be exported to python:
.def("OverwriteSolutionStepData", [](){ModelPart::OverwriteSolutionStepData(1, 0);})
And this is also interesting: https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/sources/model_part.cpp#L190
@AlejandroCornejo have you taken a look at these lines?
https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/python/add_model_part_to_python.cpp#L1012
https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/sources/model_part.cpp#L179
If needed, this can be exported to python:
.def("OverwriteSolutionStepData", [](){ModelPart::OverwriteSolutionStepData(1, 0);})
And this is also interesting:
https://github.com/KratosMultiphysics/Kratos/blob/66535071233657434d36941d6492a48613573dc9/kratos/sources/model_part.cpp#L190
yeah! Some time ago I needed somethign like that, honestly I do not remember why hah
what is the status of this? @AlejandroCornejo @rubenzorrilla
the status is "forgotten" haha