From 268a905d3249700cb465bad57262bf255f582923 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Thu, 13 May 2021 16:38:12 +0200 Subject: [PATCH 01/57] adding new zerolength implex contact --- DEVELOPER/core/classTags.h | 1 + SRC/Makefile | 1 + .../FEM_ObjectBrokerAllClasses.cpp | 5 +- SRC/classTags.h | 1 + SRC/element/TclElementCommands.cpp | 13 +- SRC/element/zeroLength/Makefile | 1 + .../zeroLength/ZeroLengthImplexContact.cpp | 1084 +++++++++++++++++ .../zeroLength/ZeroLengthImplexContact.h | 234 ++++ SRC/interpreter/OpenSeesElementCommands.cpp | 2 + SRC/recorder/GmshRecorder.cpp | 1 + SRC/recorder/MPCORecorder.cpp | 1 + SRC/recorder/PVDRecorder.cpp | 1 + SRC/recorder/VTK_Recorder.cpp | 1 + Win32/proj/element/element.vcxproj | 2 + Win32/proj/element/element.vcxproj.filters | 6 + Win64/proj/element/element.vcxproj | 2 + Win64/proj/element/element.vcxproj.filters | 6 + 17 files changed, 1360 insertions(+), 2 deletions(-) create mode 100644 SRC/element/zeroLength/ZeroLengthImplexContact.cpp create mode 100644 SRC/element/zeroLength/ZeroLengthImplexContact.h diff --git a/DEVELOPER/core/classTags.h b/DEVELOPER/core/classTags.h index 3127735b5..3ebc8309a 100644 --- a/DEVELOPER/core/classTags.h +++ b/DEVELOPER/core/classTags.h @@ -721,6 +721,7 @@ #define ELE_TAG_NineNodeQuad 207 #define ELE_TAG_EightNodeQuad 208 #define ELE_TAG_SixNodeTri 209 +#define ELE_TAG_ZeroLengthImplexContact 215 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define FRN_TAG_Coulomb 1 #define FRN_TAG_VelDependent 2 diff --git a/SRC/Makefile b/SRC/Makefile index 88f91c169..c9520959a 100644 --- a/SRC/Makefile +++ b/SRC/Makefile @@ -472,6 +472,7 @@ ELE_LIBS = $(FE)/element/Element.o \ $(FE)/element/truss/N4BiaxialTruss.o \ $(FE)/element/zeroLength/ZeroLengthContact2D.o \ $(FE)/element/zeroLength/ZeroLengthContact3D.o \ + $(FE)/element/zeroLength/ZeroLengthImplexContact.o \ $(FE)/element/zeroLength/ZeroLengthContactNTS2D.o \ $(FE)/element/zeroLength/ZeroLengthInterface2D.o \ $(FE)/element/zeroLength/ZeroLengthRocking.o \ diff --git a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp index de4b7ef96..3c0311276 100644 --- a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp +++ b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp @@ -220,6 +220,7 @@ #include "zeroLength/ZeroLengthContact3D.h" #include "zeroLength/ZeroLengthContactNTS2D.h" #include "zeroLength/ZeroLengthInterface2D.h" +#include "zeroLength/ZeroLengthImplexContact.h" //#include "ZeroLengthND.h" #include "fourNodeQuad/FourNodeQuad.h" @@ -674,7 +675,9 @@ FEM_ObjectBrokerAllClasses::getNewElement(int classTag) case ELE_TAG_ZeroLengthContactNTS2D: return new ZeroLengthContactNTS2D(); - + + case ELE_TAG_ZeroLengthImplexContact: + return new ZeroLengthImplexContact(); //case ELE_TAG_ZeroLengthND: //return new ZeroLengthND(); diff --git a/SRC/classTags.h b/SRC/classTags.h index a492f930a..2ef09f5a6 100644 --- a/SRC/classTags.h +++ b/SRC/classTags.h @@ -776,6 +776,7 @@ #define ELE_TAG_BeamColumn2DwLHNMYS_Damage 211 #define ELE_TAG_MVLEM_3D 212 // Kristijan Kolozvari #define ELE_TAG_SFI_MVLEM_3D 213 // Kristijan Kolozvari +#define ELE_TAG_ZeroLengthImplexContact 215 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define ELE_TAG_ExternalElement 99990 diff --git a/SRC/element/TclElementCommands.cpp b/SRC/element/TclElementCommands.cpp index e18f20db0..dda371c86 100644 --- a/SRC/element/TclElementCommands.cpp +++ b/SRC/element/TclElementCommands.cpp @@ -185,6 +185,7 @@ extern void *OPS_RJWatsonEQS3d(void); extern void *OPS_RockingBC(void); extern void* OPS_LehighJoint2d(void); +extern void* OPS_ZeroLengthImplexContact(void); // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) extern int TclModelBuilder_addFeapTruss(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv, Domain*, TclModelBuilder *, int argStart); @@ -1431,6 +1432,16 @@ TclModelBuilderElementCommand(ClientData clientData, Tcl_Interp *interp, } } + else if (strcmp(argv[1], "zeroLengthImplexContact") == 0) { + void* theEle = OPS_ZeroLengthImplexContact(); + if (theEle != 0) + theElement = (Element*)theEle; + else { + opserr << "TclElementCommand -- unable to create element of type : " << argv[1] << endln; + return TCL_ERROR; + } + } + // if one of the above worked if (theElement != 0) { if (theTclDomain->addElement(theElement) == false) { @@ -1605,7 +1616,7 @@ TclModelBuilderElementCommand(ClientData clientData, Tcl_Interp *interp, opserr << "TCL -- unable to create element of type: " << argv[1] << endln; return TCL_ERROR; } - } + } else if ((strcmp(argv[1], "inelastic2dYS01")== 0) || (strcmp(argv[1], "inelastic2dYS02")== 0) || (strcmp(argv[1], "inelastic2dYS03")== 0) || diff --git a/SRC/element/zeroLength/Makefile b/SRC/element/zeroLength/Makefile index 92bb9261c..14fd17c6c 100644 --- a/SRC/element/zeroLength/Makefile +++ b/SRC/element/zeroLength/Makefile @@ -4,6 +4,7 @@ OBJS = ZeroLength.o \ ZeroLengthSection.o \ ZeroLengthContact2D.o \ ZeroLengthContact3D.o \ + ZeroLengthImplexContact.o \ ZeroLengthND.o \ ZeroLengthContactNTS2D.o \ ZeroLengthInterface2D.o \ diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp new file mode 100644 index 000000000..da8830f7e --- /dev/null +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp @@ -0,0 +1,1084 @@ +/* ****************************************************************** ** +** OpenSees - Open System for Earthquake Engineering Simulation ** +** Pacific Earthquake Engineering Research Center ** +** ** +** ** +** (C) Copyright 1999, The Regents of the University of California ** +** All Rights Reserved. ** +** ** +** Commercial use of this program without express permission of the ** +** University of California, Berkeley, is strictly prohibited. See ** +** file 'COPYRIGHT' in main directory for information on usage and ** +** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** +** ** +** Developed by: ** +** Frank McKenna (fmckenna@ce.berkeley.edu) ** +** Gregory L. Fenves (fenves@ce.berkeley.edu) ** +** Filip C. Filippou (filippou@ce.berkeley.edu) ** +** ** +** ****************************************************************** */ + +// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthImplexContact.cpp,v $ +// $Revision: 1.0 $ +// $Date: 2020-May $ + +// Written: Onur Deniz Akan (onur.akan@iusspavia.it) +// Dr. Massimo Petracca +// Prof. Guido Camata +// Prof. Enrico Spacone +// Prof. Carlo G. Lai +// +// Created: May 2020 +// +// Description: This file contains the implementation for the ZeroLengthImplexContact class. + +#include "ZeroLengthImplexContact.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + class GlobalStorage + { + public: + int size = 0; + Matrix K; // stiffness + Matrix K0; // initial stiffness + Matrix M; // mass + Matrix D; // damping + Vector U; // displacement + Vector R; // residual + + public: + GlobalStorage() = default; + GlobalStorage& resize(int N) { + if (N != size) { + K.resize(N, N); + K0.resize(N, N); + M.resize(N, N); + D.resize(N, N); + U.resize(N); + R.resize(N); + } + return *this; + } + }; + + static GlobalStorage& getGlobalStorage(int N) + { + static std::map gsmap; + return gsmap[N].resize(N); + } + + inline void cross(const Vector& A, const Vector& B, Vector& C) { + + C(0) = A(1) * B(2) - A(2) * B(1); + C(1) = A(2) * B(0) - A(0) * B(2); + C(2) = A(0) * B(1) - A(1) * B(0); + } +} + +void* OPS_ZeroLengthImplexContact(void) { + + double SmallNumber = 1.0e-6; + Element* theElement = nullptr; + + // some kudos + static int counter = 0; + if (++counter == 1) + opserr << "ZeroLengthImplexContact element - Implemented: Akan, OD., Petracca, M., Camata, G., Spacone, E. & Lai, CG. (2020)\n"; + + // model dimension + int ndm = OPS_GetNDM(); + if (ndm < 2 || ndm > 3) { + opserr << "ZeroLengthImplexContact: Unsupported NDM (" << ndm << "). It should be 2 or 3\n"; + return theElement; + } + + // a quick check on number of args + if (OPS_GetNumRemainingInputArgs() < 7) { + opserr << "ZeroLengthImplexContact: WARNING: too few arguments \n" << + "want - element zeroLengthImplexContact eleTag? iNode? jNode? Kn? Kt? mu? C? <-orient $x1 $x2 $x3> <-intType type?>\n"; + return theElement; + } + + // start with mandatory inputs + // read eleTag, iNode, jNode + int idata[3]; + int numdata = 3; + if (OPS_GetIntInput(&numdata, idata) < 0) { + opserr << "ZeroLengthImplexContact: WARNING: invalid int inputs\n"; + return theElement; + } + + // read Kn, Kt, mu + double ddata[3]; + numdata = 3; + if (OPS_GetDoubleInput(&numdata, ddata) < 0) { + opserr << "ZeroLengthImplexContact: WARNING: invalid double inputs\n"; + return theElement; + } + + // continue with optional inputs + Vector x_e(3); x_e(0) = 1.0; x_e(1) = 0.0; x_e(2) = 0.0; // initialize orientation vector + int integrationType = 0; // implicit by default + while (OPS_GetNumRemainingInputArgs() > 0) { + const char* inputstring = OPS_GetString(); + if (strcmp(inputstring, "-orient") == 0) { // #1 read global element orientation + if (ndm == 2) { + if (OPS_GetNumRemainingInputArgs() < 2) { + opserr << "ZeroLengthImplexContact: WARNING: insufficient orient values in 2D\n"; + return theElement; + } + numdata = 3; + if (OPS_GetDoubleInput(&numdata, &x_e(0)) < 0) { + opserr << "ZeroLengthImplexContact: WARNING: invalid double input after -orient\n"; + return theElement; + } + } + else if (ndm == 3) { + if (OPS_GetNumRemainingInputArgs() < 3) { + opserr << "ZeroLengthImplexContact: WARNING: insufficient orient values in 3D\n"; + return theElement; + } + numdata = 3; + if (OPS_GetDoubleInput(&numdata, &x_e(0)) < 0) { + opserr << "ZeroLengthImplexContact: WARNING: invalid double input after -orient\n"; + return theElement; + } + } + else { + opserr << "ZeroLengthImplexContact: WARNING: -orient: model dimension is invalid! \n"; + return theElement; + } + } + else if (strcmp(inputstring, "-intType") == 0) { // #2 read type of integration + numdata = 1; + if (OPS_GetIntInput(&numdata, &integrationType) < 0) { + opserr << "ZeroLengthImplexContact: WARNING: invalid integer after -intType\n"; + return theElement; + } + } + } + // input reading stage is complete + + // check integration type and pick implicit if neither 1 or 0 + if (integrationType != 1 && integrationType != 0) { + opserr << "ZeroLengthImplexContact: WARNING: type of integration is set to IMPLICIT due to invalid flag\n"; + integrationType = false; + } + // check the normal vector and normalize + if (x_e.Norm() < SmallNumber) { + opserr << "ZeroLengthImplexContact: WARNING: normal vector is NOT valid!: -orient $x1 $x2 $x3 cannot be < 0, 0, 0 >\n"; + return theElement; + } + x_e.Normalize(); // normalized it on input! + + // finally, create the element + theElement = new ZeroLengthImplexContact(idata[0], idata[1], idata[2], ddata[0], ddata[1], + ddata[2], ndm, integrationType, x_e[0], x_e[1], x_e[2]); + + if (theElement == 0) { + opserr << "WARNING: out of memory: element zeroLengthImplexContact " << idata[0] << + " iNode? jNode? Kn? Kt? mu? <-orient $x1 $x2 $x3> <-intType type?>\n"; + } + + return theElement; +} + +ZeroLengthImplexContact::ZeroLengthImplexContact(int tag, int Nd1, int Nd2, + double Kn, double Kt, double fcoeff, + int ndm, bool itype, double xN, double yN, double zN) + : Element(tag, ELE_TAG_ZeroLengthImplexContact) + , connectedExternalNodes(2) + , Knormal(Kn) + , Kfriction(Kt) + , mu(fcoeff) + , numDIM(ndm) + , use_implex(itype) +{ + connectedExternalNodes(0) = Nd1; + connectedExternalNodes(1) = Nd2; + Xorient[0] = xN; + Xorient[1] = yN; + Xorient[2] = zN; +} + +ZeroLengthImplexContact::ZeroLengthImplexContact() + : Element(0, ELE_TAG_ZeroLengthImplexContact) +{ +} + +ZeroLengthImplexContact::~ZeroLengthImplexContact() +{ +} + +int ZeroLengthImplexContact::getNumExternalNodes() const +{ + return 2; +} + +const ID& ZeroLengthImplexContact::getExternalNodes() +{ + return connectedExternalNodes; +} + +Node** ZeroLengthImplexContact::getNodePtrs() +{ + return theNodes.data(); +} + +int ZeroLengthImplexContact::getNumDOF() +{ + return numDOF[0] + numDOF[1]; +} + +void ZeroLengthImplexContact::setDomain(Domain* theDomain) +{ + // check Domain is not null - invoked when object removed from a domain + if (theDomain == 0) { + theNodes[0] = nullptr; + theNodes[1] = nullptr; + return; + } + + // first set the node pointers + int Nd1 = connectedExternalNodes(0); + int Nd2 = connectedExternalNodes(1); + theNodes[0] = theDomain->getNode(Nd1); + theNodes[1] = theDomain->getNode(Nd2); + + // check nodes + if ((theNodes[0] == nullptr) || (theNodes[1] == nullptr)) { + opserr << + "FATAL ERROR ZeroLengthImplexContact::setDomain() - Nd1: " << Nd1 << + " and/or Nd2: " << Nd2 << " do not exist in the model.\n"; + exit(-1); + } + + // check NDM + if (theNodes[0]->getCrds().Size() != numDIM || theNodes[1]->getCrds().Size() != numDIM) { + opserr << + "FATAL ERROR ZeroLengthImplexContact::setDomain() - Nd1: " << Nd1 << + " and/or Nd2: " << Nd2 << " have an incorrect number of coordinates.\n" + "Element NDM = " << numDIM << "\n" + "NDM at Nd1: " << theNodes[0]->getCrds().Size() << "\n" + "NDM at Nd2: " << theNodes[1]->getCrds().Size() << "\n"; + exit(-1); + } + + // now determine the number of dof and the dimension + numDOF[0] = theNodes[0]->getNumberDOF(); + numDOF[1] = theNodes[1]->getNumberDOF(); + + // check dofs + if (numDIM == 2) { + for (int i = 0; i < 2; ++i) { + int idof = numDOF[i]; + if (idof < 2 || idof > 3) { + opserr << + "FATAL ERROR ZeroLengthImplexContact::setDomain() - #DOFs (" + << idof << ") at node " << i + 1 + << " is not supported! it can be either 2 or 3\n"; + exit(-1); + } + } + } + else { + for (int i = 0; i < 2; ++i) { + int idof = numDOF[i]; + if ((idof != 3) && (idof != 4) && (idof != 6)) { + opserr << + "FATAL ERROR ZeroLengthImplexContact::setDomain() - #DOFs (" + << idof << ") at node " << i + 1 + << " is not supported! it can be either 3, 4 or 6\n"; + exit(-1); + } + } + } + + // compute the initial gap vector in global coordinates + // accounting for the geometrical gap and initial displacement + if (!gap0_initialized) { + const Vector& P0 = theNodes[0]->getCrds(); + const Vector& P1 = theNodes[1]->getCrds(); + const Vector& U0 = theNodes[0]->getTrialDisp(); + const Vector& U1 = theNodes[1]->getTrialDisp(); + gap0.Zero(); + for (int i = 0; i < numDIM; ++i) + gap0(i) = P1(i) + U1(i) - P0(i) - U0(i); + gap0_initialized = true; + } + + // call the base class method + DomainComponent::setDomain(theDomain); +} + +int ZeroLengthImplexContact::commitState(void) +{ + // do the implicit correction if impl-ex + if (use_implex) { + // get trial strain tensor at integration point in local crd. sys. + computeStrain(); + // update material internal variables + updateInternal(false, false); // explicit_phase?, do_tangent? + } + + // commit internal variables + sv.eps_commit = sv.eps; + sv.shear_commit = sv.shear; + sv.xs_commit_old = sv.xs_commit; + sv.xs_commit = sv.xs; + sv.rs_commit_old = sv.rs_commit; + sv.rs_commit = sv.rs; + sv.cres_commit_old = sv.cres_commit; + sv.cres_commit = sv.rs; + sv.PC_commit = sv.PC; + sv.dtime_n_commit = sv.dtime_n; + + // done + return 0; +} + +int ZeroLengthImplexContact::revertToLastCommit(void) +{ + // restore committed internal variables + sv.eps = sv.eps_commit; + sv.shear = sv.shear_commit; + sv.xs = sv.xs_commit; + sv.rs = sv.rs_commit; + sv.cres = sv.cres_commit; + sv.PC = sv.PC_commit; + sv.dtime_n = sv.dtime_n_commit; + + //done + return 0; +} + +int ZeroLengthImplexContact::revertToStart() +{ + // reset state variables + sv = StateVariables(); + // done + return 0; +} + +int ZeroLengthImplexContact::update() +{ + computeStrain(); + updateInternal(true, true); + return 0; +} + +const Matrix& ZeroLengthImplexContact::getTangentStiff() +{ + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + auto& stiff = gs.K; + const auto& C = sv.C; + formStiffnessMatrix(C, stiff); + return stiff; +} + +const Matrix& ZeroLengthImplexContact::getInitialStiff() +{ + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + auto& stiff = gs.K0; + static Matrix C0(3, 3); + + C0.Zero(); + const Vector& LGap = getInitialGap(); + double Un = LGap(0); // gap parallel to normal vector + if (use_implex) { // implex + C0 = sv.C; // send tangent instead + } + else { // implicit + if (Un <= LENTOL) { // send elastic stiffness, if contact + C0(0, 0) = Knormal; + C0(1, 1) = C0(2, 2) = Kfriction; + } + } + formStiffnessMatrix(C0, stiff); + return stiff; +} + +const Matrix& ZeroLengthImplexContact::getDamp() +{ + // get global storage for gloabl DOFset + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + gs.D.Zero(); + return gs.D; +} + +const Matrix& ZeroLengthImplexContact::getMass() +{ + // get global storage for global DOFset + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + gs.M.Zero(); + return gs.M; +} + +const Vector& ZeroLengthImplexContact::getResistingForce() { + + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + auto& R = gs.R; + + // stress vector in local coordinate system & local dof-set + const auto& F = sv.sig; + + // residual vector in local coordinate system & global dof-set + static Vector RL(6); + const Matrix& B = theBMatrix(); + RL.addMatrixTransposeVector(0.0, B, F, 1.0); + + // residual vector in global system, local DOFset + static Vector RG(6); + const Matrix& T2 = getRotationMatrix66(); + RG.addMatrixTransposeVector(0.0, T2, RL, 1.0); + + // compute global residual in global DOFset + R.Zero(); + int index = numDOF[0]; + for (int i = 0; i < numDIM; i++) { + R(i) = RG(i); + R(i + index) = RG(i + 3); + } + return R; +} + +const Vector& ZeroLengthImplexContact::getResistingForceIncInertia() +{ + return getResistingForce(); +} + +int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { + + int res = 0; + int dataTag = this->getDbTag(); + + // int data + static ID idata(10); + idata(0) = getTag(); + idata(1) = numDIM; + idata(2) = numDOF[0]; + idata(3) = numDOF[1]; + idata(4) = connectedExternalNodes[0]; + idata(5) = connectedExternalNodes[1]; + idata(6) = use_implex ? 1 : 0; + idata(7) = sv.dtime_is_user_defined ? 1 : 0; + idata(8) = sv.dtime_first_set ? 1 : 0; + idata(9) = gap0_initialized ? 1 : 0; + res = theChannel.sendID(dataTag, commitTag, idata); + if (res < 0) { + opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send ID\n"; + return -1; + } + + // double data + static Vector ddata(33); + ddata(1) = Knormal; + ddata(2) = Kfriction; + ddata(3) = mu; + ddata(4) = Xorient(0); + ddata(5) = Xorient(1); + ddata(6) = Xorient(2); + ddata(7) = sv.eps(0); + ddata(8) = sv.eps(1); + ddata(9) = sv.eps(2); + ddata(10) = sv.eps_commit(0); + ddata(11) = sv.eps_commit(1); + ddata(12) = sv.eps_commit(2); + ddata(13) = sv.shear(0); + ddata(14) = sv.shear(1); + ddata(15) = sv.shear_commit(0); + ddata(16) = sv.shear_commit(1); + ddata(17) = sv.xs; + ddata(18) = sv.xs_commit; + ddata(19) = sv.xs_commit_old; + ddata(20) = sv.rs; + ddata(21) = sv.rs_commit; + ddata(22) = sv.rs_commit_old; + ddata(23) = sv.cres; + ddata(24) = sv.cres_commit; + ddata(25) = sv.cres_commit_old; + ddata(26) = sv.PC; + ddata(27) = sv.PC_commit; + ddata(28) = sv.dtime_n; + ddata(29) = sv.dtime_n_commit; + ddata(30) = gap0(0); + ddata(31) = gap0(1); + ddata(32) = gap0(2); + res = theChannel.sendVector(dataTag, commitTag, ddata); + if (res < 0) { + opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send Vector\n"; + return -1; + } + + // done + return 0; +} + +int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_ObjectBroker& theBroker) { + + int res; + int dataTag = this->getDbTag(); + + // int data + static ID idata(10); + res = theChannel.recvID(dataTag, commitTag, idata); + if (res < 0) { + opserr << "WARNING ZeroLengthImplexContact::recvSelf() - failed to receive ID\n"; + return -1; + } + setTag(idata(0)); + numDIM = idata(1); + numDOF[0] = idata(2); + numDOF[1] = idata(3); + connectedExternalNodes[0] = idata(4); + connectedExternalNodes[1] = idata(5); + use_implex = idata(6) == 1; + sv.dtime_is_user_defined = idata(7) == 1; + sv.dtime_first_set = idata(8) == 1; + gap0_initialized = idata(9) == 1; + + // double data + static Vector ddata(33); + res = theChannel.recvVector(dataTag, commitTag, ddata); + if (res < 0) { + opserr << "WARNING ZeroLengthImplexContact::recvSelf() - failed to receive Vector\n"; + return -1; + } + Knormal = ddata(1); + Kfriction = ddata(2); + mu = ddata(3); + Xorient(0) = ddata(4); + Xorient(1) = ddata(5); + Xorient(2) = ddata(6); + sv.eps(0) = ddata(7); + sv.eps(1) = ddata(8); + sv.eps(2) = ddata(9); + sv.eps_commit(0) = ddata(10); + sv.eps_commit(1) = ddata(11); + sv.eps_commit(2) = ddata(12); + sv.shear(0) = ddata(13); + sv.shear(1) = ddata(14); + sv.shear_commit(0) = ddata(15); + sv.shear_commit(1) = ddata(16); + sv.xs = ddata(17); + sv.xs_commit = ddata(18); + sv.xs_commit_old = ddata(19); + sv.rs = ddata(20); + sv.rs_commit = ddata(21); + sv.rs_commit_old = ddata(22); + sv.cres = ddata(23); + sv.cres_commit = ddata(24); + sv.cres_commit_old = ddata(25); + sv.PC = ddata(26); + sv.PC_commit = ddata(27); + sv.dtime_n = ddata(28); + sv.dtime_n_commit = ddata(29); + gap0(0) = ddata(30); + gap0(1) = ddata(31); + gap0(2) = ddata(32); + + return 0; +} + +int ZeroLengthImplexContact::displaySelf(Renderer& theViewer, int displayMode, float fact, const char** modes, int numMode) +{ + if (theNodes[0] == 0 || theNodes[1] == 0) + return 0; + + static Vector v1(3); + static Vector v2(3); + float d1 = 1.0; + + theNodes[0]->getDisplayCrds(v1, 0.); + theNodes[1]->getDisplayCrds(v2, 0.); + return theViewer.drawPoint(v1, d1, 10); +} + +void ZeroLengthImplexContact::Print(OPS_Stream& strm, int flag) { + + if (flag == 0) { + strm << "Element: " << this->getTag(); + strm << " type: ZeroLengthImplexContact iNode: " << connectedExternalNodes(0); + strm << " jNode: " << connectedExternalNodes(1) << endln; + } + else if (flag == 1) { + strm << this->getTag() << endln; + } +} + +Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_Stream& output) +{ + Response* theResponse = nullptr; + + output.tag("ElementOutput"); + output.attr("eleType", "zeroLengthImplexContact"); + output.attr("eleTag", this->getTag()); + output.attr("node1", connectedExternalNodes[0]); + output.attr("node2", connectedExternalNodes[1]); + + auto lam_open_gauss = [&output]() { + output.tag("GaussPoint"); + output.attr("number", 1); + output.attr("eta", 0.0); + + output.tag("NdMaterialOutput"); + output.attr("classType", 0); + output.attr("tag", 0); + }; + auto lam_close_gauss = [&output]() { + output.endTag(); // GaussPoint + output.endTag(); // NdMaterialOutput + }; + + // results which depend on the dimension + if (numDIM == 2) { + if (strcmp(argv[0], "force") == 0 || strcmp(argv[0], "forces") == 0) { + output.tag("ResponseType", "Px_1"); + output.tag("ResponseType", "Py_1"); + output.tag("ResponseType", "Px_2"); + output.tag("ResponseType", "Py_2"); + theResponse = new ElementResponse(this, 1, Vector(4)); + } + else if (strcmp(argv[0], "displacement") == 0 || strcmp(argv[0], "dispJump") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "dUx"); + output.tag("ResponseType", "dUy"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 2, Vector(2)); + } + else if (strcmp(argv[0], "localForce") == 0 || strcmp(argv[0], "localForces") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "N"); + output.tag("ResponseType", "Tx"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 3, Vector(2)); + } + else if (strcmp(argv[0], "localDisplacement") == 0 || strcmp(argv[0], "localDispJump") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "dUN"); + output.tag("ResponseType", "dUTx"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 4, Vector(2)); + } + } + else { + if (strcmp(argv[0], "force") == 0 || strcmp(argv[0], "forces") == 0) { + output.tag("ResponseType", "Px_1"); + output.tag("ResponseType", "Py_1"); + output.tag("ResponseType", "Pz_1"); + output.tag("ResponseType", "Px_2"); + output.tag("ResponseType", "Py_2"); + output.tag("ResponseType", "Pz_2"); + + theResponse = new ElementResponse(this, 1, Vector(6)); + } + else if (strcmp(argv[0], "displacement") == 0 || strcmp(argv[0], "dispJump") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "dUx"); + output.tag("ResponseType", "dUy"); + output.tag("ResponseType", "dUz"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 2, Vector(3)); + } + else if (strcmp(argv[0], "localForce") == 0 || strcmp(argv[0], "localForces") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "N"); + output.tag("ResponseType", "Tx"); + output.tag("ResponseType", "Ty"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 3, Vector(3)); + } + else if (strcmp(argv[0], "localDisplacement") == 0 || strcmp(argv[0], "localDispJump") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "dUN"); + output.tag("ResponseType", "dUTx"); + output.tag("ResponseType", "dUTy"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 4, Vector(3)); + } + } + + // other results + if (theResponse == nullptr) { + if ((strcmp(argv[0], "slip") == 0) || (strcmp(argv[0], "slipMultiplier") == 0)) { + lam_open_gauss(); + output.tag("ResponseType", "lambda"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 5, Vector(1)); + } + else if ((strcmp(argv[0], "NormalContactForce") == 0) || (strcmp(argv[0], "normalContactForce") == 0)) { + lam_open_gauss(); + output.tag("ResponseType", "N"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 6, Vector(1)); + } + else if ((strcmp(argv[0], "TangentialContactForce") == 0) || (strcmp(argv[0], "tangentialContactForce") == 0)) { + lam_open_gauss(); + output.tag("ResponseType", "|T|"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 7, Vector(1)); + } + } + + output.endTag(); // ElementOutput + return theResponse; +} + +int ZeroLengthImplexContact::getResponse(int responseID, Information& eleInfo) { + + auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); + static Vector small(numDIM); + static Vector large(2 * numDIM); + static Vector scalar(1); + + if (responseID == 1) { + // global contact forces + const Vector& nodeForces = this->getResistingForce(); + for (int i = 0; i < numDIM; i++) + { + large(i) = nodeForces(i); + large(i + numDIM) = nodeForces(i + numDOF[0]); + } + return eleInfo.setVector(large); + } + else if (responseID == 2) { + // global displacement jump + const Matrix& T1 = getRotationMatrix33(); + static Vector dU(3); + dU.addMatrixTransposeVector(0.0, T1, sv.eps, 1.0); + for (int i = 0; i < numDIM; i++) { + small(i) = dU(i); + } + return eleInfo.setVector(small); + } + else if (responseID == 3) { + // local contact forces + for (int i = 0; i < numDIM; i++) { + small(i) = sv.sig(i); + } + return eleInfo.setVector(small); + } + else if (responseID == 4) { + // local displacement jump + for (int i = 0; i < numDIM; i++) { + small(i) = sv.eps(i); + } + return eleInfo.setVector(small); + } + else if (responseID == 5) { + // material slip multiplier + scalar(0) = sv.xs; + return eleInfo.setVector(scalar); + } + else if (responseID == 6) { + // normal contanct force + scalar(0) = sv.sig(0); + return eleInfo.setVector(scalar); + } + else if (responseID == 7) { + // tangential contanct force norm + scalar(0) = std::sqrt(sv.sig(1)*sv.sig(1) + sv.sig(2)*sv.sig(2)); + return eleInfo.setVector(scalar); + } + else { + return -1; + } +} + +int ZeroLengthImplexContact::updateParameter(int parameterID, double value) +{ + if (parameterID == 1) { + // set user defined current time increment + // this is useful for rate dependency in implicit mode and for the implex model + // when using arc length or displacement control methods, where the pseudo time step + // is actually the load factor. + // if when this variable is first set or when it is set before the first commit + // we set the committed variable to the same value + sv.dtime_n = value; + if (!sv.dtime_first_set) { + sv.dtime_n_commit = sv.dtime_n; + sv.dtime_first_set = true; + } + sv.dtime_is_user_defined = true; + } + // done + return 0; +} + +const Matrix& ZeroLengthImplexContact::getRotationMatrix33() +{ + static Matrix T(3, 3); + + // initialize orthogonal vectors to Xorient + static Vector rY(3); + static Vector rZ(3); + + // create global Y and Z axes + // static and initialized only once + auto make3DVector = [](double x, double y, double z) { + Vector v(3); + v(0) = x; + v(1) = y; + v(2) = z; + return v; + }; + static Vector gY = make3DVector(0.0, 1.0, 0.0); // global Y axis + static Vector gZ = make3DVector(0.0, 0.0, 1.0); // global Z axis + + // compute two orthonal vectors to Xorient + if (fabs(Xorient ^ gY) < 0.99) { // assume X is not parallel to global Y + cross(Xorient, gY, rZ); + rZ.Normalize(); + cross(rZ, Xorient, rY); + rY.Normalize(); + } + else { // if not, assume X is not parallel to global Z + cross(Xorient, gZ, rY); + rY.Normalize(); + cross(rY, Xorient, rZ); + rZ.Normalize(); + } + + // fill the local 3x3 orientation matrix (transpoed of rotation matrix) + for (int j = 0; j < 3; j++) { + T(0, j) = Xorient(j); + T(1, j) = rY(j); + T(2, j) = rZ(j); + } + + return T; +} + +const Matrix& ZeroLengthImplexContact::getRotationMatrix66() +{ + static Matrix T2(6, 6); + T2.Zero(); + + const Matrix& T1 = getRotationMatrix33(); + + for (int q = 0; q < 2; ++q) { + int index = q * 3; + for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) + T2(index + i, index + j) = T1(i, j); + } + + return T2; +} + +const Vector& ZeroLengthImplexContact::getInitialGap() +{ + // compute local gap vector + static Vector LGap(3); + const Matrix& T1 = getRotationMatrix33(); + LGap.addMatrixVector(0.0, T1, gap0, 1.0); + return LGap; +} + +void ZeroLengthImplexContact::computeStrain() +{ + // get global displacement for global DOFset + const Vector& U1 = theNodes[0]->getTrialDisp(); + const Vector& U2 = theNodes[1]->getTrialDisp(); + + // set global displacement for local DOFset + static Vector UGL(6); + for (int i = 0; i < numDIM; i++) { + UGL(i) = U1(i); + UGL(i + 3) = U2(i); + } + + // compute local displacement for local DOFset + static Vector UL(6); + const Matrix& T2 = getRotationMatrix66(); + UL.addMatrixVector(0.0, T2, UGL, 1.0); + + // compute displacement jump + const Matrix& B = theBMatrix(); + sv.eps.addMatrixVector(0.0, B, UL, 1.0); + + // add the initial gap + const Vector& LGap = getInitialGap(); + sv.eps.addVector(1.0, LGap, 1.0); +} + +void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) +{ + // strain layout + // [Normal, Tangential1, Tangential2] + + // get committed values + sv.rs = sv.rs_commit; + sv.xs = sv.xs_commit; + sv.shear = sv.shear_commit; + sv.cres = sv.cres_commit; + + // time factor for explicit extrapolation + double time_factor = 1.0; + if (do_implex && use_implex && (sv.dtime_n_commit > 0.0)) + time_factor = sv.dtime_n / sv.dtime_n_commit; + // note: the implex method just wants the ratio of the new to the old time step + // not the real time step, so it is just fine to assume it to 1. + // otherwise we have to deal with the problem of the opensees pseudo-time step + // being the load multiplier in continuation methods... + time_factor = 1.0; + + // elastic trial + double SN = Knormal * sv.eps(0); + double T1 = sv.shear(0) + Kfriction * (sv.eps(1) - sv.eps_commit(1)); + double T2 = sv.shear(1) + Kfriction * (sv.eps(2) - sv.eps_commit(2)); + + // tangential stress norm + double SS = std::sqrt(T1 * T1 + T2 * T2); + + // compute residual stress in shear + double do_dDamage = false; + if (do_implex && use_implex) { + // explicit extrapolation + sv.cres = std::max(0.0, sv.cres_commit + time_factor * (sv.cres_commit - sv.cres_commit_old)); + } + else { + // implicit + sv.cres = 0.0; + if (SN < 0.0) { + sv.cres = -mu * SN; + } + } + + // shear stress moved to total stress space + double SS_bar = SS + sv.xs * Kfriction; + + // compute equivalent shear stress (exceeding cres) + if (do_implex && use_implex) { + // explicit extrapolation + sv.rs = sv.rs_commit + time_factor * (sv.rs_commit - sv.rs_commit_old); + } + else { + // implicit + double rs_trial = SS_bar - sv.cres; + sv.rs = std::max(sv.rs, rs_trial); + } + + // update shear plastic multipler and apparent plastic damage + double equivalent_total_strain = sv.rs / Kfriction; + double rs_effective = (equivalent_total_strain - sv.xs) * Kfriction; + sv.xs = equivalent_total_strain; + double damage = 1.0; + if (sv.cres > 0.0 && rs_effective > 0.0) + damage = 1.0 - sv.cres / rs_effective; + + // extract compressive normal stress + if (do_implex && use_implex) { + // explicit extrapolation (actually keep the commited one... since it's either 0 or 1) + sv.PC = sv.PC_commit; + } + else { + sv.PC = SN < 0.0 ? 1.0 : 0.0; + } + double SC = sv.PC * SN; + + // update effective shear stress + sv.shear(0) = (1.0 - damage) * T1; + sv.shear(1) = (1.0 - damage) * T2; + + // compute nominal stress + sv.sig(0) = SC; + sv.sig(1) = sv.shear(0); + sv.sig(2) = sv.shear(1); + + // compute tangent tensor + if (do_tangent) { + sv.C.Zero(); + // the normal part is the same for both implicit and implex + sv.C(0, 0) = sv.PC * Knormal; + // the secant part is also the same + sv.C(1, 1) = sv.C(2, 2) = (1.0 - damage) * Kfriction; + if (!use_implex) { + // implicit algorithmic tangent + // may be non symmetric due to the derivative of damage + // and the dependency of cres on normal stress + if (sv.cres > 0.0) { + if (sv.rs > sv.rs_commit) { + // plastic loading + double denom_n = SN * mu + SS; + double denom_t = SS - sv.cres; + double UTsqnorm = sv.eps(1) * sv.eps(1) + sv.eps(2) * sv.eps(2); + double dE1 = 0.0; + double dE2 = 0.0; + if (UTsqnorm > 0.0) { + double dE1 = sv.eps(1) / UTsqnorm; + double dE2 = sv.eps(2) / UTsqnorm; + } + double dDdEn = Knormal * SS * mu / (denom_n * denom_n); + double dDdE1 = SS * sv.cres * dE1 / (denom_t * denom_t); + double dDdE2 = SS * sv.cres * dE2 / (denom_t * denom_t); + sv.C(1, 0) = -T1 * dDdEn; + sv.C(2, 0) = -T2 * dDdEn; + sv.C(1, 1) = -T1 * dDdE1; + sv.C(2, 1) = -T2 * dDdE1; + sv.C(1, 2) = -T1 * dDdE2; + sv.C(2, 2) = -T2 * dDdE2; + } + else { + // no plastic loading, a simple dependency on normal strain + double dDdEn = -Knormal * mu / (Kfriction * sv.xs - sv.rs); + sv.C(1, 0) = -T1 * dDdEn; + sv.C(2, 0) = -T2 * dDdEn; + } + } + } + } +} + +void ZeroLengthImplexContact::formStiffnessMatrix(const Matrix& C, Matrix& K) +{ + // element stiffness in local system + static Matrix KL(6, 6); + const Matrix& B = theBMatrix(); + KL.addMatrixTripleProduct(0.0, B, C, 1.0); + + // element stiffness in global system, local DOFset + static Matrix KG(6, 6); + const Matrix& T2 = getRotationMatrix66(); + KG.addMatrixTripleProduct(0.0, T2, KL, 1.0); + + // element stiffness in global DOFset + K.Zero(); + int index = numDOF[0]; + for (int i = 0; i < numDIM; i++) { + for (int j = 0; j < numDIM; j++) { + K(i, j) = KG(i, j); + K(i + index, j) = KG(i + 3, j); + K(i, j + index) = KG(i, j + 3); + K(i + index, j + index) = KG(i + 3, j + 3); + } + } +} + +const Matrix& ZeroLengthImplexContact::theBMatrix() +{ + // this is the strain-displacement matrix. + // the strain is a actually the displacement jump U2-U1 + static Matrix B(3, 6); + B.Zero(); + for (int i = 0; i < 3; i++) { + B(i, i + 3) = 1; + B(i, i) = -1; + } + return B; +} diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.h b/SRC/element/zeroLength/ZeroLengthImplexContact.h new file mode 100644 index 000000000..c10df8210 --- /dev/null +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.h @@ -0,0 +1,234 @@ +/* ****************************************************************** ** +** OpenSees - Open System for Earthquake Engineering Simulation ** +** Pacific Earthquake Engineering Research Center ** +** ** +** ** +** (C) Copyright 1999, The Regents of the University of California ** +** All Rights Reserved. ** +** ** +** Commercial use of this program without express permission of the ** +** University of California, Berkeley, is strictly prohibited. See ** +** file 'COPYRIGHT' in main directory for information on usage and ** +** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** +** ** +** Developed by: ** +** Frank McKenna (fmckenna@ce.berkeley.edu) ** +** Gregory L. Fenves (fenves@ce.berkeley.edu) ** +** Filip C. Filippou (filippou@ce.berkeley.edu) ** +** ** +** ****************************************************************** */ + +// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthImplexContact.h,v $ +// $Revision: 1.0 $ +// $Date: 2020-XX-XX XX:XX:XX $ + +#ifndef ZeroLengthImplexContact_h +#define ZeroLengthImplexContact_h + +// Written: Onur Deniz Akan (onur.akan@iusspavia.it) +// Dr. Massimo Petracca +// Prof. Guido Camata +// Prof. Enrico Spacone +// Prof. Carlo G. Lai +// +// Created: May 2020 +// + + /*----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----* + | | + | ZeroLengthImplexContact element | + + + + |--------------------------------------------------------------------------------| + | | + + Authors: Onur Deniz Akan (IUSS), Dr. Massimo Petracca (ASDEA) + + | Prof. Guido Camata, Prof. Enrico Spacone (UNICH) and | + | Prof. Carlo G. Lai (UNIPV) | + | | + + Istituto Universitario di Studi Superiori di Pavia (IUSS) + + | Advanced Structural Design & Analysis Software Technology (ASDEA) | + | Universita degli Studi 'G. d'Annunzio' Chieti - Pescara (UNICH) | + | Università degli Studi di Pavia (UNIPV) | + + + + | | + | Email: onur.akan@iusspavia.it (O.D.A.) | + + + + | Development History: | + | Created -- May 2020 | + + Final Release -- XXX XXXX + + | | + | | + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----*/ + + /* command + + element zeroLengthImplexContact $eleID $mNdID $sNdID $Kn $Kt $mu <-orient $x1 $x2 $x3> <-intType $type> + + where: + $eleID : element ID of this contact element + $mNdID : master node ID + $sNdID : slave node ID + $Kn : penalty in the normal direction + $Kt : penalty in the tangential direction + $mu : friction coefficient [mu = tan(Phi) where Phi is the angle of internal friction] + -orient : vector components in global coordinates defining local x-axis in 2D or 3D (optional) + default = <1,0> in 2D and <1,0,0> in 3D + i.e. normal vector directed from the master towards the slave node + -intType : type of integration scheme (optional) + rFlag = 0 implicit, backward-euler integration scheme (default) + rFlag = 1 impl-ex, implicit/explicit integration scheme + + Description: This file contains the class definition for ZeroLengthImplexContact. + (1) A ZeroLengthImplexContact element is defined by two nodes in R^2 (x,y) or R^3 (x,y,z). + (2) Penalty (Kn,Kt) method is used to constrain displacements in the normal direction, + and in the tangential direction along with a Mohr-Coulomb frictional yield surface. + (3) In 2D and 3D, 2, 4, 6 or 12 DOFs with the possibility of having different DOFsets at + each of the two nodes is supported automatically. (Example: Solid <--> Shell contact in 3D) + (4) Optionally, the normal vector of the contact plane, orienting the contact axis can be + specified by the user. Otherwise, the global X vector is chosen by default. + (5) Optionally, the user can prefer using the IMPL-EX scheme over the standard Backward Euler + return mapping scheme for the implicit-explicit integration of the contact material residual + and tangent modulus. + (6) Currently, only small deformations are considered, however an update on large deformations + may be implemented in the near future. + (7) In IMPL-EX scheme, the material tangent and residual at the current step (n+1) are computed + by lineary extrapolating the material parameters commited at steps (n) and (n-1). Then, after + the convergence criteria is achieved, extrapolated material parameters are corrected with a + step of traditional implicit computation from the last commited step (n). Finally, corrected + parameters are saved as the current step (n+1) commited variables. + (8) In a Newton-Raphson scheme, IMPL-EX integration translates to a step-linear solution of the material + non-linearity, and a symmetric, semi-positive definite tangent tensor regardless of what the analytical + tangent migh be, hence improving the robustness of the solution. The order of accuracy is the same with + the implicit (backward) euler integration scheme, however the commited error at a time step is larger. + An automatic time-stepping algorithm should be employed in order to a priori control this error. (Oliver et al, 2008) + + References: + Oliver, J., Huespe, A.E. and Cante, J.C. "An Implicit/Explicit Integration Scheme to + Increase Computability of Non-linear Material and Contact/Friction Problems", Comp. + Methods Appl. Mech. Eng., 197, 1865-1889 (2008) + */ + +#include +#include +#include + +#define LENTOL 1.0e-6 // tolerance for zero-length of the element + +class Node; +class Channel; +class Response; + +class ZeroLengthImplexContact : public Element { + +public: + class StateVariables { + public: + // material strain and stress [(0 = normal) (1 = tangent_1) (2 = tangent_2)] + Vector eps = Vector(3); // material strain + Vector eps_commit = Vector(3); // commited material strain + Vector shear = Vector(2); // effective shear stress + Vector shear_commit = Vector(2); // commited effective shear stress + double xs = 0.0; // equivalent plastic strain + double xs_commit = 0.0; // commited equivalent plastic strain + double xs_commit_old = 0.0; // commited equivalent plastic strain (n-1) + double rs = 0.0; // equivalent shear stress + double rs_commit = 0.0; // commited equivalent shear stress + double rs_commit_old = 0.0; // commited equivalent shear stress (n-1) + double cres = 0.0; // residual shear stress + double cres_commit = 0.0; // commited residual shear stress + double cres_commit_old = 0.0; // commited residual shear stress (n-1) + double PC = 1.0; // normal stress compressive projector + double PC_commit = 1.0; // commited normal stress compressive projector + double dtime_n = 0.0; // time factor + double dtime_n_commit = 0.0; // commited time factor + bool dtime_is_user_defined = false; + bool dtime_first_set = false; + // modulus + Matrix C = Matrix(3, 3); // tangent modulus matrix + Vector sig = Vector(3); + // constructor + StateVariables() = default; + StateVariables(const StateVariables&) = default; + StateVariables& operator = (const StateVariables&) = default; + }; + +public: + // constructor + ZeroLengthImplexContact(int tag, int Nd1, int Nd2, + double Kn, double Kt, double fs, + int ndm, bool itype, double xN, double yN, double zN); + + // null constructor & destructor + ZeroLengthImplexContact(); + ~ZeroLengthImplexContact(); + + // public methods to obtain information about dof & connectivity + int getNumExternalNodes() const; + const ID& getExternalNodes(); + Node** getNodePtrs(); + int getNumDOF(); + void setDomain(Domain* theDomain); + + // public methods to set the state of the element + int commitState(); + int revertToLastCommit(); + int revertToStart(); + int update(); + + // public methods to obtain stiffness, mass, damping and residual information + const Matrix& getTangentStiff(); + const Matrix& getInitialStiff(); + const Matrix& getDamp(); + const Matrix& getMass(); + + const Vector& getResistingForce(); + const Vector& getResistingForceIncInertia(); + + // public methods for element output + int sendSelf(int commitTag, Channel& theChannel); + int recvSelf(int commitTag, Channel& theChannel, FEM_ObjectBroker& theBroker); + int displaySelf(Renderer&, int mode, float fact, const char** displayModes = 0, int numModes = 0); + void Print(OPS_Stream& s, int flag = 0); + + Response* setResponse(const char** argv, int argc, OPS_Stream& output); + int getResponse(int responseID, Information& eleInformation); + int updateParameter(int parameterID, double value); + +private: + // element info + ID connectedExternalNodes = ID(2); // contains the tags of the end nodes + double Knormal = 0.0; // normal penalty + double Kfriction = 0.0; // tangential penalty + double mu = 0.0; // friction coefficient + int numDIM = 0; // model dimension + std::array numDOF = { { 0, 0 } }; // no. of DOF at 1st and 2nd node + bool use_implex = false; // integration type flag + Vector Xorient = Vector(3); // contact axis orientation in global coords. + + // element pointers + std::array theNodes = { { nullptr, nullptr } }; // node pointers + + // initial gap in global coordinates + // it includes the initial gap in geometry and the initial displacement + // (if any) + Vector gap0 = Vector(3); + bool gap0_initialized = false; + + // state variables + StateVariables sv; // element & material state variables + +private: + // compute rotation matrix + const Matrix& getRotationMatrix33(); // 3-by-3 for operations in the local dof-set + const Matrix& getRotationMatrix66(); // 6-by-6 for operations in the global dof-set + // compute local initial gap + const Vector& getInitialGap(); // returns initial gap in local coordinate system + // compute strain + void computeStrain(); + // compute material response + void updateInternal(bool do_implex, bool do_tangent); + // compute siffness + void formStiffnessMatrix(const Matrix& C, Matrix& K); + // compute B matrix + const Matrix& theBMatrix(); +}; +#endif \ No newline at end of file diff --git a/SRC/interpreter/OpenSeesElementCommands.cpp b/SRC/interpreter/OpenSeesElementCommands.cpp index 226c6c8d8..fdfbd9bee 100644 --- a/SRC/interpreter/OpenSeesElementCommands.cpp +++ b/SRC/interpreter/OpenSeesElementCommands.cpp @@ -187,6 +187,7 @@ void* OPS_BbarBrickWithSensitivity(); void* OPS_ZeroLengthRocking(); void* OPS_ZeroLengthContact2D(); void* OPS_ZeroLengthContact3D(); +void* OPS_ZeroLengthImplexContact(); void* OPS_Joint2D(); void* OPS_Joint3D(); void* OPS_LehighJoint2d(); @@ -535,6 +536,7 @@ namespace { functionMap.insert(std::make_pair("LehighJoint2d", &OPS_LehighJoint2d)); functionMap.insert(std::make_pair("zeroLengthContact2D", &OPS_ZeroLengthContact2D)); functionMap.insert(std::make_pair("zeroLengthContact3D", &OPS_ZeroLengthContact3D)); + functionMap.insert(std::make_pair("zeroLengthImplexContact", &OPS_ZeroLengthImplexContact)); functionMap.insert(std::make_pair("zeroLengthRocking", &OPS_ZeroLengthRocking)); functionMap.insert(std::make_pair("bbarBrickWithSensitivity", &OPS_BbarBrickWithSensitivity)); functionMap.insert(std::make_pair("bbarBrick", &OPS_BbarBrick)); diff --git a/SRC/recorder/GmshRecorder.cpp b/SRC/recorder/GmshRecorder.cpp index 5cf063ba1..a72398949 100644 --- a/SRC/recorder/GmshRecorder.cpp +++ b/SRC/recorder/GmshRecorder.cpp @@ -1273,6 +1273,7 @@ GmshRecorder::setGMSHType() gmshtypes[ELE_TAG_ZeroLengthND] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContact2D] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContact3D] = GMSH_LINE; + gmshtypes[ELE_TAG_ZeroLengthImplexContact] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContactNTS2D] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthInterface2D] = GMSH_LINE; gmshtypes[ELE_TAG_CoupledZeroLength] = GMSH_LINE; diff --git a/SRC/recorder/MPCORecorder.cpp b/SRC/recorder/MPCORecorder.cpp index 2b381a432..c457ab5fa 100755 --- a/SRC/recorder/MPCORecorder.cpp +++ b/SRC/recorder/MPCORecorder.cpp @@ -3647,6 +3647,7 @@ namespace mpco { elem_class_tag == ELE_TAG_ZeroLengthRocking || elem_class_tag == ELE_TAG_ZeroLengthContact2D || elem_class_tag == ELE_TAG_ZeroLengthContact3D || + elem_class_tag == ELE_TAG_ZeroLengthImplexContact || elem_class_tag == ELE_Tag_ZeroLengthImpact3D || // ./elasticBeamColumn elem_class_tag == ELE_TAG_ElasticBeam2d || diff --git a/SRC/recorder/PVDRecorder.cpp b/SRC/recorder/PVDRecorder.cpp index 9a845fd0f..a9841392c 100644 --- a/SRC/recorder/PVDRecorder.cpp +++ b/SRC/recorder/PVDRecorder.cpp @@ -1814,6 +1814,7 @@ PVDRecorder::setVTKType() vtktypes[ELE_TAG_ZeroLengthND] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact3D] = VTK_POLY_VERTEX; + vtktypes[ELE_TAG_ZeroLengthImplexContact] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContactNTS2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthInterface2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_CoupledZeroLength] = VTK_POLY_VERTEX; diff --git a/SRC/recorder/VTK_Recorder.cpp b/SRC/recorder/VTK_Recorder.cpp index ccf17142f..8904322a2 100644 --- a/SRC/recorder/VTK_Recorder.cpp +++ b/SRC/recorder/VTK_Recorder.cpp @@ -1009,6 +1009,7 @@ VTK_Recorder::setVTKType() vtktypes[ELE_TAG_ZeroLengthND] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact3D] = VTK_POLY_VERTEX; + vtktypes[ELE_TAG_ZeroLengthImplexContact] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContactNTS2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthInterface2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_CoupledZeroLength] = VTK_POLY_VERTEX; diff --git a/Win32/proj/element/element.vcxproj b/Win32/proj/element/element.vcxproj index d9851f5d5..b1d07a0f7 100644 --- a/Win32/proj/element/element.vcxproj +++ b/Win32/proj/element/element.vcxproj @@ -197,6 +197,7 @@ + @@ -461,6 +462,7 @@ + diff --git a/Win32/proj/element/element.vcxproj.filters b/Win32/proj/element/element.vcxproj.filters index da0c5c771..a6b13a868 100644 --- a/Win32/proj/element/element.vcxproj.filters +++ b/Win32/proj/element/element.vcxproj.filters @@ -194,6 +194,9 @@ zeroLength + + zeroLength + zeroLength @@ -973,6 +976,9 @@ zeroLength + + zeroLength + zeroLength diff --git a/Win64/proj/element/element.vcxproj b/Win64/proj/element/element.vcxproj index 0fa403955..39d887b67 100644 --- a/Win64/proj/element/element.vcxproj +++ b/Win64/proj/element/element.vcxproj @@ -287,6 +287,7 @@ + @@ -556,6 +557,7 @@ + diff --git a/Win64/proj/element/element.vcxproj.filters b/Win64/proj/element/element.vcxproj.filters index b9f0dab53..f7525e421 100644 --- a/Win64/proj/element/element.vcxproj.filters +++ b/Win64/proj/element/element.vcxproj.filters @@ -194,6 +194,9 @@ zeroLength + + zeroLength + zeroLength @@ -982,6 +985,9 @@ zeroLength + + zeroLength + zeroLength From 23e060c56372fe89fce777f7b7edb49a7210086b Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Fri, 14 May 2021 16:21:30 +0200 Subject: [PATCH 02/57] some improvements --- .../zeroLength/ZeroLengthImplexContact.cpp | 150 ++++++++++++------ .../zeroLength/ZeroLengthImplexContact.h | 2 +- 2 files changed, 102 insertions(+), 50 deletions(-) diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp index da8830f7e..f7a6af8a1 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -330,8 +331,6 @@ int ZeroLengthImplexContact::commitState(void) { // do the implicit correction if impl-ex if (use_implex) { - // get trial strain tensor at integration point in local crd. sys. - computeStrain(); // update material internal variables updateInternal(false, false); // explicit_phase?, do_tangent? } @@ -339,12 +338,11 @@ int ZeroLengthImplexContact::commitState(void) // commit internal variables sv.eps_commit = sv.eps; sv.shear_commit = sv.shear; - sv.xs_commit_old = sv.xs_commit; sv.xs_commit = sv.xs; sv.rs_commit_old = sv.rs_commit; sv.rs_commit = sv.rs; sv.cres_commit_old = sv.cres_commit; - sv.cres_commit = sv.rs; + sv.cres_commit = sv.cres; sv.PC_commit = sv.PC; sv.dtime_n_commit = sv.dtime_n; @@ -378,7 +376,31 @@ int ZeroLengthImplexContact::revertToStart() int ZeroLengthImplexContact::update() { computeStrain(); - updateInternal(true, true); + if (use_implex) { + updateInternal(true, true); + sv.sig_implex = sv.sig; + } + else { + // for the implicit case we use the numerical tangent... seems more stable + static Vector strain(3); + static Matrix Cnum(3, 3); + constexpr double pert = 1.0e-9; + strain = sv.eps; + for (int j = 0; j < 3; ++j) { + sv.eps(j) = strain(j) + pert; + updateInternal(true, false); + for (int i = 0; i < 3; ++i) + Cnum(i, j) = sv.sig(i); + sv.eps(j) = strain(j) - pert; + updateInternal(true, false); + for (int i = 0; i < 3; ++i) + Cnum(i, j) = (Cnum(i, j) - sv.sig(i)) / 2.0 / pert; + sv.eps(j) = strain(j); + } + updateInternal(true, false); + sv.C = Cnum; + } + return 0; } @@ -486,7 +508,7 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { } // double data - static Vector ddata(33); + static Vector ddata(32); ddata(1) = Knormal; ddata(2) = Kfriction; ddata(3) = mu; @@ -505,20 +527,19 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { ddata(16) = sv.shear_commit(1); ddata(17) = sv.xs; ddata(18) = sv.xs_commit; - ddata(19) = sv.xs_commit_old; - ddata(20) = sv.rs; - ddata(21) = sv.rs_commit; - ddata(22) = sv.rs_commit_old; - ddata(23) = sv.cres; - ddata(24) = sv.cres_commit; - ddata(25) = sv.cres_commit_old; - ddata(26) = sv.PC; - ddata(27) = sv.PC_commit; - ddata(28) = sv.dtime_n; - ddata(29) = sv.dtime_n_commit; - ddata(30) = gap0(0); - ddata(31) = gap0(1); - ddata(32) = gap0(2); + ddata(19) = sv.rs; + ddata(20) = sv.rs_commit; + ddata(21) = sv.rs_commit_old; + ddata(22) = sv.cres; + ddata(23) = sv.cres_commit; + ddata(24) = sv.cres_commit_old; + ddata(25) = sv.PC; + ddata(26) = sv.PC_commit; + ddata(27) = sv.dtime_n; + ddata(28) = sv.dtime_n_commit; + ddata(29) = gap0(0); + ddata(30) = gap0(1); + ddata(31) = gap0(2); res = theChannel.sendVector(dataTag, commitTag, ddata); if (res < 0) { opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send Vector\n"; @@ -577,20 +598,19 @@ int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_Ob sv.shear_commit(1) = ddata(16); sv.xs = ddata(17); sv.xs_commit = ddata(18); - sv.xs_commit_old = ddata(19); - sv.rs = ddata(20); - sv.rs_commit = ddata(21); - sv.rs_commit_old = ddata(22); - sv.cres = ddata(23); - sv.cres_commit = ddata(24); - sv.cres_commit_old = ddata(25); - sv.PC = ddata(26); - sv.PC_commit = ddata(27); - sv.dtime_n = ddata(28); - sv.dtime_n_commit = ddata(29); - gap0(0) = ddata(30); - gap0(1) = ddata(31); - gap0(2) = ddata(32); + sv.rs = ddata(19); + sv.rs_commit = ddata(20); + sv.rs_commit_old = ddata(21); + sv.cres = ddata(22); + sv.cres_commit = ddata(23); + sv.cres_commit_old = ddata(24); + sv.PC = ddata(25); + sv.PC_commit = ddata(26); + sv.dtime_n = ddata(27); + sv.dtime_n_commit = ddata(28); + gap0(0) = ddata(29); + gap0(1) = ddata(30); + gap0(2) = ddata(31); return 0; } @@ -668,6 +688,13 @@ Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_ lam_close_gauss(); theResponse = new ElementResponse(this, 3, Vector(2)); } + else if (strcmp(argv[0], "localForceImplex") == 0 || strcmp(argv[0], "localForcesImplex") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "N"); + output.tag("ResponseType", "Tx"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 33, Vector(3)); + } else if (strcmp(argv[0], "localDisplacement") == 0 || strcmp(argv[0], "localDispJump") == 0) { lam_open_gauss(); output.tag("ResponseType", "dUN"); @@ -703,6 +730,14 @@ Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_ lam_close_gauss(); theResponse = new ElementResponse(this, 3, Vector(3)); } + else if (strcmp(argv[0], "localForceImplex") == 0 || strcmp(argv[0], "localForcesImplex") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "N"); + output.tag("ResponseType", "Tx"); + output.tag("ResponseType", "Ty"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 33, Vector(3)); + } else if (strcmp(argv[0], "localDisplacement") == 0 || strcmp(argv[0], "localDispJump") == 0) { lam_open_gauss(); output.tag("ResponseType", "dUN"); @@ -733,6 +768,14 @@ Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_ lam_close_gauss(); theResponse = new ElementResponse(this, 7, Vector(1)); } + else if (strcmp(argv[0], "cres") == 0) { + lam_open_gauss(); + output.tag("ResponseType", "cres(n+1)"); + output.tag("ResponseType", "cres(n)"); + output.tag("ResponseType", "cres(n-1)"); + lam_close_gauss(); + theResponse = new ElementResponse(this, 8, Vector(3)); + } } output.endTag(); // ElementOutput @@ -773,6 +816,13 @@ int ZeroLengthImplexContact::getResponse(int responseID, Information& eleInfo) { } return eleInfo.setVector(small); } + else if (responseID == 33) { + // local contact forces + for (int i = 0; i < numDIM; i++) { + small(i) = sv.sig_implex(i); + } + return eleInfo.setVector(small); + } else if (responseID == 4) { // local displacement jump for (int i = 0; i < numDIM; i++) { @@ -795,6 +845,12 @@ int ZeroLengthImplexContact::getResponse(int responseID, Information& eleInfo) { scalar(0) = std::sqrt(sv.sig(1)*sv.sig(1) + sv.sig(2)*sv.sig(2)); return eleInfo.setVector(scalar); } + else if (responseID == 8) { + // cres internal variable hist + static Vector cres(3); + cres(0) = sv.cres; cres(1) = sv.cres_commit; cres(2) = sv.cres_commit_old; + return eleInfo.setVector(cres); + } else { return -1; } @@ -947,14 +1003,13 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) double SS = std::sqrt(T1 * T1 + T2 * T2); // compute residual stress in shear - double do_dDamage = false; if (do_implex && use_implex) { // explicit extrapolation sv.cres = std::max(0.0, sv.cres_commit + time_factor * (sv.cres_commit - sv.cres_commit_old)); } else { // implicit - sv.cres = 0.0; + sv.cres = 0.0; // tolerance?? if (SN < 0.0) { sv.cres = -mu * SN; } @@ -976,11 +1031,14 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) // update shear plastic multipler and apparent plastic damage double equivalent_total_strain = sv.rs / Kfriction; - double rs_effective = (equivalent_total_strain - sv.xs) * Kfriction; + double rs_effective = (equivalent_total_strain - sv.xs) * Kfriction + sv.cres; sv.xs = equivalent_total_strain; - double damage = 1.0; - if (sv.cres > 0.0 && rs_effective > 0.0) - damage = 1.0 - sv.cres / rs_effective; + double damage = 0.0; + if (sv.xs > std::numeric_limits::epsilon()) { + damage = 1.0; + if (rs_effective > std::numeric_limits::epsilon()) + damage = 1.0 - sv.cres / rs_effective; + } // extract compressive normal stress if (do_implex && use_implex) { @@ -988,7 +1046,7 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) sv.PC = sv.PC_commit; } else { - sv.PC = SN < 0.0 ? 1.0 : 0.0; + sv.PC = SN <= 0.0 ? 1.0 : 0.0; } double SC = sv.PC * SN; @@ -1012,7 +1070,7 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) // implicit algorithmic tangent // may be non symmetric due to the derivative of damage // and the dependency of cres on normal stress - if (sv.cres > 0.0) { + if (sv.cres > std::numeric_limits::epsilon()) { if (sv.rs > sv.rs_commit) { // plastic loading double denom_n = SN * mu + SS; @@ -1020,7 +1078,7 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) double UTsqnorm = sv.eps(1) * sv.eps(1) + sv.eps(2) * sv.eps(2); double dE1 = 0.0; double dE2 = 0.0; - if (UTsqnorm > 0.0) { + if (UTsqnorm > std::numeric_limits::epsilon()) { double dE1 = sv.eps(1) / UTsqnorm; double dE2 = sv.eps(2) / UTsqnorm; } @@ -1034,12 +1092,6 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) sv.C(1, 2) = -T1 * dDdE2; sv.C(2, 2) = -T2 * dDdE2; } - else { - // no plastic loading, a simple dependency on normal strain - double dDdEn = -Knormal * mu / (Kfriction * sv.xs - sv.rs); - sv.C(1, 0) = -T1 * dDdEn; - sv.C(2, 0) = -T2 * dDdEn; - } } } } diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.h b/SRC/element/zeroLength/ZeroLengthImplexContact.h index c10df8210..40484a2d0 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.h +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.h @@ -129,7 +129,6 @@ class ZeroLengthImplexContact : public Element { Vector shear_commit = Vector(2); // commited effective shear stress double xs = 0.0; // equivalent plastic strain double xs_commit = 0.0; // commited equivalent plastic strain - double xs_commit_old = 0.0; // commited equivalent plastic strain (n-1) double rs = 0.0; // equivalent shear stress double rs_commit = 0.0; // commited equivalent shear stress double rs_commit_old = 0.0; // commited equivalent shear stress (n-1) @@ -145,6 +144,7 @@ class ZeroLengthImplexContact : public Element { // modulus Matrix C = Matrix(3, 3); // tangent modulus matrix Vector sig = Vector(3); + Vector sig_implex = Vector(3); // only for output // constructor StateVariables() = default; StateVariables(const StateVariables&) = default; From 95022caf14e924bce510c7f8700dc58af38ea3f2 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Sat, 15 May 2021 11:08:15 +0200 Subject: [PATCH 03/57] Update ZeroLengthImplexContact.cpp --- SRC/element/zeroLength/ZeroLengthImplexContact.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp index f7a6af8a1..e16426e3f 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp @@ -375,6 +375,13 @@ int ZeroLengthImplexContact::revertToStart() int ZeroLengthImplexContact::update() { + if (!sv.dtime_is_user_defined) { + sv.dtime_n = ops_Dt; + if (!sv.dtime_first_set) { + sv.dtime_n_commit = sv.dtime_n; + sv.dtime_first_set = true; + } + } computeStrain(); if (use_implex) { updateInternal(true, true); From 4ed560a222192b9b7a5fbc05e8a03768ae06ede4 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 17 May 2021 15:34:30 +0200 Subject: [PATCH 04/57] some improvements --- .../zeroLength/ZeroLengthImplexContact.cpp | 18 +++++++----------- .../zeroLength/ZeroLengthImplexContact.h | 2 -- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp index e16426e3f..c21ab3fc1 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp @@ -425,18 +425,12 @@ const Matrix& ZeroLengthImplexContact::getInitialStiff() auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); auto& stiff = gs.K0; static Matrix C0(3, 3); - C0.Zero(); const Vector& LGap = getInitialGap(); double Un = LGap(0); // gap parallel to normal vector - if (use_implex) { // implex - C0 = sv.C; // send tangent instead - } - else { // implicit - if (Un <= LENTOL) { // send elastic stiffness, if contact - C0(0, 0) = Knormal; - C0(1, 1) = C0(2, 2) = Kfriction; - } + if (Un <= 1.0e-10) { // send elastic stiffness, if contact + C0(0, 0) = Knormal; + C0(1, 1) = C0(2, 2) = Kfriction; } formStiffnessMatrix(C0, stiff); return stiff; @@ -1016,9 +1010,11 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) } else { // implicit - sv.cres = 0.0; // tolerance?? - if (SN < 0.0) { + if (SN < 0.0) sv.cres = -mu * SN; + else { + if(!use_implex && sv.eps(0) < 1.0e-6) + sv.cres = 1.0e-10; } } diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.h b/SRC/element/zeroLength/ZeroLengthImplexContact.h index 40484a2d0..22714f57b 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.h +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.h @@ -111,8 +111,6 @@ #include #include -#define LENTOL 1.0e-6 // tolerance for zero-length of the element - class Node; class Channel; class Response; From c027bd09487cc6322d12b4bbac7a4f29b192afe9 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 17 May 2021 18:13:15 +0200 Subject: [PATCH 05/57] fix send recv self methods --- .../zeroLength/ZeroLengthImplexContact.cpp | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp index c21ab3fc1..a5352b426 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp +++ b/SRC/element/zeroLength/ZeroLengthImplexContact.cpp @@ -509,38 +509,38 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { } // double data - static Vector ddata(32); - ddata(1) = Knormal; - ddata(2) = Kfriction; - ddata(3) = mu; - ddata(4) = Xorient(0); - ddata(5) = Xorient(1); - ddata(6) = Xorient(2); - ddata(7) = sv.eps(0); - ddata(8) = sv.eps(1); - ddata(9) = sv.eps(2); - ddata(10) = sv.eps_commit(0); - ddata(11) = sv.eps_commit(1); - ddata(12) = sv.eps_commit(2); - ddata(13) = sv.shear(0); - ddata(14) = sv.shear(1); - ddata(15) = sv.shear_commit(0); - ddata(16) = sv.shear_commit(1); - ddata(17) = sv.xs; - ddata(18) = sv.xs_commit; - ddata(19) = sv.rs; - ddata(20) = sv.rs_commit; - ddata(21) = sv.rs_commit_old; - ddata(22) = sv.cres; - ddata(23) = sv.cres_commit; - ddata(24) = sv.cres_commit_old; - ddata(25) = sv.PC; - ddata(26) = sv.PC_commit; - ddata(27) = sv.dtime_n; - ddata(28) = sv.dtime_n_commit; - ddata(29) = gap0(0); - ddata(30) = gap0(1); - ddata(31) = gap0(2); + static Vector ddata(31); + ddata(0) = Knormal; + ddata(1) = Kfriction; + ddata(2) = mu; + ddata(3) = Xorient(0); + ddata(4) = Xorient(1); + ddata(5) = Xorient(2); + ddata(6) = sv.eps(0); + ddata(7) = sv.eps(1); + ddata(8) = sv.eps(2); + ddata(9) = sv.eps_commit(0); + ddata(10) = sv.eps_commit(1); + ddata(11) = sv.eps_commit(2); + ddata(12) = sv.shear(0); + ddata(13) = sv.shear(1); + ddata(14) = sv.shear_commit(0); + ddata(15) = sv.shear_commit(1); + ddata(16) = sv.xs; + ddata(17) = sv.xs_commit; + ddata(18) = sv.rs; + ddata(19) = sv.rs_commit; + ddata(20) = sv.rs_commit_old; + ddata(21) = sv.cres; + ddata(22) = sv.cres_commit; + ddata(23) = sv.cres_commit_old; + ddata(24) = sv.PC; + ddata(25) = sv.PC_commit; + ddata(26) = sv.dtime_n; + ddata(27) = sv.dtime_n_commit; + ddata(28) = gap0(0); + ddata(29) = gap0(1); + ddata(30) = gap0(2); res = theChannel.sendVector(dataTag, commitTag, ddata); if (res < 0) { opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send Vector\n"; @@ -575,43 +575,43 @@ int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_Ob gap0_initialized = idata(9) == 1; // double data - static Vector ddata(33); + static Vector ddata(31); res = theChannel.recvVector(dataTag, commitTag, ddata); if (res < 0) { opserr << "WARNING ZeroLengthImplexContact::recvSelf() - failed to receive Vector\n"; return -1; } - Knormal = ddata(1); - Kfriction = ddata(2); - mu = ddata(3); - Xorient(0) = ddata(4); - Xorient(1) = ddata(5); - Xorient(2) = ddata(6); - sv.eps(0) = ddata(7); - sv.eps(1) = ddata(8); - sv.eps(2) = ddata(9); - sv.eps_commit(0) = ddata(10); - sv.eps_commit(1) = ddata(11); - sv.eps_commit(2) = ddata(12); - sv.shear(0) = ddata(13); - sv.shear(1) = ddata(14); - sv.shear_commit(0) = ddata(15); - sv.shear_commit(1) = ddata(16); - sv.xs = ddata(17); - sv.xs_commit = ddata(18); - sv.rs = ddata(19); - sv.rs_commit = ddata(20); - sv.rs_commit_old = ddata(21); - sv.cres = ddata(22); - sv.cres_commit = ddata(23); - sv.cres_commit_old = ddata(24); - sv.PC = ddata(25); - sv.PC_commit = ddata(26); - sv.dtime_n = ddata(27); - sv.dtime_n_commit = ddata(28); - gap0(0) = ddata(29); - gap0(1) = ddata(30); - gap0(2) = ddata(31); + Knormal = ddata(0); + Kfriction = ddata(1); + mu = ddata(2); + Xorient(0) = ddata(3); + Xorient(1) = ddata(4); + Xorient(2) = ddata(5); + sv.eps(0) = ddata(6); + sv.eps(1) = ddata(7); + sv.eps(2) = ddata(8); + sv.eps_commit(0) = ddata(9); + sv.eps_commit(1) = ddata(10); + sv.eps_commit(2) = ddata(11); + sv.shear(0) = ddata(12); + sv.shear(1) = ddata(13); + sv.shear_commit(0) = ddata(14); + sv.shear_commit(1) = ddata(15); + sv.xs = ddata(16); + sv.xs_commit = ddata(17); + sv.rs = ddata(18); + sv.rs_commit = ddata(19); + sv.rs_commit_old = ddata(20); + sv.cres = ddata(21); + sv.cres_commit = ddata(22); + sv.cres_commit_old = ddata(23); + sv.PC = ddata(24); + sv.PC_commit = ddata(25); + sv.dtime_n = ddata(26); + sv.dtime_n_commit = ddata(27); + gap0(0) = ddata(28); + gap0(1) = ddata(39); + gap0(2) = ddata(30); return 0; } From 727beff50aad8dd5e28a67936e27449d629dfe17 Mon Sep 17 00:00:00 2001 From: Ahmed Elkady Date: Fri, 2 Jul 2021 10:34:13 +0100 Subject: [PATCH 06/57] IMKBilin fix A fix for an observed zigzag bug in the response during high frequency un/reloading. --- SRC/material/uniaxial/IMKBilin.cpp | 5 +++-- SRC/material/uniaxial/IMKBilin.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/IMKBilin.cpp b/SRC/material/uniaxial/IMKBilin.cpp index 492e2e846..9fa1dfc58 100644 --- a/SRC/material/uniaxial/IMKBilin.cpp +++ b/SRC/material/uniaxial/IMKBilin.cpp @@ -41,7 +41,7 @@ OPS_IMKBilin(void) { if (numIMKBilinMaterials == 0) { numIMKBilinMaterials++; - OPS_Error("Mod. IMK Model with Bilinear Hysteretic Response - Code by A. ELKADY\n", 1); + OPS_Error("Mod. IMK Model with Bilinear Hysteretic Response - Code by A.ELKADY-21\n", 1); } // Pointer to a uniaxial material that will be returned @@ -337,7 +337,8 @@ int IMKBilin::setTrialStrain(double strain, double strainRate) } // Simple and unified notation for current bacbone parameters - if (Di >= 0.0) { + Mi_temp = Mi_1 + K_j * (Ri - Ri_1); + if (Mi_temp >= 0.0) { Ki = K_j; slope_pi = slope_p_pos_j; slope_pci = slope_pc_pos_j; diff --git a/SRC/material/uniaxial/IMKBilin.h b/SRC/material/uniaxial/IMKBilin.h index 6abfae686..d5f4576c4 100644 --- a/SRC/material/uniaxial/IMKBilin.h +++ b/SRC/material/uniaxial/IMKBilin.h @@ -178,6 +178,7 @@ class IMKBilin : public UniaxialMaterial double Theta_y_x, cTheta_y_x; double MpeProject_x, cMpeProject_x; + double Mi_temp; }; From 2d9c6c2740c917103b86134fe8a0e3927d2500db Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 2 Aug 2021 19:06:27 +0200 Subject: [PATCH 07/57] update class tag in developer --- DEVELOPER/core/classTags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPER/core/classTags.h b/DEVELOPER/core/classTags.h index 3ebc8309a..ad465ac01 100644 --- a/DEVELOPER/core/classTags.h +++ b/DEVELOPER/core/classTags.h @@ -721,7 +721,7 @@ #define ELE_TAG_NineNodeQuad 207 #define ELE_TAG_EightNodeQuad 208 #define ELE_TAG_SixNodeTri 209 -#define ELE_TAG_ZeroLengthImplexContact 215 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +#define ELE_TAG_ZeroLengthImplexContact 217 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define FRN_TAG_Coulomb 1 #define FRN_TAG_VelDependent 2 From 9b533e7423ac4dd023579032bcdc93745b6d7ce2 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 2 Aug 2021 19:13:35 +0200 Subject: [PATCH 08/57] shift class tag --- DEVELOPER/core/classTags.h | 2 +- SRC/classTags.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPER/core/classTags.h b/DEVELOPER/core/classTags.h index ad465ac01..77d8d768c 100644 --- a/DEVELOPER/core/classTags.h +++ b/DEVELOPER/core/classTags.h @@ -721,7 +721,7 @@ #define ELE_TAG_NineNodeQuad 207 #define ELE_TAG_EightNodeQuad 208 #define ELE_TAG_SixNodeTri 209 -#define ELE_TAG_ZeroLengthImplexContact 217 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +#define ELE_TAG_ZeroLengthImplexContact 218 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define FRN_TAG_Coulomb 1 #define FRN_TAG_VelDependent 2 diff --git a/SRC/classTags.h b/SRC/classTags.h index 87cf8b67b..cff1fd513 100644 --- a/SRC/classTags.h +++ b/SRC/classTags.h @@ -788,7 +788,7 @@ #define ELE_TAG_BeamGT 214 #define ELE_TAG_MasonPan12 215 #define ELE_TAG_MasonPan3D 216 -#define ELE_TAG_ZeroLengthImplexContact 217 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +#define ELE_TAG_ZeroLengthImplexContact 218 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define ELE_TAG_ExternalElement 99990 From 5ba80bc931aa00230b6120b6cb35be5a49ef70ec Mon Sep 17 00:00:00 2001 From: mhscott Date: Sat, 25 Sep 2021 12:56:27 -0700 Subject: [PATCH 09/57] Initial (untested) implementation of HSS section integration --- .../integration/HSSSectionIntegration.cpp | 513 ++++++++++++++++++ .../integration/HSSSectionIntegration.h | 77 +++ 2 files changed, 590 insertions(+) create mode 100644 SRC/material/section/integration/HSSSectionIntegration.cpp create mode 100644 SRC/material/section/integration/HSSSectionIntegration.h diff --git a/SRC/material/section/integration/HSSSectionIntegration.cpp b/SRC/material/section/integration/HSSSectionIntegration.cpp new file mode 100644 index 000000000..2c0d3cdd0 --- /dev/null +++ b/SRC/material/section/integration/HSSSectionIntegration.cpp @@ -0,0 +1,513 @@ +/* ****************************************************************** ** +** OpenSees - Open System for Earthquake Engineering Simulation ** +** Pacific Earthquake Engineering Research Center ** +** ** +** ** +** (C) Copyright 1999, The Regents of the University of California ** +** All Rights Reserved. ** +** ** +** Commercial use of this program without express permission of the ** +** University of California, Berkeley, is strictly prohibited. See ** +** file 'COPYRIGHT' in main directory for information on usage and ** +** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** +** ** +** Developed by: ** +** Frank McKenna (fmckenna@ce.berkeley.edu) ** +** Gregory L. Fenves (fenves@ce.berkeley.edu) ** +** Filip C. Filippou (filippou@ce.berkeley.edu) ** +** ** +** ****************************************************************** */ + +// $Revision: 1.4 $ +// $Date: 2010-09-13 21:31:26 $ +// $Source: /usr/local/cvs/OpenSees/SRC/material/section/integration/HSSSectionIntegration.cpp,v $ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +void* OPS_HSSSection2d() +{ + if (OPS_GetNumRemainingInputArgs() < 8) { + opserr << "WARNING insufficient arguments\n"; + opserr << "Want: section HSS tag? matTag? h? b? t? Nfh? Nfb? Nft? <-nd shape?>" << endln; + return 0; + } + + int tag, matTag; + double h, b, t; + int Nfh, Nfb, Nft; + + SectionForceDeformation* theSection = 0; + + int numdata = 1; + if (OPS_GetIntInput(&numdata, &tag) < 0) { + opserr << "WARNING invalid section HSS tag" << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &matTag) < 0) { + opserr << "WARNING invalid section HSS matTag" << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &h) < 0) { + opserr << "WARNING invalid h" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &b) < 0) { + opserr << "WARNING invalid b" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &t) < 0) { + opserr << "WARNING invalid t" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &Nfh) < 0) { + opserr << "WARNING invalid Nfh" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &Nfb) < 0) { + opserr << "WARNING invalid Nfb" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &Nft) < 0) { + opserr << "WARNING invalid Nft" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + HSSSectionIntegration hsssect(h, b, t, Nfh, Nfb, Nft); + + int numFibers = hsssect.getNumFibers(); + + if (OPS_GetNumRemainingInputArgs() > 0) { + + double shape = 1.0; + if (OPS_GetNumRemainingInputArgs() > 1) { + if (OPS_GetDoubleInput(&numdata, &shape) < 0) { + opserr << "WARNING invalid shape" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + } + + NDMaterial *theSteel = OPS_getNDMaterial(matTag); + + if (theSteel == 0) { + opserr << "WARNING ND material does not exist\n"; + opserr << "material: " << matTag; + opserr << "\nHSS section: " << tag << endln; + return 0; + } + + NDMaterial **theMats = new NDMaterial *[numFibers]; + + hsssect.arrangeFibers(theMats, theSteel); + + // Parsing was successful, allocate the section + theSection = 0; + if (OPS_GetNumRemainingInputArgs() > 0) { + const char* flag = OPS_GetString(); + if (strcmp(flag,"-nd") == 0) { + theSection = new NDFiberSection2d(tag, numFibers, theMats, hsssect, shape); + } else if (strcmp(flag,"-ndWarping") == 0) { + theSection = new NDFiberSectionWarping2d(tag, numFibers, theMats, hsssect, shape); + } + } + delete [] theMats; + } + else { + UniaxialMaterial *theSteel = OPS_getUniaxialMaterial(matTag); + + if (theSteel == 0) { + opserr << "WARNING uniaxial material does not exist\n"; + opserr << "material: " << matTag; + opserr << "\nHSS section: " << tag << endln; + return 0; + } + + UniaxialMaterial **theMats = new UniaxialMaterial *[numFibers]; + + hsssect.arrangeFibers(theMats, theSteel); + + // Parsing was successful, allocate the section + theSection = new FiberSection2d(tag, numFibers, theMats, hsssect); + + delete [] theMats; + } + + return theSection; +} + +HSSSectionIntegration::HSSSectionIntegration(double H, double B, double T, + int NFH, int NFB, int NFT): + SectionIntegration(SECTION_INTEGRATION_TAG_HSS), + h(H), b(B), t(T), Nfh(NFH), Nfb(NFB), Nft(1), parameterID(0) +{ + +} + +HSSSectionIntegration::HSSSectionIntegration(): + SectionIntegration(SECTION_INTEGRATION_TAG_HSS), + h(0.0), b(0.0), t(0.0), Nfh(0), Nfb(0), Nft(0), parameterID(0) +{ + +} + +HSSSectionIntegration::~HSSSectionIntegration() +{ + +} + +int +HSSSectionIntegration::getNumFibers(FiberType type) +{ + return 2*Nfh + 2*Nfb + 4*Nft*Nft; +} + +int +HSSSectionIntegration::arrangeFibers(UniaxialMaterial **theMaterials, + UniaxialMaterial *theSteel) +{ + int numFibers = this->getNumFibers(); + + for (int i = 0; i < numFibers; i++) + theMaterials[i] = theSteel; + + return 0; +} + +int +HSSSectionIntegration::arrangeFibers(NDMaterial **theMaterials, + NDMaterial *theSteel) +{ + int numFibers = this->getNumFibers(); + + for (int i = 0; i < numFibers; i++) + theMaterials[i] = theSteel; + + return 0; +} + +void +HSSSectionIntegration::getFiberLocations(int nFibers, double *yi, double *zi) +{ + double hw = h - 2*t; + double bw = b - 2*t; + + int i, loc; + + double yIncr = hw/Nfh; + double yStart = 0.5 * (hw-yIncr); + + for (loc = 0, i = 0; loc < Nfh; loc++, i++) { + yi[loc] = yStart - yIncr*i; + yi[loc+Nfh] = yi[loc]; + } + if (zi != 0) { + for (loc = 0; loc < Nfh; loc++) { + zi[loc] = 0.5*(bw + t); + zi[loc+Nfh] = -zi[loc]; + } + } + + for (loc = 2*Nfh, i = 0; i < Nfb; loc++, i++) { + yi[loc] = 0.5*(hw + t); + yi[loc+Nfb] = -yi[loc]; + } + if (zi != 0) { + double zIncr = bw/Nfb; + double zStart = 0.5 * (bw-zIncr); + for (loc = 2*Nfh, i = 0; i < Nfb; loc++, i++) { + zi[loc] = zStart - zIncr*i; + zi[loc+Nfb] = zi[loc]; + } + } + + // Four corners + loc = 2*Nfh + 2*Nfb; + double yy = 0.5*(hw+t); + yi[loc++] = yy; + yi[loc++] = -yy; + yi[loc++] = -yy; + yi[loc++] = yy; + if (zi != 0) { + loc = 2*Nfh + 2*Nfb; + double zz = 0.5*(bw+t); + zi[loc++] = zz; + zi[loc++] = zz; + zi[loc++] = -zz; + zi[loc++] = -zz; + } + + return; +} + +void +HSSSectionIntegration::getFiberWeights(int nFibers, double *wt) +{ + double hw = h - 2*t; + double bw = b - 2*t; + + // Assuming Nft = 1 + double a_h = hw*t/(Nfh); + double a_b = bw*t/(Nfb); + + int i, loc; + + for (loc = 0; loc < Nfh; loc++) { + wt[loc] = a_h; + wt[loc+Nfh] = a_h; + } + + for (loc = 2*Nfh, i = 0; i < Nfb; i++, loc++) { + wt[loc] = a_b; + wt[loc+Nfb] = a_b; + } + + // Four corners + double a_t = t*t; + loc = 2*Nfh + 2*Nfb; + for (i = 0; i < 4; i++, loc++) { + wt[loc] = a_t; + } + + return; +} + +SectionIntegration* +HSSSectionIntegration::getCopy(void) +{ + return new HSSSectionIntegration(h, b, t, Nfh, Nfb, Nft); +} + +int +HSSSectionIntegration::setParameter(const char **argv, int argc, + Parameter ¶m) +{ + if (argc < 1) + return -1; + + if (strcmp(argv[0],"b") == 0) { + param.setValue(h); + return param.addObject(1, this); + } + if (strcmp(argv[0],"b") == 0) { + param.setValue(b); + return param.addObject(2, this); + } + if (strcmp(argv[0],"t") == 0) { + param.setValue(t); + return param.addObject(3, this); + } + + return -1; +} + +int +HSSSectionIntegration::updateParameter(int parameterID, + Information &info) +{ + switch (parameterID) { + case 1: + h = info.theDouble; + return 0; + case 2: + b = info.theDouble; + return 0; + case 3: + t = info.theDouble; + return 0; + default: + return -1; + } +} + +int +HSSSectionIntegration::activateParameter(int paramID) +{ + parameterID = paramID; + + return 0; +} + +void +HSSSectionIntegration::getLocationsDeriv(int nFibers, double *dyidh, double *dzidh) +{ + /* + //double dw = d-2*tf; + + double dddh = 0.0; + double ddwdh = 0.0; + //double dtwdh = 0.0; + //double dbfdh = 0.0; + double dtfdh = 0.0; + + if (parameterID == 1) { // d + dddh = 1.0; + ddwdh = 1.0; + } + //if (parameterID == 2) // tw + // dtwdh = 1.0; + //if (parameterID == 3) // bf + // dbfdh = 1.0; + if (parameterID == 4) { // tf + dtfdh = 1.0; + ddwdh = -2.0; + } + + //double yIncr = tf/Nftf; + //double yStart = 0.5*d - 0.5*yIncr; + double dyIncrdh = dtfdh/Nftf; + double dyStartdh = 0.5 * (dddh-dyIncrdh); + + int loc; + + for (loc = 0; loc < Nftf; loc++) { + //yi[loc] = yStart - yIncr*loc; + //yi[nFibers-loc-1] = -yi[loc]; + dyidh[loc] = dyStartdh - dyIncrdh*loc; + dyidh[nFibers-loc-1] = -dyidh[loc]; + } + + //yIncr = dw/Nfdw; + //yStart = 0.5*dw - 0.5*yIncr; + dyIncrdh = ddwdh/Nfdw; + dyStartdh = 0.5 * (ddwdh-dyIncrdh); + + for (int count = 0; loc < nFibers-Nftf; loc++, count++) { + //yi[loc] = yStart - yIncr*count; + dyidh[loc] = dyStartdh - dyIncrdh*count; + } + + if (dzidh != 0) { + for (int i = 0; i < nFibers; i++) + dzidh[i] = 0.0; + } + */ + + return; +} + +void +HSSSectionIntegration::getWeightsDeriv(int nFibers, double *dwtdh) +{ + /* + double dw = d-2*tf; + + double ddwdh = 0.0; + double dtwdh = 0.0; + double dbfdh = 0.0; + double dtfdh = 0.0; + + if (parameterID == 1) // d + ddwdh = 1.0; + if (parameterID == 2) // tw + dtwdh = 1.0; + if (parameterID == 3) // bf + dbfdh = 1.0; + if (parameterID == 4) { // tf + dtfdh = 1.0; + ddwdh = -2.0; + } + + double dAfdh = (bf*dtfdh + dbfdh*tf) / Nftf; + double dAwdh = (dw*dtwdh + ddwdh*tw) / Nfdw; + + int loc = 0; + + for (loc = 0; loc < Nftf; loc++) { + dwtdh[loc] = dAfdh; + dwtdh[nFibers-loc-1] = dAfdh; + } + + for ( ; loc < nFibers-Nftf; loc++) + dwtdh[loc] = dAwdh; + + //for (int i = 0; i < nFibers; i++) + // opserr << dwtsdh[i] << ' '; + //opserr << endln; + */ + + return; +} + +void +HSSSectionIntegration::Print(OPS_Stream &s, int flag) +{ + s << "HSS" << endln; + s << " h = " << h; + s << " b = " << b; + s << " Nfh = " << Nfh; + s << " Nfb = " << Nfb; + s << " Nft = " << Nft << endln; + + return; +} + +int +HSSSectionIntegration::sendSelf(int cTag, Channel &theChannel) +{ + static Vector data(6); + + data(0) = h; + data(1) = b; + data(2) = t; + data(3) = Nfh; + data(4) = Nfb; + data(5) = Nft; + + int dbTag = this->getDbTag(); + + if (theChannel.sendVector(dbTag, cTag, data) < 0) { + opserr << "HSSSectionIntegration::sendSelf() - failed to send Vector data\n"; + return -1; + } + + return 0; +} + +int +HSSSectionIntegration::recvSelf(int cTag, Channel &theChannel, + FEM_ObjectBroker &theBroker) +{ + static Vector data(6); + + int dbTag = this->getDbTag(); + + if (theChannel.recvVector(dbTag, cTag, data) < 0) { + opserr << "HSSSectionIntegration::recvSelf() - failed to receive Vector data\n"; + return -1; + } + + h = data(0); + b = data(1); + t = data(2); + Nfh = (int)data(3); + Nfb = (int)data(4); + Nft = (int)data(5); + + return 0; +} diff --git a/SRC/material/section/integration/HSSSectionIntegration.h b/SRC/material/section/integration/HSSSectionIntegration.h new file mode 100644 index 000000000..02dd045a5 --- /dev/null +++ b/SRC/material/section/integration/HSSSectionIntegration.h @@ -0,0 +1,77 @@ +/* ****************************************************************** ** +** OpenSees - Open System for Earthquake Engineering Simulation ** +** Pacific Earthquake Engineering Research Center ** +** ** +** ** +** (C) Copyright 1999, The Regents of the University of California ** +** All Rights Reserved. ** +** ** +** Commercial use of this program without express permission of the ** +** University of California, Berkeley, is strictly prohibited. See ** +** file 'COPYRIGHT' in main directory for information on usage and ** +** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** +** ** +** Developed by: ** +** Frank McKenna (fmckenna@ce.berkeley.edu) ** +** Gregory L. Fenves (fenves@ce.berkeley.edu) ** +** Filip C. Filippou (filippou@ce.berkeley.edu) ** +** ** +** ****************************************************************** */ + +// $Revision: 1.5 $ +// $Date: 2010-09-13 21:31:26 $ +// $Source: /usr/local/cvs/OpenSees/SRC/material/section/integration/HSSSectionIntegration.h,v $ + +#ifndef HSSSectionIntegration_h +#define HSSSectionIntegration_h + +#include + +class UniaxialMaterial; +class NDMaterial; + +class HSSSectionIntegration : public SectionIntegration +{ + public: + HSSSectionIntegration(double h, double b, double t, + int Nfh, int Nfb, int Nft = 1); + HSSSectionIntegration(); + ~HSSSectionIntegration(); + + int getNumFibers(FiberType type = all); + + void getFiberLocations(int nFibers, double *yi, double *zi = 0); + void getFiberWeights(int nFibers, double *wt); + + SectionIntegration *getCopy(void); + + int sendSelf(int cTag, Channel &theChannel); + int recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker); + + int setParameter(const char **argv, int argc, Parameter ¶m); + int updateParameter(int parameterID, Information &info); + int activateParameter(int parameterID); + + void getLocationsDeriv(int nFibers, double *dyidh, double *dzidh = 0); + void getWeightsDeriv(int nFibers, double *dwtdh); + + void Print(OPS_Stream &s, int flag = 0); + + int arrangeFibers(UniaxialMaterial **theMaterials, + UniaxialMaterial *theSteel); + int arrangeFibers(NDMaterial **theMaterials, + NDMaterial *theSteel); + + private: + double h; + double b; + double t; + + int Nfh; + int Nfb; + int Nft; + + int parameterID; +}; + +#endif From 970496738a89e724f722be4042472a6386851c82 Mon Sep 17 00:00:00 2001 From: mhscott Date: Sat, 25 Sep 2021 12:56:53 -0700 Subject: [PATCH 10/57] Adding class tag for HSS section integration --- SRC/classTags.h | 1 + 1 file changed, 1 insertion(+) diff --git a/SRC/classTags.h b/SRC/classTags.h index 58c2f7a05..e280d2a62 100644 --- a/SRC/classTags.h +++ b/SRC/classTags.h @@ -336,6 +336,7 @@ #define SECTION_INTEGRATION_TAG_RCCIRCULAR 5 #define SECTION_INTEGRATION_TAG_RCTUNNEL 6 #define SECTION_INTEGRATION_TAG_Tube 7 +#define SECTION_INTEGRATION_TAG_HSS 8 #define ND_TAG_WrapperNDMaterial 9 #define ND_TAG_ElasticIsotropic 10 From 1bc12b974288feb0a5893808743fd1da93060330 Mon Sep 17 00:00:00 2001 From: mhscott Date: Sat, 25 Sep 2021 12:57:14 -0700 Subject: [PATCH 11/57] Adding HSS section integration to make and cmake --- SRC/material/section/integration/CMakeLists.txt | 2 ++ SRC/material/section/integration/Makefile | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SRC/material/section/integration/CMakeLists.txt b/SRC/material/section/integration/CMakeLists.txt index d4d786865..545bf2613 100644 --- a/SRC/material/section/integration/CMakeLists.txt +++ b/SRC/material/section/integration/CMakeLists.txt @@ -13,6 +13,7 @@ target_sources(OPS_Material RCCircularSectionIntegration.cpp TubeSectionIntegration.cpp RCTunnelSectionIntegration.cpp + HSSSectionIntegration.cpp PUBLIC SectionIntegration.h WideFlangeSectionIntegration.h @@ -21,6 +22,7 @@ target_sources(OPS_Material RCCircularSectionIntegration.h TubeSectionIntegration.h RCTunnelSectionIntegration.h + HSSSectionIntegration.h ) target_include_directories(OPS_Material PUBLIC ${CMAKE_CURRENT_LIST_DIR}) diff --git a/SRC/material/section/integration/Makefile b/SRC/material/section/integration/Makefile index c492ccd20..4f3190b63 100644 --- a/SRC/material/section/integration/Makefile +++ b/SRC/material/section/integration/Makefile @@ -3,7 +3,8 @@ include ../../../../Makefile.def OBJS = SectionIntegration.o \ WideFlangeSectionIntegration.o RCSectionIntegration.o \ RCTBeamSectionIntegration.o RCCircularSectionIntegration.o \ - TubeSectionIntegration.o RCTunnelSectionIntegration.o + TubeSectionIntegration.o RCTunnelSectionIntegration.o \ + HSSSectionIntegration.o # Compilation control From 872f2c47cbed809d98de474e2dfafba660647079 Mon Sep 17 00:00:00 2001 From: mhscott Date: Sat, 25 Sep 2021 13:19:28 -0700 Subject: [PATCH 12/57] Adding HSS section integration to Makefile --- SRC/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/SRC/Makefile b/SRC/Makefile index 2e9ecc8a5..94233b469 100644 --- a/SRC/Makefile +++ b/SRC/Makefile @@ -1057,6 +1057,7 @@ SECTION_LIBS = $(FE)/material/section/SectionForceDeformation.o \ $(FE)/material/section/integration/WideFlangeSectionIntegration.o \ $(FE)/material/section/integration/RCTBeamSectionIntegration.o \ $(FE)/material/section/integration/TubeSectionIntegration.o \ + $(FE)/material/section/integration/HSSSectionIntegration.o \ $(FE)/material/section/repres/patch/Patch.o \ $(FE)/material/section/repres/patch/QuadPatch.o \ $(FE)/material/section/repres/patch/CircPatch.o \ From c3047060562d8cb3c83369ebce535d3763c8de0e Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 27 Sep 2021 10:07:53 +0200 Subject: [PATCH 13/57] updatetags --- DEVELOPER/core/classTags.h | 1 - SRC/classTags.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/DEVELOPER/core/classTags.h b/DEVELOPER/core/classTags.h index 7a2b046f4..50ce42de1 100644 --- a/DEVELOPER/core/classTags.h +++ b/DEVELOPER/core/classTags.h @@ -722,7 +722,6 @@ #define ELE_TAG_NineNodeQuad 207 #define ELE_TAG_EightNodeQuad 208 #define ELE_TAG_SixNodeTri 209 -#define ELE_TAG_ZeroLengthImplexContact 218 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define ELE_TAG_ASDEmbeddedNodeElement 217 // Massimo Petracca (ASDEA) diff --git a/SRC/classTags.h b/SRC/classTags.h index a15162c82..149d87841 100644 --- a/SRC/classTags.h +++ b/SRC/classTags.h @@ -790,7 +790,7 @@ #define ELE_TAG_MasonPan12 215 #define ELE_TAG_MasonPan3D 216 #define ELE_TAG_ASDEmbeddedNodeElement 217 // Massimo Petracca (ASDEA) -#define ELE_TAG_ZeroLengthImplexContact 218 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +#define ELE_TAG_ZeroLengthImplexContact 220 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define ELE_TAG_ExternalElement 99990 From 8e5b6a0617c10c903c47eafc360f07b0a84d87c5 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Thu, 7 Oct 2021 12:45:15 +0200 Subject: [PATCH 14/57] renaming --- SRC/Makefile | 2 +- .../FEM_ObjectBrokerAllClasses.cpp | 6 +- SRC/classTags.h | 2 +- SRC/element/TclElementCommands.cpp | 6 +- SRC/element/zeroLength/Makefile | 2 +- ...act.cpp => ZeroLengthContactASDimplex.cpp} | 130 +++++++++--------- ...Contact.h => ZeroLengthContactASDimplex.h} | 28 ++-- SRC/interpreter/OpenSeesElementCommands.cpp | 4 +- SRC/recorder/GmshRecorder.cpp | 2 +- SRC/recorder/MPCORecorder.cpp | 2 +- SRC/recorder/PVDRecorder.cpp | 2 +- SRC/recorder/VTK_Recorder.cpp | 2 +- Win32/proj/element/element.vcxproj | 4 +- Win32/proj/element/element.vcxproj.filters | 4 +- Win64/proj/element/element.vcxproj | 4 +- Win64/proj/element/element.vcxproj.filters | 4 +- 16 files changed, 102 insertions(+), 102 deletions(-) rename SRC/element/zeroLength/{ZeroLengthImplexContact.cpp => ZeroLengthContactASDimplex.cpp} (86%) rename SRC/element/zeroLength/{ZeroLengthImplexContact.h => ZeroLengthContactASDimplex.h} (93%) diff --git a/SRC/Makefile b/SRC/Makefile index 3f5ccab84..c82e46361 100644 --- a/SRC/Makefile +++ b/SRC/Makefile @@ -474,7 +474,7 @@ ELE_LIBS = $(FE)/element/Element.o \ $(FE)/element/truss/N4BiaxialTruss.o \ $(FE)/element/zeroLength/ZeroLengthContact2D.o \ $(FE)/element/zeroLength/ZeroLengthContact3D.o \ - $(FE)/element/zeroLength/ZeroLengthImplexContact.o \ + $(FE)/element/zeroLength/ZeroLengthContactASDimplex.o \ $(FE)/element/zeroLength/ZeroLengthContactNTS2D.o \ $(FE)/element/zeroLength/ZeroLengthInterface2D.o \ $(FE)/element/zeroLength/ZeroLengthRocking.o \ diff --git a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp index 3005b38b7..f0d580abc 100644 --- a/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp +++ b/SRC/actor/objectBroker/FEM_ObjectBrokerAllClasses.cpp @@ -224,7 +224,7 @@ #include "zeroLength/ZeroLengthContact3D.h" #include "zeroLength/ZeroLengthContactNTS2D.h" #include "zeroLength/ZeroLengthInterface2D.h" -#include "zeroLength/ZeroLengthImplexContact.h" +#include "zeroLength/ZeroLengthContactASDimplex.h" //#include "ZeroLengthND.h" #include "fourNodeQuad/FourNodeQuad.h" @@ -687,8 +687,8 @@ FEM_ObjectBrokerAllClasses::getNewElement(int classTag) case ELE_TAG_ZeroLengthContactNTS2D: return new ZeroLengthContactNTS2D(); - case ELE_TAG_ZeroLengthImplexContact: - return new ZeroLengthImplexContact(); + case ELE_TAG_ZeroLengthContactASDimplex: + return new ZeroLengthContactASDimplex(); //case ELE_TAG_ZeroLengthND: //return new ZeroLengthND(); diff --git a/SRC/classTags.h b/SRC/classTags.h index cca7a5b81..9b4e99224 100644 --- a/SRC/classTags.h +++ b/SRC/classTags.h @@ -795,7 +795,7 @@ #define ELE_TAG_MasonPan3D 216 #define ELE_TAG_ASDEmbeddedNodeElement 217 // Massimo Petracca (ASDEA) #define ELE_TAG_InertiaTruss 218 //Added by Xiaodong Ji, Yuhao Cheng, Yue Yu -#define ELE_TAG_ZeroLengthImplexContact 221 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +#define ELE_TAG_ZeroLengthContactASDimplex 221 // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) #define ELE_TAG_ExternalElement 99990 diff --git a/SRC/element/TclElementCommands.cpp b/SRC/element/TclElementCommands.cpp index a2304faa8..561ca1527 100644 --- a/SRC/element/TclElementCommands.cpp +++ b/SRC/element/TclElementCommands.cpp @@ -195,7 +195,7 @@ extern void *OPS_BeamGT(void); extern void* OPS_DispBeamColumnAsym3dTcl(); //Xinlong Du extern void* OPS_MixedBeamColumnAsym3dTcl(); //Xinlong Du -extern void* OPS_ZeroLengthImplexContact(void); // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) +extern void* OPS_ZeroLengthContactASDimplex(void); // Onur Deniz Akan (IUSS), Massimo Petracca (ASDEA) extern int TclModelBuilder_addFeapTruss(ClientData clientData, Tcl_Interp *interp, int argc, TCL_Char **argv, Domain*, TclModelBuilder *, int argStart); @@ -1548,8 +1548,8 @@ TclModelBuilderElementCommand(ClientData clientData, Tcl_Interp *interp, } } - else if (strcmp(argv[1], "zeroLengthImplexContact") == 0) { - void* theEle = OPS_ZeroLengthImplexContact(); + else if (strcmp(argv[1], "zeroLengthContactASDimplex") == 0) { + void* theEle = OPS_ZeroLengthContactASDimplex(); if (theEle != 0) theElement = (Element*)theEle; else { diff --git a/SRC/element/zeroLength/Makefile b/SRC/element/zeroLength/Makefile index 14fd17c6c..757716826 100644 --- a/SRC/element/zeroLength/Makefile +++ b/SRC/element/zeroLength/Makefile @@ -4,7 +4,7 @@ OBJS = ZeroLength.o \ ZeroLengthSection.o \ ZeroLengthContact2D.o \ ZeroLengthContact3D.o \ - ZeroLengthImplexContact.o \ + ZeroLengthContactASDimplex.o \ ZeroLengthND.o \ ZeroLengthContactNTS2D.o \ ZeroLengthInterface2D.o \ diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp b/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp similarity index 86% rename from SRC/element/zeroLength/ZeroLengthImplexContact.cpp rename to SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp index a5352b426..e7d36877c 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.cpp +++ b/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp @@ -18,7 +18,7 @@ ** ** ** ****************************************************************** */ -// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthImplexContact.cpp,v $ +// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp,v $ // $Revision: 1.0 $ // $Date: 2020-May $ @@ -30,9 +30,9 @@ // // Created: May 2020 // -// Description: This file contains the implementation for the ZeroLengthImplexContact class. +// Description: This file contains the implementation for the ZeroLengthContactASDimplex class. -#include "ZeroLengthImplexContact.h" +#include "ZeroLengthContactASDimplex.h" #include #include #include @@ -91,7 +91,7 @@ namespace } } -void* OPS_ZeroLengthImplexContact(void) { +void* OPS_ZeroLengthContactASDimplex(void) { double SmallNumber = 1.0e-6; Element* theElement = nullptr; @@ -99,19 +99,19 @@ void* OPS_ZeroLengthImplexContact(void) { // some kudos static int counter = 0; if (++counter == 1) - opserr << "ZeroLengthImplexContact element - Implemented: Akan, OD., Petracca, M., Camata, G., Spacone, E. & Lai, CG. (2020)\n"; + opserr << "ZeroLengthContactASDimplex element - Implemented: Akan, OD., Petracca, M., Camata, G., Spacone, E. & Lai, CG. (2020)\n"; // model dimension int ndm = OPS_GetNDM(); if (ndm < 2 || ndm > 3) { - opserr << "ZeroLengthImplexContact: Unsupported NDM (" << ndm << "). It should be 2 or 3\n"; + opserr << "ZeroLengthContactASDimplex: Unsupported NDM (" << ndm << "). It should be 2 or 3\n"; return theElement; } // a quick check on number of args - if (OPS_GetNumRemainingInputArgs() < 7) { - opserr << "ZeroLengthImplexContact: WARNING: too few arguments \n" << - "want - element zeroLengthImplexContact eleTag? iNode? jNode? Kn? Kt? mu? C? <-orient $x1 $x2 $x3> <-intType type?>\n"; + if (OPS_GetNumRemainingInputArgs() < 6) { + opserr << "ZeroLengthContactASDimplex: WARNING: too few arguments \n" << + "want - element zeroLengthContactASDimplex eleTag? iNode? jNode? Kn? Kt? mu? <-orient $x1 $x2 $x3> <-intType type?>\n"; return theElement; } @@ -120,7 +120,7 @@ void* OPS_ZeroLengthImplexContact(void) { int idata[3]; int numdata = 3; if (OPS_GetIntInput(&numdata, idata) < 0) { - opserr << "ZeroLengthImplexContact: WARNING: invalid int inputs\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: invalid int inputs\n"; return theElement; } @@ -128,7 +128,7 @@ void* OPS_ZeroLengthImplexContact(void) { double ddata[3]; numdata = 3; if (OPS_GetDoubleInput(&numdata, ddata) < 0) { - opserr << "ZeroLengthImplexContact: WARNING: invalid double inputs\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: invalid double inputs\n"; return theElement; } @@ -140,35 +140,35 @@ void* OPS_ZeroLengthImplexContact(void) { if (strcmp(inputstring, "-orient") == 0) { // #1 read global element orientation if (ndm == 2) { if (OPS_GetNumRemainingInputArgs() < 2) { - opserr << "ZeroLengthImplexContact: WARNING: insufficient orient values in 2D\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: insufficient orient values in 2D\n"; return theElement; } numdata = 3; if (OPS_GetDoubleInput(&numdata, &x_e(0)) < 0) { - opserr << "ZeroLengthImplexContact: WARNING: invalid double input after -orient\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: invalid double input after -orient\n"; return theElement; } } else if (ndm == 3) { if (OPS_GetNumRemainingInputArgs() < 3) { - opserr << "ZeroLengthImplexContact: WARNING: insufficient orient values in 3D\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: insufficient orient values in 3D\n"; return theElement; } numdata = 3; if (OPS_GetDoubleInput(&numdata, &x_e(0)) < 0) { - opserr << "ZeroLengthImplexContact: WARNING: invalid double input after -orient\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: invalid double input after -orient\n"; return theElement; } } else { - opserr << "ZeroLengthImplexContact: WARNING: -orient: model dimension is invalid! \n"; + opserr << "ZeroLengthContactASDimplex: WARNING: -orient: model dimension is invalid! \n"; return theElement; } } else if (strcmp(inputstring, "-intType") == 0) { // #2 read type of integration numdata = 1; if (OPS_GetIntInput(&numdata, &integrationType) < 0) { - opserr << "ZeroLengthImplexContact: WARNING: invalid integer after -intType\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: invalid integer after -intType\n"; return theElement; } } @@ -177,32 +177,32 @@ void* OPS_ZeroLengthImplexContact(void) { // check integration type and pick implicit if neither 1 or 0 if (integrationType != 1 && integrationType != 0) { - opserr << "ZeroLengthImplexContact: WARNING: type of integration is set to IMPLICIT due to invalid flag\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: type of integration is set to IMPLICIT due to invalid flag\n"; integrationType = false; } // check the normal vector and normalize if (x_e.Norm() < SmallNumber) { - opserr << "ZeroLengthImplexContact: WARNING: normal vector is NOT valid!: -orient $x1 $x2 $x3 cannot be < 0, 0, 0 >\n"; + opserr << "ZeroLengthContactASDimplex: WARNING: normal vector is NOT valid!: -orient $x1 $x2 $x3 cannot be < 0, 0, 0 >\n"; return theElement; } x_e.Normalize(); // normalized it on input! // finally, create the element - theElement = new ZeroLengthImplexContact(idata[0], idata[1], idata[2], ddata[0], ddata[1], + theElement = new ZeroLengthContactASDimplex(idata[0], idata[1], idata[2], ddata[0], ddata[1], ddata[2], ndm, integrationType, x_e[0], x_e[1], x_e[2]); if (theElement == 0) { - opserr << "WARNING: out of memory: element zeroLengthImplexContact " << idata[0] << + opserr << "WARNING: out of memory: element zeroLengthContactASDimplex " << idata[0] << " iNode? jNode? Kn? Kt? mu? <-orient $x1 $x2 $x3> <-intType type?>\n"; } return theElement; } -ZeroLengthImplexContact::ZeroLengthImplexContact(int tag, int Nd1, int Nd2, +ZeroLengthContactASDimplex::ZeroLengthContactASDimplex(int tag, int Nd1, int Nd2, double Kn, double Kt, double fcoeff, int ndm, bool itype, double xN, double yN, double zN) - : Element(tag, ELE_TAG_ZeroLengthImplexContact) + : Element(tag, ELE_TAG_ZeroLengthContactASDimplex) , connectedExternalNodes(2) , Knormal(Kn) , Kfriction(Kt) @@ -217,36 +217,36 @@ ZeroLengthImplexContact::ZeroLengthImplexContact(int tag, int Nd1, int Nd2, Xorient[2] = zN; } -ZeroLengthImplexContact::ZeroLengthImplexContact() - : Element(0, ELE_TAG_ZeroLengthImplexContact) +ZeroLengthContactASDimplex::ZeroLengthContactASDimplex() + : Element(0, ELE_TAG_ZeroLengthContactASDimplex) { } -ZeroLengthImplexContact::~ZeroLengthImplexContact() +ZeroLengthContactASDimplex::~ZeroLengthContactASDimplex() { } -int ZeroLengthImplexContact::getNumExternalNodes() const +int ZeroLengthContactASDimplex::getNumExternalNodes() const { return 2; } -const ID& ZeroLengthImplexContact::getExternalNodes() +const ID& ZeroLengthContactASDimplex::getExternalNodes() { return connectedExternalNodes; } -Node** ZeroLengthImplexContact::getNodePtrs() +Node** ZeroLengthContactASDimplex::getNodePtrs() { return theNodes.data(); } -int ZeroLengthImplexContact::getNumDOF() +int ZeroLengthContactASDimplex::getNumDOF() { return numDOF[0] + numDOF[1]; } -void ZeroLengthImplexContact::setDomain(Domain* theDomain) +void ZeroLengthContactASDimplex::setDomain(Domain* theDomain) { // check Domain is not null - invoked when object removed from a domain if (theDomain == 0) { @@ -264,7 +264,7 @@ void ZeroLengthImplexContact::setDomain(Domain* theDomain) // check nodes if ((theNodes[0] == nullptr) || (theNodes[1] == nullptr)) { opserr << - "FATAL ERROR ZeroLengthImplexContact::setDomain() - Nd1: " << Nd1 << + "FATAL ERROR ZeroLengthContactASDimplex::setDomain() - Nd1: " << Nd1 << " and/or Nd2: " << Nd2 << " do not exist in the model.\n"; exit(-1); } @@ -272,7 +272,7 @@ void ZeroLengthImplexContact::setDomain(Domain* theDomain) // check NDM if (theNodes[0]->getCrds().Size() != numDIM || theNodes[1]->getCrds().Size() != numDIM) { opserr << - "FATAL ERROR ZeroLengthImplexContact::setDomain() - Nd1: " << Nd1 << + "FATAL ERROR ZeroLengthContactASDimplex::setDomain() - Nd1: " << Nd1 << " and/or Nd2: " << Nd2 << " have an incorrect number of coordinates.\n" "Element NDM = " << numDIM << "\n" "NDM at Nd1: " << theNodes[0]->getCrds().Size() << "\n" @@ -290,7 +290,7 @@ void ZeroLengthImplexContact::setDomain(Domain* theDomain) int idof = numDOF[i]; if (idof < 2 || idof > 3) { opserr << - "FATAL ERROR ZeroLengthImplexContact::setDomain() - #DOFs (" + "FATAL ERROR ZeroLengthContactASDimplex::setDomain() - #DOFs (" << idof << ") at node " << i + 1 << " is not supported! it can be either 2 or 3\n"; exit(-1); @@ -302,7 +302,7 @@ void ZeroLengthImplexContact::setDomain(Domain* theDomain) int idof = numDOF[i]; if ((idof != 3) && (idof != 4) && (idof != 6)) { opserr << - "FATAL ERROR ZeroLengthImplexContact::setDomain() - #DOFs (" + "FATAL ERROR ZeroLengthContactASDimplex::setDomain() - #DOFs (" << idof << ") at node " << i + 1 << " is not supported! it can be either 3, 4 or 6\n"; exit(-1); @@ -327,7 +327,7 @@ void ZeroLengthImplexContact::setDomain(Domain* theDomain) DomainComponent::setDomain(theDomain); } -int ZeroLengthImplexContact::commitState(void) +int ZeroLengthContactASDimplex::commitState(void) { // do the implicit correction if impl-ex if (use_implex) { @@ -350,7 +350,7 @@ int ZeroLengthImplexContact::commitState(void) return 0; } -int ZeroLengthImplexContact::revertToLastCommit(void) +int ZeroLengthContactASDimplex::revertToLastCommit(void) { // restore committed internal variables sv.eps = sv.eps_commit; @@ -365,7 +365,7 @@ int ZeroLengthImplexContact::revertToLastCommit(void) return 0; } -int ZeroLengthImplexContact::revertToStart() +int ZeroLengthContactASDimplex::revertToStart() { // reset state variables sv = StateVariables(); @@ -373,7 +373,7 @@ int ZeroLengthImplexContact::revertToStart() return 0; } -int ZeroLengthImplexContact::update() +int ZeroLengthContactASDimplex::update() { if (!sv.dtime_is_user_defined) { sv.dtime_n = ops_Dt; @@ -411,7 +411,7 @@ int ZeroLengthImplexContact::update() return 0; } -const Matrix& ZeroLengthImplexContact::getTangentStiff() +const Matrix& ZeroLengthContactASDimplex::getTangentStiff() { auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); auto& stiff = gs.K; @@ -420,7 +420,7 @@ const Matrix& ZeroLengthImplexContact::getTangentStiff() return stiff; } -const Matrix& ZeroLengthImplexContact::getInitialStiff() +const Matrix& ZeroLengthContactASDimplex::getInitialStiff() { auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); auto& stiff = gs.K0; @@ -436,7 +436,7 @@ const Matrix& ZeroLengthImplexContact::getInitialStiff() return stiff; } -const Matrix& ZeroLengthImplexContact::getDamp() +const Matrix& ZeroLengthContactASDimplex::getDamp() { // get global storage for gloabl DOFset auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); @@ -444,7 +444,7 @@ const Matrix& ZeroLengthImplexContact::getDamp() return gs.D; } -const Matrix& ZeroLengthImplexContact::getMass() +const Matrix& ZeroLengthContactASDimplex::getMass() { // get global storage for global DOFset auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); @@ -452,7 +452,7 @@ const Matrix& ZeroLengthImplexContact::getMass() return gs.M; } -const Vector& ZeroLengthImplexContact::getResistingForce() { +const Vector& ZeroLengthContactASDimplex::getResistingForce() { auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); auto& R = gs.R; @@ -480,12 +480,12 @@ const Vector& ZeroLengthImplexContact::getResistingForce() { return R; } -const Vector& ZeroLengthImplexContact::getResistingForceIncInertia() +const Vector& ZeroLengthContactASDimplex::getResistingForceIncInertia() { return getResistingForce(); } -int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { +int ZeroLengthContactASDimplex::sendSelf(int commitTag, Channel& theChannel) { int res = 0; int dataTag = this->getDbTag(); @@ -504,7 +504,7 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { idata(9) = gap0_initialized ? 1 : 0; res = theChannel.sendID(dataTag, commitTag, idata); if (res < 0) { - opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send ID\n"; + opserr << "WARNING ZeroLengthContactASDimplex::sendSelf() - " << this->getTag() << " failed to send ID\n"; return -1; } @@ -543,7 +543,7 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { ddata(30) = gap0(2); res = theChannel.sendVector(dataTag, commitTag, ddata); if (res < 0) { - opserr << "WARNING ZeroLengthImplexContact::sendSelf() - " << this->getTag() << " failed to send Vector\n"; + opserr << "WARNING ZeroLengthContactASDimplex::sendSelf() - " << this->getTag() << " failed to send Vector\n"; return -1; } @@ -551,7 +551,7 @@ int ZeroLengthImplexContact::sendSelf(int commitTag, Channel& theChannel) { return 0; } -int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_ObjectBroker& theBroker) { +int ZeroLengthContactASDimplex::recvSelf(int commitTag, Channel& theChannel, FEM_ObjectBroker& theBroker) { int res; int dataTag = this->getDbTag(); @@ -560,7 +560,7 @@ int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_Ob static ID idata(10); res = theChannel.recvID(dataTag, commitTag, idata); if (res < 0) { - opserr << "WARNING ZeroLengthImplexContact::recvSelf() - failed to receive ID\n"; + opserr << "WARNING ZeroLengthContactASDimplex::recvSelf() - failed to receive ID\n"; return -1; } setTag(idata(0)); @@ -578,7 +578,7 @@ int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_Ob static Vector ddata(31); res = theChannel.recvVector(dataTag, commitTag, ddata); if (res < 0) { - opserr << "WARNING ZeroLengthImplexContact::recvSelf() - failed to receive Vector\n"; + opserr << "WARNING ZeroLengthContactASDimplex::recvSelf() - failed to receive Vector\n"; return -1; } Knormal = ddata(0); @@ -616,7 +616,7 @@ int ZeroLengthImplexContact::recvSelf(int commitTag, Channel& theChannel, FEM_Ob return 0; } -int ZeroLengthImplexContact::displaySelf(Renderer& theViewer, int displayMode, float fact, const char** modes, int numMode) +int ZeroLengthContactASDimplex::displaySelf(Renderer& theViewer, int displayMode, float fact, const char** modes, int numMode) { if (theNodes[0] == 0 || theNodes[1] == 0) return 0; @@ -630,11 +630,11 @@ int ZeroLengthImplexContact::displaySelf(Renderer& theViewer, int displayMode, f return theViewer.drawPoint(v1, d1, 10); } -void ZeroLengthImplexContact::Print(OPS_Stream& strm, int flag) { +void ZeroLengthContactASDimplex::Print(OPS_Stream& strm, int flag) { if (flag == 0) { strm << "Element: " << this->getTag(); - strm << " type: ZeroLengthImplexContact iNode: " << connectedExternalNodes(0); + strm << " type: ZeroLengthContactASDimplex iNode: " << connectedExternalNodes(0); strm << " jNode: " << connectedExternalNodes(1) << endln; } else if (flag == 1) { @@ -642,12 +642,12 @@ void ZeroLengthImplexContact::Print(OPS_Stream& strm, int flag) { } } -Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_Stream& output) +Response* ZeroLengthContactASDimplex::setResponse(const char** argv, int argc, OPS_Stream& output) { Response* theResponse = nullptr; output.tag("ElementOutput"); - output.attr("eleType", "zeroLengthImplexContact"); + output.attr("eleType", "zeroLengthContactASDimplex"); output.attr("eleTag", this->getTag()); output.attr("node1", connectedExternalNodes[0]); output.attr("node2", connectedExternalNodes[1]); @@ -783,7 +783,7 @@ Response* ZeroLengthImplexContact::setResponse(const char** argv, int argc, OPS_ return theResponse; } -int ZeroLengthImplexContact::getResponse(int responseID, Information& eleInfo) { +int ZeroLengthContactASDimplex::getResponse(int responseID, Information& eleInfo) { auto& gs = getGlobalStorage(numDOF[0] + numDOF[1]); static Vector small(numDIM); @@ -857,7 +857,7 @@ int ZeroLengthImplexContact::getResponse(int responseID, Information& eleInfo) { } } -int ZeroLengthImplexContact::updateParameter(int parameterID, double value) +int ZeroLengthContactASDimplex::updateParameter(int parameterID, double value) { if (parameterID == 1) { // set user defined current time increment @@ -877,7 +877,7 @@ int ZeroLengthImplexContact::updateParameter(int parameterID, double value) return 0; } -const Matrix& ZeroLengthImplexContact::getRotationMatrix33() +const Matrix& ZeroLengthContactASDimplex::getRotationMatrix33() { static Matrix T(3, 3); @@ -921,7 +921,7 @@ const Matrix& ZeroLengthImplexContact::getRotationMatrix33() return T; } -const Matrix& ZeroLengthImplexContact::getRotationMatrix66() +const Matrix& ZeroLengthContactASDimplex::getRotationMatrix66() { static Matrix T2(6, 6); T2.Zero(); @@ -938,7 +938,7 @@ const Matrix& ZeroLengthImplexContact::getRotationMatrix66() return T2; } -const Vector& ZeroLengthImplexContact::getInitialGap() +const Vector& ZeroLengthContactASDimplex::getInitialGap() { // compute local gap vector static Vector LGap(3); @@ -947,7 +947,7 @@ const Vector& ZeroLengthImplexContact::getInitialGap() return LGap; } -void ZeroLengthImplexContact::computeStrain() +void ZeroLengthContactASDimplex::computeStrain() { // get global displacement for global DOFset const Vector& U1 = theNodes[0]->getTrialDisp(); @@ -974,7 +974,7 @@ void ZeroLengthImplexContact::computeStrain() sv.eps.addVector(1.0, LGap, 1.0); } -void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) +void ZeroLengthContactASDimplex::updateInternal(bool do_implex, bool do_tangent) { // strain layout // [Normal, Tangential1, Tangential2] @@ -1100,7 +1100,7 @@ void ZeroLengthImplexContact::updateInternal(bool do_implex, bool do_tangent) } } -void ZeroLengthImplexContact::formStiffnessMatrix(const Matrix& C, Matrix& K) +void ZeroLengthContactASDimplex::formStiffnessMatrix(const Matrix& C, Matrix& K) { // element stiffness in local system static Matrix KL(6, 6); @@ -1125,7 +1125,7 @@ void ZeroLengthImplexContact::formStiffnessMatrix(const Matrix& C, Matrix& K) } } -const Matrix& ZeroLengthImplexContact::theBMatrix() +const Matrix& ZeroLengthContactASDimplex::theBMatrix() { // this is the strain-displacement matrix. // the strain is a actually the displacement jump U2-U1 diff --git a/SRC/element/zeroLength/ZeroLengthImplexContact.h b/SRC/element/zeroLength/ZeroLengthContactASDimplex.h similarity index 93% rename from SRC/element/zeroLength/ZeroLengthImplexContact.h rename to SRC/element/zeroLength/ZeroLengthContactASDimplex.h index 22714f57b..972c8268f 100644 --- a/SRC/element/zeroLength/ZeroLengthImplexContact.h +++ b/SRC/element/zeroLength/ZeroLengthContactASDimplex.h @@ -18,12 +18,12 @@ ** ** ** ****************************************************************** */ -// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthImplexContact.h,v $ +// $Source: /usr/local/cvs/OpenSees/SRC/element/zeroLength/ZeroLengthContactASDimplex.h,v $ // $Revision: 1.0 $ // $Date: 2020-XX-XX XX:XX:XX $ -#ifndef ZeroLengthImplexContact_h -#define ZeroLengthImplexContact_h +#ifndef ZeroLengthContactASDimplex_h +#define ZeroLengthContactASDimplex_h // Written: Onur Deniz Akan (onur.akan@iusspavia.it) // Dr. Massimo Petracca @@ -36,7 +36,7 @@ /*----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----* | | - | ZeroLengthImplexContact element | + | ZeroLengthContactASDimplex element | + + |--------------------------------------------------------------------------------| | | @@ -61,7 +61,7 @@ /* command - element zeroLengthImplexContact $eleID $mNdID $sNdID $Kn $Kt $mu <-orient $x1 $x2 $x3> <-intType $type> + element zeroLengthContactASDimplex $eleID $mNdID $sNdID $Kn $Kt $mu <-orient $x1 $x2 $x3> <-intType $type> where: $eleID : element ID of this contact element @@ -77,8 +77,8 @@ rFlag = 0 implicit, backward-euler integration scheme (default) rFlag = 1 impl-ex, implicit/explicit integration scheme - Description: This file contains the class definition for ZeroLengthImplexContact. - (1) A ZeroLengthImplexContact element is defined by two nodes in R^2 (x,y) or R^3 (x,y,z). + Description: This file contains the class definition for ZeroLengthContactASDimplex. + (1) A ZeroLengthContactASDimplex element is defined by two nodes in R^2 (x,y) or R^3 (x,y,z). (2) Penalty (Kn,Kt) method is used to constrain displacements in the normal direction, and in the tangential direction along with a Mohr-Coulomb frictional yield surface. (3) In 2D and 3D, 2, 4, 6 or 12 DOFs with the possibility of having different DOFsets at @@ -95,11 +95,11 @@ the convergence criteria is achieved, extrapolated material parameters are corrected with a step of traditional implicit computation from the last commited step (n). Finally, corrected parameters are saved as the current step (n+1) commited variables. - (8) In a Newton-Raphson scheme, IMPL-EX integration translates to a step-linear solution of the material + (8) In a Newton-Raphson scheme, IMPL-EX integration translates to a step-wise linear solution of the material non-linearity, and a symmetric, semi-positive definite tangent tensor regardless of what the analytical - tangent migh be, hence improving the robustness of the solution. The order of accuracy is the same with + tangent might be, hence improving the robustness of the solution. The order of accuracy is the same with the implicit (backward) euler integration scheme, however the commited error at a time step is larger. - An automatic time-stepping algorithm should be employed in order to a priori control this error. (Oliver et al, 2008) + An automatic time-stepping algorithm should be employed in order to control (a-priori) this error. (Oliver et al, 2008) References: Oliver, J., Huespe, A.E. and Cante, J.C. "An Implicit/Explicit Integration Scheme to @@ -115,7 +115,7 @@ class Node; class Channel; class Response; -class ZeroLengthImplexContact : public Element { +class ZeroLengthContactASDimplex : public Element { public: class StateVariables { @@ -151,13 +151,13 @@ class ZeroLengthImplexContact : public Element { public: // constructor - ZeroLengthImplexContact(int tag, int Nd1, int Nd2, + ZeroLengthContactASDimplex(int tag, int Nd1, int Nd2, double Kn, double Kt, double fs, int ndm, bool itype, double xN, double yN, double zN); // null constructor & destructor - ZeroLengthImplexContact(); - ~ZeroLengthImplexContact(); + ZeroLengthContactASDimplex(); + ~ZeroLengthContactASDimplex(); // public methods to obtain information about dof & connectivity int getNumExternalNodes() const; diff --git a/SRC/interpreter/OpenSeesElementCommands.cpp b/SRC/interpreter/OpenSeesElementCommands.cpp index 0da80a912..eac5e8bcf 100644 --- a/SRC/interpreter/OpenSeesElementCommands.cpp +++ b/SRC/interpreter/OpenSeesElementCommands.cpp @@ -190,7 +190,7 @@ void* OPS_BbarBrickWithSensitivity(); void* OPS_ZeroLengthRocking(); void* OPS_ZeroLengthContact2D(); void* OPS_ZeroLengthContact3D(); -void* OPS_ZeroLengthImplexContact(); +void* OPS_ZeroLengthContactASDimplex(); void* OPS_Joint2D(); void* OPS_Joint3D(); void* OPS_LehighJoint2d(); @@ -541,7 +541,7 @@ namespace { functionMap.insert(std::make_pair("LehighJoint2d", &OPS_LehighJoint2d)); functionMap.insert(std::make_pair("zeroLengthContact2D", &OPS_ZeroLengthContact2D)); functionMap.insert(std::make_pair("zeroLengthContact3D", &OPS_ZeroLengthContact3D)); - functionMap.insert(std::make_pair("zeroLengthImplexContact", &OPS_ZeroLengthImplexContact)); + functionMap.insert(std::make_pair("zeroLengthContactASDimplex", &OPS_ZeroLengthContactASDimplex)); functionMap.insert(std::make_pair("zeroLengthRocking", &OPS_ZeroLengthRocking)); functionMap.insert(std::make_pair("bbarBrickWithSensitivity", &OPS_BbarBrickWithSensitivity)); functionMap.insert(std::make_pair("bbarBrick", &OPS_BbarBrick)); diff --git a/SRC/recorder/GmshRecorder.cpp b/SRC/recorder/GmshRecorder.cpp index bf939875c..add8ead76 100644 --- a/SRC/recorder/GmshRecorder.cpp +++ b/SRC/recorder/GmshRecorder.cpp @@ -1273,7 +1273,7 @@ GmshRecorder::setGMSHType() gmshtypes[ELE_TAG_ZeroLengthND] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContact2D] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContact3D] = GMSH_LINE; - gmshtypes[ELE_TAG_ZeroLengthImplexContact] = GMSH_LINE; + gmshtypes[ELE_TAG_ZeroLengthContactASDimplex] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthContactNTS2D] = GMSH_LINE; gmshtypes[ELE_TAG_ZeroLengthInterface2D] = GMSH_LINE; gmshtypes[ELE_TAG_CoupledZeroLength] = GMSH_LINE; diff --git a/SRC/recorder/MPCORecorder.cpp b/SRC/recorder/MPCORecorder.cpp index befe04611..91540d271 100755 --- a/SRC/recorder/MPCORecorder.cpp +++ b/SRC/recorder/MPCORecorder.cpp @@ -3649,7 +3649,7 @@ namespace mpco { elem_class_tag == ELE_TAG_ZeroLengthRocking || elem_class_tag == ELE_TAG_ZeroLengthContact2D || elem_class_tag == ELE_TAG_ZeroLengthContact3D || - elem_class_tag == ELE_TAG_ZeroLengthImplexContact || + elem_class_tag == ELE_TAG_ZeroLengthContactASDimplex || elem_class_tag == ELE_Tag_ZeroLengthImpact3D || // ./elasticBeamColumn elem_class_tag == ELE_TAG_ElasticBeam2d || diff --git a/SRC/recorder/PVDRecorder.cpp b/SRC/recorder/PVDRecorder.cpp index b2fc86fa2..30b6a8334 100644 --- a/SRC/recorder/PVDRecorder.cpp +++ b/SRC/recorder/PVDRecorder.cpp @@ -1815,7 +1815,7 @@ PVDRecorder::setVTKType() vtktypes[ELE_TAG_ZeroLengthND] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact3D] = VTK_POLY_VERTEX; - vtktypes[ELE_TAG_ZeroLengthImplexContact] = VTK_POLY_VERTEX; + vtktypes[ELE_TAG_ZeroLengthContactASDimplex] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContactNTS2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthInterface2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_CoupledZeroLength] = VTK_POLY_VERTEX; diff --git a/SRC/recorder/VTK_Recorder.cpp b/SRC/recorder/VTK_Recorder.cpp index ef4e22842..311d77b37 100644 --- a/SRC/recorder/VTK_Recorder.cpp +++ b/SRC/recorder/VTK_Recorder.cpp @@ -1009,7 +1009,7 @@ VTK_Recorder::setVTKType() vtktypes[ELE_TAG_ZeroLengthND] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContact3D] = VTK_POLY_VERTEX; - vtktypes[ELE_TAG_ZeroLengthImplexContact] = VTK_POLY_VERTEX; + vtktypes[ELE_TAG_ZeroLengthContactASDimplex] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthContactNTS2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_ZeroLengthInterface2D] = VTK_POLY_VERTEX; vtktypes[ELE_TAG_CoupledZeroLength] = VTK_POLY_VERTEX; diff --git a/Win32/proj/element/element.vcxproj b/Win32/proj/element/element.vcxproj index 0f93799ce..dbbe3b2bb 100644 --- a/Win32/proj/element/element.vcxproj +++ b/Win32/proj/element/element.vcxproj @@ -203,7 +203,7 @@ - + @@ -474,7 +474,7 @@ - + diff --git a/Win32/proj/element/element.vcxproj.filters b/Win32/proj/element/element.vcxproj.filters index 8a5e5d680..5de30cdbe 100644 --- a/Win32/proj/element/element.vcxproj.filters +++ b/Win32/proj/element/element.vcxproj.filters @@ -200,7 +200,7 @@ zeroLength - + zeroLength @@ -1000,7 +1000,7 @@ zeroLength - + zeroLength diff --git a/Win64/proj/element/element.vcxproj b/Win64/proj/element/element.vcxproj index 6427f7371..379e79585 100644 --- a/Win64/proj/element/element.vcxproj +++ b/Win64/proj/element/element.vcxproj @@ -301,7 +301,7 @@ - + @@ -578,7 +578,7 @@ - + diff --git a/Win64/proj/element/element.vcxproj.filters b/Win64/proj/element/element.vcxproj.filters index fd8555e3d..3ded67f58 100644 --- a/Win64/proj/element/element.vcxproj.filters +++ b/Win64/proj/element/element.vcxproj.filters @@ -200,7 +200,7 @@ zeroLength - + zeroLength @@ -1032,7 +1032,7 @@ zeroLength - + zeroLength From 5e7f9eca0fac3d53b9df76de2c03ab1ab2ebf172 Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Thu, 7 Oct 2021 12:58:14 +0200 Subject: [PATCH 15/57] Update element.vcxproj.filters --- Win64/proj/element/element.vcxproj.filters | 1 + 1 file changed, 1 insertion(+) diff --git a/Win64/proj/element/element.vcxproj.filters b/Win64/proj/element/element.vcxproj.filters index 66f340c09..e26638c6f 100644 --- a/Win64/proj/element/element.vcxproj.filters +++ b/Win64/proj/element/element.vcxproj.filters @@ -979,6 +979,7 @@ forceBeamColumn\beamIntegration + truss From 13ababf60629422d6473147d7896ccf8347bb3ac Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 11 Oct 2021 11:14:48 +0200 Subject: [PATCH 16/57] Update CMakeLists.txt --- SRC/element/zeroLength/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SRC/element/zeroLength/CMakeLists.txt b/SRC/element/zeroLength/CMakeLists.txt index 90c0c231c..136370293 100644 --- a/SRC/element/zeroLength/CMakeLists.txt +++ b/SRC/element/zeroLength/CMakeLists.txt @@ -29,6 +29,7 @@ target_sources(OPS_Element CoupledZeroLength.cpp ZeroLengthContact2D.cpp ZeroLengthContact3D.cpp + ZeroLengthContactASDimplex.cpp ZeroLengthContactNTS2D.cpp ZeroLengthImpact3D.cpp ZeroLengthInterface2D.cpp @@ -41,6 +42,7 @@ target_sources(OPS_Element CoupledZeroLength.h ZeroLengthContact2D.h ZeroLengthContact3D.h + ZeroLengthContactASDimplex.h ZeroLengthContactNTS2D.h ZeroLengthImpact3D.h ZeroLengthInterface2D.h From cf8780aa03c1207720237d644cdcf8d3bfba169a Mon Sep 17 00:00:00 2001 From: Massimo Petracca Date: Mon, 11 Oct 2021 18:04:25 +0200 Subject: [PATCH 17/57] Update ZeroLengthContactASDimplex.cpp --- SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp b/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp index e7d36877c..7c23264fa 100644 --- a/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp +++ b/SRC/element/zeroLength/ZeroLengthContactASDimplex.cpp @@ -319,7 +319,7 @@ void ZeroLengthContactASDimplex::setDomain(Domain* theDomain) const Vector& U1 = theNodes[1]->getTrialDisp(); gap0.Zero(); for (int i = 0; i < numDIM; ++i) - gap0(i) = P1(i) + U1(i) - P0(i) - U0(i); + gap0(i) = P1(i) - U1(i) - P0(i) + U0(i); gap0_initialized = true; } From 63d816fe122a9a7fa3131a938cd48c1d2a667f9a Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 11 Oct 2021 11:06:56 -0700 Subject: [PATCH 18/57] Update HystereticMaterial.cpp Calling setEnvelope() at end of updateParameter --- SRC/material/uniaxial/HystereticMaterial.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SRC/material/uniaxial/HystereticMaterial.cpp b/SRC/material/uniaxial/HystereticMaterial.cpp index 9e824609b..3b5e3d39c 100644 --- a/SRC/material/uniaxial/HystereticMaterial.cpp +++ b/SRC/material/uniaxial/HystereticMaterial.cpp @@ -789,6 +789,8 @@ HystereticMaterial::updateParameter(int parameterID, Information &info) return -1; } + this->setEnvelope(); + return 0; } From 65256672bb91a8080b87d65346ab1c70b72ae58b Mon Sep 17 00:00:00 2001 From: fmckenna Date: Mon, 11 Oct 2021 11:07:34 -0700 Subject: [PATCH 19/57] fmk - fixing math includein ASDAabsorbingBC files --- SRC/element/absorbentBoundaries/ASDAbsorbingBoundary2D.cpp | 7 ++++--- SRC/element/absorbentBoundaries/ASDAbsorbingBoundary3D.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary2D.cpp b/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary2D.cpp index 5d15c36e4..f82483c9f 100644 --- a/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary2D.cpp +++ b/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary2D.cpp @@ -36,12 +36,13 @@ #include #include -#include -#include -#include #include +#include #include #include +#include +#include + namespace { diff --git a/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary3D.cpp b/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary3D.cpp index 80e706499..ce0826f7c 100644 --- a/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary3D.cpp +++ b/SRC/element/absorbentBoundaries/ASDAbsorbingBoundary3D.cpp @@ -38,11 +38,12 @@ #include #include -#include #include + #include #include #include +#include namespace { From ec25ba7bf14787bd1822cd4354ef96958e638013 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 11 Oct 2021 11:30:47 -0700 Subject: [PATCH 20/57] Update HystereticMaterial.cpp K. Mackie - more parameter options --- SRC/material/uniaxial/HystereticMaterial.cpp | 50 +++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/HystereticMaterial.cpp b/SRC/material/uniaxial/HystereticMaterial.cpp index 3b5e3d39c..4a2879336 100644 --- a/SRC/material/uniaxial/HystereticMaterial.cpp +++ b/SRC/material/uniaxial/HystereticMaterial.cpp @@ -739,7 +739,31 @@ HystereticMaterial::setParameter(const char **argv, int argc, Parameter ¶m) param.setValue(rot3n); return param.addObject(12, this); } - + if (strcmp(argv[0],"mom1") == 0) { + param.setValue(mom1p); + return param.addObject(13, this); + } + if (strcmp(argv[0],"rot1") == 0) { + param.setValue(rot1p); + return param.addObject(14, this); + } + if (strcmp(argv[0],"mom2") == 0) { + param.setValue(mom2p); + return param.addObject(15, this); + } + if (strcmp(argv[0],"rot2") == 0) { + param.setValue(rot2p); + return param.addObject(16, this); + } + if (strcmp(argv[0],"mom3") == 0) { + param.setValue(mom3p); + return param.addObject(17, this); + } + if (strcmp(argv[0],"rot3") == 0) { + param.setValue(rot3p); + return param.addObject(18, this); + } + return -1; } @@ -785,6 +809,30 @@ HystereticMaterial::updateParameter(int parameterID, Information &info) case 12: this->rot3n = info.theDouble; break; + case 13: + this->mom1p = info.theDouble; + this->mom1n = -mom1p; + break; + case 14: + this->rot1p = info.theDouble; + this->rot1n = -rot1p; + break; + case 15: + this->mom2p = info.theDouble; + this->mom2n = -mom2p; + break; + case 16: + this->rot2p = info.theDouble; + this->rot2n = -rot2p; + break; + case 17: + this->mom3p = info.theDouble; + this->mom3n = -mom3p; + break; + case 18: + this->rot3p = info.theDouble; + this->rot3n = -rot3p; + break; default: return -1; } From fa2f9732ba376622c5d422d5cce81491855d1ab4 Mon Sep 17 00:00:00 2001 From: Minjie Zhu Date: Thu, 14 Oct 2021 22:04:02 +0000 Subject: [PATCH 21/57] check if mpi is inited --- SRC/actor/machineBroker/MPI_MachineBroker.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SRC/actor/machineBroker/MPI_MachineBroker.cpp b/SRC/actor/machineBroker/MPI_MachineBroker.cpp index 8852fb787..f10322c72 100644 --- a/SRC/actor/machineBroker/MPI_MachineBroker.cpp +++ b/SRC/actor/machineBroker/MPI_MachineBroker.cpp @@ -37,7 +37,11 @@ MPI_MachineBroker::MPI_MachineBroker(FEM_ObjectBroker *theBroker, int argc, char **argv) :MachineBroker(theBroker) { - MPI_Init(&argc, &argv); + int flag = 0; + MPI_Initialized(&flag); + if (!flag) { + MPI_Init(&argc, &argv); + } MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); From abaebb8882f5746f5e3fc3196a4d138e5a234acb Mon Sep 17 00:00:00 2001 From: mhscott Date: Fri, 15 Oct 2021 06:46:43 -0700 Subject: [PATCH 22/57] Allowing different section tags for distributed plasticity beam integrations --- .../ChebyshevBeamIntegration.cpp | 82 ++++++++++++------- .../CompositeSimpsonBeamIntegration.cpp | 69 ++++++++++++---- .../LegendreBeamIntegration.cpp | 70 ++++++++++++---- .../LobattoBeamIntegration.cpp | 69 ++++++++++++---- .../NewtonCotesBeamIntegration.cpp | 69 ++++++++++++---- .../forceBeamColumn/RadauBeamIntegration.cpp | 69 ++++++++++++---- .../SimpsonBeamIntegration.cpp | 71 ++++++++++++---- .../TrapezoidalBeamIntegration.cpp | 69 ++++++++++++---- 8 files changed, 424 insertions(+), 144 deletions(-) diff --git a/SRC/element/forceBeamColumn/ChebyshevBeamIntegration.cpp b/SRC/element/forceBeamColumn/ChebyshevBeamIntegration.cpp index 3f74836c1..b0c0275be 100755 --- a/SRC/element/forceBeamColumn/ChebyshevBeamIntegration.cpp +++ b/SRC/element/forceBeamColumn/ChebyshevBeamIntegration.cpp @@ -29,40 +29,64 @@ void* OPS_ChebyshevBeamIntegration(int& integrationTag, ID& secTags) { - if(OPS_GetNumRemainingInputArgs() < 3) { - opserr<<"insufficient arguments:integrationTag,secTag,N,\n"; - return 0; - } + int nArgs = OPS_GetNumRemainingInputArgs(); - // inputs: integrationTag,secTag,N, - int iData[3]; - int numData = 3; - if(OPS_GetIntInput(&numData,&iData[0]) < 0) { - opserr << "WARNING: failed to read inputs\n"; - return 0; + if (nArgs < 3) { + opserr<<"insufficient arguments:integrationTag,secTag,N -or- N,*secTagList\n"; + return 0; + } + + // Read tag + int iData[2]; + int numData = 2; + if (OPS_GetIntInput(&numData,&iData[0]) < 0) { + opserr << "ChebyshevBeamIntegration - unable to read int data" << endln; + return 0; + } + integrationTag = iData[0]; + + if (nArgs == 3) { + // inputs: integrationTag,secTag,N + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "ChebyshevBeamIntegration - Unable to read number of sections" << endln; + return 0; } - - integrationTag = iData[0]; - if(iData[2] > 0) { - secTags.resize(iData[2]); + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { - numData = 1; - if(OPS_GetIntInput(&numData,&iData[0]) < 0) { - opserr << "WARNING: failed to read inputs\n"; - return 0; - } - return new ChebyshevBeamIntegration(iData[0]); - } else - return new ChebyshevBeamIntegration(); - - + } + else { + // inputs: integrationTag,N,*secTagList + int Nsections = iData[1]; + if (Nsections < 0) + return 0; + int *sections = new int[Nsections]; + if (OPS_GetIntInput(&Nsections,sections) < 0) { + opserr << "ChebyshevBeamIntegration - Unable to read section tags" << endln; + return 0; + } + if (Nsections > 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "CompositeSimpsonBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "LobattoBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "NewtonCotesBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "RadauBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "SimpsonBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i 0) { - secTags.resize(iData[2]); + numData = 1; + int Nsections; + if (OPS_GetIntInput(&numData,&Nsections) < 0) { + opserr << "TrapezoidalBeamIntegration - Unable to read number of sections" << endln; + return 0; + } + if (Nsections < 0) + return 0; + + if (Nsections > 0) { + secTags.resize(Nsections); } else { - secTags = ID(); + secTags = ID(); } - for(int i=0; i 0) { + secTags.resize(Nsections); + } else { + secTags = ID(); + } + for (int i=0; i Date: Fri, 15 Oct 2021 11:44:24 -0700 Subject: [PATCH 23/57] cmp - Do not link found tcl when conan has been run. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf587e478..f9f412a40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,15 +359,17 @@ target_link_libraries(OpenSees ${MYSQL_LIBRARIES} ) -target_include_directories(OpenSees PUBLIC ${TCL_INCLUDE_PATH}) #---------------------------- # OPS_Interp_Tcl #---------------------------- # Add sources to OPS_Interp_Tcl target -target_include_directories(OPS_Interp_Tcl PUBLIC ${TCL_INCLUDE_PATH}) -target_link_libraries(OPS_Interp_Tcl PRIVATE ${TCL_LIBRARIES}) +if(NOT EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + target_include_directories(OpenSees PUBLIC ${TCL_INCLUDE_PATH}) + target_include_directories(OPS_Interp_Tcl PUBLIC ${TCL_INCLUDE_PATH}) + target_link_libraries(OPS_Interp_Tcl PRIVATE ${TCL_LIBRARIES}) +endif() target_compile_definitions(OPS_Interp_Tcl PUBLIC _TCL85) From 26a1d58bc9fb2288e143718b4fbb6796c8630478 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 17 Oct 2021 15:46:46 -0700 Subject: [PATCH 24/57] Update HSSSectionIntegration.cpp --- .../section/integration/HSSSectionIntegration.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SRC/material/section/integration/HSSSectionIntegration.cpp b/SRC/material/section/integration/HSSSectionIntegration.cpp index 2c0d3cdd0..3cbdc6943 100644 --- a/SRC/material/section/integration/HSSSectionIntegration.cpp +++ b/SRC/material/section/integration/HSSSectionIntegration.cpp @@ -310,7 +310,7 @@ HSSSectionIntegration::setParameter(const char **argv, int argc, if (argc < 1) return -1; - if (strcmp(argv[0],"b") == 0) { + if (strcmp(argv[0],"h") == 0) { param.setValue(h); return param.addObject(1, this); } @@ -458,10 +458,11 @@ void HSSSectionIntegration::Print(OPS_Stream &s, int flag) { s << "HSS" << endln; - s << " h = " << h; - s << " b = " << b; - s << " Nfh = " << Nfh; - s << " Nfb = " << Nfb; + s << " h = " << h << endln; + s << " b = " << b << endln; + s << " t = " << t << endln; + s << " Nfh = " << Nfh << endln; + s << " Nfb = " << Nfb << endln; s << " Nft = " << Nft << endln; return; From 217bf62819c2ff441ea4b97d600d87d2e6c6cdb7 Mon Sep 17 00:00:00 2001 From: mhscott Date: Sun, 17 Oct 2021 16:58:13 -0700 Subject: [PATCH 25/57] Adding HSS command to interpreter --- SRC/interpreter/OpenSeesSectionCommands.cpp | 122 ++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/SRC/interpreter/OpenSeesSectionCommands.cpp b/SRC/interpreter/OpenSeesSectionCommands.cpp index 94f3e45d6..299983ac2 100644 --- a/SRC/interpreter/OpenSeesSectionCommands.cpp +++ b/SRC/interpreter/OpenSeesSectionCommands.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -271,6 +272,126 @@ namespace { return theSec; } + static void* OPS_HSSSection() + { + if (OPS_GetNumRemainingInputArgs() < 7) { + opserr << "WARNING insufficient arguments\n"; + opserr << "Want: section HSS tag? matTag? h? b? t? nfh? nfb? <-nd shape?>" << endln; + return 0; + } + + int tag, matTag; + double h, b, t; + int nfh, nfb; + int nft = 1; + + SectionForceDeformation* theSection = 0; + + int numdata = 1; + if (OPS_GetIntInput(&numdata, &tag) < 0) { + opserr << "WARNING invalid section HSS tag" << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &matTag) < 0) { + opserr << "WARNING invalid section HSS matTag" << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &h) < 0) { + opserr << "WARNING invalid h" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &b) < 0) { + opserr << "WARNING invalid b" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetDoubleInput(&numdata, &t) < 0) { + opserr << "WARNING invalid t" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &nfh) < 0) { + opserr << "WARNING invalid nfh" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + if (OPS_GetIntInput(&numdata, &nfb) < 0) { + opserr << "WARNING invalid nfb" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + + HSSSectionIntegration hsssect(h, b, t, nfh, nfb, nft); + + int numFibers = hsssect.getNumFibers(); + + if (OPS_GetNumRemainingInputArgs() > 0) { + + double shape = 1.0; + if (OPS_GetNumRemainingInputArgs() > 1) { + if (OPS_GetDoubleInput(&numdata, &shape) < 0) { + opserr << "WARNING invalid shape" << endln; + opserr << "HSS section: " << tag << endln; + return 0; + } + } + + NDMaterial *theSteel = OPS_getNDMaterial(matTag); + + if (theSteel == 0) { + opserr << "WARNING ND material does not exist\n"; + opserr << "material: " << matTag; + opserr << "\nHSS section: " << tag << endln; + return 0; + } + + NDMaterial **theMats = new NDMaterial *[numFibers]; + + hsssect.arrangeFibers(theMats, theSteel); + + // Parsing was successful, allocate the section + theSection = 0; + if (OPS_GetNumRemainingInputArgs() > 0) { + const char* flag = OPS_GetString(); + if (strcmp(flag,"-nd") == 0) { + theSection = new NDFiberSection3d(tag, numFibers, theMats, hsssect, shape); + } else if (strcmp(flag,"-ndWarping") == 0) { + theSection = new NDFiberSectionWarping2d(tag, numFibers, theMats, hsssect, shape); + } + } + delete [] theMats; + } + else { + UniaxialMaterial *theSteel = OPS_getUniaxialMaterial(matTag); + + if (theSteel == 0) { + opserr << "WARNING uniaxial material does not exist\n"; + opserr << "material: " << matTag; + opserr << "\nTube section: " << tag << endln; + return 0; + } + + UniaxialMaterial **theMats = new UniaxialMaterial *[numFibers]; + + hsssect.arrangeFibers(theMats, theSteel); + + // Parsing was successful, allocate the section + ElasticMaterial theTorsion(0,1.0); + theSection = new FiberSection3d(tag, numFibers, theMats, hsssect, theTorsion); + + delete [] theMats; + } + + return theSection; + } + static void* OPS_UniaxialSection() { int numdata = OPS_GetNumRemainingInputArgs(); @@ -1086,6 +1207,7 @@ namespace { functionMap.insert(std::make_pair("ElasticWarpingShear", &OPS_ElasticWarpingShearSection2d)); functionMap.insert(std::make_pair("ElasticTube", &OPS_ElasticTubeSection3d)); functionMap.insert(std::make_pair("Tube", &OPS_TubeSection)); + functionMap.insert(std::make_pair("HSS", &OPS_HSSSection)); functionMap.insert(std::make_pair("WFSection2d", &OPS_WFSection2d)); functionMap.insert(std::make_pair("WSection2d", &OPS_WFSection2d)); functionMap.insert(std::make_pair("RCSection2d", &OPS_RCSection2d)); From 49b48334c6993f11f6f1e827ec6b28790fe8d274 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Oct 2021 09:11:44 -0700 Subject: [PATCH 26/57] Update IMKBilin.cpp --- SRC/material/uniaxial/IMKBilin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/IMKBilin.cpp b/SRC/material/uniaxial/IMKBilin.cpp index 9fa1dfc58..339386c24 100644 --- a/SRC/material/uniaxial/IMKBilin.cpp +++ b/SRC/material/uniaxial/IMKBilin.cpp @@ -337,7 +337,7 @@ int IMKBilin::setTrialStrain(double strain, double strainRate) } // Simple and unified notation for current bacbone parameters - Mi_temp = Mi_1 + K_j * (Ri - Ri_1); + double Mi_temp = Mi_1 + K_j * (Ri - Ri_1); if (Mi_temp >= 0.0) { Ki = K_j; slope_pi = slope_p_pos_j; From b6266149a97dc285d766a59024ab57dafc9c1437 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Mon, 18 Oct 2021 09:12:05 -0700 Subject: [PATCH 27/57] Update IMKBilin.h --- SRC/material/uniaxial/IMKBilin.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/SRC/material/uniaxial/IMKBilin.h b/SRC/material/uniaxial/IMKBilin.h index d5f4576c4..3b34737d5 100644 --- a/SRC/material/uniaxial/IMKBilin.h +++ b/SRC/material/uniaxial/IMKBilin.h @@ -177,8 +177,6 @@ class IMKBilin : public UniaxialMaterial double Mpe_x, cMpe_x; double Theta_y_x, cTheta_y_x; double MpeProject_x, cMpeProject_x; - - double Mi_temp; }; @@ -257,4 +255,4 @@ Energy_Excrsni_1 Dissipated energy in previous excursion Energy_Excrsn Dissipated energy in current excursion Energy_Rev Total dissipated energy till previous load reversal point Energy_total Total dissipated energy till current step -*/ \ No newline at end of file +*/ From 4491b19533d82792b3e7ae6e343be0b003ca1f99 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Mon, 18 Oct 2021 10:43:12 -0700 Subject: [PATCH 28/57] fmk - updating EC2-UBUNTU Makefile.def .. adding -fallow-argument-mismatch to FFLAGS for latest fortran compiler and very old fortran code --- MAKES/Makefile.def.EC2-UBUNTU | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAKES/Makefile.def.EC2-UBUNTU b/MAKES/Makefile.def.EC2-UBUNTU index 74b48573b..2e8477de2 100644 --- a/MAKES/Makefile.def.EC2-UBUNTU +++ b/MAKES/Makefile.def.EC2-UBUNTU @@ -185,7 +185,7 @@ C++FLAGS = -Wall -D_LINUX -D_UNIX -D_TCL85 \ $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) \ $(PROGRAMMING_FLAG) -fPIC -ffloat-store CFLAGS = -Wall -fPIC -FFLAGS = -Wall -fPIC +FFLAGS = -Wall -fPIC -fallow-argument-mismatch # Linker LINKER = $(CC++) @@ -197,7 +197,7 @@ C++FLAGS = -Wall -D_LINUX -D_UNIX -D_TCL85 \ $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) \ $(PROGRAMMING_FLAG) -O3 -ffloat-store CFLAGS = -Wall -O2 -FFLAGS = -Wall -O +FFLAGS = -Wall -O -fallow-argument-mismatch # Linker LINKER = $(CC++) From aaf4f3c1ae2a4f2ab6ad2f410a2ea4caf7cdd444 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:44:04 -0700 Subject: [PATCH 29/57] Removing exit call and small fix in recvSelf --- SRC/material/uniaxial/SimpleFractureMaterial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/SimpleFractureMaterial.cpp b/SRC/material/uniaxial/SimpleFractureMaterial.cpp index 659442bc8..936c084db 100644 --- a/SRC/material/uniaxial/SimpleFractureMaterial.cpp +++ b/SRC/material/uniaxial/SimpleFractureMaterial.cpp @@ -92,7 +92,7 @@ SimpleFractureMaterial::SimpleFractureMaterial(int tag, UniaxialMaterial &materi if (theMaterial == 0) { opserr << "SimpleFractureMaterial::SimpleFractureMaterial -- failed to get copy of material\n"; - exit(-1); + //exit(-1); } } @@ -348,7 +348,7 @@ SimpleFractureMaterial::recvSelf(int cTag, Channel &theChannel, maxStrain = dataVec(0); - if (dataVec(2) == 1.0) + if (dataVec(1) == 1.0) Cfailed = true; else Cfailed = false; From e536c2e44b2ad636a365e356f9a11b63326d2313 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:45:20 -0700 Subject: [PATCH 30/57] Removing exit call --- SRC/material/uniaxial/ElasticPowerFunc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/ElasticPowerFunc.cpp b/SRC/material/uniaxial/ElasticPowerFunc.cpp index 97e6d4c1b..44d34e62e 100644 --- a/SRC/material/uniaxial/ElasticPowerFunc.cpp +++ b/SRC/material/uniaxial/ElasticPowerFunc.cpp @@ -134,7 +134,7 @@ ElasticPowerFunc::ElasticPowerFunc(int tag, if (numTerms != exponents.Size()) { opserr << "ElasticPowerFunc::ElasticPowerFunc() " << "- coefficient and exponent arrays do not have same length.\n"; - exit(-1); + //exit(-1); } this->revertToStart(); From 62f930aa6abb29df259bd3762f18d7911031cddc Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:46:19 -0700 Subject: [PATCH 31/57] Removing exit call --- SRC/material/uniaxial/GNGMaterial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/GNGMaterial.cpp b/SRC/material/uniaxial/GNGMaterial.cpp index c58084ed2..d4b844493 100644 --- a/SRC/material/uniaxial/GNGMaterial.cpp +++ b/SRC/material/uniaxial/GNGMaterial.cpp @@ -143,7 +143,7 @@ GNGMaterial::GNGMaterial(int tag, double e, double sigY0, double p, double eta0) E = fabs(sigY)/0.002; else { opserr << "GNGMaterial::GNGMaterial -- E and sigY are zero\n"; - exit(-1); + //exit(-1); } } else From 7ca33e4223f7cef7ca28960a72245ffc4cbf0914 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:47:00 -0700 Subject: [PATCH 32/57] Removing exit call --- SRC/material/uniaxial/PathIndependentMaterial.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/PathIndependentMaterial.cpp b/SRC/material/uniaxial/PathIndependentMaterial.cpp index 50c17b598..da3b46b55 100644 --- a/SRC/material/uniaxial/PathIndependentMaterial.cpp +++ b/SRC/material/uniaxial/PathIndependentMaterial.cpp @@ -79,7 +79,7 @@ PathIndependentMaterial::PathIndependentMaterial(int tag, UniaxialMaterial &mate if (theMaterial == 0) { opserr << "PathIndependentMaterial::PathIndependentMaterial -- failed to get copy of material\n"; - exit(-1); + //exit(-1); } } @@ -235,7 +235,8 @@ PathIndependentMaterial::recvSelf(int cTag, Channel &theChannel, theMaterial = theBroker.getNewUniaxialMaterial(classTags(0)); if (theMaterial == 0) { opserr << "PathIndependentMaterial::recvSelf -- could not get a UniaxialMaterial\n"; - exit(-1); + //exit(-1); + return -1; } } From 4460da447db39999a10ea9e4c3e6d040079f7f0d Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:49:39 -0700 Subject: [PATCH 33/57] Removing exit call --- SRC/material/uniaxial/SteelBRB.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/SteelBRB.cpp b/SRC/material/uniaxial/SteelBRB.cpp index 65acd9a46..632bc3267 100755 --- a/SRC/material/uniaxial/SteelBRB.cpp +++ b/SRC/material/uniaxial/SteelBRB.cpp @@ -482,7 +482,8 @@ double SteelBRB::Newton_BRB(double CStress, double beta, double CPlastStrain, d if (fabs(F)>Tol){ opserr<< "Fatal error: SteelBRB::Newton_BRB does not converge ===============\n"; - exit(-1); + //exit(-1); + return 0.0; } return x0; From 62dac868673aae8b189ba66f3bed6037b970f0c8 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:50:11 -0700 Subject: [PATCH 34/57] Removing exit call --- SRC/material/uniaxial/InitStrainMaterial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/InitStrainMaterial.cpp b/SRC/material/uniaxial/InitStrainMaterial.cpp index 6c663793b..a210eae94 100644 --- a/SRC/material/uniaxial/InitStrainMaterial.cpp +++ b/SRC/material/uniaxial/InitStrainMaterial.cpp @@ -88,7 +88,7 @@ InitStrainMaterial::InitStrainMaterial(int tag, if (theMaterial == 0) { opserr << "InitStrainMaterial::InitStrainMaterial -- failed to get copy of material\n"; - exit(-1); + //exit(-1); } theMaterial->setTrialStrain(epsInit); theMaterial->commitState(); From ac49350868aa7eae31c3a42fac7f68fc06c0a79c Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:51:04 -0700 Subject: [PATCH 35/57] Removing exit call --- SRC/material/uniaxial/Trilinwp.cpp | 2 +- SRC/material/uniaxial/Trilinwpd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/Trilinwp.cpp b/SRC/material/uniaxial/Trilinwp.cpp index e9c2edeaf..87f5ca3e8 100644 --- a/SRC/material/uniaxial/Trilinwp.cpp +++ b/SRC/material/uniaxial/Trilinwp.cpp @@ -129,7 +129,7 @@ Trilinwp::Trilinwp(int tag, if (error) { opserr << "Trilinwp::Trilinwp -- input backbone is not unique (one-to-one)\n"; - exit(-1); + //exit(-1); } mom1pi=mom1p; mom2pi=mom2p; diff --git a/SRC/material/uniaxial/Trilinwpd.cpp b/SRC/material/uniaxial/Trilinwpd.cpp index aeec3a4c0..71b1b6e88 100644 --- a/SRC/material/uniaxial/Trilinwpd.cpp +++ b/SRC/material/uniaxial/Trilinwpd.cpp @@ -123,7 +123,7 @@ mom1n(m1n), rot1n(r1n), mom2n(m2n), rot2n(r2n), mom3n(m3n), rot3n(r3n),pt(ptn), if (error) { opserr << "trilinwpd::trilinwpd -- input backbone is not unique (one-to-one)\n"; - exit(-1); + //exit(-1); } mom1pi=mom1p; mom2pi=mom2p; From 0aa0132f7eb82b242a2d95afdd4b136eb3ed0a96 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:52:25 -0700 Subject: [PATCH 36/57] Small fix in recvSelf --- SRC/material/uniaxial/Trilinwpd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/Trilinwpd.cpp b/SRC/material/uniaxial/Trilinwpd.cpp index 71b1b6e88..11bf1ff62 100644 --- a/SRC/material/uniaxial/Trilinwpd.cpp +++ b/SRC/material/uniaxial/Trilinwpd.cpp @@ -652,8 +652,8 @@ trilinwpd::recvSelf(int commitTag, Channel &theChannel, Cstrain = data(25); Ttangent = data(26); pt = data(27); - pb = data(29); - itype=data(30); + pb = data(28); + itype=data(29); // set the trial values TrotMax = CrotMax; TrotMin = CrotMin; From 54f5b7a8e49da60e45d629392d91bb2f81cbbe1b Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:53:11 -0700 Subject: [PATCH 37/57] Removing exit call --- SRC/material/uniaxial/BraceMaterial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/BraceMaterial.cpp b/SRC/material/uniaxial/BraceMaterial.cpp index 23f1d0cef..5e4d5e9ae 100644 --- a/SRC/material/uniaxial/BraceMaterial.cpp +++ b/SRC/material/uniaxial/BraceMaterial.cpp @@ -116,7 +116,7 @@ BraceMaterial::BraceMaterial(int tag, if (error) { opserr << "BraceMaterial::BraceMaterial -- input backbone is not unique (one-to-one)\n"; - exit(-1); + //exit(-1); } energyA = 0.5 * (rot1p*mom1p + (rot2p-rot1p)*(mom2p+mom1p) + (rot3p-rot2p)*(mom3p+mom2p) + rot1n*mom1n + (rot3n-rot1n)*(mom3n+mom1n)); @@ -153,7 +153,7 @@ BraceMaterial::BraceMaterial(int tag, error = true; if (error) { opserr << "BraceMaterial::BraceMaterial -- input backbone is not unique (one-to-one)\n"; - exit(-1); + //exit(-1); } energyA = 0.5 * (rot1p*mom1p + (rot3p-rot1p)*(mom3p+mom1p) + From 616064e4b5c7b00842ee79be6cbfec940ad83fe3 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 06:57:37 -0700 Subject: [PATCH 38/57] Removing exit call in recvSelf --- SRC/material/uniaxial/DamperMaterial.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/DamperMaterial.cpp b/SRC/material/uniaxial/DamperMaterial.cpp index 6ecba2cd0..6f1fe4717 100644 --- a/SRC/material/uniaxial/DamperMaterial.cpp +++ b/SRC/material/uniaxial/DamperMaterial.cpp @@ -253,7 +253,8 @@ DamperMaterial::recvSelf(int cTag, Channel &theChannel, if (theMaterial == 0) { opserr << "FATAL DamperMaterial::recvSelf() "; opserr << " could not get a UniaxialMaterial \n"; - exit(-1); + //exit(-1); + return -1; } theMaterial->setDbTag(dbTag); theMaterial->recvSelf(cTag, theChannel, theBroker); From 8905f5bb6490f057c01e5e2bffc0aed1168007ba Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:04:46 -0700 Subject: [PATCH 39/57] Removing exit calls --- SRC/material/uniaxial/HyperbolicGapMaterial.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SRC/material/uniaxial/HyperbolicGapMaterial.cpp b/SRC/material/uniaxial/HyperbolicGapMaterial.cpp index a7b355316..ea5d50cce 100644 --- a/SRC/material/uniaxial/HyperbolicGapMaterial.cpp +++ b/SRC/material/uniaxial/HyperbolicGapMaterial.cpp @@ -93,12 +93,14 @@ HyperbolicGapMaterial::HyperbolicGapMaterial(int tag, double kmax, double kur, d Kmax(kmax), Kur(kur), Rf(rf), Fult(fult), gap(gap0) { if (gap>=0) { - opserr << "HyperbolicGapMaterial::HyperbolicGapMaterial -- Initial gap size must be negative for compression-only material\n"; - exit(-1); + opserr << "HyperbolicGapMaterial::HyperbolicGapMaterial -- Initial gap size must be negative for compression-only material, setting to negative\n"; + //exit(-1); + gap = -gap; } if (Fult>0) { - opserr << "HyperbolicGapMaterial::HyperbolicGapMaterial -- Fult must be negative for compression-only material\n"; - exit(-1); + opserr << "HyperbolicGapMaterial::HyperbolicGapMaterial -- Fult must be negative for compression-only material, setting to negative\n"; + //exit(-1); + Fult = -Fult; } if (Kmax == 0.0) { opserr << "HyperbolicGapMaterial::HyperbolicGapMaterial -- Kmax is zero, continuing with Kmax = Fult/0.002\n"; From 142689fbbbdae921b47dcd2bbff43e57b24b32fb Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:15:12 -0700 Subject: [PATCH 40/57] Removing exit call and checking for null material pointer --- SRC/material/uniaxial/MultiplierMaterial.cpp | 94 ++++++++++++++++---- 1 file changed, 77 insertions(+), 17 deletions(-) diff --git a/SRC/material/uniaxial/MultiplierMaterial.cpp b/SRC/material/uniaxial/MultiplierMaterial.cpp index 3af29b7c4..c09d95477 100644 --- a/SRC/material/uniaxial/MultiplierMaterial.cpp +++ b/SRC/material/uniaxial/MultiplierMaterial.cpp @@ -99,7 +99,7 @@ MultiplierMaterial::MultiplierMaterial(int tag, UniaxialMaterial &material, doub if (theMaterial == 0) { opserr << "MultiplierMaterial::MultiplierMaterial -- failed to get copy of material\n"; - exit(-1); + //exit(-1); } } @@ -118,33 +118,48 @@ MultiplierMaterial::~MultiplierMaterial() int MultiplierMaterial::setTrialStrain(double strain, double strainRate) { - return theMaterial->setTrialStrain(strain, strainRate); + if (theMaterial) + return theMaterial->setTrialStrain(strain, strainRate); + else + return -1; } int MultiplierMaterial::setTrialStrain(double strain, double temp, double strainRate) { - return theMaterial->setTrialStrain(strain, temp, strainRate); + if (theMaterial) + return theMaterial->setTrialStrain(strain, temp, strainRate); + else + return -1; } double MultiplierMaterial::getStress(void) { - return multiplier*theMaterial->getStress(); + if (theMaterial) + return multiplier*theMaterial->getStress(); + else + return 0.0; } double MultiplierMaterial::getTangent(void) { - return multiplier*theMaterial->getTangent(); + if (theMaterial) + return multiplier*theMaterial->getTangent(); + else + return 0.0; } double MultiplierMaterial::getDampTangent(void) { - return multiplier*theMaterial->getDampTangent(); + if (theMaterial) + return multiplier*theMaterial->getDampTangent(); + else + return 0.0; } @@ -152,38 +167,54 @@ MultiplierMaterial::getDampTangent(void) double MultiplierMaterial::getStrain(void) { - return theMaterial->getStrain(); + if (theMaterial) + return theMaterial->getStrain(); + else + return 0.0; } double MultiplierMaterial::getStrainRate(void) { - return theMaterial->getStrainRate(); + if (theMaterial) + return theMaterial->getStrainRate(); + else + return 0.0; } int MultiplierMaterial::commitState(void) -{ - return theMaterial->commitState(); +{ + if (theMaterial) + return theMaterial->commitState(); + else + return -1; } int MultiplierMaterial::revertToLastCommit(void) { - return theMaterial->revertToLastCommit(); + if (theMaterial) + return theMaterial->revertToLastCommit(); + else + return -1; } int MultiplierMaterial::revertToStart(void) { - return theMaterial->revertToStart(); + if (theMaterial) + return theMaterial->revertToStart(); + else + return -1; } UniaxialMaterial * MultiplierMaterial::getCopy(void) { - MultiplierMaterial *theCopy = - new MultiplierMaterial(this->getTag(), *theMaterial, multiplier); + MultiplierMaterial *theCopy = 0; + if (theMaterial) + theCopy = new MultiplierMaterial(this->getTag(), *theMaterial, multiplier); return theCopy; } @@ -191,6 +222,11 @@ MultiplierMaterial::getCopy(void) int MultiplierMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "MultiplierMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int dbTag = this->getDbTag(); static ID dataID(3); @@ -267,7 +303,10 @@ void MultiplierMaterial::Print(OPS_Stream &s, int flag) { s << "MultiplierMaterial tag: " << this->getTag() << endln; - s << "\tMaterial: " << theMaterial->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; s << "\tMultiplier: " << multiplier << endln; } @@ -278,7 +317,10 @@ MultiplierMaterial::setParameter(const char **argv, int argc, Parameter ¶m) param.setValue(multiplier); return param.addObject(1,this); } - return theMaterial->setParameter(argv, argc, param); + if (theMaterial) + return theMaterial->setParameter(argv, argc, param); + else + return -1; } int @@ -306,6 +348,9 @@ MultiplierMaterial::activateParameter(int paramID) double MultiplierMaterial::getStressSensitivity(int gradIndex, bool conditional) { + if (theMaterial == 0) + return 0.0; + // dsig = dF*sigma + F*dsigma if (parameterID == 1) return theMaterial->getStress(); // dF*sigma where dF=1 @@ -316,12 +361,18 @@ MultiplierMaterial::getStressSensitivity(int gradIndex, bool conditional) double MultiplierMaterial::getStrainSensitivity(int gradIndex) { - return theMaterial->getStrainSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getStrainSensitivity(gradIndex); + else + return 0.0; } double MultiplierMaterial::getInitialTangentSensitivity(int gradIndex) { + if (theMaterial == 0) + return 0.0; + if (parameterID == 1) return theMaterial->getInitialTangent(); else @@ -331,6 +382,9 @@ MultiplierMaterial::getInitialTangentSensitivity(int gradIndex) double MultiplierMaterial::getDampTangentSensitivity(int gradIndex) { + if (theMaterial == 0) + return 0.0; + if (parameterID == 1) return theMaterial->getDampTangent(); else @@ -340,11 +394,17 @@ MultiplierMaterial::getDampTangentSensitivity(int gradIndex) double MultiplierMaterial::getRhoSensitivity(int gradIndex) { + if (theMaterial == 0) + return 0.0; + return theMaterial->getRhoSensitivity(gradIndex); } int MultiplierMaterial::commitSensitivity(double strainGradient, int gradIndex, int numGrads) { + if (theMaterial == 0) + return -1; + return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); } From 9bca0703e394dbc26801c839d4f5f414a99156ac Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:24:06 -0700 Subject: [PATCH 41/57] Changing return statements --- SRC/material/uniaxial/MultiplierMaterial.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SRC/material/uniaxial/MultiplierMaterial.cpp b/SRC/material/uniaxial/MultiplierMaterial.cpp index c09d95477..075a64937 100644 --- a/SRC/material/uniaxial/MultiplierMaterial.cpp +++ b/SRC/material/uniaxial/MultiplierMaterial.cpp @@ -394,17 +394,17 @@ MultiplierMaterial::getDampTangentSensitivity(int gradIndex) double MultiplierMaterial::getRhoSensitivity(int gradIndex) { - if (theMaterial == 0) + if (theMaterial) + return theMaterial->getRhoSensitivity(gradIndex); + else return 0.0; - - return theMaterial->getRhoSensitivity(gradIndex); } int MultiplierMaterial::commitSensitivity(double strainGradient, int gradIndex, int numGrads) { - if (theMaterial == 0) + if (theMaterial) + return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); + else return -1; - - return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); } From af6fae5446b6c904e5e1559c464aa80e6d412f9d Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:24:15 -0700 Subject: [PATCH 42/57] Removing exit call and checking for null material pointer --- SRC/material/uniaxial/PenaltyMaterial.cpp | 107 +++++++++++++++++----- 1 file changed, 83 insertions(+), 24 deletions(-) diff --git a/SRC/material/uniaxial/PenaltyMaterial.cpp b/SRC/material/uniaxial/PenaltyMaterial.cpp index 3d6b2f1a1..faa9f3501 100644 --- a/SRC/material/uniaxial/PenaltyMaterial.cpp +++ b/SRC/material/uniaxial/PenaltyMaterial.cpp @@ -98,7 +98,7 @@ PenaltyMaterial::PenaltyMaterial(int tag, UniaxialMaterial &material, double mul if (theMaterial == 0) { opserr << "PenaltyMaterial::PenaltyMaterial -- failed to get copy of material\n"; - exit(-1); + //exit(-1); } } @@ -117,72 +117,101 @@ PenaltyMaterial::~PenaltyMaterial() int PenaltyMaterial::setTrialStrain(double strain, double strainRate) { - return theMaterial->setTrialStrain(strain, strainRate); + if (theMaterial) + return theMaterial->setTrialStrain(strain, strainRate); + else + return -1; } int PenaltyMaterial::setTrialStrain(double strain, double temp, double strainRate) { - return theMaterial->setTrialStrain(strain, temp, strainRate); + if (theMaterial) + return theMaterial->setTrialStrain(strain, temp, strainRate); + else + return -1; } double PenaltyMaterial::getStress(void) { - return theMaterial->getStress() + penalty*theMaterial->getStrain(); + if (theMaterial) + return theMaterial->getStress() + penalty*theMaterial->getStrain(); + else + return 0.0; } double PenaltyMaterial::getTangent(void) { - return theMaterial->getTangent() + penalty; + if (theMaterial) + return theMaterial->getTangent() + penalty; + else + return 0.0; } double PenaltyMaterial::getDampTangent(void) { - return theMaterial->getDampTangent(); + if (theMaterial) + return theMaterial->getDampTangent(); + else + return 0.0; } - - double PenaltyMaterial::getStrain(void) { - return theMaterial->getStrain(); + if (theMaterial) + return theMaterial->getStrain(); + else + return 0.0; } double PenaltyMaterial::getStrainRate(void) { - return theMaterial->getStrainRate(); + if (theMaterial) + return theMaterial->getStrainRate(); + else + return 0.0; } int PenaltyMaterial::commitState(void) -{ - return theMaterial->commitState(); +{ + if (theMaterial) + return theMaterial->commitState(); + else + return -1; } int PenaltyMaterial::revertToLastCommit(void) { - return theMaterial->revertToLastCommit(); + if (theMaterial) + return theMaterial->revertToLastCommit(); + else + return -1; } int PenaltyMaterial::revertToStart(void) { - return theMaterial->revertToStart(); + if (theMaterial) + return theMaterial->revertToStart(); + else + return -1; } UniaxialMaterial * PenaltyMaterial::getCopy(void) { - PenaltyMaterial *theCopy = - new PenaltyMaterial(this->getTag(), *theMaterial, penalty); + PenaltyMaterial *theCopy = 0; + if (theMaterial) + theCopy = new PenaltyMaterial(this->getTag(), *theMaterial, penalty); return theCopy; } @@ -190,6 +219,11 @@ PenaltyMaterial::getCopy(void) int PenaltyMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "PenaltyMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int dbTag = this->getDbTag(); static ID dataID(3); @@ -266,7 +300,10 @@ void PenaltyMaterial::Print(OPS_Stream &s, int flag) { s << "PenaltyMaterial tag: " << this->getTag() << endln; - s << "\tMaterial: " << theMaterial->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; s << "\tPenalty: " << penalty << endln; } @@ -277,7 +314,10 @@ PenaltyMaterial::setParameter(const char **argv, int argc, Parameter ¶m) param.setValue(penalty); return param.addObject(1,this); } - return theMaterial->setParameter(argv, argc, param); + if (theMaterial) + return theMaterial->setParameter(argv, argc, param); + else + return -1; } int @@ -305,6 +345,9 @@ PenaltyMaterial::activateParameter(int paramID) double PenaltyMaterial::getStressSensitivity(int gradIndex, bool conditional) { + if (theMaterial == 0) + return 0.0; + // dsig = dsigma + dalpha*strain < + alpha*dstrain> if (parameterID == 1) return theMaterial->getStrain(); // dalpha*strain where dalpha=1 @@ -315,7 +358,10 @@ PenaltyMaterial::getStressSensitivity(int gradIndex, bool conditional) double PenaltyMaterial::getStrainSensitivity(int gradIndex) { - return theMaterial->getStrainSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getStrainSensitivity(gradIndex); + else + return 0.0; } double @@ -323,24 +369,37 @@ PenaltyMaterial::getInitialTangentSensitivity(int gradIndex) { if (parameterID == 1) return 1.0; - else - return theMaterial->getInitialTangentSensitivity(gradIndex); + else { + if (theMaterial) + return theMaterial->getInitialTangentSensitivity(gradIndex); + else + return 0.0; + } } double PenaltyMaterial::getDampTangentSensitivity(int gradIndex) { - theMaterial->getDampTangentSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getDampTangentSensitivity(gradIndex); + else + return 0.0; } double PenaltyMaterial::getRhoSensitivity(int gradIndex) { - return theMaterial->getRhoSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getRhoSensitivity(gradIndex); + else + return 0.0; } int PenaltyMaterial::commitSensitivity(double strainGradient, int gradIndex, int numGrads) { - return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); + if (theMaterial) + return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); + else + return -1; } From 6e543330a392f8bcdabf977bddfe287bd7be7106 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:35:15 -0700 Subject: [PATCH 43/57] Revert "Removing exit call" This reverts commit e536c2e44b2ad636a365e356f9a11b63326d2313. --- SRC/material/uniaxial/ElasticPowerFunc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/ElasticPowerFunc.cpp b/SRC/material/uniaxial/ElasticPowerFunc.cpp index 44d34e62e..97e6d4c1b 100644 --- a/SRC/material/uniaxial/ElasticPowerFunc.cpp +++ b/SRC/material/uniaxial/ElasticPowerFunc.cpp @@ -134,7 +134,7 @@ ElasticPowerFunc::ElasticPowerFunc(int tag, if (numTerms != exponents.Size()) { opserr << "ElasticPowerFunc::ElasticPowerFunc() " << "- coefficient and exponent arrays do not have same length.\n"; - //exit(-1); + exit(-1); } this->revertToStart(); From a32f6fb548336b9270029cad3817d6d18a4a73b0 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:40:06 -0700 Subject: [PATCH 44/57] Revert "Removing exit call" This reverts commit 62f930aa6abb29df259bd3762f18d7911031cddc. --- SRC/material/uniaxial/GNGMaterial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/GNGMaterial.cpp b/SRC/material/uniaxial/GNGMaterial.cpp index d4b844493..c58084ed2 100644 --- a/SRC/material/uniaxial/GNGMaterial.cpp +++ b/SRC/material/uniaxial/GNGMaterial.cpp @@ -143,7 +143,7 @@ GNGMaterial::GNGMaterial(int tag, double e, double sigY0, double p, double eta0) E = fabs(sigY)/0.002; else { opserr << "GNGMaterial::GNGMaterial -- E and sigY are zero\n"; - //exit(-1); + exit(-1); } } else From 4c9b88a7d6d79c87cbf6d5ac8849e782023a887b Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:53:01 -0700 Subject: [PATCH 45/57] Update SimpleFractureMaterial.cpp Small fix in recvSelf --- SRC/material/uniaxial/SimpleFractureMaterial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/uniaxial/SimpleFractureMaterial.cpp b/SRC/material/uniaxial/SimpleFractureMaterial.cpp index 659442bc8..a94e4ca04 100644 --- a/SRC/material/uniaxial/SimpleFractureMaterial.cpp +++ b/SRC/material/uniaxial/SimpleFractureMaterial.cpp @@ -348,7 +348,7 @@ SimpleFractureMaterial::recvSelf(int cTag, Channel &theChannel, maxStrain = dataVec(0); - if (dataVec(2) == 1.0) + if (dataVec(1) == 1.0) Cfailed = true; else Cfailed = false; From ec7e87c2d0f3abc9a87b5215af86f25815be36b7 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:54:48 -0700 Subject: [PATCH 46/57] Update Trilinwpd.cpp Small fix in recvSelf --- SRC/material/uniaxial/Trilinwpd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/Trilinwpd.cpp b/SRC/material/uniaxial/Trilinwpd.cpp index aeec3a4c0..529aac772 100644 --- a/SRC/material/uniaxial/Trilinwpd.cpp +++ b/SRC/material/uniaxial/Trilinwpd.cpp @@ -652,8 +652,8 @@ trilinwpd::recvSelf(int commitTag, Channel &theChannel, Cstrain = data(25); Ttangent = data(26); pt = data(27); - pb = data(29); - itype=data(30); + pb = data(28); + itype=data(29); // set the trial values TrotMax = CrotMax; TrotMin = CrotMin; From 9910f924ec33700539411c4954f55e9031b4db4b Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:58:55 -0700 Subject: [PATCH 47/57] Revert "Removing exit call" This reverts commit 54f5b7a8e49da60e45d629392d91bb2f81cbbe1b. --- SRC/material/uniaxial/BraceMaterial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/BraceMaterial.cpp b/SRC/material/uniaxial/BraceMaterial.cpp index 5e4d5e9ae..23f1d0cef 100644 --- a/SRC/material/uniaxial/BraceMaterial.cpp +++ b/SRC/material/uniaxial/BraceMaterial.cpp @@ -116,7 +116,7 @@ BraceMaterial::BraceMaterial(int tag, if (error) { opserr << "BraceMaterial::BraceMaterial -- input backbone is not unique (one-to-one)\n"; - //exit(-1); + exit(-1); } energyA = 0.5 * (rot1p*mom1p + (rot2p-rot1p)*(mom2p+mom1p) + (rot3p-rot2p)*(mom3p+mom2p) + rot1n*mom1n + (rot3n-rot1n)*(mom3n+mom1n)); @@ -153,7 +153,7 @@ BraceMaterial::BraceMaterial(int tag, error = true; if (error) { opserr << "BraceMaterial::BraceMaterial -- input backbone is not unique (one-to-one)\n"; - //exit(-1); + exit(-1); } energyA = 0.5 * (rot1p*mom1p + (rot3p-rot1p)*(mom3p+mom1p) + From 444f2487614a050c6a43274f03fef5cf8e41f6cd Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sat, 23 Oct 2021 07:59:51 -0700 Subject: [PATCH 48/57] Revert "Removing exit call" This reverts commit ac49350868aa7eae31c3a42fac7f68fc06c0a79c. --- SRC/material/uniaxial/Trilinwp.cpp | 2 +- SRC/material/uniaxial/Trilinwpd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SRC/material/uniaxial/Trilinwp.cpp b/SRC/material/uniaxial/Trilinwp.cpp index 87f5ca3e8..e9c2edeaf 100644 --- a/SRC/material/uniaxial/Trilinwp.cpp +++ b/SRC/material/uniaxial/Trilinwp.cpp @@ -129,7 +129,7 @@ Trilinwp::Trilinwp(int tag, if (error) { opserr << "Trilinwp::Trilinwp -- input backbone is not unique (one-to-one)\n"; - //exit(-1); + exit(-1); } mom1pi=mom1p; mom2pi=mom2p; diff --git a/SRC/material/uniaxial/Trilinwpd.cpp b/SRC/material/uniaxial/Trilinwpd.cpp index 11bf1ff62..529aac772 100644 --- a/SRC/material/uniaxial/Trilinwpd.cpp +++ b/SRC/material/uniaxial/Trilinwpd.cpp @@ -123,7 +123,7 @@ mom1n(m1n), rot1n(r1n), mom2n(m2n), rot2n(r2n), mom3n(m3n), rot3n(r3n),pt(ptn), if (error) { opserr << "trilinwpd::trilinwpd -- input backbone is not unique (one-to-one)\n"; - //exit(-1); + exit(-1); } mom1pi=mom1p; mom2pi=mom2p; From 1104d3aa08abbf4d491c2a5059c082c7e3390afd Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 10:15:50 -0700 Subject: [PATCH 49/57] Checking material pointer in state determination --- .../uniaxial/SimpleFractureMaterial.cpp | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/SRC/material/uniaxial/SimpleFractureMaterial.cpp b/SRC/material/uniaxial/SimpleFractureMaterial.cpp index 936c084db..ae0323b12 100644 --- a/SRC/material/uniaxial/SimpleFractureMaterial.cpp +++ b/SRC/material/uniaxial/SimpleFractureMaterial.cpp @@ -83,17 +83,17 @@ SimpleFractureMaterial::SimpleFractureMaterial(int tag, UniaxialMaterial &materi { theMaterial = material.getCopy(); + if (theMaterial == 0) { + opserr << "SimpleFractureMaterial::SimpleFractureMaterial -- failed to get copy of material\n"; + exit(-1); + } + Cstress = theMaterial->getStress(); Ctangent = theMaterial->getTangent(); Cstrain = theMaterial->getStrain(); Tstress = Cstress; Ttangent = Ctangent; Tstrain = Cstrain; - - if (theMaterial == 0) { - opserr << "SimpleFractureMaterial::SimpleFractureMaterial -- failed to get copy of material\n"; - //exit(-1); - } } SimpleFractureMaterial::SimpleFractureMaterial() @@ -125,6 +125,9 @@ SimpleFractureMaterial::setTrialStrain(double strain, double strainRate) int SimpleFractureMaterial::setTrialStrain(double strain, double temp, double strainRate) { + if (theMaterial == 0) + return -1; + // determine based on last converged step Tfailed = Cfailed; TstartCompStrain = CstartCompStrain; @@ -208,7 +211,10 @@ SimpleFractureMaterial::getTangent(void) double SimpleFractureMaterial::getDampTangent(void) { - return theMaterial->getDampTangent(); + if (theMaterial) + return theMaterial->getDampTangent(); + else + return 0.0; } @@ -221,12 +227,18 @@ SimpleFractureMaterial::getStrain(void) double SimpleFractureMaterial::getStrainRate(void) { - return theMaterial->getStrainRate(); + if (theMaterial) + return theMaterial->getStrainRate(); + else + return 0.0; } int SimpleFractureMaterial::commitState(void) -{ +{ + if (theMaterial == 0) + return -1; + Cfailed = Tfailed; Cstress = Tstress; Ctangent = Ttangent; @@ -239,6 +251,9 @@ SimpleFractureMaterial::commitState(void) int SimpleFractureMaterial::revertToLastCommit(void) { + if (theMaterial == 0) + return -1; + Tfailed = Cfailed; Tstress = Cstress; Ttangent = Ctangent; @@ -251,6 +266,9 @@ SimpleFractureMaterial::revertToLastCommit(void) int SimpleFractureMaterial::revertToStart(void) { + if (theMaterial == 0) + return -1; + Tfailed = false; Cstrain = 0; theMaterial->revertToStart(); @@ -262,8 +280,9 @@ SimpleFractureMaterial::revertToStart(void) UniaxialMaterial * SimpleFractureMaterial::getCopy(void) { - SimpleFractureMaterial *theCopy = - new SimpleFractureMaterial(this->getTag(), *theMaterial, maxStrain); + SimpleFractureMaterial *theCopy = 0; + if (theMaterial) + theCopy = new SimpleFractureMaterial(this->getTag(), *theMaterial, maxStrain); return theCopy; } @@ -271,6 +290,11 @@ SimpleFractureMaterial::getCopy(void) int SimpleFractureMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "SimpleFractureMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int dbTag = this->getDbTag(); static ID dataID(3); @@ -290,11 +314,7 @@ SimpleFractureMaterial::sendSelf(int cTag, Channel &theChannel) static Vector dataVec(6); dataVec(0) = maxStrain; - if (Cfailed == true) - dataVec(1) = 1.0; - else - dataVec(1) = 0.0; - + dataVec(1) = Cfailed ? 1.0 : 0.0; dataVec(2) = Cstress; dataVec(3) = Cstrain; dataVec(4) = Ctangent; @@ -347,13 +367,8 @@ SimpleFractureMaterial::recvSelf(int cTag, Channel &theChannel, } maxStrain = dataVec(0); - - if (dataVec(1) == 1.0) - Cfailed = true; - else - Cfailed = false; - - Cstress = dataVec(2); + Cfailed = dataVec(1) == 1.0 ? true : false; + Cstress = dataVec(2); Cstrain = dataVec(3); Ctangent = dataVec(4); CstartCompStrain = dataVec(5); @@ -371,6 +386,9 @@ void SimpleFractureMaterial::Print(OPS_Stream &s, int flag) { s << "SimpleFractureMaterial tag: " << this->getTag() << endln; - s << "\tMaterial: " << theMaterial->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; s << "\tMax strain: " << maxStrain << endln; } From 285778c8f5a6a070a01b7a914c1c7b1943b5f571 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 10:18:11 -0700 Subject: [PATCH 50/57] Removing exit call --- SRC/material/uniaxial/SimpleFractureMaterial.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SRC/material/uniaxial/SimpleFractureMaterial.cpp b/SRC/material/uniaxial/SimpleFractureMaterial.cpp index ae0323b12..828fc6b19 100644 --- a/SRC/material/uniaxial/SimpleFractureMaterial.cpp +++ b/SRC/material/uniaxial/SimpleFractureMaterial.cpp @@ -85,12 +85,14 @@ SimpleFractureMaterial::SimpleFractureMaterial(int tag, UniaxialMaterial &materi if (theMaterial == 0) { opserr << "SimpleFractureMaterial::SimpleFractureMaterial -- failed to get copy of material\n"; - exit(-1); + Cstress = 0.0; + Ctangent = 0.0; + Cstrain = 0.0; + } else { + Cstress = theMaterial->getStress(); + Ctangent = theMaterial->getTangent(); + Cstrain = theMaterial->getStrain(); } - - Cstress = theMaterial->getStress(); - Ctangent = theMaterial->getTangent(); - Cstrain = theMaterial->getStrain(); Tstress = Cstress; Ttangent = Ctangent; Tstrain = Cstrain; From 2a06a088492e7c1b556525e213a4de9659c68149 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 10:28:24 -0700 Subject: [PATCH 51/57] Checking material pointer in state determination --- .../uniaxial/PathIndependentMaterial.cpp | 71 ++++++++++++++++--- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/SRC/material/uniaxial/PathIndependentMaterial.cpp b/SRC/material/uniaxial/PathIndependentMaterial.cpp index da3b46b55..342beb83b 100644 --- a/SRC/material/uniaxial/PathIndependentMaterial.cpp +++ b/SRC/material/uniaxial/PathIndependentMaterial.cpp @@ -98,44 +98,65 @@ PathIndependentMaterial::~PathIndependentMaterial() int PathIndependentMaterial::setTrialStrain(double strain, double strainRate) { + if (theMaterial) return theMaterial->setTrialStrain(strain, strainRate); + else + return -1; } double PathIndependentMaterial::getStress(void) { + if (theMaterial) return theMaterial->getStress(); + else + return 0.0; } double PathIndependentMaterial::getTangent(void) { + if (theMaterial) return theMaterial->getTangent(); + else + return 0.0; } double PathIndependentMaterial::getDampTangent(void) { + if (theMaterial) return theMaterial->getDampTangent(); + else + return 0.0; } double PathIndependentMaterial::getInitialTangent(void) { + if (theMaterial) return theMaterial->getInitialTangent(); + else + return 0.0; } double PathIndependentMaterial::getStrain(void) { + if (theMaterial) return theMaterial->getStrain(); + else + return 0.0; } double PathIndependentMaterial::getStrainRate(void) { + if (theMaterial) return theMaterial->getStrainRate(); + else + return 0.0; } int @@ -153,22 +174,31 @@ PathIndependentMaterial::revertToLastCommit(void) int PathIndependentMaterial::revertToStart(void) { + if (theMaterial) return theMaterial->revertToStart(); + else + return -1; } UniaxialMaterial * PathIndependentMaterial::getCopy(void) { - PathIndependentMaterial *theCopy = - new PathIndependentMaterial(this->getTag(), *theMaterial); + PathIndependentMaterial *theCopy = 0; + if (theMaterial) + theCopy = new PathIndependentMaterial(this->getTag(), *theMaterial); - return theCopy; + return theCopy; } int PathIndependentMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "PathIndependentMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int res = 0; static ID classTags(3); @@ -255,13 +285,19 @@ void PathIndependentMaterial::Print(OPS_Stream &s, int flag) { s << "PathIndependentMaterial tag: " << this->getTag() << endln; - s << "\tmaterial: " << theMaterial->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; } int PathIndependentMaterial::setParameter(const char **argv, int argc, Parameter ¶m) { - return theMaterial->setParameter(argv, argc, param); + if (theMaterial) + return theMaterial->setParameter(argv, argc, param); + else + return -1; } int @@ -273,31 +309,46 @@ PathIndependentMaterial::updateParameter(int parameterID, Information &info) double PathIndependentMaterial::getStressSensitivity(int gradIndex, bool conditional) { - return theMaterial->getStressSensitivity(gradIndex, conditional); + if (theMaterial) + return theMaterial->getStressSensitivity(gradIndex, conditional); + else + return 0.0; } double PathIndependentMaterial::getStrainSensitivity(int gradIndex) { - return theMaterial->getStrainSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getStrainSensitivity(gradIndex); + else + return 0.0; } double PathIndependentMaterial::getInitialTangentSensitivity(int gradIndex) { - return theMaterial->getInitialTangentSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getInitialTangentSensitivity(gradIndex); + else + return 0.0; } double PathIndependentMaterial::getDampTangentSensitivity(int gradIndex) { - return theMaterial->getDampTangentSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getDampTangentSensitivity(gradIndex); + else + return 0.0; } double PathIndependentMaterial::getRhoSensitivity(int gradIndex) { - return theMaterial->getRhoSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getRhoSensitivity(gradIndex); + else + return 0.0; } int From 8f3dedd2f55fd2cf4cbce15939aaac8a8229790e Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 10:35:11 -0700 Subject: [PATCH 52/57] Checking material pointer in state determination --- SRC/material/uniaxial/DamperMaterial.cpp | 72 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/SRC/material/uniaxial/DamperMaterial.cpp b/SRC/material/uniaxial/DamperMaterial.cpp index 6f1fe4717..27e20183d 100644 --- a/SRC/material/uniaxial/DamperMaterial.cpp +++ b/SRC/material/uniaxial/DamperMaterial.cpp @@ -88,6 +88,9 @@ DamperMaterial::DamperMaterial(int tag, trialStrain(0.0), trialStrainRate(0.0), theMaterial(0) { theMaterial = theMaterialModel->getCopy(); + + if (theMaterial == 0) + opserr << "DamperMaterial::DamperMaterial -- failed to get copy of material\n"; } @@ -105,7 +108,8 @@ DamperMaterial::DamperMaterial() DamperMaterial::~DamperMaterial() { - delete theMaterial; + if (theMaterial) + delete theMaterial; } @@ -118,9 +122,10 @@ DamperMaterial::setTrialStrain(double strain, double strainRate) trialStrain = strain; trialStrainRate = strainRate; - theMaterial->setTrialStrain(strainRate, 0); - - return 0; + if (theMaterial) + return theMaterial->setTrialStrain(strainRate, 0); + else + return -1; } @@ -139,39 +144,49 @@ DamperMaterial::getStrainRate(void) double DamperMaterial::getStress(void) { - return theMaterial->getStress(); + if (theMaterial) + return theMaterial->getStress(); + else + return 0.0; } - - double DamperMaterial::getTangent(void) { - return 0; + return 0.0; } double DamperMaterial::getInitialTangent(void) { - return 0; + return 0.0; } double DamperMaterial::getDampTangent(void) { - return theMaterial->getTangent(); + if (theMaterial) + return theMaterial->getTangent(); + else + return 0.0; } int DamperMaterial::commitState(void) { - return theMaterial->commitState(); + if (theMaterial) + return theMaterial->commitState(); + else + return -1; } int DamperMaterial::revertToLastCommit(void) { - return theMaterial->revertToLastCommit(); + if (theMaterial) + return theMaterial->revertToLastCommit(); + else + return -1; } @@ -180,9 +195,11 @@ DamperMaterial::revertToStart(void) { trialStrain = 0.0; trialStrainRate = 0.0; - theMaterial->revertToStart(); - - return 0; + + if (theMaterial) + return theMaterial->revertToStart(); + else + return -1; } @@ -190,11 +207,13 @@ DamperMaterial::revertToStart(void) UniaxialMaterial * DamperMaterial::getCopy(void) { - DamperMaterial *theCopy = new - DamperMaterial(this->getTag(), theMaterial); + DamperMaterial *theCopy = 0; + if (theMaterial) { + theCopy = new DamperMaterial(this->getTag(), theMaterial); - theCopy->trialStrain = trialStrain; - theCopy->trialStrainRate = trialStrainRate; + theCopy->trialStrain = trialStrain; + theCopy->trialStrainRate = trialStrainRate; + } return theCopy; } @@ -203,6 +222,11 @@ DamperMaterial::getCopy(void) int DamperMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "DamperMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int res = 0; static ID data(3); @@ -265,11 +289,11 @@ DamperMaterial::recvSelf(int cTag, Channel &theChannel, void DamperMaterial::Print(OPS_Stream &s, int flag) { - if (flag == OPS_PRINT_PRINTMODEL_MATERIAL) { - s << "DamperMaterial tag: " << this->getTag() << endln; - s << " "; - theMaterial->Print(s, flag); - } + s << "DamperMaterial tag: " << this->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; } From 298bab935c64a840d984b64e30ef7bc7d3deda44 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 10:43:14 -0700 Subject: [PATCH 53/57] Checking material pointer in state determination --- SRC/material/uniaxial/InitStrainMaterial.cpp | 107 ++++++++++++++----- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/SRC/material/uniaxial/InitStrainMaterial.cpp b/SRC/material/uniaxial/InitStrainMaterial.cpp index a210eae94..2d5b304d7 100644 --- a/SRC/material/uniaxial/InitStrainMaterial.cpp +++ b/SRC/material/uniaxial/InitStrainMaterial.cpp @@ -89,9 +89,10 @@ InitStrainMaterial::InitStrainMaterial(int tag, if (theMaterial == 0) { opserr << "InitStrainMaterial::InitStrainMaterial -- failed to get copy of material\n"; //exit(-1); + } else { + theMaterial->setTrialStrain(epsInit); + theMaterial->commitState(); } - theMaterial->setTrialStrain(epsInit); - theMaterial->commitState(); } InitStrainMaterial::InitStrainMaterial() @@ -111,67 +112,95 @@ int InitStrainMaterial::setTrialStrain(double strain, double strainRate) { localStrain = strain; - - return theMaterial->setTrialStrain(strain+epsInit, strainRate); + + if (theMaterial) + return theMaterial->setTrialStrain(strain+epsInit, strainRate); + else + return -1; } double InitStrainMaterial::getStress(void) { - return theMaterial->getStress(); + if (theMaterial) + return theMaterial->getStress(); + else + return 0.0; } double InitStrainMaterial::getTangent(void) { - return theMaterial->getTangent(); + if (theMaterial) + return theMaterial->getTangent(); + else + return 0.0; } double InitStrainMaterial::getDampTangent(void) { - return theMaterial->getDampTangent(); + if (theMaterial) + return theMaterial->getDampTangent(); + else + return 0.0; } double InitStrainMaterial::getStrain(void) { - return theMaterial->getStrain(); + if (theMaterial) + return theMaterial->getStrain(); + else + return 0.0; } double InitStrainMaterial::getStrainRate(void) { - return theMaterial->getStrainRate(); + if (theMaterial) + return theMaterial->getStrainRate(); + else + return 0.0; } int InitStrainMaterial::commitState(void) -{ - return theMaterial->commitState(); +{ + if (theMaterial) + return theMaterial->commitState(); + else + return -1; } int InitStrainMaterial::revertToLastCommit(void) { - return theMaterial->revertToLastCommit(); + if (theMaterial) + return theMaterial->revertToLastCommit(); + else + return -1; } int InitStrainMaterial::revertToStart(void) { int res = 0; - res = theMaterial->revertToStart(); - res += theMaterial->setTrialStrain(epsInit); - res += theMaterial->commitState(); - return res; + if (theMaterial) { + res = theMaterial->revertToStart(); + res += theMaterial->setTrialStrain(epsInit); + res += theMaterial->commitState(); + return res; + } else + return -1; } UniaxialMaterial * InitStrainMaterial::getCopy(void) { - InitStrainMaterial *theCopy = - new InitStrainMaterial(this->getTag(), *theMaterial, epsInit); + InitStrainMaterial *theCopy = 0; + if (theMaterial) + theCopy = new InitStrainMaterial(this->getTag(), *theMaterial, epsInit); return theCopy; } @@ -179,6 +208,11 @@ InitStrainMaterial::getCopy(void) int InitStrainMaterial::sendSelf(int cTag, Channel &theChannel) { + if (theMaterial == 0) { + opserr << "InitStrainMaterial::sendSelf() - theMaterial is null, nothing to send\n"; + return -1; + } + int dbTag = this->getDbTag(); static ID dataID(3); @@ -260,11 +294,17 @@ InitStrainMaterial::Print(OPS_Stream &s, int flag) s << "\t\t\t{"; s << "\"name\": \"" << this->getTag() << "\", "; s << "\"type\": \"InitStrainMaterial\", "; - s << "\"Material\": " << theMaterial->getTag() << ", "; + if (theMaterial) + s << "\"Material\": " << theMaterial->getTag() << ", "; + else + s << "\"Material\": " << "NULL" << ", "; s << "\"initialStrain\": " << epsInit << "}"; } else { s << "InitStrainMaterial tag: " << this->getTag() << endln; - s << "\tMaterial: " << theMaterial->getTag() << endln; + if (theMaterial) + s << "\tMaterial: " << theMaterial->getTag() << endln; + else + s << "\tMaterial is NULL" << endln; s << "\tinitital strain: " << epsInit << endln; } } @@ -278,7 +318,10 @@ InitStrainMaterial::setParameter(const char **argv, int argc, Parameter ¶m) } // Otherwise, pass it on to the wrapped material - return theMaterial->setParameter(argv, argc, param); + if (theMaterial) + return theMaterial->setParameter(argv, argc, param); + else + return -1; } int @@ -286,8 +329,11 @@ InitStrainMaterial::updateParameter(int parameterID, Information &info) { if (parameterID == 1) { this->epsInit = info.theDouble; - theMaterial->setTrialStrain(localStrain+epsInit); - theMaterial->commitState(); + if (theMaterial) { + theMaterial->setTrialStrain(localStrain+epsInit); + theMaterial->commitState(); + } else + return -1; } return 0; @@ -296,18 +342,27 @@ InitStrainMaterial::updateParameter(int parameterID, Information &info) double InitStrainMaterial::getStressSensitivity(int gradIndex, bool conditional) { - return theMaterial->getStressSensitivity(gradIndex, conditional); + if (theMaterial) + return theMaterial->getStressSensitivity(gradIndex, conditional); + else + return 0.0; } double InitStrainMaterial::getInitialTangentSensitivity(int gradIndex) { - return theMaterial->getInitialTangentSensitivity(gradIndex); + if (theMaterial) + return theMaterial->getInitialTangentSensitivity(gradIndex); + else + return 0.0; } int InitStrainMaterial::commitSensitivity(double strainGradient, int gradIndex, int numGrads) { - return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); + if (theMaterial) + return theMaterial->commitSensitivity(strainGradient, gradIndex, numGrads); + else + return -1; } From f82b8e58043dc720d451a52feb23a67c0dd7dad2 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 13:10:08 -0700 Subject: [PATCH 54/57] Moving interpreter command to OPS function in HSSSectionIntegration.cpp --- SRC/interpreter/OpenSeesSectionCommands.cpp | 121 +----------------- .../integration/HSSSectionIntegration.cpp | 106 +++++++++------ 2 files changed, 69 insertions(+), 158 deletions(-) diff --git a/SRC/interpreter/OpenSeesSectionCommands.cpp b/SRC/interpreter/OpenSeesSectionCommands.cpp index 299983ac2..7a40909f7 100644 --- a/SRC/interpreter/OpenSeesSectionCommands.cpp +++ b/SRC/interpreter/OpenSeesSectionCommands.cpp @@ -92,6 +92,7 @@ void* OPS_Bidirectional(); void* OPS_Elliptical2(); void* OPS_Isolator2spring(); void* OPS_FiberSection2dThermal(); +void* OPS_HSSSection(); namespace { static FiberSection2d* theActiveFiberSection2d = 0; @@ -272,126 +273,6 @@ namespace { return theSec; } - static void* OPS_HSSSection() - { - if (OPS_GetNumRemainingInputArgs() < 7) { - opserr << "WARNING insufficient arguments\n"; - opserr << "Want: section HSS tag? matTag? h? b? t? nfh? nfb? <-nd shape?>" << endln; - return 0; - } - - int tag, matTag; - double h, b, t; - int nfh, nfb; - int nft = 1; - - SectionForceDeformation* theSection = 0; - - int numdata = 1; - if (OPS_GetIntInput(&numdata, &tag) < 0) { - opserr << "WARNING invalid section HSS tag" << endln; - return 0; - } - - if (OPS_GetIntInput(&numdata, &matTag) < 0) { - opserr << "WARNING invalid section HSS matTag" << endln; - return 0; - } - - if (OPS_GetDoubleInput(&numdata, &h) < 0) { - opserr << "WARNING invalid h" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - - if (OPS_GetDoubleInput(&numdata, &b) < 0) { - opserr << "WARNING invalid b" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - - if (OPS_GetDoubleInput(&numdata, &t) < 0) { - opserr << "WARNING invalid t" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - - if (OPS_GetIntInput(&numdata, &nfh) < 0) { - opserr << "WARNING invalid nfh" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - - if (OPS_GetIntInput(&numdata, &nfb) < 0) { - opserr << "WARNING invalid nfb" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - - HSSSectionIntegration hsssect(h, b, t, nfh, nfb, nft); - - int numFibers = hsssect.getNumFibers(); - - if (OPS_GetNumRemainingInputArgs() > 0) { - - double shape = 1.0; - if (OPS_GetNumRemainingInputArgs() > 1) { - if (OPS_GetDoubleInput(&numdata, &shape) < 0) { - opserr << "WARNING invalid shape" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - } - - NDMaterial *theSteel = OPS_getNDMaterial(matTag); - - if (theSteel == 0) { - opserr << "WARNING ND material does not exist\n"; - opserr << "material: " << matTag; - opserr << "\nHSS section: " << tag << endln; - return 0; - } - - NDMaterial **theMats = new NDMaterial *[numFibers]; - - hsssect.arrangeFibers(theMats, theSteel); - - // Parsing was successful, allocate the section - theSection = 0; - if (OPS_GetNumRemainingInputArgs() > 0) { - const char* flag = OPS_GetString(); - if (strcmp(flag,"-nd") == 0) { - theSection = new NDFiberSection3d(tag, numFibers, theMats, hsssect, shape); - } else if (strcmp(flag,"-ndWarping") == 0) { - theSection = new NDFiberSectionWarping2d(tag, numFibers, theMats, hsssect, shape); - } - } - delete [] theMats; - } - else { - UniaxialMaterial *theSteel = OPS_getUniaxialMaterial(matTag); - - if (theSteel == 0) { - opserr << "WARNING uniaxial material does not exist\n"; - opserr << "material: " << matTag; - opserr << "\nTube section: " << tag << endln; - return 0; - } - - UniaxialMaterial **theMats = new UniaxialMaterial *[numFibers]; - - hsssect.arrangeFibers(theMats, theSteel); - - // Parsing was successful, allocate the section - ElasticMaterial theTorsion(0,1.0); - theSection = new FiberSection3d(tag, numFibers, theMats, hsssect, theTorsion); - - delete [] theMats; - } - - return theSection; - } - static void* OPS_UniaxialSection() { int numdata = OPS_GetNumRemainingInputArgs(); diff --git a/SRC/material/section/integration/HSSSectionIntegration.cpp b/SRC/material/section/integration/HSSSectionIntegration.cpp index 3cbdc6943..56f0aebb4 100644 --- a/SRC/material/section/integration/HSSSectionIntegration.cpp +++ b/SRC/material/section/integration/HSSSectionIntegration.cpp @@ -32,22 +32,28 @@ #include #include +#include #include #include +#include #include +#include #include -void* OPS_HSSSection2d() +void* OPS_HSSSection() { - if (OPS_GetNumRemainingInputArgs() < 8) { + if (OPS_GetNumRemainingInputArgs() < 7) { opserr << "WARNING insufficient arguments\n"; - opserr << "Want: section HSS tag? matTag? h? b? t? Nfh? Nfb? Nft? <-nd shape?>" << endln; + opserr << "Want: section HSS tag? matTag? h? b? t? nfh? nfb? <-nd> <-shape shape?> <-GJ GJ?> <-torsion tag?>" << endln; return 0; } + int ndm = OPS_GetNDM(); + int tag, matTag; double h, b, t; - int Nfh, Nfb, Nft; + int nfh, nfb; + int nft = 1; SectionForceDeformation* theSection = 0; @@ -80,41 +86,61 @@ void* OPS_HSSSection2d() return 0; } - if (OPS_GetIntInput(&numdata, &Nfh) < 0) { - opserr << "WARNING invalid Nfh" << endln; + if (OPS_GetIntInput(&numdata, &nfh) < 0) { + opserr << "WARNING invalid nfh" << endln; opserr << "HSS section: " << tag << endln; return 0; } - if (OPS_GetIntInput(&numdata, &Nfb) < 0) { - opserr << "WARNING invalid Nfb" << endln; + if (OPS_GetIntInput(&numdata, &nfb) < 0) { + opserr << "WARNING invalid nfb" << endln; opserr << "HSS section: " << tag << endln; return 0; } - - if (OPS_GetIntInput(&numdata, &Nft) < 0) { - opserr << "WARNING invalid Nft" << endln; - opserr << "HSS section: " << tag << endln; - return 0; - } - HSSSectionIntegration hsssect(h, b, t, Nfh, Nfb, Nft); + HSSSectionIntegration hsssect(h, b, t, nfh, nfb, nft); int numFibers = hsssect.getNumFibers(); - - if (OPS_GetNumRemainingInputArgs() > 0) { - - double shape = 1.0; - if (OPS_GetNumRemainingInputArgs() > 1) { + bool isND = false; double shape = 1.0; + UniaxialMaterial *torsion = 0; + bool deleteTorsion = false; + while (OPS_GetNumRemainingInputArgs() > 0) { + const char* flag = OPS_GetString(); + // read <-nd> + if (strcmp(flag,"-nd") == 0) + isND = true; + // read <-shape shape> + if (strcmp(flag,"-shape") == 0 && OPS_GetNumRemainingInputArgs() > 0) { if (OPS_GetDoubleInput(&numdata, &shape) < 0) { opserr << "WARNING invalid shape" << endln; opserr << "HSS section: " << tag << endln; return 0; } + isND = true; } - + // read <-GJ GJ> + if (strcmp(flag,"-GJ") == 0 && OPS_GetNumRemainingInputArgs() > 0) { + double GJ; + if (OPS_GetDoubleInput(&numdata, &GJ) < 0) { + opserr << "WARNING: failed to read GJ\n"; + return 0; + } + torsion = new ElasticMaterial(0,GJ); + deleteTorsion = true; + } + // read <-torsion tag> + if (strcmp(flag,"-torsion") == 0 && OPS_GetNumRemainingInputArgs() > 0) { + int torsionTag; + if (OPS_GetIntInput(&numdata, &torsionTag) < 0) { + opserr << "WARNING: failed to read torsion\n"; + return 0; + } + torsion = OPS_getUniaxialMaterial(torsionTag); + } + } + + if (isND) { NDMaterial *theSteel = OPS_getNDMaterial(matTag); - if (theSteel == 0) { opserr << "WARNING ND material does not exist\n"; opserr << "material: " << matTag; @@ -123,24 +149,18 @@ void* OPS_HSSSection2d() } NDMaterial **theMats = new NDMaterial *[numFibers]; - hsssect.arrangeFibers(theMats, theSteel); + + if (ndm == 2) + theSection = new NDFiberSection2d(tag, numFibers, theMats, hsssect); + if (ndm == 3) + theSection = new NDFiberSection3d(tag, numFibers, theMats, hsssect, shape); - // Parsing was successful, allocate the section - theSection = 0; - if (OPS_GetNumRemainingInputArgs() > 0) { - const char* flag = OPS_GetString(); - if (strcmp(flag,"-nd") == 0) { - theSection = new NDFiberSection2d(tag, numFibers, theMats, hsssect, shape); - } else if (strcmp(flag,"-ndWarping") == 0) { - theSection = new NDFiberSectionWarping2d(tag, numFibers, theMats, hsssect, shape); - } - } delete [] theMats; } + else { UniaxialMaterial *theSteel = OPS_getUniaxialMaterial(matTag); - if (theSteel == 0) { opserr << "WARNING uniaxial material does not exist\n"; opserr << "material: " << matTag; @@ -148,17 +168,27 @@ void* OPS_HSSSection2d() return 0; } - UniaxialMaterial **theMats = new UniaxialMaterial *[numFibers]; + if (torsion == 0) { + opserr << "WARNING torsion not speified for FiberSection\n"; + opserr << "\nHSS section: " << tag << endln; + return 0; + } + UniaxialMaterial **theMats = new UniaxialMaterial *[numFibers]; hsssect.arrangeFibers(theMats, theSteel); - // Parsing was successful, allocate the section - theSection = new FiberSection2d(tag, numFibers, theMats, hsssect); + if (ndm == 2) + theSection = new FiberSection2d(tag, numFibers, theMats, hsssect); + if (ndm == 3) + theSection = new FiberSection3d(tag, numFibers, theMats, hsssect, *torsion); + + if (deleteTorsion) + delete torsion; delete [] theMats; } - return theSection; + return theSection; } HSSSectionIntegration::HSSSectionIntegration(double H, double B, double T, From 5e8c696bd855adc309b0c0cadffe42bb916fc267 Mon Sep 17 00:00:00 2001 From: mhscott Date: Sun, 24 Oct 2021 13:35:19 -0700 Subject: [PATCH 55/57] Adding HSS section integration to workspace --- Win64/proj/material/material.vcxproj | 1 + Win64/proj/material/material.vcxproj.filters | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Win64/proj/material/material.vcxproj b/Win64/proj/material/material.vcxproj index dcaf0a307..6add27679 100644 --- a/Win64/proj/material/material.vcxproj +++ b/Win64/proj/material/material.vcxproj @@ -239,6 +239,7 @@ + diff --git a/Win64/proj/material/material.vcxproj.filters b/Win64/proj/material/material.vcxproj.filters index 17327347c..0f2d6e0ad 100644 --- a/Win64/proj/material/material.vcxproj.filters +++ b/Win64/proj/material/material.vcxproj.filters @@ -1382,6 +1382,9 @@ uniaxial\py_tz_qz + + section\integration + From b3e0a3db3324b080bf365eb4170a0b9ce234de5d Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 18:40:19 -0700 Subject: [PATCH 56/57] Update J2BeamFiber2d.cpp --- SRC/material/nD/J2BeamFiber2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/nD/J2BeamFiber2d.cpp b/SRC/material/nD/J2BeamFiber2d.cpp index 1ff76a80e..94cfe2056 100644 --- a/SRC/material/nD/J2BeamFiber2d.cpp +++ b/SRC/material/nD/J2BeamFiber2d.cpp @@ -700,7 +700,7 @@ J2BeamFiber2d::setParameter(const char **argv, int argc, param.setValue(nu); return param.addObject(2, this); } - else if (strcmp(argv[0],"sigmaY") == 0 || strcmp(argv[0],"fy") == 0) { + else if (strcmp(argv[0],"sigmaY") == 0 || strcmp(argv[0],"fy") == 0 || strcmp(argv[0],"Fy") == 0) { param.setValue(sigmaY); return param.addObject(5, this); } From fcf40e8643ab616011e44b29d0ece6c92d7cead2 Mon Sep 17 00:00:00 2001 From: "Michael H. Scott" Date: Sun, 24 Oct 2021 18:40:41 -0700 Subject: [PATCH 57/57] Update J2BeamFiber3d.cpp --- SRC/material/nD/J2BeamFiber3d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SRC/material/nD/J2BeamFiber3d.cpp b/SRC/material/nD/J2BeamFiber3d.cpp index e555857ee..3c32ce39a 100644 --- a/SRC/material/nD/J2BeamFiber3d.cpp +++ b/SRC/material/nD/J2BeamFiber3d.cpp @@ -759,7 +759,7 @@ J2BeamFiber3d::setParameter(const char **argv, int argc, param.setValue(nu); return param.addObject(2, this); } - else if (strcmp(argv[0],"sigmaY") == 0 || strcmp(argv[0],"fy") == 0) { + else if (strcmp(argv[0],"sigmaY") == 0 || strcmp(argv[0],"fy") == 0 || strcmp(argv[0],"Fy") == 0) { param.setValue(sigmaY); return param.addObject(5, this); }