-
Notifications
You must be signed in to change notification settings - Fork 248
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
[StructuralMechanicsApplication] Add initial state and stress calculation to truss element and constitutive law #12525
Merged
rfaasse
merged 11 commits into
master
from
geo/12496-add-initial-state-and-stress-calculation-to-trusses
Sep 4, 2024
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
57d346b
Added the addition of the initial state to the truss constitutive mod…
rfaasse 8788bf0
Reverted some refactoring steps because they give issues with the sco…
rfaasse 56024fe
Added a test for the calculation of the PK2 stress
rfaasse 67dc960
Refactored the additions to the truss element
rfaasse 1ab70da
Added pre-stress, to make it more comparable to the non-linear variant
rfaasse e4953a3
Cleaning up and making the prestress vector 1 length again
rfaasse a9d80a0
Changed license for the new test file
rfaasse a47d09f
Processed review comments and removed some empty statements (redundan…
rfaasse 2a93bc5
Add [[nodiscard]] to a few stub functions in the truss test
rfaasse 7e28fe4
Processing review comments
rfaasse efd8e60
Merge remote-tracking branch 'origin/master' into geo/12496-add-initi…
rfaasse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
65 changes: 65 additions & 0 deletions
65
applications/StructuralMechanicsApplication/tests/cpp_tests/test_truss_constitutive_law.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,65 @@ | ||
// KRATOS ___| | | | | ||
// \___ \ __| __| | | __| __| | | __| _` | | | ||
// | | | | | ( | | | | ( | | | ||
// _____/ \__|_| \__,_|\___|\__|\__,_|_| \__,_|_| MECHANICS | ||
// | ||
// License: BSD License | ||
// license: StructuralMechanicsApplication/license.txt | ||
// | ||
// Main authors: Richard Faasse | ||
// | ||
|
||
#include "structural_mechanics_fast_suite.h" | ||
#include "custom_constitutive/truss_constitutive_law.h" | ||
|
||
namespace Kratos::Testing | ||
{ | ||
|
||
KRATOS_TEST_CASE_IN_SUITE(TrussConstitutiveLaw_CalculatesLinearElasticStress, KratosStructuralMechanicsFastSuite) { | ||
TrussConstitutiveLaw law; | ||
ConstitutiveLaw::Parameters parameters; | ||
constexpr auto induced_strain = 0.005; | ||
Vector temp_strain = ScalarVector(1, induced_strain); | ||
Vector temp_stress = ZeroVector(1); | ||
parameters.SetStrainVector(temp_strain); | ||
parameters.SetStressVector(temp_stress); | ||
|
||
Properties properties; | ||
constexpr auto youngs_modulus = 1.0e6; | ||
properties[YOUNG_MODULUS] = youngs_modulus; | ||
parameters.SetMaterialProperties(properties); | ||
law.CalculateMaterialResponsePK2(parameters); | ||
|
||
constexpr double expected_stress = induced_strain * youngs_modulus; | ||
KRATOS_EXPECT_EQ(expected_stress, parameters.GetStressVector()[0]); | ||
} | ||
|
||
KRATOS_TEST_CASE_IN_SUITE(TrussConstitutiveLaw_CalculatesLinearElasticStress_WithInitialState, KratosStructuralMechanicsFastSuite) { | ||
TrussConstitutiveLaw law; | ||
constexpr auto induced_strain = 0.005; | ||
Vector temp_strain = ScalarVector(1, induced_strain); | ||
Vector temp_stress = ZeroVector(1); | ||
|
||
ConstitutiveLaw::Parameters parameters; | ||
parameters.SetStrainVector(temp_strain); | ||
parameters.SetStressVector(temp_stress); | ||
|
||
Properties properties; | ||
constexpr auto youngs_modulus = 1.0e6; | ||
properties[YOUNG_MODULUS] = youngs_modulus; | ||
parameters.SetMaterialProperties(properties); | ||
|
||
constexpr auto initial_stress = 5000.0; | ||
constexpr auto initial_strain = 0.01; | ||
const auto p_initial_state = Kratos::make_intrusive<InitialState>( | ||
ScalarVector(1, initial_strain), ScalarVector(1, initial_stress)); | ||
law.SetInitialState(p_initial_state); | ||
|
||
law.CalculateMaterialResponsePK2(parameters); | ||
|
||
constexpr double expected_stress = | ||
(induced_strain - initial_strain) * youngs_modulus + initial_stress; | ||
KRATOS_EXPECT_EQ(expected_stress, parameters.GetStressVector()[0]); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no initial strains? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we do not need it for our application at the moment, but added it now for completeness (as well as to the unit test)