Skip to content
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

Maint/remove remaining set varname values in tardigrade hydra linear elasticity #148

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading