Skip to content

Commit

Permalink
Merge pull request #148 from UCBoulder/maint/remove-remaining-set_var…
Browse files Browse the repository at this point in the history
…name-values-in-tardigrade_hydraLinearElasticity

Maint/remove remaining set varname values in tardigrade hydra linear elasticity
  • Loading branch information
NateAM authored Jul 31, 2024
2 parents f2f7cd4 + 46c8e86 commit 3f191c7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/sphinx/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Internal Changes
- Removed set_varname and replaced with setDataStorage for linear elasticity (:pull:`145`). By `Nathan Miller`_.
- Removed set_varname and replaced with setDataStorage for the classical base classes (:pull:`146`). By `Nathan Miller`_.
- Removed malloc causing operations in tardigrade_hydra and tardigrade_hydraLinearElasticity (:pull:`147`). By `Nathan Miller`_.
- Removed additional set_varname like functions in linear elasticity (:pull:`148`). By `Nathan Miller`_.

******************
0.4.4 (07-12-2024)
Expand Down
34 changes: 22 additions & 12 deletions src/cpp/tardigrade_hydraLinearElasticity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ namespace tardigradeHydra{

setCauchyStress( false );

setStress( *get_cauchyStress( ) );
auto stress = get_setDataStorage_stress( );

*stress.value = *get_cauchyStress( );

}

Expand All @@ -580,7 +582,9 @@ namespace tardigradeHydra{

setCauchyStress( true );

setPreviousStress( *get_previousCauchyStress( ) );
auto previousStress = get_setDataStorage_previousStress( );

*previousStress.value = *get_previousCauchyStress( );

}

Expand Down Expand Up @@ -663,10 +667,12 @@ namespace tardigradeHydra{
/*!
* Set the residual value
*/

const secondOrderTensor *cauchyStress = getStress( );

TARDIGRADE_ERROR_TOOLS_CATCH( setResidual( *cauchyStress - *hydra->getStress( ) ) );
auto residual = get_setDataStorage_residual( );

const secondOrderTensor *stress = getStress( );

TARDIGRADE_ERROR_TOOLS_CATCH( *residual.value = *stress - *hydra->getStress( ) );

}

Expand All @@ -686,34 +692,36 @@ namespace tardigradeHydra{
const unsigned int num_unknowns = hydra->getNumUnknowns( );

// Form the Jacobian
floatVector jacobian = floatVector( sot_dim * num_unknowns, 0 );
auto jacobian = get_setDataStorage_jacobian( );

jacobian.zero( sot_dim * num_unknowns );

for ( unsigned int i = 0; i < dim; i++ ){

for ( unsigned int j = 0; j < dim; j++ ){

jacobian[ num_unknowns * dim * i + num_unknowns * j + dim * i + j ] = -1;
( *jacobian.value )[ num_unknowns * dim * i + num_unknowns * j + dim * i + j ] = -1;

for ( unsigned int I = 0; I < num_unknown_config_vars; I++ ){

jacobian[ num_unknowns * dim * i + num_unknowns * j + getStress( )->size( ) + I ] = ( *get_dCauchyStressdFn( ) )[ dim * num_unknown_config_vars * i + num_unknown_config_vars * j + I ];
( *jacobian.value )[ num_unknowns * dim * i + num_unknowns * j + getStress( )->size( ) + I ] = ( *get_dCauchyStressdFn( ) )[ dim * num_unknown_config_vars * i + num_unknown_config_vars * j + I ];

}

}

}

setJacobian( jacobian );

}

void residual::setdRdT( ){
/*!
* Set the derivative of the residual w.r.t. the temperature
*/

setdRdT( floatVector( *getNumEquations( ), 0 ) );
auto dRdT = get_setDataStorage_dRdT( );

dRdT.zero( *getNumEquations( ) );

}

Expand All @@ -722,7 +730,9 @@ namespace tardigradeHydra{
* Set the derivative of the residual w.r.t. the deformation gradient
*/

setdRdF( *get_dCauchyStressdF( ) );
auto dRdF = get_setDataStorage_dRdF( );

*dRdF.value = *get_dCauchyStressdF( );

}

Expand Down

0 comments on commit 3f191c7

Please sign in to comment.