-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GeoMechanicsApplication] Fix prescribed acceleration, velocity and d…
…t_water_pressure (#12208) This commit fixes the issue that the time integration schemes would overwrite values for prescribed acceleration/velocity/dt_water_pressure, even if these variables were 'Fixed'
- Loading branch information
Showing
26 changed files
with
3,344 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// Main authors: Richard Faasse | ||
// | ||
#include "node_utilities.h" | ||
#include "includes/node.h" | ||
#include "variables_utilities.hpp" | ||
|
||
#include <boost/range/combine.hpp> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace Kratos | ||
{ | ||
|
||
void NodeUtilities::AssignUpdatedVectorVariableToNonFixedComponents(Node& rNode, | ||
const Variable<array_1d<double, 3>>& rDestinationVariable, | ||
const array_1d<double, 3>& rNewValues) | ||
{ | ||
const std::vector<std::string> components = {"X", "Y", "Z"}; | ||
for (const auto& zipped : boost::combine(rNewValues, components)) { | ||
double new_value = 0.0; | ||
std::string component; | ||
boost::tie(new_value, component) = zipped; | ||
|
||
if (const auto& component_variable = | ||
VariablesUtilities::GetComponentFromVectorVariable(rDestinationVariable.Name(), component); | ||
!rNode.IsFixed(component_variable)) { | ||
rNode.FastGetSolutionStepValue(component_variable, 0) = new_value; | ||
} | ||
} | ||
} | ||
|
||
} // namespace Kratos |
31 changes: 31 additions & 0 deletions
31
applications/GeoMechanicsApplication/custom_utilities/node_utilities.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// Main authors: Richard Faasse | ||
// | ||
|
||
#pragma once | ||
|
||
#include "containers/array_1d.h" | ||
#include "containers/variable.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
class Node; | ||
|
||
class KRATOS_API(GEO_MECHANICS_APPLICATION) NodeUtilities | ||
{ | ||
public: | ||
static void AssignUpdatedVectorVariableToNonFixedComponents(Node& rNode, | ||
const Variable<array_1d<double, 3>>& rDestinationVariable, | ||
const array_1d<double, 3>& rNewValues); | ||
}; | ||
|
||
} // namespace Kratos |
32 changes: 32 additions & 0 deletions
32
applications/GeoMechanicsApplication/custom_utilities/variables_utilities.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// KRATOS___ | ||
// // ) ) | ||
// // ___ ___ | ||
// // ____ //___) ) // ) ) | ||
// // / / // // / / | ||
// ((____/ / ((____ ((___/ / MECHANICS | ||
// | ||
// License: geo_mechanics_application/license.txt | ||
// | ||
// | ||
// Main authors: Richard Faasse | ||
// | ||
|
||
#pragma once | ||
|
||
#include "variables_utilities.hpp" | ||
#include "includes/kratos_components.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
const Variable<double>& VariablesUtilities::GetComponentFromVectorVariable(const std::string& rSourceVariableName, | ||
const std::string& rComponent) | ||
{ | ||
const auto component_name = rSourceVariableName + "_" + rComponent; | ||
KRATOS_ERROR_IF_NOT(KratosComponents<Variable<double>>::Has(component_name)) | ||
<< "The component \"" << component_name << "\" is not registered!" << std::endl; | ||
|
||
return KratosComponents<Variable<double>>::Get(component_name); | ||
} | ||
|
||
} // namespace Kratos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.