-
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
Thermally coupled Constitutive Laws #9053
Merged
AlejandroCornejo
merged 157 commits into
master
from
thermal-solver-mechanical-coupling
Aug 31, 2023
Merged
Changes from 56 commits
Commits
Show all changes
157 commits
Select commit
Hold shift + click to select a range
a5b0b0b
minor
AlejandroCornejo 4e8a4ef
clear print
AlejandroCornejo ce31fdd
adding convective correctiion
AlejandroCornejo 7a350b5
Update applications/ConvectionDiffusionApplication/python_scripts/cou…
loumalouomega c2a4de9
print leftover
AlejandroCornejo 3edea79
using variable_utils for convective velocity
AlejandroCornejo 8d801f1
adding generic virtual method in base solid CL in SMA
AlejandroCornejo 41ebb4e
VariableUtils
loumalouomega adbe4e9
Merge branch 'thermal-solver-mechanical-coupling' of https://github.c…
AlejandroCornejo 6e8f8b6
Tabs
loumalouomega cadc48c
merge
AlejandroCornejo 0c7690d
accepting lowercase
AlejandroCornejo 463faaf
elastic 3d law modified
AlejandroCornejo 3dd0717
unused mat_props
AlejandroCornejo eae02ea
changinh plane strain
AlejandroCornejo ed081e9
clear spaces
AlejandroCornejo 05ec7be
plane stress
AlejandroCornejo 8653189
axysimmetric
AlejandroCornejo 778dee0
adding table interpolation in advanced constitutive laws utilities
AlejandroCornejo 76e06e2
adding comment in method
AlejandroCornejo b71f9ac
inverting order -> Reference TEMPERATURE
AlejandroCornejo b1568d8
more methods to the utils
AlejandroCornejo c1c4ccd
adding first thermal elastic 3d law
AlejandroCornejo 7371461
adding calculation methods
AlejandroCornejo 6cf902b
registering thermal law
AlejandroCornejo 283b655
minor strain type
AlejandroCornejo 3ea0f42
final details of the first thermal law
AlejandroCornejo 2110294
better looking logger
AlejandroCornejo 31bc1c4
clang issue
AlejandroCornejo 2f0ba7c
registering plane strain
AlejandroCornejo ace3bf3
minor original plane strain space
AlejandroCornejo 905e976
adding plane strain thermal
AlejandroCornejo a4b47fc
consistent ordering
AlejandroCornejo 18ef872
correct ordering of Solve in the Thermal and Structural
AlejandroCornejo 1e4c8ec
Update applications/ConstitutiveLawsApplication/custom_utilities/adva…
AlejandroCornejo d778296
Update applications/ConstitutiveLawsApplication/custom_utilities/adva…
AlejandroCornejo 08100ea
adding csome calculate values
AlejandroCornejo 5cbee8a
adding custom utilities to python in CLApp
AlejandroCornejo e24773e
adding blanck utility
AlejandroCornejo f0450f4
imprving the solver
AlejandroCornejo 29a84ab
not required in the end the python process
AlejandroCornejo 5d2c25f
solving REFERENCE_TEMP in CLs
AlejandroCornejo 747ce40
adding empty utilities container for the future
AlejandroCornejo 4b79eeb
registering thermal plane zstress
AlejandroCornejo 0cd5425
plane stress thermal cl
AlejandroCornejo b4c2486
missing overrides
AlejandroCornejo 1bbec1b
avoiding warning
AlejandroCornejo 561ff93
unused import
AlejandroCornejo e69eafb
Methods are access (not operators)
loumalouomega c17d339
Minor
loumalouomega 4ff5819
adding c++ test, 2d version
AlejandroCornejo 0bfeabe
unused includes
AlejandroCornejo 6d150eb
adding test with table interpolation
AlejandroCornejo 867739f
adding 3d case thermal with tables interpolation
AlejandroCornejo 41c5a5a
minor for checks
AlejandroCornejo 82bff15
removing virtual from utilities
AlejandroCornejo daf8aee
adding temperature table possibility for alpha
AlejandroCornejo 0beab1d
Merge branch 'master' into thermal-solver-mechanical-coupling
loumalouomega 3028750
[WIP] Function example
loumalouomega b5ca197
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 35897b0
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo df42254
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 90931ca
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo e571160
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo a2c1eb8
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo f4d113e
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 66c5d5e
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo f472dbd
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo f4a84f1
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo c812a74
updating Check method
AlejandroCornejo 19267e9
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo aae7b3a
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 2b28c16
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 4bf41b7
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo cf462a0
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 5728160
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo c70fdc2
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 7af8149
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 3f89009
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo cf4a941
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 47dfb06
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 5ad8caf
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo d53b386
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 04c65dc
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo d1b7d5b
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 6a4ab1e
unused print
AlejandroCornejo ddd313c
adding removed methods
AlejandroCornejo 5a22749
ne more
AlejandroCornejo 7eea18f
separated in cpp version
AlejandroCornejo e7c36a0
minor
AlejandroCornejo 23e97fb
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo dca539f
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 7bb9197
revert overhead in elastic ones
AlejandroCornejo 86c96c9
no longer used this way
AlejandroCornejo b7131b0
missing props
AlejandroCornejo 97502fa
exposing E and NU to be able to use accessor dependent props
AlejandroCornejo b028669
update damage
AlejandroCornejo 2c11d15
exposing properties and moving to utilities the calculation of PK2 st…
AlejandroCornejo 2e9ae9e
updating Thermal elastic 3D
AlejandroCornejo 0c4db4c
minor tab
AlejandroCornejo b524bf2
adapting plane stress
AlejandroCornejo ce917af
plane strain ok
AlejandroCornejo 4a8bdba
minor correction in plane strain
AlejandroCornejo 1320fbb
remove unused method and file
AlejandroCornejo 45dcfc0
remove include
AlejandroCornejo 2c99965
movign thermal CL
AlejandroCornejo eec1c63
more mving
AlejandroCornejo f663c92
cpp tests updated
AlejandroCornejo cd23846
corrected path
AlejandroCornejo 2597637
.
AlejandroCornejo ebcc1c3
comments
AlejandroCornejo 4514fad
trail whitespaces
AlejandroCornejo 9c7d388
better stream
AlejandroCornejo b7471f0
adding complete test case
AlejandroCornejo 6e49d77
tabs
AlejandroCornejo bee5ea5
adding test to convection diffusion app
AlejandroCornejo f3a1267
implementing everything in calculateSolutionStep
AlejandroCornejo f5cc3ca
using pragma once
AlejandroCornejo 435bc63
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo 4176b36
reduce size of mdpa
AlejandroCornejo 9dbb4dd
once
AlejandroCornejo 63ee514
unify namespaces
AlejandroCornejo 56ac970
removing unnecessary method
AlejandroCornejo 30743ee
only dynamic in lowercase
AlejandroCornejo 6839064
moving methods to private and add doxigen
AlejandroCornejo 5cd7892
consistent style
AlejandroCornejo 0cfece5
includes to cpp
AlejandroCornejo 5b80f4a
not typedef anymore
AlejandroCornejo 9b1cdf7
collapsing namespaces
AlejandroCornejo 3e597df
review advanced CL utilities
AlejandroCornejo 33e62ea
avoid repetition int he cpp test
AlejandroCornejo fbb447c
adding conv in thermal solve
AlejandroCornejo 15edd48
remove print
AlejandroCornejo 447e70c
reduced size mdpa
AlejandroCornejo b12c201
remove gid and vtk print settings in test
AlejandroCornejo 681a299
adding extra check for C
AlejandroCornejo 8672900
correcting header of utilities and style
AlejandroCornejo 1ef5613
chaging name test directory
AlejandroCornejo cf6dff0
moving CLs to its approppriate folder
AlejandroCornejo 8eb0498
update directory in json test
AlejandroCornejo 6c73a37
now we run only 5 steps intead of 50
AlejandroCornejo 1df441c
Minoor suggestions
loumalouomega 077db45
Merge branch 'master' into thermal-solver-mechanical-coupling
AlejandroCornejo d297a21
ading a virtual method to the thermal one 3d
AlejandroCornejo c091323
adapting plane strain to thermal
AlejandroCornejo a11482c
moving stuff to utilities and avoid repetition
AlejandroCornejo 60be0dd
with const expr
AlejandroCornejo 8715e8d
corrected
AlejandroCornejo 22e35f3
unused GetValue removed
AlejandroCornejo 232f7ee
iso dam ok
AlejandroCornejo 9484323
h of isodam
AlejandroCornejo 2ee1083
Revert "unused GetValue removed"
AlejandroCornejo 202a613
plane strain ok
AlejandroCornejo d4debc3
adding dimension to thermal plane strain
AlejandroCornejo a844ca8
updating plane stress
AlejandroCornejo a9e23d2
more generality to avoid breaking test in SMApp
AlejandroCornejo 546bd51
moving the test to a subfolder to be consistent
AlejandroCornejo 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
181 changes: 181 additions & 0 deletions
181
.../ConstitutiveLawsApplication/custom_constitutive_thermal/thermal_elastic_isotropic_3d.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,181 @@ | ||
// KRATOS ___ _ _ _ _ _ __ _ | ||
// / __\___ _ __ ___| |_(_) |_ _ _| |_(_)_ _____ / / __ ___ _____ /_\ _ __ _ __ | ||
// / / / _ \| '_ \/ __| __| | __| | | | __| \ \ / / _ \/ / / _` \ \ /\ / / __| //_\\| '_ \| '_ | | ||
// / /__| (_) | | | \__ \ |_| | |_| |_| | |_| |\ V / __/ /__| (_| |\ V V /\__ \/ _ \ |_) | |_) | | ||
// \____/\___/|_| |_|___/\__|_|\__|\__,_|\__|_| \_/ \___\____/\__,_| \_/\_/ |___/\_/ \_/ .__/| .__/ | ||
// |_| |_| | ||
// | ||
// License: BSD License | ||
// license: structural_mechanics_application/license.txt | ||
// | ||
// Main authors: Alejandro Cornejo | ||
// | ||
|
||
// System includes | ||
#include <iostream> | ||
|
||
// External includes | ||
|
||
// Project includes | ||
#include "custom_constitutive_thermal/thermal_elastic_isotropic_3d.h" | ||
|
||
#include "includes/checks.h" | ||
#include "structural_mechanics_application_variables.h" | ||
|
||
namespace Kratos | ||
{ | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
void ThermalElasticIsotropic3D::CalculateMaterialResponsePK2(ConstitutiveLaw::Parameters& rValues) | ||
{ | ||
KRATOS_TRY | ||
|
||
Flags& r_constitutive_law_options = rValues.GetOptions(); | ||
ConstitutiveLaw::StrainVectorType& r_strain_vector = rValues.GetStrainVector(); | ||
|
||
const bool use_elem_provided_flag_backup = r_constitutive_law_options.Is(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN); | ||
|
||
if (r_constitutive_law_options.IsNot(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN)) { | ||
// Since we are in small strains, any strain measure works, e.g. CAUCHY_GREEN | ||
CalculateCauchyGreenStrain(rValues, r_strain_vector); | ||
} | ||
|
||
// We add the thermal contribution | ||
AdvancedConstitutiveLawUtilities<6>::SubstractThermalStrain(r_strain_vector, mReferenceTemperature, rValues); | ||
|
||
// We force to use the already computed strain in the base CL | ||
r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, true); | ||
|
||
BaseType::CalculateMaterialResponsePK2(rValues); | ||
|
||
// We reset the flag | ||
r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, use_elem_provided_flag_backup); | ||
|
||
KRATOS_CATCH("") | ||
} | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
int ThermalElasticIsotropic3D::Check( | ||
const Properties& rMaterialProperties, | ||
const GeometryType& rElementGeometry, | ||
const ProcessInfo& rCurrentProcessInfo | ||
) | ||
{ | ||
KRATOS_ERROR_IF_NOT(rElementGeometry[0].SolutionStepsDataHas(TEMPERATURE)) << "The TEMPERATURE variable is not available at the nodes." << std::endl; | ||
KRATOS_ERROR_IF_NOT(rMaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT)) << "The THERMAL_EXPANSION_COEFFICIENT is not set in the material properties." << std::endl; | ||
KRATOS_ERROR_IF(rMaterialProperties[THERMAL_EXPANSION_COEFFICIENT] < 0.0) << "The THERMAL_EXPANSION_COEFFICIENT is negative..." << std::endl; | ||
KRATOS_ERROR_IF_NOT(rElementGeometry.Has(REFERENCE_TEMPERATURE) || rMaterialProperties.Has(REFERENCE_TEMPERATURE)) << "The REFERENCE_TEMPERATURE is not given in the material properties nor via SetValue()" << std::endl; | ||
BaseType::Check(rMaterialProperties, rElementGeometry, rCurrentProcessInfo); | ||
return 0; | ||
} | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
Vector& ThermalElasticIsotropic3D::CalculateValue( | ||
ConstitutiveLaw::Parameters& rParameterValues, | ||
const Variable<Vector>& rThisVariable, | ||
Vector& rValue | ||
) | ||
{ | ||
if (rThisVariable == STRAIN || | ||
rThisVariable == GREEN_LAGRANGE_STRAIN_VECTOR || | ||
rThisVariable == ALMANSI_STRAIN_VECTOR) { | ||
|
||
Flags& r_flags = rParameterValues.GetOptions(); | ||
|
||
// Previous flags saved | ||
const bool flag_const_tensor = r_flags.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR); | ||
const bool flag_stress = r_flags.Is(ConstitutiveLaw::COMPUTE_STRESS); | ||
|
||
// Set flags to only compute the strain | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_STRESS, false); | ||
|
||
ThermalElasticIsotropic3D::CalculateMaterialResponsePK2(rParameterValues); | ||
if (rValue.size() != GetStrainSize()) { | ||
rValue.resize(GetStrainSize()); | ||
} | ||
noalias(rValue) = rParameterValues.GetStrainVector(); | ||
|
||
// Previous flags restored | ||
r_flags.Set( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, flag_const_tensor ); | ||
r_flags.Set( ConstitutiveLaw::COMPUTE_STRESS, flag_stress ); | ||
|
||
} else if (rThisVariable == STRESSES || | ||
rThisVariable == CAUCHY_STRESS_VECTOR || | ||
rThisVariable == KIRCHHOFF_STRESS_VECTOR || | ||
rThisVariable == PK2_STRESS_VECTOR) { | ||
|
||
Flags& r_flags = rParameterValues.GetOptions(); | ||
|
||
// Previous flags saved | ||
const bool flag_const_tensor = r_flags.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR); | ||
const bool flag_stress = r_flags.Is(ConstitutiveLaw::COMPUTE_STRESS); | ||
|
||
// Set flags to only compute the stress | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_STRESS, true); | ||
|
||
ThermalElasticIsotropic3D::CalculateMaterialResponsePK2(rParameterValues); | ||
if (rValue.size() != GetStrainSize()) { | ||
rValue.resize(GetStrainSize()); | ||
} | ||
noalias(rValue) = rParameterValues.GetStressVector(); | ||
|
||
// Previous flags restored | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, flag_const_tensor); | ||
r_flags.Set(ConstitutiveLaw::COMPUTE_STRESS, flag_stress); | ||
} else if (rThisVariable == INITIAL_STRAIN_VECTOR) { | ||
if (this->HasInitialState()) { | ||
if (rValue.size() != GetStrainSize()) { | ||
rValue.resize(GetStrainSize()); | ||
} | ||
noalias(rValue) = GetInitialState().GetInitialStrainVector(); | ||
} else { | ||
noalias(rValue) = ZeroVector(0); | ||
} | ||
} | ||
return (rValue); | ||
} | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
double& ThermalElasticIsotropic3D::CalculateValue( | ||
ConstitutiveLaw::Parameters& rParameterValues, | ||
const Variable<double>& rThisVariable, double& rValue | ||
) | ||
{ | ||
if (rThisVariable == REFERENCE_TEMPERATURE) { | ||
rValue = mReferenceTemperature; | ||
} else { | ||
BaseType::CalculateValue(rParameterValues, rThisVariable, rValue); | ||
} | ||
return (rValue); | ||
} | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
void ThermalElasticIsotropic3D::InitializeMaterial( | ||
const Properties& rMaterialProperties, | ||
const GeometryType& rElementGeometry, | ||
const Vector& rShapeFunctionsValues | ||
) | ||
{ | ||
if (rElementGeometry.Has(REFERENCE_TEMPERATURE)) { | ||
mReferenceTemperature = rElementGeometry.GetValue(REFERENCE_TEMPERATURE); | ||
} else if (rMaterialProperties.Has(REFERENCE_TEMPERATURE)) { | ||
mReferenceTemperature = rMaterialProperties[REFERENCE_TEMPERATURE]; | ||
} | ||
} | ||
|
||
/***********************************************************************************/ | ||
/***********************************************************************************/ | ||
|
||
} // Namespace Kratos |
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.
For the sake of consistency with the rest of applications, I'd suggest to put the new constitutive models together with their corresponding base classes within the
custom_constitutive
folder.