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: Removed all calls to errorOut #180

Merged
merged 3 commits into from
Nov 25, 2024
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 @@ -46,6 +46,7 @@ Internal Changes
- Working towards improved convergence (:pull:`170`). By `Nathan Miller`_.
- Set the initial estimate of the plastic multiplier to be positive in the case of yielding (:pull:`174`). By `Nathan Miller`_.
- Added additional verbosity for debugging of the solves (:pull:`176`). By `Nathan Miller`_.
- Changed functions to remove errorOut (:pull:`180`). By `Nathan Miller`_.

Bug Fixes
=========
Expand Down
80 changes: 34 additions & 46 deletions src/cpp/tardigrade_hydra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,13 +1315,10 @@ namespace tardigradeHydra{

/// Say hello
/// @param message The message to print
errorOut sayHello( std::string message ) {
if ( message.compare( "George" ) == 0 ){
errorOut result = new errorNode( __func__, "ERROR: George is a wolf in sheep's clothing!");
return result;
}
void sayHello( std::string message ) {
TARDIGRADE_ERROR_TOOLS_CHECK( ( message.compare( "George" ) != 0 ), "ERROR: George is a wolf in sheep's clothing!");
std::cout << "Hello " << message << std::endl;
return NULL;
return;
}

const floatVector* hydraBase::getStress( ){
Expand Down Expand Up @@ -2915,31 +2912,24 @@ namespace tardigradeHydra{

}

errorOut dummyMaterialModel( floatVector &stress, floatVector &statev, floatMatrix &ddsdde, floatType &SSE, floatType &SPD,
floatType &SCD, floatType &RPL, floatVector &ddsddt, floatVector &drplde, floatType &DRPLDT,
const floatVector &strain, const floatVector &dstrain, const floatVector &time, const floatType &DTIME, const floatType &TEMP,
const floatType &DTEMP, const floatVector &predef, const floatVector &dpred, const std::string &cmname, const int &NDI,
const int &NSHR, const int &NTENS, const int &NSTATV, const floatVector &props, const int &NPROPS,
const floatVector &coords, const floatMatrix &drot, floatType &PNEWDT, const floatType &CELENT, const floatMatrix &dfgrd0,
const floatMatrix &dfgrd1, const int &NOEL, const int &NPT, const int &LAYER, const int &KSPT,
const std::vector< int > &jstep, const int &KINC ){
void dummyMaterialModel( floatVector &stress, floatVector &statev, floatMatrix &ddsdde, floatType &SSE, floatType &SPD,
floatType &SCD, floatType &RPL, floatVector &ddsddt, floatVector &drplde, floatType &DRPLDT,
const floatVector &strain, const floatVector &dstrain, const floatVector &time, const floatType &DTIME, const floatType &TEMP,
const floatType &DTEMP, const floatVector &predef, const floatVector &dpred, const std::string &cmname, const int &NDI,
const int &NSHR, const int &NTENS, const int &NSTATV, const floatVector &props, const int &NPROPS,
const floatVector &coords, const floatMatrix &drot, floatType &PNEWDT, const floatType &CELENT, const floatMatrix &dfgrd0,
const floatMatrix &dfgrd1, const int &NOEL, const int &NPT, const int &LAYER, const int &KSPT,
const std::vector< int > &jstep, const int &KINC ){
/*!
* A template Abaqus c++ UMAT using c++ STL types. Variables in all caps reference ABAQUS FORTRAN
* memory directly. Variables in lower case are native c++ type conversions stored separately from the original
* ABAQUS FORTRAN memory.
*/

//Call functions of constitutive model to do things
errorOut error = sayHello( "Abaqus" );

//Error handling
if ( error ){
errorOut result = new errorNode( __func__, "Error when calling sayHello" );
result->addNext( error );
return result;
}
TARDIGRADE_ERROR_TOOLS_CATCH( sayHello( "Abaqus" ) );

return NULL;
return;
}

void abaqusInterface( double *STRESS, double *STATEV, double *DDSDDE, double &SSE, double &SPD,
Expand All @@ -2955,9 +2945,6 @@ namespace tardigradeHydra{
* model's expected input, handles tensor shape changes, and calls a c++ material model.
*/

//Initialize error return codes
errorOut error = NULL;

//Provide a variable string message for error nodes
std::ostringstream message;

Expand Down Expand Up @@ -3001,26 +2988,27 @@ namespace tardigradeHydra{

//Call the constitutive model c++ interface
if ( KINC == 1 && NOEL == 1 && NPT == 1 ){
error = dummyMaterialModel( stress, statev, ddsdde, SSE, SPD,
SCD, RPL, ddsddt, drplde, DRPLDT,
strain, dstrain, time, DTIME, TEMP,
DTEMP, predef, dpred, cmname, NDI,
NSHR, NTENS, NSTATV, props, NPROPS,
coords, drot, PNEWDT, CELENT, dfgrd0,
dfgrd1, NOEL, NPT, LAYER, KSPT,
jstep, KINC );
}

//Error handling
if ( error ){
message.clear();
message << "ERROR:" << __FILENAME__ << "." << __func__ << ": Error when calling dummyMaterialModel.";
errorOut result = new errorNode( __func__, message.str( ) );
result->addNext( error );
error->print( true );
//If an error was thrown, but the ratio of new/current time increment is not updated, it was a fatal error.
if ( PNEWDT >= 1. ){
throw std::runtime_error( message.str( ) );

try{

dummyMaterialModel( stress, statev, ddsdde, SSE, SPD,
SCD, RPL, ddsddt, drplde, DRPLDT,
strain, dstrain, time, DTIME, TEMP,
DTEMP, predef, dpred, cmname, NDI,
NSHR, NTENS, NSTATV, props, NPROPS,
coords, drot, PNEWDT, CELENT, dfgrd0,
dfgrd1, NOEL, NPT, LAYER, KSPT,
jstep, KINC );

}
catch(std::exception &e){

if ( PNEWDT >= 1. ){

throw e;

}

}
}

Expand Down
6 changes: 2 additions & 4 deletions src/cpp/tardigrade_hydra.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ namespace tardigradeHydra{
const std::string __BASENAME__ = file_name(__FILE__); //!< The base filename which will be parsed
const std::string __FILENAME__ = __BASENAME__.substr(0, __BASENAME__.find_last_of(".")); //!< The parsed filename for error handling

typedef tardigradeErrorTools::Node errorNode; //!< Redefinition for the error node
typedef errorNode* errorOut; //!< Redefinition for a pointer to the error node
typedef double floatType; //!< Define the float values type.
typedef std::vector< floatType > floatVector; //!< Define a vector of floats
typedef std::vector< std::vector< floatType > > floatMatrix; //!< Define a matrix of floats
Expand Down Expand Up @@ -2046,7 +2044,7 @@ namespace tardigradeHydra{

/// Say hello
/// @param message The message to print
errorOut sayHello(std::string message);
void sayHello(std::string message);

void abaqusInterface( double *STRESS, double *STATEV, double *DDSDDE, double &SSE, double &SPD,
double &SCD, double &RPL, double *DDSDDT, double *DRPLDE, double &DRPLDT,
Expand All @@ -2057,7 +2055,7 @@ namespace tardigradeHydra{
const double *DFGRD1, const int &NOEL, const int &NPT, const int &LAYER, const int &KSPT,
const int *JSTEP, const int &KINC );

errorOut dummyMaterialModel( floatVector &stress, floatVector &statev, floatMatrix &ddsdde, floatType &SSE, floatType &SPD,
void dummyMaterialModel( floatVector &stress, floatVector &statev, floatMatrix &ddsdde, floatType &SSE, floatType &SPD,
floatType &SCD, floatType &RPL, floatVector &ddsddt, floatVector &drplde, floatType &DRPLDT,
const floatVector &strain, const floatVector &dstrain, const floatVector &time, const floatType &DTIME, const floatType &TEMP,
const floatType &DTEMP, const floatVector &predef, const floatVector &dpred, const std::string &cmname, const int &NDI,
Expand Down
Loading
Loading