From 32afa0506e1bd1f5dcf1f942e4d0c6849f70ca27 Mon Sep 17 00:00:00 2001 From: gumaa Date: Wed, 13 Oct 2021 14:22:24 +0100 Subject: [PATCH 01/60] manual --- doc/elementlibmanual/elementlibmanual.tex | 19 ++++++++++++ doc/matlibmanual/matlibmanual.tex | 35 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index 4f8a1782a..cf970d89f 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -453,6 +453,25 @@ \subsubsection{Latticelink3dboundary} \elementDescription{Reference}{\cite{GraAnt19}} \end{elementsummary} +\subsubsection{latticeframe3d element} +latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure~\ref{latticeframe3dfig}. +The element is based on the Rigid Body Spring Model originally developed by Toi for modelling failure in steel frame member. +The input parameters for this element are shown in Table~\ref{latticeframe3dsummary}. + +\begin{figure}[htb] + \centering + \includegraphics[width=0.3\textwidth]{./latticeframe3d.pdf} + \caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point $C$.} + \label{latticeframe3dfig} +\end{figure} + +\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{\field{thick}{rn} \field{width}{rn} \field{gpCoords}{ra}}{latticeframe3d element summary}{latticeframe3dsummary} +\elementParam{\param{thick}: defines the out of plane ($Y$-direction) thickness} +\elementParam{\param{width}: defines the width of the midpoint cross-section in the $x$-$Z$ plane with the point $C$ at its centre} +\elementParam{\param{gpCooords}: array of the coordinates of the integration point $C$ in the global coordinate system} +\elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} +\end{elementsummary} + %----------------------------------------------------------------------------------------------- \clearpage \subsection{Plane Stress Elements} diff --git a/doc/matlibmanual/matlibmanual.tex b/doc/matlibmanual/matlibmanual.tex index 6597e041d..7c9e593e4 100644 --- a/doc/matlibmanual/matlibmanual.tex +++ b/doc/matlibmanual/matlibmanual.tex @@ -6026,6 +6026,41 @@ \subsubsection{Model for relaxation of prestressing steel - SteelRelaxMat} %\end{center} \end{table} +\subsubsection{Plasticity lattice model for steel} + +This is a Plasticity material used together with lattice elements. +The stress-strain law has the form +\begin{equation} +\boldsymbol{\sigma} = \mathbf{D}_{\rm e} \left(\boldsymbol{\varepsilon}-\boldsymbol{\varepsilon}_{\rm p} \right) +\end{equation} +where $\boldsymbol{\sigma}$ is a vector of tractions and rotational components, $\mathbf{D}_{\rm e}$ is the elastic stiffness matrix, $\boldsymbol{\varepsilon}$ is a vector of strains obtained from displacement jumps smeared over the element length and rotational components and $\boldsymbol{\varepsilon}_{\rm p}$ are the plastic strains. +\begin{table}[!htb] +\begin{mmt} +\hline +Description & Plasticity steel model for lattice elements \\ +\hline +Record Format & \descitem{latticeframesteelplastic} \elemparam{}{in} +\elemparam{d}{rn} \optelemparam{talpha}{rn} \elemparam{e}{rn} \optelemparam{n}{rn} \optelemparam{nx0}{rn} \optelemparam{mx0}{rn} \optelemparam{my0}{rn} \optelemparam{mz0}{rn} \elemparam{sub}{in} \elemparam{iter}{in} \elemparam{tol}{rn}\\ +Parameters &- \param{} material number\\ +&- \param{d} material density\\ +&- \optparam{talpha} Thermal expansion coefficient. Default is 0.\\ +&- \optparam{e} Young's modulus of the lattice material.\\ +&- \param{n} Poisson's ratio of the material that the beam element is made of.\\ +&- \optparam{nx0} maximum axial force.\\ +&- \optparam{mx0} maximum bending moment about x.\\ +&- \optparam{my0} maximum bending moment about y.\\ +&- \optparam{mz0} maximum bending moment about z.\\ +&- \optparam{sub} maximum number of subincrementations.\\ +&- \optparam{iter} maximum number of newton iterations.\\ +&- \optparam{tol} tolerance for newton method.\\ +Supported modes & 3dlattice\\ +Supported modes & 3dlattice\\ +\hline +\end{mmt} +\caption{Plasticity steel model for lattice elements -- summary.} +\label{latticeframesteelplastic_table} +%\end{center} +\end{table} \subsection{User-defined material models using MFront} From 6fad87f964bf5fda08073480f4f43357236dd532 Mon Sep 17 00:00:00 2001 From: gumaa Date: Wed, 13 Oct 2021 14:55:10 +0100 Subject: [PATCH 02/60] manual --- doc/matlibmanual/matlibmanual.tex | 35 ------------------------------- 1 file changed, 35 deletions(-) diff --git a/doc/matlibmanual/matlibmanual.tex b/doc/matlibmanual/matlibmanual.tex index 7c9e593e4..6597e041d 100644 --- a/doc/matlibmanual/matlibmanual.tex +++ b/doc/matlibmanual/matlibmanual.tex @@ -6026,41 +6026,6 @@ \subsubsection{Model for relaxation of prestressing steel - SteelRelaxMat} %\end{center} \end{table} -\subsubsection{Plasticity lattice model for steel} - -This is a Plasticity material used together with lattice elements. -The stress-strain law has the form -\begin{equation} -\boldsymbol{\sigma} = \mathbf{D}_{\rm e} \left(\boldsymbol{\varepsilon}-\boldsymbol{\varepsilon}_{\rm p} \right) -\end{equation} -where $\boldsymbol{\sigma}$ is a vector of tractions and rotational components, $\mathbf{D}_{\rm e}$ is the elastic stiffness matrix, $\boldsymbol{\varepsilon}$ is a vector of strains obtained from displacement jumps smeared over the element length and rotational components and $\boldsymbol{\varepsilon}_{\rm p}$ are the plastic strains. -\begin{table}[!htb] -\begin{mmt} -\hline -Description & Plasticity steel model for lattice elements \\ -\hline -Record Format & \descitem{latticeframesteelplastic} \elemparam{}{in} -\elemparam{d}{rn} \optelemparam{talpha}{rn} \elemparam{e}{rn} \optelemparam{n}{rn} \optelemparam{nx0}{rn} \optelemparam{mx0}{rn} \optelemparam{my0}{rn} \optelemparam{mz0}{rn} \elemparam{sub}{in} \elemparam{iter}{in} \elemparam{tol}{rn}\\ -Parameters &- \param{} material number\\ -&- \param{d} material density\\ -&- \optparam{talpha} Thermal expansion coefficient. Default is 0.\\ -&- \optparam{e} Young's modulus of the lattice material.\\ -&- \param{n} Poisson's ratio of the material that the beam element is made of.\\ -&- \optparam{nx0} maximum axial force.\\ -&- \optparam{mx0} maximum bending moment about x.\\ -&- \optparam{my0} maximum bending moment about y.\\ -&- \optparam{mz0} maximum bending moment about z.\\ -&- \optparam{sub} maximum number of subincrementations.\\ -&- \optparam{iter} maximum number of newton iterations.\\ -&- \optparam{tol} tolerance for newton method.\\ -Supported modes & 3dlattice\\ -Supported modes & 3dlattice\\ -\hline -\end{mmt} -\caption{Plasticity steel model for lattice elements -- summary.} -\label{latticeframesteelplastic_table} -%\end{center} -\end{table} \subsection{User-defined material models using MFront} From fd75b979b7b2757cb14f224310fe857c85d3538d Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Wed, 13 Oct 2021 17:03:37 +0100 Subject: [PATCH 03/60] small clean up --- src/sm/Elements/LatticeElements/latticeframe3d.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d.C b/src/sm/Elements/LatticeElements/latticeframe3d.C index 796007989..07c987a20 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d.C @@ -101,14 +101,14 @@ LatticeFrame3d::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, i answer.at(2, 3) = 0.; answer.at(2, 4) = 0.; answer.at(2, 5) = 0; - answer.at(2, 6) = -this->length*(1-this->s)/2.; + answer.at(2, 6) = -this->length*(1.-this->s)/2.; //Second node answer.at(2, 7) = 0.; answer.at(2, 8) = 1.; answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - answer.at(2, 12) = -this->length*(1+this->s)/2.; + answer.at(2, 12) = -this->length*(1.+this->s)/2.; //Shear displacement jump in z-plane //first node @@ -116,14 +116,14 @@ LatticeFrame3d::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, i answer.at(3, 2) = 0.; answer.at(3, 3) = -1.; answer.at(3, 4) = 0.; - answer.at(3, 5) = this->length*(1-this->s)/2.; + answer.at(3, 5) = this->length*(1.-this->s)/2.; answer.at(3, 6) = 0.; //Second node answer.at(3, 7) = 0.; answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - answer.at(3, 11) = this->length*(1+this->s)/2.; + answer.at(3, 11) = this->length*(1.+this->s)/2.; answer.at(3, 12) = 0.; //Rotation around x-axis From 8331b9d2e531b5b34877eb6d91bb225f5d432503 Mon Sep 17 00:00:00 2001 From: gumaa Date: Wed, 13 Oct 2021 19:11:54 +0100 Subject: [PATCH 04/60] manual --- doc/elementlibmanual/elementlibmanual.tex | 2 +- doc/matlibmanual/matlibmanual.tex | 38 ++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index cf970d89f..2a78060c4 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -467,7 +467,7 @@ \subsubsection{latticeframe3d element} \begin{elementsummary}{latticeframe3d}{3d lattice frame element}{\field{thick}{rn} \field{width}{rn} \field{gpCoords}{ra}}{latticeframe3d element summary}{latticeframe3dsummary} \elementParam{\param{thick}: defines the out of plane ($Y$-direction) thickness} -\elementParam{\param{width}: defines the width of the midpoint cross-section in the $x$-$Z$ plane with the point $C$ at its centre} +\elementParam{\param{width}: defines the width of the midpoint cross-section in the $x$-$z$ plane with the point $C$ at its centre} \elementParam{\param{gpCooords}: array of the coordinates of the integration point $C$ in the global coordinate system} \elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} \end{elementsummary} diff --git a/doc/matlibmanual/matlibmanual.tex b/doc/matlibmanual/matlibmanual.tex index 6597e041d..644becf71 100644 --- a/doc/matlibmanual/matlibmanual.tex +++ b/doc/matlibmanual/matlibmanual.tex @@ -5915,6 +5915,43 @@ \subsubsection{Viscoelastic plasticity damage lattice model} \label{latticeplasticdamageviscoelastic_table} \end{table} +\subsubsection{Plasticity lattice model for steel} + +This is a Plasticity material used together with lattice elements. +The stress-strain law has the form +\begin{equation} +\boldsymbol{\sigma} = \mathbf{D}_{\rm e} \left(\boldsymbol{\varepsilon}-\boldsymbol{\varepsilon}_{\rm p} \right) +\end{equation} +where $\boldsymbol{\sigma}$ is a vector of tractions and rotational components, $\mathbf{D}_{\rm e}$ is the elastic stiffness matrix, $\boldsymbol{\varepsilon}$ is a vector of strains obtained from disp\ +lacement jumps smeared over the element length and rotational components and $\boldsymbol{\varepsilon}_{\rm p}$ are the plastic strains. +\begin{table}[!htb] +\begin{mmt} +\hline +Description & Plasticity steel model for lattice elements \\ +\hline +Record Format & \descitem{latticeframesteelplastic} \elemparam{}{in} +\elemparam{d}{rn} \optelemparam{talpha}{rn} \elemparam{e}{rn} \optelemparam{n}{rn} \optelemparam{nx0}{rn} \optelemparam{mx0}{rn} \optelemparam{my0}{rn} \optelemparam{mz0}{rn} \elemparam{sub}{in} \elempa\ +ram{iter}{in} \elemparam{tol}{rn}\\ +Parameters &- \param{} material number\\ +&- \param{d} material density\\ +&- \optparam{talpha} Thermal expansion coefficient. Default is 0.\\ +&- \optparam{e} Young's modulus of the lattice material.\\ +&- \param{n} Poisson's ratio of the material that the beam element is made of.\\ +&- \optparam{nx0} ultimate capacity under pure axialloads.\\ +&- \optparam{mx0} ultimate capacity under pure moment about x.\\ +&- \optparam{my0} ultimate capacity under pure moment about y.\\ +&- \optparam{mz0} ultimate capacity under pure moment about z.\\ +&- \optparam{sub} maximum number of subincrementations.\\ +&- \optparam{iter} maximum number of newton iterations.\\ +&- \optparam{tol} tolerance for newton method.\\ +Supported modes & 3dlattice\\ +Supported modes & 3dlattice\\ +\hline +\end{mmt} +\caption{Plasticity steel model for lattice elements -- summary.} +\label{latticeframesteelplastic_table} +%\end{center} +\end{table} \subsection{Material models for steel relaxation} @@ -6027,7 +6064,6 @@ \subsubsection{Model for relaxation of prestressing steel - SteelRelaxMat} \end{table} - \subsection{User-defined material models using MFront} A user-defined material created with MFront can be used if MGIS is installed \newline From 0bd54661010fe270896e01ca1b41f76f0da8edd2 Mon Sep 17 00:00:00 2001 From: gumaa Date: Thu, 21 Oct 2021 21:04:28 +0100 Subject: [PATCH 05/60] element --- doc/elementlibmanual/elementlibmanual.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index 2a78060c4..c06024eeb 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -456,19 +456,19 @@ \subsubsection{Latticelink3dboundary} \subsubsection{latticeframe3d element} latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure~\ref{latticeframe3dfig}. The element is based on the Rigid Body Spring Model originally developed by Toi for modelling failure in steel frame member. -The input parameters for this element are shown in Table~\ref{latticeframe3dsummary}. +The input parameters for this element are shown in Table~\ref{latticeframe3dsummary}. \begin{figure}[htb] \centering - \includegraphics[width=0.3\textwidth]{./latticeframe3d.pdf} + \includegraphics[width=0.3\textwidth]{./latticeframe3d.png} \caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point $C$.} \label{latticeframe3dfig} \end{figure} -\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{\field{thick}{rn} \field{width}{rn} \field{gpCoords}{ra}}{latticeframe3d element summary}{latticeframe3dsummary} -\elementParam{\param{thick}: defines the out of plane ($Y$-direction) thickness} -\elementParam{\param{width}: defines the width of the midpoint cross-section in the $x$-$z$ plane with the point $C$ at its centre} -\elementParam{\param{gpCooords}: array of the coordinates of the integration point $C$ in the global coordinate system} +\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{\field{iy}{rn} \field{iz}{rn} \field{ik}{rn} \field{shearcoeff}{rn} \field{s}{rn} \field{area}{rn} \field{gpCoords}{ra}}{latticeframe3d element summary}{latticeframe3dsummary} +\elementParam{\param{refnode}: sets reference node to determine the local coordinate system of element.} +\elementParam{\param{s}: s is the position of the integration point} +\elementDescription{CS properties}{Area, inertia moment along y and z axis (\param{iy} and \param{iz} parameters), torsion inertia moment (\param{ik} parameter) and either cross section area shear correction factor (\param{shearcoeff} parameter) are required. These cross section properties are assumed to be defined in local coordinate system of element.} \elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} \end{elementsummary} From 5e63d8f8cc7ecc4e4097e27264d1fec39b01e073 Mon Sep 17 00:00:00 2001 From: gumaa Date: Sat, 23 Oct 2021 12:46:03 +0100 Subject: [PATCH 06/60] material --- src/sm/CMakeLists.txt | 1 + .../latticeframeconcreteplastic.C | 515 ++++++++++++++++++ .../latticeframeconcreteplastic.h | 196 +++++++ 3 files changed, 712 insertions(+) create mode 100644 src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C create mode 100644 src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 8bbbe2739..540bf8492 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -293,6 +293,7 @@ set (sm_material Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C Materials/LatticeMaterials/latticeframeelastic.C Materials/LatticeMaterials/latticeframesteelplastic.C + Materials/LatticeMaterials/latticeframeconcreteplastic.C ) if (USE_MFRONT) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C new file mode 100644 index 000000000..61715c422 --- /dev/null +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -0,0 +1,515 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "latticeframeconcreteplastic.h" +#include "latticeframeelastic.h" +#include "latticestructuralmaterial.h" +#include "gausspoint.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "CrossSections/structuralcrosssection.h" +#include "engngm.h" +#include "mathfem.h" +#include "Elements/LatticeElements/latticestructuralelement.h" +#include "datastream.h" +#include "staggeredproblem.h" +#include "contextioerr.h" +#include "classfactory.h" + +namespace oofem { +REGISTER_Material(LatticeFrameConcretePlastic); + +// constructor which creates a dummy material without a status and without random extension interface +// LatticeFrameConcretePlastic :: LatticeFrameConcretelPlastic(int n, Domain *d) : +// LatticeStructuralMaterial(n, d) +bool +LatticeFrameConcretePlastic::hasMaterialModeCapability(MaterialMode mode) const +{ + return ( mode == _3dLattice ); +} + + +void +LatticeFrameConcretePlastic::initializeFrom(InputRecord &ir) +{ + LatticeStructuralMaterial::initializeFrom(ir); + + //Young's modulus of the material that the beam element is made of + IR_GIVE_FIELD(ir, this->e, _IFT_LatticeFrameConcretePlastic_e); // Macro + + //Poisson's ratio of the material that the beam element is made of + IR_GIVE_FIELD(ir, this->nu, _IFT_LatticeFrameConcretePlastic_n); // Macro + + //Nx0 + IR_GIVE_FIELD(ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0); // Macro + + //Mx0 + IR_GIVE_FIELD(ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0); // Macro + + //My0 + IR_GIVE_FIELD(ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0); // Macro + + //Mz0 + IR_GIVE_FIELD(ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0); // Macro + + yieldTol = 1.e-6; + ; + IR_GIVE_FIELD(ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol); // Macro + + this->newtonIter = 100; + IR_GIVE_FIELD(ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter); // Macro + + numberOfSubIncrements = 10; + IR_GIVE_FIELD(ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub); // Macro + + this->plasticFlag = 1; + IR_GIVE_OPTIONAL_FIELD(ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic); // Macro +} + +MaterialStatus * +LatticeFrameConcretePlastic::CreateStatus(GaussPoint *gp) const +{ + return new LatticeFrameConcretePlasticStatus(1, LatticeFrameConcretePlastic::domain, gp); +} + +MaterialStatus * +LatticeFrameConcretePlastic::giveStatus(GaussPoint *gp) const +{ + // test + MaterialStatus *status = static_cast< MaterialStatus * >( gp->giveMaterialStatus() ); + if ( !status ) { + // create a new one + status = this->CreateStatus(gp); + + if ( status ) { + gp->setMaterialStatus(status); + } + } + + return status; +} + +double +LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, + GaussPoint *gp, + TimeStep *tStep) const +{ + double yieldValue = 0.; + double nx = stress.at(1); + double mx = stress.at(2); + double my = stress.at(3); + double mz = stress.at(4); + + { + yieldValue = pow(nx / this->nx0, 2.) + pow(mx / this->mx0, 2.) + pow(my / this->my0, 2.) + pow(mz / this->mz0, 2.) - 1.; + } + + return yieldValue; +} + +FloatArrayF< 4 > +LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, + GaussPoint *gp, + TimeStep *tStep) const +{ + double nx = stress.at(1); + double mx = stress.at(2); + double my = stress.at(3); + double mz = stress.at(4); + + FloatArrayF< 4 >f; + + f.at(1) = 2. * nx / pow(this->nx0, 2.); + f.at(2) = 2. * mx / pow(this->mx0, 2.); + f.at(3) = 2. * my / pow(this->my0, 2.); + f.at(4) = 2. * mz / pow(this->mz0, 2.); + + return f; +} + +FloatMatrixF< 4, 4 > +LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, GaussPoint *gp, TimeStep *tStep) const +{ + FloatMatrixF< 4, 4 >dm; + + //Derivatives of dGDSig + dm.at(1, 1) = 2. / pow(this->nx0, 2.); + dm.at(1, 2) = 0; + dm.at(1, 3) = 0; + dm.at(1, 4) = 0; + + //Derivatives of dGDTau + dm.at(2, 1) = 0; + dm.at(2, 2) = 2. / pow(this->mx0, 2.); + dm.at(2, 3) = 0; + dm.at(2, 4) = 0; + + //Derivates of evolution law + dm.at(3, 1) = 0; + dm.at(3, 2) = 0; + dm.at(3, 3) = 2. / pow(this->my0, 2.); + dm.at(3, 4) = 0; + + //Derivates of evolution law + dm.at(4, 1) = 0; + dm.at(4, 2) = 0; + dm.at(4, 3) = 0; + dm.at(4, 3) = 2. / pow(this->mz0, 2.); + + return dm; +} + +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const +// returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes +{ + double alpha = this->give(tAlpha, gp); + + return { + alpha, 0., 0., 0., 0., 0. + }; +} + +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveReducedStrain(GaussPoint *gp, TimeStep *tStep) const +{ + auto status = static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); + return status->giveReducedLatticeStrain(); +} + + +FloatArrayF< 6 > +LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &reducedStrain, TimeStep *tStep) const +{ + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + //Shear components are not used for plasticity return + auto strain = reducedStrain [ { 0, 3, 4, 5 } ]; + + /* Get plastic strain vector from status*/ + auto tempPlasticStrain = status->givePlasticLatticeStrain() [ { 0, 3, 4, 5 } ]; + + FloatArrayF< 4 >tangent = { area *this->e, ik *g, iy *this->e, iz *this->e }; + + /* Compute trial stress*/ + auto stress = mult(tangent, strain - tempPlasticStrain); + + auto oldStrain = this->giveReducedStrain(gp, tStep) [ { 0, 3, 4, 5 } ]; + + /* Compute yield value*/ + double yieldValue = computeYieldValue(stress, gp, tStep); + int subIncrementCounter = 0; + + /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ + + if ( yieldValue > yieldTol ) { + int subIncrementFlag = 0; + auto convergedStrain = oldStrain; + auto tempStrain = strain; + auto deltaStrain = strain - oldStrain; + //To get into the loop + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { + stress = mult(tangent, tempStrain - tempPlasticStrain); + performRegularReturn(stress, yieldValue, gp, tStep); + + if ( status->giveTempReturnResult() == RR_NotConverged ) { + subIncrementCounter++; + if ( subIncrementCounter > numberOfSubIncrements ) { + OOFEM_LOG_INFO("Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); + OOFEM_LOG_INFO("Yield value %e \n", yieldValue); + OOFEM_LOG_INFO("ConvergedStrain value %e %e %e %e\n", convergedStrain.at(1), convergedStrain.at(2), convergedStrain.at(3), convergedStrain.at(4) ); + OOFEM_LOG_INFO("tempStrain value %e %e %e %e\n", tempStrain.at(1), tempStrain.at(2), tempStrain.at(3), tempStrain.at(4) ); + OOFEM_LOG_INFO("deltaStrain value %e %e %e %e\n", deltaStrain.at(1), deltaStrain.at(2), deltaStrain.at(3), deltaStrain.at(4) ); + OOFEM_LOG_INFO("targetstrain value %e %e %e %e\n", strain.at(1), strain.at(2), strain.at(3), strain.at(4) ); + + OOFEM_ERROR("LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up."); + } + subIncrementFlag = 1; + deltaStrain *= 0.5; + tempStrain = convergedStrain + deltaStrain; + } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { + tempPlasticStrain.at(1) = tempStrain.at(1) - stress.at(1) / ( area * this->e ); + tempPlasticStrain.at(2) = tempStrain.at(2) - stress.at(2) / ( ik * g ); + tempPlasticStrain.at(3) = tempStrain.at(3) - stress.at(3) / ( iy * this->e ); + tempPlasticStrain.at(4) = tempStrain.at(4) - stress.at(4) / ( iz * this->e ); + + status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 3, 4, 5 }) ); + + subIncrementFlag = 0; + + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + convergedStrain = tempStrain; + deltaStrain = strain - convergedStrain; + tempStrain = strain; + subIncrementCounter = 0; + } + } + } + + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + + + tempPlasticStrain.at(1) = strain.at(1) - stress.at(1) / ( area * this->e ); + tempPlasticStrain.at(2) = strain.at(2) - stress.at(2) / ( ik * g ); + tempPlasticStrain.at(3) = strain.at(3) - stress.at(3) / ( iy * this->e ); + tempPlasticStrain.at(4) = strain.at(4) - stress.at(4) / ( iz * this->e ); + + + status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 3, 4, 5 }) ); + auto answer = assemble< 6 >(stress, { 0, 3, 4, 5 }); + answer.at(2) = shearareay * g * reducedStrain.at(2); + answer.at(3) = shearareaz * g * reducedStrain.at(3); + + return answer; +} + +Interface * +LatticeFrameConcretePlastic::giveInterface(InterfaceType type) +{ + return nullptr; +} + +void +LatticeFrameConcretePlastic::performRegularReturn(FloatArrayF< 4 > &stress, + double yieldValue, + GaussPoint *gp, + TimeStep *tStep) const +{ + //Use material specific status + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + double deltaLambda = 0.; + + auto trialStress = stress; + auto tempStress = trialStress; + + //initialise unknowns + FloatArrayF< 5 >unknowns; + unknowns.at(1) = trialStress.at(1); + unknowns.at(2) = trialStress.at(2); + unknowns.at(3) = trialStress.at(3); + unknowns.at(4) = trialStress.at(4); + unknowns.at(5) = 0.; + + yieldValue = computeYieldValue(tempStress, gp, tStep); + + //initiate residuals + FloatArrayF< 5 >residuals; + residuals.at(5) = yieldValue; + double normOfResiduals = 1.; //just to get into the loop + int iterationCount = 0; + while ( normOfResiduals > yieldTol ) { + iterationCount++; + if ( iterationCount == newtonIter ) { + status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); + return; + } + + FloatArrayF< 5 >residualsNorm; + residualsNorm.at(1) = residuals.at(1) / this->nx0; + residualsNorm.at(2) = residuals.at(2) / this->mx0; + residualsNorm.at(3) = residuals.at(3) / this->my0; + residualsNorm.at(4) = residuals.at(4) / this->mz0; + residualsNorm.at(5) = residuals.at(5); + + normOfResiduals = norm(residualsNorm); + + if ( std::isnan(normOfResiduals) ) { + status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); + return; + } + + if ( normOfResiduals > yieldTol ) { + auto jacobian = computeJacobian(tempStress, deltaLambda, gp, tStep); + + auto solution = solve_check(jacobian, residuals); + if ( solution.first ) { + unknowns -= solution.second; + } else { + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + } + + unknowns.at(5) = max(unknowns.at(5), 0.); //Keep deltaLambda greater than zero! + + /* Update increments final values and DeltaLambda*/ + tempStress.at(1) = unknowns.at(1); + tempStress.at(2) = unknowns.at(2); + tempStress.at(3) = unknowns.at(3); + tempStress.at(4) = unknowns.at(4); + deltaLambda = unknowns.at(5); + + /* Compute the fVector*/ + auto FVector = computeFVector(tempStress, gp, tStep); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + + residuals.at(1) = tempStress.at(1) - trialStress.at(1) + area * this->e * deltaLambda * FVector.at(1); + residuals.at(2) = tempStress.at(2) - trialStress.at(2) + ik * g * deltaLambda * FVector.at(2); + residuals.at(3) = tempStress.at(3) - trialStress.at(3) + iy * this->e * deltaLambda * FVector.at(3); + residuals.at(4) = tempStress.at(4) - trialStress.at(4) + iz * this->e * deltaLambda * FVector.at(4); + residuals.at(5) = computeYieldValue(tempStress, gp, tStep); + } + } + + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_Converged); + ; + + stress = tempStress; +} + +FloatMatrixF< 5, 5 > +LatticeFrameConcretePlastic::computeJacobian(const FloatArrayF< 4 > &stress, + const double deltaLambda, + GaussPoint *gp, + TimeStep *tStep) const +{ + auto dMMatrix = computeDMMatrix(stress, gp, tStep); + auto fVector = computeFVector(stress, gp, tStep); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + + + /* Compute matrix*/ + FloatMatrixF< 5, 5 >jacobian; + jacobian.at(1, 1) = 1. + this->e * area * deltaLambda * dMMatrix.at(1, 1); + jacobian.at(1, 2) = 0.; + jacobian.at(1, 3) = 0.; + jacobian.at(1, 4) = 0.; + jacobian.at(1, 5) = this->e * area * fVector.at(1); + + jacobian.at(2, 1) = 0.; + jacobian.at(2, 2) = 1. + ik * g * deltaLambda * dMMatrix.at(2, 2); + jacobian.at(2, 3) = 0.; + jacobian.at(2, 4) = 0.; + jacobian.at(2, 5) = ik * this->e * fVector.at(2); + + jacobian.at(3, 1) = 0.; + jacobian.at(3, 2) = 0.; + jacobian.at(3, 3) = 1. + iy * this->e * deltaLambda * dMMatrix.at(3, 3); + jacobian.at(3, 4) = 0.; + jacobian.at(3, 5) = iy * this->e * fVector.at(3); + + jacobian.at(4, 1) = 0.; + jacobian.at(4, 2) = 0.; + jacobian.at(4, 3) = 0.; + jacobian.at(4, 4) = 1. + iz * this->e * deltaLambda * dMMatrix.at(4, 4); + jacobian.at(4, 5) = iz * this->e * fVector.at(4); + + jacobian.at(5, 1) = fVector.at(1); + jacobian.at(5, 2) = fVector.at(2); + jacobian.at(5, 3) = fVector.at(3); + jacobian.at(5, 4) = fVector.at(4); + jacobian.at(5, 5) = 0.; + + return jacobian; +} + +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveFrameForces3d(const FloatArrayF< 6 > &originalStrain, GaussPoint *gp, TimeStep *tStep) +{ + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + auto reducedStrain = originalStrain; + auto thermalStrain = this->computeStressIndependentStrainVector(gp, tStep, VM_Total); + if ( thermalStrain.giveSize() ) { + reducedStrain -= FloatArrayF< 6 >(thermalStrain); + } + + auto stress = this->performPlasticityReturn(gp, reducedStrain, tStep); + + status->letTempLatticeStrainBe(originalStrain); + status->letTempReducedLatticeStrainBe(reducedStrain); + status->letTempLatticeStressBe(stress); + + return stress; +} + + + +FloatMatrixF< 6, 6 > +LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const +{ + static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + double g = this->e / ( 2. * ( 1. + this->nu ) ); + + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + + FloatArrayF< 6 >d = { + this->e * area, + g *shearareay, + g *shearareaz, + g *ik, + this->e * iy, + this->e * iz + }; + + return diag(d); +} + +LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus(int n, Domain *d, GaussPoint *g) : LatticeMaterialStatus(g) +{ } + +void +LatticeFrameConcretePlasticStatus::printOutputAt(FILE *file, TimeStep *tStep) const +{ + LatticeMaterialStatus::printOutputAt(file, tStep); + + fprintf(file, "plasticStrains "); + for ( double s : this->plasticLatticeStrain ) { + fprintf(file, "% .8e ", s); + } +} +} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h new file mode 100644 index 000000000..4bec68cff --- /dev/null +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -0,0 +1,196 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef latticeframeconcreteplastic_h +#define latticeframeconcreteplastic_h + +#include "latticestructuralmaterial.h" +#include "cltypes.h" +#include "randommaterialext.h" +#include "strainvector.h" +#include "stressvector.h" +#include "latticematstatus.h" + +///@name Input fields for LatticeFrameConcrePlastic +//@{ +#define _IFT_LatticeFrameConcretePlastic_Name "LatticeFrameConcretePlastic" +#define _IFT_LatticeFrameConcretePlastic_talpha "talpha" +#define _IFT_LatticeFrameConcretePlastic_e "e" +#define _IFT_LatticeFrameConcretePlastic_n "n" +#define _IFT_LatticeFrameConcretePlastic_nx0 "nx0" +#define _IFT_LatticeFrameConcretePlastic_mx0 "mx0" +#define _IFT_LatticeFrameConcretePlastic_my0 "my0" +#define _IFT_LatticeFrameConcretePlastic_mz0 "mz0" +#define _IFT_LatticeFrameConcretePlastic_tol "tol" +#define _IFT_LatticeFrameConcretePlastic_iter "iter" +#define _IFT_LatticeFrameConcretePlastic_sub "sub" +#define _IFT_LatticeFrameConcretePlastic_plastic "plastic" +//@} + +namespace oofem { +/** + * This class implements associated Material Status to LatticeFrameConcretePlastic. + * @authors: Gumaa Abdelrhim, Peter Grassl + */ + +class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus +{ +public: + + enum state_flag_values { + LatticeFrameConcretePlastic_Elastic, + LatticeFrameConcretePlastic_Unloading, + LatticeFrameConcretePlastic_Plastic, + }; + + + enum LatticeFrameConcretePlastic_ReturnResult { + RR_NotConverged, + RR_Converged + }; + + +protected: + + int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; + + + +public: + + /// Constructor + LatticeFrameConcretePlasticStatus(int n, Domain *d, GaussPoint *g); + + + void printOutputAt(FILE *file, TimeStep *tStep) const override; + + const char *giveClassName() const override { return "LatticeFrameConcretePlasticStatus"; } + + void letTempReturnResultBe(const int result) { tempReturnResult = result; } + + int giveTempReturnResult() const { return tempReturnResult; } +}; + + +/** + * This class implements a local random linear elastic model for lattice elements. + */ +class LatticeFrameConcretePlastic : public LatticeStructuralMaterial + +{ +protected: + + ///Normal modulus + double e; + + ///Ratio of shear and normal modulus + double nu; + + ///maximum axial force in x-axis x-axis nx0 + double nx0; + + ///maximum bending moment about x-axis mx0 + double mx0; + + ///maximum bending moment about x-axis my0 + double my0; + + ///maximum bending moment about x-axis mz0 + double mz0; + + /// yield tolerance + double yieldTol; + + /// maximum number of iterations for stress return + double newtonIter; + + ///number Of SubIncrements + double numberOfSubIncrements; + + ///plastic flag + double plasticFlag; + + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged }; + // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. + + double initialYieldStress = 0.; + + // + +public: + LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; + + FloatArrayF< 4 >computeFVector(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + + FloatMatrixF< 4, 4 >computeDMMatrix(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + + FloatArrayF< 6 >giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; + + FloatArrayF< 6 >giveReducedLatticeStrain(GaussPoint *gp, TimeStep *tStep) const; + + virtual FloatArrayF< 6 >giveReducedStrain(GaussPoint *gp, TimeStep *tStep) const; + + FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &reducedStrain, TimeStep *tStep) const; + + void performRegularReturn(FloatArrayF< 4 > &stress, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; + + double computeYieldValue(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + + FloatMatrixF< 5, 5 >computeJacobian(const FloatArrayF< 4 > &sigma, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; + + FloatArrayF< 6 >giveFrameForces3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) override; + + const char *giveInputRecordName() const override { return _IFT_LatticeFrameConcretePlastic_Name; } + + const char *giveClassName() const override { return "LatticeFrameConcretePlastic"; } + + void initializeFrom(InputRecord &ir) override; + + bool isCharacteristicMtrxSymmetric(MatResponseMode rMode) const override { return false; } + + Interface *giveInterface(InterfaceType) override; + + FloatMatrixF< 6, 6 >give3dFrameStiffnessMatrix(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; + + bool hasMaterialModeCapability(MaterialMode mode) const override; + + MaterialStatus *CreateStatus(GaussPoint *gp) const override; + + MaterialStatus *giveStatus(GaussPoint *gp) const override; + +protected: +}; +} // end namespace oofem + +#endif From 3c660d24ffb06ba177ca4672b1e2ce3b58765e15 Mon Sep 17 00:00:00 2001 From: gumaa Date: Sun, 24 Oct 2021 18:05:03 +0100 Subject: [PATCH 07/60] concrete --- .../latticeframeconcreteplastic.C | 208 ++++++++++++++++-- .../latticeframeconcreteplastic.h | 16 ++ 2 files changed, 207 insertions(+), 17 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 61715c422..e48e298a9 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -77,15 +77,27 @@ LatticeFrameConcretePlastic::initializeFrom(InputRecord &ir) //Nx0 IR_GIVE_FIELD(ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0); // Macro + //Nx01 + IR_GIVE_FIELD(ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01); // Macro + //Mx0 IR_GIVE_FIELD(ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0); // Macro + //Mx01 + IR_GIVE_FIELD(ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01); // Macro + //My0 IR_GIVE_FIELD(ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0); // Macro + //My01 + IR_GIVE_FIELD(ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01); // Macro + //Mz0 IR_GIVE_FIELD(ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0); // Macro + //Mz01 + IR_GIVE_FIELD(ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01); // Macro + yieldTol = 1.e-6; ; IR_GIVE_FIELD(ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol); // Macro @@ -128,16 +140,46 @@ LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, GaussPoint *gp, TimeStep *tStep) const { - double yieldValue = 0.; - double nx = stress.at(1); - double mx = stress.at(2); - double my = stress.at(3); - double mz = stress.at(4); + double yieldValue = 0.; + double nx = stress.at(1); + double mx = stress.at(2); + double my = stress.at(3); + double mz = stress.at(4); + double a; + { + if ( nx > 0 ) { + a = nx0; + } else { + a = nx01; + } + double b; - { - yieldValue = pow(nx / this->nx0, 2.) + pow(mx / this->mx0, 2.) + pow(my / this->my0, 2.) + pow(mz / this->mz0, 2.) - 1.; + if ( mx > 0 ) { + b = mx0; + } else { + b = mx01; + } + double c; + + if ( my > 0 ) { + c = my0; + } else { + c = my01; } + double d; + + if ( mz> 0 ) { + d = mz0; + } else { + d = mz01; + } + + { + + yieldValue = pow(nx / a, 2.) + pow(mx / b, 2.) + pow(my / c, 2.) + pow(mz / d, 2.) - 1.; + } + } return yieldValue; } @@ -150,13 +192,45 @@ LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, double mx = stress.at(2); double my = stress.at(3); double mz = stress.at(4); + double a; + double b; + double c; + double d; + + if ( nx > 0 ) { + a = nx01; + } else { + a = nx0; + } + + if ( mx > 0 ) { + b = mx0; + } else { + b = mx01; + } + + if ( my > 0 ) { + c = my0; + } else { + c = my01; + } + + if ( mz> 0 ) { + d = mz0; + } else { + d = mz01; + } FloatArrayF< 4 >f; - f.at(1) = 2. * nx / pow(this->nx0, 2.); - f.at(2) = 2. * mx / pow(this->mx0, 2.); - f.at(3) = 2. * my / pow(this->my0, 2.); - f.at(4) = 2. * mz / pow(this->mz0, 2.); + // f.at(1) = 2. * nx / pow(this->nx0, 2.); + // f.at(2) = 2. * mx / pow(this->mx0, 2.); + // f.at(3) = 2. * my / pow(this->my0, 2.); + // f.at(4) = 2. * mz / pow(this->mz0, 2.); + f.at(1) = 2. * nx / pow(a, 2.); + f.at(2) = 2. * mx / pow(b, 2.); + f.at(3) = 2. * my / pow(c, 2.); + f.at(4) = 2. * mz / pow(d, 2.); return f; } @@ -164,31 +238,66 @@ LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, FloatMatrixF< 4, 4 > LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, GaussPoint *gp, TimeStep *tStep) const { + // FloatMatrixF< 4, 4 >dm; + double nx = stress.at(1); + double mx = stress.at(2); + double my = stress.at(3); + double mz = stress.at(4); + + double a; + double b; + double c; + double d; + + if ( nx > 0 ) { + a = nx01; + } else { + a = nx0; + } + + if ( mx > 0 ) { + b = mx0; + } else { + b = mx01; + } + + if ( my > 0 ) { + c = my0; + } else { + c = my01; + } + + if ( mz> 0 ) { + d = mz0; + } else { + d = mz01; + } + FloatMatrixF< 4, 4 >dm; //Derivatives of dGDSig - dm.at(1, 1) = 2. / pow(this->nx0, 2.); + dm.at(1, 1) = 2. / pow(a, 2.); dm.at(1, 2) = 0; dm.at(1, 3) = 0; dm.at(1, 4) = 0; //Derivatives of dGDTau dm.at(2, 1) = 0; - dm.at(2, 2) = 2. / pow(this->mx0, 2.); + dm.at(2, 2) = 2. / pow(b, 2.); dm.at(2, 3) = 0; dm.at(2, 4) = 0; //Derivates of evolution law dm.at(3, 1) = 0; dm.at(3, 2) = 0; - dm.at(3, 3) = 2. / pow(this->my0, 2.); + dm.at(3, 3) = 2. / pow(c, 2.); dm.at(3, 4) = 0; //Derivates of evolution law dm.at(4, 1) = 0; dm.at(4, 2) = 0; dm.at(4, 3) = 0; - dm.at(4, 3) = 2. / pow(this->mz0, 2.); + dm.at(4, 3) = 2. / pow(d, 2.); return dm; } @@ -230,11 +339,76 @@ LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const Float auto tempPlasticStrain = status->givePlasticLatticeStrain() [ { 0, 3, 4, 5 } ]; FloatArrayF< 4 >tangent = { area *this->e, ik *g, iy *this->e, iz *this->e }; - + /* Compute trial stress*/ auto stress = mult(tangent, strain - tempPlasticStrain); - auto oldStrain = this->giveReducedStrain(gp, tStep) [ { 0, 3, 4, 5 } ]; + double k1; + double k2; + double k3; + double k4; + k1 = stress.at(1); + k2 = stress.at(2); + k3 = stress.at(3); + k4 = stress.at(4); + + if ( k1>0 && k2>0 && k3>0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1>0 && k2>0 && k3<0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1>0 && k2>0 && k3<0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1>0 && k2>0 && k3>0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1>0 && k2<0 && k3>0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1>0 && k2<0 && k3<0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1>0 && k2<0 && k3<0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1>0 && k2<0 && k3>0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1<0 && k2>0 && k3>0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1<0 && k2>0 && k3<0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1<0 && k2>0 && k3<0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1<0 && k2>0 && k3>0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1<0 && k2<0 && k3>0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1<0 && k2<0 && k3<0 && k4>0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + if ( k1<0 && k2<0 && k3<0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; + } else { + + if ( k1<0 && k2<0 && k3>0 && k4<0 ) { + stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} + + auto oldStrain = this->giveReducedStrain(gp, tStep) [ { 0, 3, 4, 5 } ]; /* Compute yield value*/ double yieldValue = computeYieldValue(stress, gp, tStep); diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 4bec68cff..d2b5d2df8 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -52,6 +52,10 @@ #define _IFT_LatticeFrameConcretePlastic_mx0 "mx0" #define _IFT_LatticeFrameConcretePlastic_my0 "my0" #define _IFT_LatticeFrameConcretePlastic_mz0 "mz0" +#define _IFT_LatticeFrameConcretePlastic_nx01 "nx01" +#define _IFT_LatticeFrameConcretePlastic_mx01 "mx01" +#define _IFT_LatticeFrameConcretePlastic_my01 "my01" +#define _IFT_LatticeFrameConcretePlastic_mz01 "mz01" #define _IFT_LatticeFrameConcretePlastic_tol "tol" #define _IFT_LatticeFrameConcretePlastic_iter "iter" #define _IFT_LatticeFrameConcretePlastic_sub "sub" @@ -128,6 +132,18 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///maximum bending moment about x-axis mz0 double mz0; + + ///maximum axial force in x-axis x-axis nx01 + double nx01; + + ///maximum bending moment about x-axis mx01 + double mx01; + + ///maximum bending moment about x-axis my01 + double my01; + + ///maximum bending moment about x-axis mz01 + double mz01; /// yield tolerance double yieldTol; From cb8f1447e8b66afbe4860868189c526a45570059 Mon Sep 17 00:00:00 2001 From: gumaa Date: Mon, 25 Oct 2021 11:05:51 +0100 Subject: [PATCH 08/60] m --- src/sm/CMakeLists.txt | 1 + src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C | 1 + src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h | 1 + 3 files changed, 3 insertions(+) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 540bf8492..8f301b086 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -296,6 +296,7 @@ set (sm_material Materials/LatticeMaterials/latticeframeconcreteplastic.C ) + if (USE_MFRONT) list (APPEND sm_material Materials/mfrontusermaterial.C) endif () diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index e48e298a9..2551f21bd 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -58,6 +58,7 @@ REGISTER_Material(LatticeFrameConcretePlastic); // LatticeStructuralMaterial(n, d) bool LatticeFrameConcretePlastic::hasMaterialModeCapability(MaterialMode mode) const + { return ( mode == _3dLattice ); } diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index d2b5d2df8..e2b7d0da4 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -165,6 +165,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial // public: + LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; FloatArrayF< 4 >computeFVector(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; From ea9d34e8b458c4f085ae32b5afdf1c27f3cb6864 Mon Sep 17 00:00:00 2001 From: gumaa Date: Mon, 25 Oct 2021 11:34:27 +0100 Subject: [PATCH 09/60] newmaterial --- src/sm/CMakeLists.txt | 1 - src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C | 1 - src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h | 1 - 3 files changed, 3 deletions(-) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 8f301b086..540bf8492 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -296,7 +296,6 @@ set (sm_material Materials/LatticeMaterials/latticeframeconcreteplastic.C ) - if (USE_MFRONT) list (APPEND sm_material Materials/mfrontusermaterial.C) endif () diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 2551f21bd..e48e298a9 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -58,7 +58,6 @@ REGISTER_Material(LatticeFrameConcretePlastic); // LatticeStructuralMaterial(n, d) bool LatticeFrameConcretePlastic::hasMaterialModeCapability(MaterialMode mode) const - { return ( mode == _3dLattice ); } diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index e2b7d0da4..d2b5d2df8 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -165,7 +165,6 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial // public: - LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; FloatArrayF< 4 >computeFVector(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; From e7b091f029d88d4745d7775542151ec8f28afe06 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Mon, 25 Oct 2021 12:20:20 +0100 Subject: [PATCH 10/60] new --- src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index e48e298a9..5cf9e8bcc 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -351,7 +351,7 @@ LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const Float k2 = stress.at(2); k3 = stress.at(3); k4 = stress.at(4); - +//test if ( k1>0 && k2>0 && k3>0 && k4>0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { From ddd8c0eb47ba38f00578d7405ed6aeab2eade69e Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Mon, 25 Oct 2021 18:11:54 +0100 Subject: [PATCH 11/60] newmaterial --- src/sm/CMakeLists.txt | 1 - .../latticeframeconcreteplastic.C | 58 +++++++++---------- .../latticeframeconcreteplastic.h | 1 - 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 540bf8492..dc3feb7b5 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -295,7 +295,6 @@ set (sm_material Materials/LatticeMaterials/latticeframesteelplastic.C Materials/LatticeMaterials/latticeframeconcreteplastic.C ) - if (USE_MFRONT) list (APPEND sm_material Materials/mfrontusermaterial.C) endif () diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 5cf9e8bcc..3257da640 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -145,23 +145,23 @@ LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, double mx = stress.at(2); double my = stress.at(3); double mz = stress.at(4); - double a; { - if ( nx > 0 ) { + double a; + if ( nx >= 0 ) { a = nx0; } else { a = nx01; } double b; - if ( mx > 0 ) { + if ( mx >= 0 ) { b = mx0; } else { b = mx01; } double c; - if ( my > 0 ) { + if ( my >= 0 ) { c = my0; } else { c = my01; @@ -169,7 +169,7 @@ LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, double d; - if ( mz> 0 ) { + if ( mz>= 0 ) { d = mz0; } else { d = mz01; @@ -197,25 +197,25 @@ LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, double c; double d; - if ( nx > 0 ) { + if ( nx >= 0 ) { a = nx01; } else { a = nx0; } - if ( mx > 0 ) { + if ( mx >= 0 ) { b = mx0; } else { b = mx01; } - if ( my > 0 ) { + if ( my >= 0 ) { c = my0; } else { c = my01; } - if ( mz> 0 ) { + if ( mz>= 0 ) { d = mz0; } else { d = mz01; @@ -249,25 +249,25 @@ LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, Gau double c; double d; - if ( nx > 0 ) { + if ( nx >= 0 ) { a = nx01; } else { a = nx0; } - if ( mx > 0 ) { + if ( mx >= 0 ) { b = mx0; } else { b = mx01; } - if ( my > 0 ) { + if ( my >= 0 ) { c = my0; } else { c = my01; } - if ( mz> 0 ) { + if ( mz>= 0 ) { d = mz0; } else { d = mz01; @@ -351,61 +351,61 @@ LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const Float k2 = stress.at(2); k3 = stress.at(3); k4 = stress.at(4); -//test - if ( k1>0 && k2>0 && k3>0 && k4>0 ) { +//tes + if ( k1>=0 && k2>=0 && k3>=0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1>0 && k2>0 && k3<0 && k4>0 ) { + if ( k1>=0 && k2>=0 && k3<0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1>0 && k2>0 && k3<0 && k4<0 ) { + if ( k1>=0 && k2>=0 && k3<0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1>0 && k2>0 && k3>0 && k4<0 ) { + if ( k1>=0 && k2>=0 && k3>=0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1>0 && k2<0 && k3>0 && k4>0 ) { + if ( k1>=0 && k2<0 && k3>=0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1>0 && k2<0 && k3<0 && k4>0 ) { + if ( k1>=0 && k2<0 && k3<0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1>0 && k2<0 && k3<0 && k4<0 ) { + if ( k1>=0 && k2<0 && k3<0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1>0 && k2<0 && k3>0 && k4<0 ) { + if ( k1>=0 && k2<0 && k3>=0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1<0 && k2>0 && k3>0 && k4>0 ) { + if ( k1<0 && k2>=0 && k3>=0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1<0 && k2>0 && k3<0 && k4>0 ) { + if ( k1<0 && k2>=0 && k3<0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1<0 && k2>0 && k3<0 && k4<0 ) { + if ( k1<0 && k2>=0 && k3<0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1<0 && k2>0 && k3>0 && k4<0 ) { + if ( k1<0 && k2>=0 && k3>=0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - if ( k1<0 && k2<0 && k3>0 && k4>0 ) { + if ( k1<0 && k2<0 && k3>=0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1<0 && k2<0 && k3<0 && k4>0 ) { + if ( k1<0 && k2<0 && k3<0 && k4>=0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} if ( k1<0 && k2<0 && k3<0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; } else { - if ( k1<0 && k2<0 && k3>0 && k4<0 ) { + if ( k1<0 && k2<0 && k3>=0 && k4<0 ) { stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} auto oldStrain = this->giveReducedStrain(gp, tStep) [ { 0, 3, 4, 5 } ]; diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index d2b5d2df8..259713da0 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -31,7 +31,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #ifndef latticeframeconcreteplastic_h #define latticeframeconcreteplastic_h From ccda545e2f31b683b3962d68d4cea3085f1f1f52 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Fri, 29 Oct 2021 09:37:18 +0100 Subject: [PATCH 12/60] newmaterial --- .../latticeframeconcreteplastic.C | 61 +++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 3257da640..f1052345c 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -169,7 +169,7 @@ LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, double d; - if ( mz>= 0 ) { + if ( mz >= 0 ) { d = mz0; } else { d = mz01; @@ -198,9 +198,9 @@ LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, double d; if ( nx >= 0 ) { - a = nx01; - } else { a = nx0; + } else { + a = nx01; } if ( mx >= 0 ) { @@ -215,7 +215,7 @@ LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, c = my01; } - if ( mz>= 0 ) { + if ( mz >= 0 ) { d = mz0; } else { d = mz01; @@ -250,9 +250,9 @@ LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, Gau double d; if ( nx >= 0 ) { - a = nx01; - } else { a = nx0; + } else { + a = nx01; } if ( mx >= 0 ) { @@ -521,13 +521,52 @@ LatticeFrameConcretePlastic::performRegularReturn(FloatArrayF< 4 > &stress, return; } + //FloatArrayF< 5 >residualsNorm; + // residualsNorm.at(1) = residuals.at(1) / this->nx01; + //residualsNorm.at(2) = residuals.at(2) / this->mx01; + //residualsNorm.at(3) = residuals.at(3) / this->my01; + //residualsNorm.at(4) = residuals.at(4) / this->mz01; + //residualsNorm.at(5) = residuals.at(5); + double nx = stress.at(1); + double mx = stress.at(2); + double my = stress.at(3); + double mz = stress.at(4); + + double a; + double b; + double c; + double d; + + if ( nx >= 0 ) { + a = nx0; + } else { + a = nx01; + } + + if ( mx >= 0 ) { + b = mx0; + } else { + b = mx01; + } + + if ( my >= 0 ) { + c = my0; + } else { + c = my01; + } + + if ( mz>= 0 ) { + d = mz0; + } else { + d = mz01; + } + FloatArrayF< 5 >residualsNorm; - residualsNorm.at(1) = residuals.at(1) / this->nx0; - residualsNorm.at(2) = residuals.at(2) / this->mx0; - residualsNorm.at(3) = residuals.at(3) / this->my0; - residualsNorm.at(4) = residuals.at(4) / this->mz0; + residualsNorm.at(1) = residuals.at(1) / a; + residualsNorm.at(2) = residuals.at(2) / b; + residualsNorm.at(3) = residuals.at(3) / c; + residualsNorm.at(4) = residuals.at(4) / d; residualsNorm.at(5) = residuals.at(5); - normOfResiduals = norm(residualsNorm); if ( std::isnan(normOfResiduals) ) { From 917047e4333f6cde5fcb4f8c8255b3ff114d2422 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Wed, 10 Nov 2021 19:41:22 +0000 Subject: [PATCH 13/60] includedShear --- doc/elementlibmanual/elementlibmanual.tex | 46 +- doc/matlibmanual/matlibmanual.tex | 77 +- .../latticeframeconcreteplastic.C | 1809 +++++++++++------ .../latticeframeconcreteplastic.h | 43 +- 4 files changed, 1349 insertions(+), 626 deletions(-) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index c06024eeb..e808620a7 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -454,24 +454,38 @@ \subsubsection{Latticelink3dboundary} \end{elementsummary} \subsubsection{latticeframe3d element} -latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure~\ref{latticeframe3dfig}. -The element is based on the Rigid Body Spring Model originally developed by Toi for modelling failure in steel frame member. -The input parameters for this element are shown in Table~\ref{latticeframe3dsummary}. - +latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure ~\ref{latticeframe3dfig}. The element is based on the Rigid Body Spring Model originally developed by Kawai and later delveloped by Bolander for modelling fracture in concrete. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies, which is the mid-cross-section of the element. The properties of the mid-cross-section are internally computed from its vertices which are given as input in the global coordinate sytem. Displacement jumps are computed at the mid-cross-section, which are smeared out over the element length in the form of strains. The input parameters +for this element are shown in Table ~\ref{tab:my_label}. \begin{figure}[htb] - \centering - \includegraphics[width=0.3\textwidth]{./latticeframe3d.png} - \caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point $C$.} - \label{latticeframe3dfig} +\centering +\includegraphics[width=0.3\textwidth]{./latticeframe.png} +\includegraphics[width=0.3\textwidth]{./latticeframe1.png} +\caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point.} +\label{latticeframe3dfig} \end{figure} - -\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{\field{iy}{rn} \field{iz}{rn} \field{ik}{rn} \field{shearcoeff}{rn} \field{s}{rn} \field{area}{rn} \field{gpCoords}{ra}}{latticeframe3d element summary}{latticeframe3dsummary} -\elementParam{\param{refnode}: sets reference node to determine the local coordinate system of element.} -\elementParam{\param{s}: s is the position of the integration point} -\elementDescription{CS properties}{Area, inertia moment along y and z axis (\param{iy} and \param{iz} parameters), torsion inertia moment (\param{ik} parameter) and either cross section area shear correction factor (\param{shearcoeff} parameter) are required. These cross section properties are assumed to be defined in local coordinate system of element.} -\elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} -\end{elementsummary} - +\begin{table}[!h] +\centering +\begin{tabular}{|l|l|} +\hline +Keyword&lattice3d\\ +Description&3d lattice frame element\\ +\hline +Parameters&refnode: sets reference node todetermine the local coo-\\ +&rdinatesystem ofelement. \\ +CS properties&Area, inertia moment along y and z axis ($iy$ and $iz$ p-\\ +& arameters),torsion inertia moment $(ik)$ parameter and \\ +&either cross section area shear correction factor (beam \\ +&shear coeff parameter) or equivalent shear areas (shear\\ +&area $y$ and shear area $z$ parameters) are required.\\ +&These cross section properties are assumed to be dened \\ +&in local coordinate system of element.\\ +Unknowns&Six dofs ($u$-displacement, $v$-displacement, $w$-displacem-\\ +&ent, $u$-rotation, $v$-rotation and $w$-rotation) are required\\ & in each node.\\ +\hline +\end{tabular} +\caption{Material properities of steel} +\label{tab:my_label} +\end{table} %----------------------------------------------------------------------------------------------- \clearpage \subsection{Plane Stress Elements} diff --git a/doc/matlibmanual/matlibmanual.tex b/doc/matlibmanual/matlibmanual.tex index 644becf71..63341a5ce 100644 --- a/doc/matlibmanual/matlibmanual.tex +++ b/doc/matlibmanual/matlibmanual.tex @@ -5917,41 +5917,72 @@ \subsubsection{Viscoelastic plasticity damage lattice model} \subsubsection{Plasticity lattice model for steel} -This is a Plasticity material used together with lattice elements. +This is a Plasticity material used together with lattice elements.It has bean developed to describe the failure process failure of steel frame member. The stress-strain law has the form \begin{equation} \boldsymbol{\sigma} = \mathbf{D}_{\rm e} \left(\boldsymbol{\varepsilon}-\boldsymbol{\varepsilon}_{\rm p} \right) \end{equation} -where $\boldsymbol{\sigma}$ is a vector of tractions and rotational components, $\mathbf{D}_{\rm e}$ is the elastic stiffness matrix, $\boldsymbol{\varepsilon}$ is a vector of strains obtained from disp\ -lacement jumps smeared over the element length and rotational components and $\boldsymbol{\varepsilon}_{\rm p}$ are the plastic strains. +where $\boldsymbol{\sigma}$ is a vector of tractions and rotational components, $\mathbf{D}_{\rm e}$ is the elastic stiffness matrix, $\boldsymbol{\varepsilon}$ is a vector of strains obtained from displacement jumps smeared over the element length and rotational components and $\boldsymbol{\varepsilon}_{\rm p}$ are the plastic strains. The model parameters are summarised in Table \ref{latticeframesteelplastic_table}. \begin{table}[!htb] -\begin{mmt} + \centering +\begin{tabular}{|l|l|} \hline -Description & Plasticity steel model for lattice elements \\ +Description & Plasticity lattice model for steel \\ \hline -Record Format & \descitem{latticeframesteelplastic} \elemparam{}{in} -\elemparam{d}{rn} \optelemparam{talpha}{rn} \elemparam{e}{rn} \optelemparam{n}{rn} \optelemparam{nx0}{rn} \optelemparam{mx0}{rn} \optelemparam{my0}{rn} \optelemparam{mz0}{rn} \elemparam{sub}{in} \elempa\ -ram{iter}{in} \elemparam{tol}{rn}\\ +Record Format & \descitem{latticeframesteelplastic} $\elemparam{}_{(in)}$ +$\elemparam{d}_{(rn)}$ $\optelemparam{talpha}_{(rn)}$ $\elemparam{e}_{(rn)}$ $\optelemparam{n}_{(rn)}$ $\optelemparam{nx0}_{(rn)}$ $\optelemparam{mx0}_{(rn)}$\\ &$\optelemparam{my0}_{(rn)}$ $\optelemparam{mz0}_{(rn)}$ $\elemparam{sub}_{(in)}$ $\elemparam{iter}_{(in)}$ $\elemparam{tol}_{(rn)}$\\ Parameters &- \param{} material number\\ -&- \param{d} material density\\ -&- \optparam{talpha} Thermal expansion coefficient. Default is 0.\\ -&- \optparam{e} Young's modulus of the lattice material.\\ -&- \param{n} Poisson's ratio of the material that the beam element is made of.\\ -&- \optparam{nx0} ultimate capacity under pure axialloads.\\ -&- \optparam{mx0} ultimate capacity under pure moment about x.\\ -&- \optparam{my0} ultimate capacity under pure moment about y.\\ -&- \optparam{mz0} ultimate capacity under pure moment about z.\\ -&- \optparam{sub} maximum number of subincrementations.\\ -&- \optparam{iter} maximum number of newton iterations.\\ -&- \optparam{tol} tolerance for newton method.\\ -Supported modes & 3dlattice\\ +&- $\param{d}$ material density\\ +&- $\optparam{talpha}$ Thermal expansion coefficient. Default is 0.\\ +&- $\optparam{e}$ Young's modulus of the lattice material.\\ +&- $\param{n}$ Poisson's ratio of the material that the beam element is made of.\\ +&- $\optparam{nx0}$ ultimate capacity under pure axialloads.\\ +&- $\optparam{mx0}$ ultimate capacity under pure moment about $x$.\\ +&- $\optparam{my0}$ ultimate capacity under pure moment about $y$.\\ +&- $\optparam{mz0}$ ultimate capacity under pure moment about $z$.\\ +&- $\optparam{sub}$ maximum number of subincrementations.\\ +&- $\optparam{iter}$ maximum number of newton iterations.\\ +&- $\optparam{tol}$ tolerance for newton method.\\ Supported modes & 3dlattice\\ + \hline -\end{mmt} +\end{tabular} + \caption{Plasticity steel model for lattice elements -- summary.} \label{latticeframesteelplastic_table} -%\end{center} -\end{table} +%\end{center} + \end{table} +The nonlinear response of the beam element is given directly as an relationship between internal force and strain. The basic equations include an additive decomposition of total strain into elastic part and plastic part + +\begin{equation} +\boldsymbol{\varepsilon} = \boldsymbol{\varepsilon}_{\rm e}-\boldsymbol{\varepsilon}_{\rm p} +\end{equation} + +Trail stress +\begin{equation} + \sigma_{n+1}^{tr} =D^e (\varepsilon_{n+1} - \varepsilon_n^p) +\end{equation} + +The yield function +\begin{equation} +(\frac{N_x}{N_0})^2+ (\frac{M_x}{M_{x0}} )^2+ (\frac{M_y}{M_{y0}} )^2+ (\frac{M_z}{M_{z0}} )^2- 1 = 0 +\end{equation} + +where $M$, $M y$ , $N$ and $M$ , are the two components of bending moment, an axial force and +a torsional moment, respectively. The subscript 0 indicates a fully plastic value under the +condition that each component of resultant forces acts independently on a cross-section of +a member. +\\ +loading-unloading conditions + +loading-unloading conditions +\begin{equation} +f(\bar{\vsig},\kappa)\le 0 \qquad \dot{\lambda}\geq 0 \qquad \dot{\lambda}f(\bar{\vsig},\kappa)=0, +\end{equation} +evolution law for plastic strain +\begin{equation} +\dot{\veps}_{\rm{p}} = \dot{\lambda} \frac{\partial f}{\partial \bar{\vsig}}, +\end{equation} \subsection{Material models for steel relaxation} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index f1052345c..622b51efe 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -51,84 +51,93 @@ #include "classfactory.h" namespace oofem { -REGISTER_Material(LatticeFrameConcretePlastic); +REGISTER_Material( LatticeFrameConcretePlastic ); // constructor which creates a dummy material without a status and without random extension interface // LatticeFrameConcretePlastic :: LatticeFrameConcretelPlastic(int n, Domain *d) : // LatticeStructuralMaterial(n, d) -bool -LatticeFrameConcretePlastic::hasMaterialModeCapability(MaterialMode mode) const +bool LatticeFrameConcretePlastic::hasMaterialModeCapability( MaterialMode mode ) const { return ( mode == _3dLattice ); } -void -LatticeFrameConcretePlastic::initializeFrom(InputRecord &ir) +void LatticeFrameConcretePlastic::initializeFrom( InputRecord &ir ) { - LatticeStructuralMaterial::initializeFrom(ir); - - //Young's modulus of the material that the beam element is made of - IR_GIVE_FIELD(ir, this->e, _IFT_LatticeFrameConcretePlastic_e); // Macro - - //Poisson's ratio of the material that the beam element is made of - IR_GIVE_FIELD(ir, this->nu, _IFT_LatticeFrameConcretePlastic_n); // Macro - - //Nx0 - IR_GIVE_FIELD(ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0); // Macro - - //Nx01 - IR_GIVE_FIELD(ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01); // Macro - - //Mx0 - IR_GIVE_FIELD(ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0); // Macro - - //Mx01 - IR_GIVE_FIELD(ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01); // Macro - - //My0 - IR_GIVE_FIELD(ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0); // Macro - - //My01 - IR_GIVE_FIELD(ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01); // Macro - - //Mz0 - IR_GIVE_FIELD(ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0); // Macro - - //Mz01 - IR_GIVE_FIELD(ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01); // Macro - + LatticeStructuralMaterial::initializeFrom( ir ); + + // Young's modulus of the material that the beam element is made of + IR_GIVE_FIELD( ir, this->e, _IFT_LatticeFrameConcretePlastic_e ); // Macro + + // Poisson's ratio of the material that the beam element is made of + IR_GIVE_FIELD( ir, this->nu, _IFT_LatticeFrameConcretePlastic_n ); // Macro + + // Nx0 + IR_GIVE_FIELD( ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0 ); // Macro + + // Nx01 + IR_GIVE_FIELD( ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01 ); // Macro + + // vy0 + IR_GIVE_FIELD( ir, this->vy0, _IFT_LatticeFrameConcretePlastic_vy0 ); // Macro + + // vy01 + IR_GIVE_FIELD( ir, this->vy01, _IFT_LatticeFrameConcretePlastic_vy01 ); // Macro + + // vz0 + IR_GIVE_FIELD( ir, this->vz0, _IFT_LatticeFrameConcretePlastic_vz0 ); // Macro + + // vz01 + IR_GIVE_FIELD( ir, this->vz01, _IFT_LatticeFrameConcretePlastic_vz01 ); // Macro + + // Mx0 + IR_GIVE_FIELD( ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0 ); // Macro + + // Mx01 + IR_GIVE_FIELD( ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01 ); // Macro + + // My0 + IR_GIVE_FIELD( ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0 ); // Macro + + // My01 + IR_GIVE_FIELD( ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01 ); // Macro + + // Mz0 + IR_GIVE_FIELD( ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0 ); // Macro + + // Mz01 + IR_GIVE_FIELD( ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01 ); // Macro + yieldTol = 1.e-6; - ; - IR_GIVE_FIELD(ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol); // Macro + IR_GIVE_FIELD( ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol ); // Macro this->newtonIter = 100; - IR_GIVE_FIELD(ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter); // Macro + IR_GIVE_FIELD( ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter ); // Macro numberOfSubIncrements = 10; - IR_GIVE_FIELD(ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub); // Macro + IR_GIVE_FIELD( ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub ); // Macro this->plasticFlag = 1; - IR_GIVE_OPTIONAL_FIELD(ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic); // Macro + IR_GIVE_OPTIONAL_FIELD( ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic ); // Macro } MaterialStatus * -LatticeFrameConcretePlastic::CreateStatus(GaussPoint *gp) const +LatticeFrameConcretePlastic::CreateStatus( GaussPoint *gp ) const { - return new LatticeFrameConcretePlasticStatus(1, LatticeFrameConcretePlastic::domain, gp); + return new LatticeFrameConcretePlasticStatus( 1, LatticeFrameConcretePlastic::domain, gp ); } MaterialStatus * -LatticeFrameConcretePlastic::giveStatus(GaussPoint *gp) const +LatticeFrameConcretePlastic::giveStatus( GaussPoint *gp ) const { // test - MaterialStatus *status = static_cast< MaterialStatus * >( gp->giveMaterialStatus() ); + MaterialStatus *status = static_cast( gp->giveMaterialStatus() ); if ( !status ) { // create a new one - status = this->CreateStatus(gp); + status = this->CreateStatus( gp ); if ( status ) { - gp->setMaterialStatus(status); + gp->setMaterialStatus( status ); } } @@ -136,593 +145,1245 @@ LatticeFrameConcretePlastic::giveStatus(GaussPoint *gp) const } double -LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 4 > &stress, - GaussPoint *gp, - TimeStep *tStep) const +LatticeFrameConcretePlastic::computeYieldValue( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + GaussPoint *gp, + TimeStep *tStep ) const { - double yieldValue = 0.; - double nx = stress.at(1); - double mx = stress.at(2); - double my = stress.at(3); - double mz = stress.at(4); - { - double a; - if ( nx >= 0 ) { - a = nx0; - } else { - a = nx01; - } - double b; + double yieldValue = 0.; + double nx = stress.at( 1 ); + double vy = stress.at( 2 ); + double vz = stress.at( 3 ); + double mx = stress.at( 4 ); + double my = stress.at( 5 ); + double mz = stress.at( 6 ); + { + double a1; + if ( k.at( 1 ) == 1 ) { + a1 = nx0; + } else { + a1 = nx01; + } + double a2; + if ( k.at( 2 ) == 1 ) { + a2 = vy0; + } else { + a2 = vy01; + } + double a3; + if ( k.at( 3 ) == 1 ) { + a3 = vz0; + } else { + a3 = vz01; + } + double a4; - if ( mx >= 0 ) { - b = mx0; - } else { - b = mx01; - } - double c; - - if ( my >= 0 ) { - c = my0; - } else { - c = my01; - } + if ( k.at( 4 ) == 1 ) { + a4 = mx0; + } else { + a4 = mx01; + } + double a5; - double d; - - if ( mz >= 0 ) { - d = mz0; - } else { - d = mz01; - } - - { - - yieldValue = pow(nx / a, 2.) + pow(mx / b, 2.) + pow(my / c, 2.) + pow(mz / d, 2.) - 1.; + if ( k.at( 5 ) == 1 ) { + a5 = my0; + } else { + a5 = my01; + } + + double a6; + + if ( k.at( 6 ) == 1 ) { + a6 = mz0; + } else { + a6 = mz01; + } + + + { + + yieldValue = pow( nx / a1, 2. ) + pow( vy / a2, 2. ) + pow( vz / a3, 2. ) + pow( mx / a4, 2. ) + pow( my / a5, 2. ) + pow( mz / a6, 2. ) - 1.; + } } - } return yieldValue; } -FloatArrayF< 4 > -LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 4 > &stress, - GaussPoint *gp, - TimeStep *tStep) const +FloatArrayF<6> +LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + GaussPoint *gp, + TimeStep *tStep ) const { - double nx = stress.at(1); - double mx = stress.at(2); - double my = stress.at(3); - double mz = stress.at(4); - double a; - double b; - double c; - double d; - - if ( nx >= 0 ) { - a = nx0; - } else { - a = nx01; - } + double nx = stress.at( 1 ); + double vy = stress.at( 2 ); + double vz = stress.at( 3 ); + double mx = stress.at( 4 ); + double my = stress.at( 5 ); + double mz = stress.at( 6 ); + { + double a1; + if ( k.at( 1 ) == 1 ) { + a1 = nx0; + } else { + a1 = nx01; + } + double a2; + if ( k.at( 2 ) == 1 ) { + a2 = vy0; + } else { + a2 = vy01; + } + double a3; + if ( k.at( 3 ) == 1 ) { + a3 = vz0; + } else { + a3 = vz01; + } + double a4; - if ( mx >= 0 ) { - b = mx0; - } else { - b = mx01; - } + if ( k.at( 4 ) == 1 ) { + a4 = mx0; + } else { + a4 = mx01; + } + double a5; - if ( my >= 0 ) { - c = my0; - } else { - c = my01; - } + if ( k.at( 5 ) == 1 ) { + a5 = my0; + } else { + a5 = my01; + } - if ( mz >= 0 ) { - d = mz0; - } else { - d = mz01; - } + double a6; - FloatArrayF< 4 >f; + if ( k.at( 6 ) == 1 ) { + a6 = mz0; + } else { + a6 = mz01; + } - // f.at(1) = 2. * nx / pow(this->nx0, 2.); - // f.at(2) = 2. * mx / pow(this->mx0, 2.); - // f.at(3) = 2. * my / pow(this->my0, 2.); - // f.at(4) = 2. * mz / pow(this->mz0, 2.); - f.at(1) = 2. * nx / pow(a, 2.); - f.at(2) = 2. * mx / pow(b, 2.); - f.at(3) = 2. * my / pow(c, 2.); - f.at(4) = 2. * mz / pow(d, 2.); + FloatArrayF<6> f; + f.at( 1 ) = 2. * nx / pow( a1, 2. ); + f.at( 2 ) = 2. * vy / pow( a2, 2. ); + f.at( 3 ) = 2. * vz / pow( a3, 2. ); + f.at( 4 ) = 2. * mx / pow( a4, 2. ); + f.at( 5 ) = 2. * my / pow( a5, 2. ); + f.at( 6 ) = 2. * mz / pow( a6, 2. ); - return f; + return f; + } } + FloatMatrixF<6, 6> + LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const + { -FloatMatrixF< 4, 4 > -LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, GaussPoint *gp, TimeStep *tStep) const -{ - // FloatMatrixF< 4, 4 >dm; - double nx = stress.at(1); - double mx = stress.at(2); - double my = stress.at(3); - double mz = stress.at(4); - - double a; - double b; - double c; - double d; - - if ( nx >= 0 ) { - a = nx0; - } else { - a = nx01; - } + double a1; + if ( k.at( 1 ) == 1 ) { + a1 = nx0; + } else { + a1 = nx01; + } + double a2; + if ( k.at( 2 ) == 1 ) { + a2 = vy0; + } else { + a2 = vy01; + } + double a3; + if ( k.at( 3 ) == 1 ) { + a3 = vz0; + } else { + a3 = vz01; + } + double a4; - if ( mx >= 0 ) { - b = mx0; - } else { - b = mx01; + if ( k.at( 4 ) == 1 ) { + a4 = mx0; + } else { + a4 = mx01; + } + double a5; + + if ( k.at( 5 ) == 1 ) { + a5 = my0; + } else { + a5 = my01; + } + + double a6; + + if ( k.at( 6 ) == 1 ) { + a6 = mz0; + } else { + a6 = mz01; + } + + + FloatMatrixF<6, 6> dm; + + // Derivatives of dGDSig + dm.at( 1, 1 ) = 2. / pow( a1, 2. ); + dm.at( 1, 2 ) = 0; + dm.at( 1, 3 ) = 0; + dm.at( 1, 4 ) = 0; + dm.at( 1, 5 ) = 0; + dm.at( 1, 6 ) = 0; + + + // Derivatives of dGDTau + dm.at( 2, 1 ) = 0; + dm.at( 2, 2 ) = 2. / pow( a2, 2. ); + dm.at( 2, 3 ) = 0; + dm.at( 2, 4 ) = 0; + dm.at( 2, 5 ) = 0; + dm.at( 2, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 3, 1 ) = 0; + dm.at( 3, 2 ) = 0; + dm.at( 3, 3 ) = 2. / pow( a3, 2. ); + dm.at( 3, 4 ) = 0; + dm.at( 3, 5 ) = 0; + dm.at( 3, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 4, 1 ) = 0; + dm.at( 4, 2 ) = 0; + dm.at( 4, 3 ) = 0; + dm.at( 4, 4 ) = 2. / pow( a4, 2. ); + dm.at( 4, 5 ) = 0; + dm.at( 4, 6 ) = 0; + + // Derivates of evolution law + dm.at( 5, 1 ) = 0; + dm.at( 5, 2 ) = 0; + dm.at( 5, 3 ) = 0; + dm.at( 5, 4 ) = 0; + dm.at( 5, 5 ) = 2. / pow( a5, 2. ); + dm.at( 5, 6 ) = 0; + + // Derivates of evolution law + dm.at( 6, 1 ) = 0; + dm.at( 6, 2 ) = 0; + dm.at( 6, 3 ) = 0; + dm.at( 6, 4 ) = 0; + dm.at( 6, 5 ) = 0; + dm.at( 6, 6 ) = 2. / pow( a6, 2. ); + + return dm; } - if ( my >= 0 ) { - c = my0; - } else { - c = my01; + FloatArrayF<6> + LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint * gp, TimeStep * tStep ) const + // returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes + { + double alpha = this->give( tAlpha, gp ); + + return { + alpha, 0., 0., 0., 0., 0. + }; } - if ( mz>= 0 ) { - d = mz0; - } else { - d = mz01; + FloatArrayF<6> + LatticeFrameConcretePlastic::giveStrain( GaussPoint * gp, TimeStep * tStep ) const + { + auto status = static_cast( this->giveStatus( gp ) ); + return status->giveLatticeStrain(); } - - FloatMatrixF< 4, 4 >dm; - - //Derivatives of dGDSig - dm.at(1, 1) = 2. / pow(a, 2.); - dm.at(1, 2) = 0; - dm.at(1, 3) = 0; - dm.at(1, 4) = 0; - - //Derivatives of dGDTau - dm.at(2, 1) = 0; - dm.at(2, 2) = 2. / pow(b, 2.); - dm.at(2, 3) = 0; - dm.at(2, 4) = 0; - - //Derivates of evolution law - dm.at(3, 1) = 0; - dm.at(3, 2) = 0; - dm.at(3, 3) = 2. / pow(c, 2.); - dm.at(3, 4) = 0; - - //Derivates of evolution law - dm.at(4, 1) = 0; - dm.at(4, 2) = 0; - dm.at(4, 3) = 0; - dm.at(4, 3) = 2. / pow(d, 2.); - - return dm; -} -FloatArrayF< 6 > -LatticeFrameConcretePlastic::giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const -// returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes -{ - double alpha = this->give(tAlpha, gp); - return { - alpha, 0., 0., 0., 0., 0. - }; -} + FloatArrayF<6> + LatticeFrameConcretePlastic::performPlasticityReturn( GaussPoint * gp, const FloatArrayF<6> &Strain, TimeStep *tStep ) const + { + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); -FloatArrayF< 6 > -LatticeFrameConcretePlastic::giveReducedStrain(GaussPoint *gp, TimeStep *tStep) const -{ - auto status = static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); - return status->giveReducedLatticeStrain(); -} + auto status = static_cast( this->giveStatus( gp ) ); + // Shear components are not used for plasticity return + auto strain = Strain[{ 0, 1, 2, 3, 4, 5 }]; + + /* Get plastic strain vector from status*/ + auto tempPlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; + + FloatArrayF<6> tangent = { area * this->e, g * shearareay, g * shearareaz, ik * g, iy * this->e, iz * this->e }; + + /* Compute trial stress*/ + auto stress = mult( tangent, strain - tempPlasticStrain ); + + FloatArrayF<6> k; + + if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; -FloatArrayF< 6 > -LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &reducedStrain, TimeStep *tStep) const -{ - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); - const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); - const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); - - auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - - //Shear components are not used for plasticity return - auto strain = reducedStrain [ { 0, 3, 4, 5 } ]; - - /* Get plastic strain vector from status*/ - auto tempPlasticStrain = status->givePlasticLatticeStrain() [ { 0, 3, 4, 5 } ]; - - FloatArrayF< 4 >tangent = { area *this->e, ik *g, iy *this->e, iz *this->e }; - - /* Compute trial stress*/ - auto stress = mult(tangent, strain - tempPlasticStrain); - - double k1; - double k2; - double k3; - double k4; - k1 = stress.at(1); - k2 = stress.at(2); - k3 = stress.at(3); - k4 = stress.at(4); -//tes - if ( k1>=0 && k2>=0 && k3>=0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1>=0 && k2>=0 && k3<0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1>=0 && k2>=0 && k3<0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1>=0 && k2>=0 && k3>=0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1>=0 && k2<0 && k3>=0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1>=0 && k2<0 && k3<0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1>=0 && k2<0 && k3<0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1>=0 && k2<0 && k3>=0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1<0 && k2>=0 && k3>=0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1<0 && k2>=0 && k3<0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1<0 && k2>=0 && k3<0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1<0 && k2>=0 && k3>=0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1<0 && k2<0 && k3>=0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1<0 && k2<0 && k3<0 && k4>=0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - if ( k1<0 && k2<0 && k3<0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4; - } else { - - if ( k1<0 && k2<0 && k3>=0 && k4<0 ) { - stress.at(1)= k1, stress.at(2)=k2, stress.at(3)= k3, stress.at(4)= k4;}} - - auto oldStrain = this->giveReducedStrain(gp, tStep) [ { 0, 3, 4, 5 } ]; - - /* Compute yield value*/ - double yieldValue = computeYieldValue(stress, gp, tStep); - int subIncrementCounter = 0; - - /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ - - if ( yieldValue > yieldTol ) { - int subIncrementFlag = 0; - auto convergedStrain = oldStrain; - auto tempStrain = strain; - auto deltaStrain = strain - oldStrain; - //To get into the loop - status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); - while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { - stress = mult(tangent, tempStrain - tempPlasticStrain); - performRegularReturn(stress, yieldValue, gp, tStep); - - if ( status->giveTempReturnResult() == RR_NotConverged ) { - subIncrementCounter++; - if ( subIncrementCounter > numberOfSubIncrements ) { - OOFEM_LOG_INFO("Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); - OOFEM_LOG_INFO("Yield value %e \n", yieldValue); - OOFEM_LOG_INFO("ConvergedStrain value %e %e %e %e\n", convergedStrain.at(1), convergedStrain.at(2), convergedStrain.at(3), convergedStrain.at(4) ); - OOFEM_LOG_INFO("tempStrain value %e %e %e %e\n", tempStrain.at(1), tempStrain.at(2), tempStrain.at(3), tempStrain.at(4) ); - OOFEM_LOG_INFO("deltaStrain value %e %e %e %e\n", deltaStrain.at(1), deltaStrain.at(2), deltaStrain.at(3), deltaStrain.at(4) ); - OOFEM_LOG_INFO("targetstrain value %e %e %e %e\n", strain.at(1), strain.at(2), strain.at(3), strain.at(4) ); - - OOFEM_ERROR("LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up."); - } - subIncrementFlag = 1; - deltaStrain *= 0.5; - tempStrain = convergedStrain + deltaStrain; - } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { - tempPlasticStrain.at(1) = tempStrain.at(1) - stress.at(1) / ( area * this->e ); - tempPlasticStrain.at(2) = tempStrain.at(2) - stress.at(2) / ( ik * g ); - tempPlasticStrain.at(3) = tempStrain.at(3) - stress.at(3) / ( iy * this->e ); - tempPlasticStrain.at(4) = tempStrain.at(4) - stress.at(4) / ( iz * this->e ); - - status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 3, 4, 5 }) ); - - subIncrementFlag = 0; - - status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); - convergedStrain = tempStrain; - deltaStrain = strain - convergedStrain; - tempStrain = strain; - subIncrementCounter = 0; - } } - } - const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } - tempPlasticStrain.at(1) = strain.at(1) - stress.at(1) / ( area * this->e ); - tempPlasticStrain.at(2) = strain.at(2) - stress.at(2) / ( ik * g ); - tempPlasticStrain.at(3) = strain.at(3) - stress.at(3) / ( iy * this->e ); - tempPlasticStrain.at(4) = strain.at(4) - stress.at(4) / ( iz * this->e ); + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } - status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 3, 4, 5 }) ); - auto answer = assemble< 6 >(stress, { 0, 3, 4, 5 }); - answer.at(2) = shearareay * g * reducedStrain.at(2); - answer.at(3) = shearareaz * g * reducedStrain.at(3); + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } - return answer; -} + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } -Interface * -LatticeFrameConcretePlastic::giveInterface(InterfaceType type) -{ - return nullptr; -} + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } -void -LatticeFrameConcretePlastic::performRegularReturn(FloatArrayF< 4 > &stress, - double yieldValue, - GaussPoint *gp, - TimeStep *tStep) const -{ - //Use material specific status - auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - - double deltaLambda = 0.; - - auto trialStress = stress; - auto tempStress = trialStress; - - //initialise unknowns - FloatArrayF< 5 >unknowns; - unknowns.at(1) = trialStress.at(1); - unknowns.at(2) = trialStress.at(2); - unknowns.at(3) = trialStress.at(3); - unknowns.at(4) = trialStress.at(4); - unknowns.at(5) = 0.; - - yieldValue = computeYieldValue(tempStress, gp, tStep); - - //initiate residuals - FloatArrayF< 5 >residuals; - residuals.at(5) = yieldValue; - double normOfResiduals = 1.; //just to get into the loop - int iterationCount = 0; - while ( normOfResiduals > yieldTol ) { - iterationCount++; - if ( iterationCount == newtonIter ) { - status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); - return; - } - - //FloatArrayF< 5 >residualsNorm; - // residualsNorm.at(1) = residuals.at(1) / this->nx01; - //residualsNorm.at(2) = residuals.at(2) / this->mx01; - //residualsNorm.at(3) = residuals.at(3) / this->my01; - //residualsNorm.at(4) = residuals.at(4) / this->mz01; - //residualsNorm.at(5) = residuals.at(5); - double nx = stress.at(1); - double mx = stress.at(2); - double my = stress.at(3); - double mz = stress.at(4); - - double a; - double b; - double c; - double d; - - if ( nx >= 0 ) { - a = nx0; - } else { - a = nx01; - } + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } - if ( mx >= 0 ) { - b = mx0; - } else { - b = mx01; - } + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } - if ( my >= 0 ) { - c = my0; - } else { - c = my01; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + + } else { + OOFEM_ERROR( "This case should not exist" ); + } + + auto oldStrain = this->giveStrain( gp, tStep )[{ 0, 1, 2, 3, 4, 5 }]; + + /* Compute yield value*/ + double yieldValue = computeYieldValue( stress, k, gp, tStep ); + int subIncrementCounter = 0; + + /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ + + if ( yieldValue > yieldTol ) { + int subIncrementFlag = 0; + auto convergedStrain = oldStrain; + auto tempStrain = strain; + auto deltaStrain = strain - oldStrain; + // To get into the loop + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { + stress = mult( tangent, tempStrain - tempPlasticStrain ); + performRegularReturn( stress, k, yieldValue, gp, tStep ); + if ( status->giveTempReturnResult() == RR_WrongSurface ) { + int RestartWithNewKValue; + } + if ( status->giveTempReturnResult() == RR_NotConverged ) { + subIncrementCounter++; + if ( subIncrementCounter > numberOfSubIncrements ) { + OOFEM_LOG_INFO( "Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); + OOFEM_LOG_INFO( "Yield value %e \n", yieldValue ); + OOFEM_LOG_INFO( "ConvergedStrain value %e %e %e %e\n", convergedStrain.at( 1 ), convergedStrain.at( 2 ), convergedStrain.at( 3 ), convergedStrain.at( 4 ), convergedStrain.at( 5 ), convergedStrain.at( 6 ) ); + OOFEM_LOG_INFO( "tempStrain value %e %e %e %e\n", tempStrain.at( 1 ), tempStrain.at( 2 ), tempStrain.at( 3 ), tempStrain.at( 4 ), tempStrain.at( 5 ), tempStrain.at( 6 ) ); + OOFEM_LOG_INFO( "deltaStrain value %e %e %e %e\n", deltaStrain.at( 1 ), deltaStrain.at( 2 ), deltaStrain.at( 3 ), deltaStrain.at( 4 ), deltaStrain.at( 5 ), deltaStrain.at( 6 ) ); + OOFEM_LOG_INFO( "targetstrain value %e %e %e %e\n", strain.at( 1 ), strain.at( 2 ), strain.at( 3 ), strain.at( 4 ), strain.at( 5 ), strain.at( 6 ) ); + + OOFEM_ERROR( "LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up." ); + } + subIncrementFlag = 1; + deltaStrain *= 0.5; + tempStrain = convergedStrain + deltaStrain; + } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { + tempPlasticStrain.at( 1 ) = tempStrain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); + tempPlasticStrain.at( 2 ) = tempStrain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); + tempPlasticStrain.at( 3 ) = tempStrain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); + tempPlasticStrain.at( 4 ) = tempStrain.at( 4 ) - stress.at( 4 ) / ( ik * g ); + tempPlasticStrain.at( 5 ) = tempStrain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); + tempPlasticStrain.at( 6 ) = tempStrain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); + + status->letTempPlasticLatticeStrainBe( assemble<6>( tempPlasticStrain, { 0, 1, 2, 3, 4, 5 } ) ); + + subIncrementFlag = 0; + + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + convergedStrain = tempStrain; + deltaStrain = strain - convergedStrain; + tempStrain = strain; + subIncrementCounter = 0; + } + } + } + //} + // const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + // const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + + + tempPlasticStrain.at( 1 ) = strain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); + tempPlasticStrain.at( 2 ) = strain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); + tempPlasticStrain.at( 3 ) = strain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); + tempPlasticStrain.at( 4 ) = strain.at( 4 ) - stress.at( 4 ) / ( ik * g ); + tempPlasticStrain.at( 5 ) = strain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); + tempPlasticStrain.at( 6 ) = strain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); + + status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 1, 2, 3, 4, 5}) ); + auto answer = assemble< 6 >(stress, { 0, 1, 2, 3, 4, 5}); + // answer.at(2) = shearareay * g * reducedStrain.at(2); + // answer.at(3) = shearareaz * g * reducedStrain.at(3); + + return answer; } - if ( mz>= 0 ) { - d = mz0; - } else { - d = mz01; + Interface * + LatticeFrameConcretePlastic::giveInterface( InterfaceType type ) + { + return nullptr; } - FloatArrayF< 5 >residualsNorm; - residualsNorm.at(1) = residuals.at(1) / a; - residualsNorm.at(2) = residuals.at(2) / b; - residualsNorm.at(3) = residuals.at(3) / c; - residualsNorm.at(4) = residuals.at(4) / d; - residualsNorm.at(5) = residuals.at(5); - normOfResiduals = norm(residualsNorm); + void + LatticeFrameConcretePlastic::performRegularReturn( FloatArrayF<6> & stress, const FloatArrayF<6> &k, + double yieldValue, + GaussPoint *gp, + TimeStep *tStep ) const + { + // Use material specific status + auto status = static_cast( this->giveStatus( gp ) ); + + double deltaLambda = 0.; + + auto trialStress = stress; + auto tempStress = trialStress; + + // initialise unknowns + FloatArrayF<7> unknowns; + unknowns.at( 1 ) = trialStress.at( 1 ); + unknowns.at( 2 ) = trialStress.at( 2 ); + unknowns.at( 3 ) = trialStress.at( 3 ); + unknowns.at( 4 ) = trialStress.at( 4 ); + unknowns.at( 5 ) = trialStress.at( 5 ); + unknowns.at( 6 ) = trialStress.at( 6 ); + unknowns.at( 7 ) = 0.; + + yieldValue = computeYieldValue( tempStress, k, gp, tStep ); + + // initiate residuals + FloatArrayF<7> residuals; + residuals.at( 7 ) = yieldValue; + double normOfResiduals = 1.; // just to get into the loop + int iterationCount = 0; + while ( normOfResiduals > yieldTol ) { + iterationCount++; + if ( iterationCount == newtonIter ) { + status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); + return; + } - if ( std::isnan(normOfResiduals) ) { - status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); - return; - } + // FloatArrayF< 5 >residualsNorm; + // residualsNorm.at(1) = residuals.at(1) / this->nx01; + // residualsNorm.at(2) = residuals.at(2) / this->mx01; + // residualsNorm.at(3) = residuals.at(3) / this->my01; + // residualsNorm.at(4) = residuals.at(4) / this->mz01; + // residualsNorm.at(5) = residuals.at(5); + // double nx = stress.at(1); + // double mx = stress.at(2); + // double my = stress.at(3); + // double mz = stress.at(4); + + double a1; + if ( k.at( 1 ) == 1 ) { + a1 = nx0; + } else { + a1 = nx01; + } + double a2; + if ( k.at( 2 ) == 1 ) { + a2 = vy0; + } else { + a2 = vy01; + } + double a3; + if ( k.at( 3 ) == 1 ) { + a3 = vz0; + } else { + a3 = vz01; + } + double a4; - if ( normOfResiduals > yieldTol ) { - auto jacobian = computeJacobian(tempStress, deltaLambda, gp, tStep); + if ( k.at( 4 ) == 1 ) { + a4 = mx0; + } else { + a4 = mx01; + } + double a5; - auto solution = solve_check(jacobian, residuals); - if ( solution.first ) { - unknowns -= solution.second; + if ( k.at( 5 ) == 1 ) { + a5 = my0; } else { - status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + a5 = my01; } - unknowns.at(5) = max(unknowns.at(5), 0.); //Keep deltaLambda greater than zero! - - /* Update increments final values and DeltaLambda*/ - tempStress.at(1) = unknowns.at(1); - tempStress.at(2) = unknowns.at(2); - tempStress.at(3) = unknowns.at(3); - tempStress.at(4) = unknowns.at(4); - deltaLambda = unknowns.at(5); - - /* Compute the fVector*/ - auto FVector = computeFVector(tempStress, gp, tStep); - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); - const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); - - residuals.at(1) = tempStress.at(1) - trialStress.at(1) + area * this->e * deltaLambda * FVector.at(1); - residuals.at(2) = tempStress.at(2) - trialStress.at(2) + ik * g * deltaLambda * FVector.at(2); - residuals.at(3) = tempStress.at(3) - trialStress.at(3) + iy * this->e * deltaLambda * FVector.at(3); - residuals.at(4) = tempStress.at(4) - trialStress.at(4) + iz * this->e * deltaLambda * FVector.at(4); - residuals.at(5) = computeYieldValue(tempStress, gp, tStep); - } - } + double a6; - status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_Converged); - ; + if ( k.at( 6 ) == 1 ) { + a6 = mz0; + } else { + a6 = mz01; + } - stress = tempStress; -} -FloatMatrixF< 5, 5 > -LatticeFrameConcretePlastic::computeJacobian(const FloatArrayF< 4 > &stress, - const double deltaLambda, - GaussPoint *gp, - TimeStep *tStep) const -{ - auto dMMatrix = computeDMMatrix(stress, gp, tStep); - auto fVector = computeFVector(stress, gp, tStep); - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); - const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); - - - /* Compute matrix*/ - FloatMatrixF< 5, 5 >jacobian; - jacobian.at(1, 1) = 1. + this->e * area * deltaLambda * dMMatrix.at(1, 1); - jacobian.at(1, 2) = 0.; - jacobian.at(1, 3) = 0.; - jacobian.at(1, 4) = 0.; - jacobian.at(1, 5) = this->e * area * fVector.at(1); - - jacobian.at(2, 1) = 0.; - jacobian.at(2, 2) = 1. + ik * g * deltaLambda * dMMatrix.at(2, 2); - jacobian.at(2, 3) = 0.; - jacobian.at(2, 4) = 0.; - jacobian.at(2, 5) = ik * this->e * fVector.at(2); - - jacobian.at(3, 1) = 0.; - jacobian.at(3, 2) = 0.; - jacobian.at(3, 3) = 1. + iy * this->e * deltaLambda * dMMatrix.at(3, 3); - jacobian.at(3, 4) = 0.; - jacobian.at(3, 5) = iy * this->e * fVector.at(3); - - jacobian.at(4, 1) = 0.; - jacobian.at(4, 2) = 0.; - jacobian.at(4, 3) = 0.; - jacobian.at(4, 4) = 1. + iz * this->e * deltaLambda * dMMatrix.at(4, 4); - jacobian.at(4, 5) = iz * this->e * fVector.at(4); - - jacobian.at(5, 1) = fVector.at(1); - jacobian.at(5, 2) = fVector.at(2); - jacobian.at(5, 3) = fVector.at(3); - jacobian.at(5, 4) = fVector.at(4); - jacobian.at(5, 5) = 0.; - - return jacobian; -} + FloatArrayF<7> residualsNorm; + residualsNorm.at( 1 ) = residuals.at( 1 ) / a1; + residualsNorm.at( 2 ) = residuals.at( 2 ) / a2; + residualsNorm.at( 3 ) = residuals.at( 3 ) / a3; + residualsNorm.at( 4 ) = residuals.at( 4 ) / a4; + residualsNorm.at( 5 ) = residuals.at( 5 ) / a5; + residualsNorm.at( 6 ) = residuals.at( 6 ) / a6; + residualsNorm.at( 7 ) = residuals.at( 7 ); + normOfResiduals = norm( residualsNorm ); + //printf( "normOfResiduals=%e\n", normOfResiduals ); + if ( std::isnan( normOfResiduals ) ) { + status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); + return; + } -FloatArrayF< 6 > -LatticeFrameConcretePlastic::giveFrameForces3d(const FloatArrayF< 6 > &originalStrain, GaussPoint *gp, TimeStep *tStep) -{ - auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - auto reducedStrain = originalStrain; - auto thermalStrain = this->computeStressIndependentStrainVector(gp, tStep, VM_Total); - if ( thermalStrain.giveSize() ) { - reducedStrain -= FloatArrayF< 6 >(thermalStrain); + if ( normOfResiduals > yieldTol ) { + auto jacobian = computeJacobian( tempStress, k, deltaLambda, gp, tStep ); + + auto solution = solve_check( jacobian, residuals ); + if ( solution.first ) { + unknowns -= solution.second; + } else { + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + } + + unknowns.at( 7 ) = max( unknowns.at( 7 ), 0. ); // Keep deltaLambda greater than zero! + + /* Update increments final values and DeltaLambda*/ + tempStress.at( 1 ) = unknowns.at( 1 ); + tempStress.at( 2 ) = unknowns.at( 2 ); + tempStress.at( 3 ) = unknowns.at( 3 ); + tempStress.at( 4 ) = unknowns.at( 4 ); + tempStress.at( 5 ) = unknowns.at( 5 ); + tempStress.at( 6 ) = unknowns.at( 6 ); + deltaLambda = unknowns.at( 7 ); + + /* Compute the fVector*/ + auto FVector = computeFVector( tempStress, k, gp, tStep ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + + + residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e * deltaLambda * FVector.at( 1 ); + residuals.at( 2 ) = tempStress.at( 2 ) - trialStress.at( 2 ) + shearareay * g * deltaLambda * FVector.at( 2 ); + residuals.at( 3 ) = tempStress.at( 3 ) - trialStress.at( 3 ) + shearareaz * g * deltaLambda * FVector.at( 3 ); + residuals.at( 4 ) = tempStress.at( 4 ) - trialStress.at( 4 ) + ik * g * deltaLambda * FVector.at( 4 ); + residuals.at( 5 ) = tempStress.at( 5 ) - trialStress.at( 5 ) + iy * this->e * deltaLambda * FVector.at( 5 ); + residuals.at( 6 ) = tempStress.at( 6 ) - trialStress.at( 6 ) + iz * this->e * deltaLambda * FVector.at( 6 ); + residuals.at( 7 ) = computeYieldValue( tempStress, k, gp, tStep ); + } + } + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_Converged ); + stress = tempStress; } - auto stress = this->performPlasticityReturn(gp, reducedStrain, tStep); + FloatMatrixF<7, 7> + LatticeFrameConcretePlastic::computeJacobian( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + const double deltaLambda, + GaussPoint *gp, + TimeStep *tStep ) const + { + auto dMMatrix = computeDMMatrix( stress, k, gp, tStep ); + auto fVector = computeFVector( stress, k, gp, tStep ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + + + /* Compute matrix*/ + FloatMatrixF<7, 7> jacobian; + jacobian.at( 1, 1 ) = 1. + this->e * area * deltaLambda * dMMatrix.at( 1, 1 ); + jacobian.at( 1, 2 ) = 0.; + jacobian.at( 1, 3 ) = 0.; + jacobian.at( 1, 4 ) = 0.; + jacobian.at( 1, 5 ) = 0.; + jacobian.at( 1, 6 ) = 0.; + jacobian.at( 1, 7 ) = this->e * area * fVector.at( 1 ); + + jacobian.at( 2, 1 ) = 0.; + jacobian.at( 2, 2 ) = 1. + shearareay * g * deltaLambda * dMMatrix.at( 2, 2 ); + jacobian.at( 2, 3 ) = 0.; + jacobian.at( 2, 4 ) = 0.; + jacobian.at( 2, 5 ) = 0.; + jacobian.at( 2, 6 ) = 0.; + jacobian.at( 2, 7 ) = this->e * area * fVector.at( 2 ); + + jacobian.at( 3, 1 ) = 0.; + jacobian.at( 3, 2 ) = 0.; + jacobian.at( 3, 3 ) = 1. + shearareaz * g * deltaLambda * dMMatrix.at( 3, 3 ); + jacobian.at( 3, 4 ) = 0.; + jacobian.at( 3, 5 ) = 0.; + jacobian.at( 3, 6 ) = 0.; + jacobian.at( 3, 7 ) = this->e * area * fVector.at( 3 ); + + jacobian.at( 4, 1 ) = 0.; + jacobian.at( 4, 2 ) = 0.; + jacobian.at( 4, 3 ) = 0.; + jacobian.at( 4, 4 ) = 1. + ik * g * deltaLambda * dMMatrix.at( 4, 4 ); + jacobian.at( 4, 5 ) = 0.; + jacobian.at( 4, 6 ) = 0.; + jacobian.at( 4, 7 ) = this->e * area * fVector.at( 4 ); + + jacobian.at( 5, 1 ) = 0.; + jacobian.at( 5, 2 ) = 0.; + jacobian.at( 5, 3 ) = 0.; + jacobian.at( 5, 4 ) = 0.; + jacobian.at( 5, 5 ) = 1. + iy * g * deltaLambda * dMMatrix.at( 5, 5 ); + jacobian.at( 5, 6 ) = 0.; + jacobian.at( 5, 7 ) = this->e * area * fVector.at( 5 ); + + jacobian.at( 6, 1 ) = 0.; + jacobian.at( 6, 2 ) = 0.; + jacobian.at( 6, 3 ) = 0.; + jacobian.at( 6, 4 ) = 0.; + jacobian.at( 6, 5 ) = 0.; + jacobian.at( 6, 6 ) = 1. + iz * g * deltaLambda * dMMatrix.at( 6, 6 ); + jacobian.at( 6, 7 ) = this->e * area * fVector.at( 6 ); + + jacobian.at( 7, 1 ) = fVector.at( 1 ); + jacobian.at( 7, 2 ) = fVector.at( 2 ); + jacobian.at( 7, 3 ) = fVector.at( 3 ); + jacobian.at( 7, 4 ) = fVector.at( 4 ); + jacobian.at( 7, 5 ) = fVector.at( 5 ); + jacobian.at( 7, 6 ) = fVector.at( 6 ); + jacobian.at( 7, 7 ) = 0.; + + return jacobian; + } - status->letTempLatticeStrainBe(originalStrain); - status->letTempReducedLatticeStrainBe(reducedStrain); - status->letTempLatticeStressBe(stress); + FloatArrayF<6> + LatticeFrameConcretePlastic::giveFrameForces3d( const FloatArrayF<6> &originalStrain, GaussPoint *gp, TimeStep *tStep ) + { + auto status = static_cast( this->giveStatus( gp ) ); + auto Strain = originalStrain; + auto thermalStrain = this->computeStressIndependentStrainVector( gp, tStep, VM_Total ); + if ( thermalStrain.giveSize() ) { + Strain -= FloatArrayF<6>( thermalStrain ); + } - return stress; -} + auto stress = this->performPlasticityReturn( gp, Strain, tStep ); + status->letTempLatticeStrainBe( originalStrain ); + status->letTempLatticeStrainBe( Strain ); + status->letTempLatticeStressBe( stress ); + return stress; + } -FloatMatrixF< 6, 6 > -LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const -{ - static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - - double g = this->e / ( 2. * ( 1. + this->nu ) ); - - const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); - const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); - const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); - - FloatArrayF< 6 >d = { - this->e * area, - g *shearareay, - g *shearareaz, - g *ik, - this->e * iy, - this->e * iz - }; - - return diag(d); -} -LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus(int n, Domain *d, GaussPoint *g) : LatticeMaterialStatus(g) -{ } + FloatMatrixF<6, 6> + LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix( MatResponseMode rmode, GaussPoint * gp, TimeStep * atTime ) const + { + static_cast( this->giveStatus( gp ) ); + + double g = this->e / ( 2. * ( 1. + this->nu ) ); + + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + + FloatArrayF<6> d = { + this->e * area, + g * shearareay, + g * shearareaz, + g * ik, + this->e * iy, + this->e * iz + }; + + return diag( d ); + } + + LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus( int n, Domain *d, GaussPoint *g ) : + LatticeMaterialStatus( g ) + { + } -void -LatticeFrameConcretePlasticStatus::printOutputAt(FILE *file, TimeStep *tStep) const -{ - LatticeMaterialStatus::printOutputAt(file, tStep); + void + LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const + { + LatticeMaterialStatus::printOutputAt( file, tStep ); - fprintf(file, "plasticStrains "); - for ( double s : this->plasticLatticeStrain ) { - fprintf(file, "% .8e ", s); + fprintf( file, "plasticStrains " ); + for ( double s : this->plasticLatticeStrain ) { + fprintf( file, "% .8e ", s ); + } } } -} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 259713da0..ac9bc0f09 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -31,16 +31,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifndef latticeframeconcreteplastic_h #define latticeframeconcreteplastic_h + #include "latticestructuralmaterial.h" #include "cltypes.h" #include "randommaterialext.h" #include "strainvector.h" #include "stressvector.h" #include "latticematstatus.h" - ///@name Input fields for LatticeFrameConcrePlastic //@{ #define _IFT_LatticeFrameConcretePlastic_Name "LatticeFrameConcretePlastic" @@ -48,10 +49,14 @@ #define _IFT_LatticeFrameConcretePlastic_e "e" #define _IFT_LatticeFrameConcretePlastic_n "n" #define _IFT_LatticeFrameConcretePlastic_nx0 "nx0" +#define _IFT_LatticeFrameConcretePlastic_vy0 "vy0" +#define _IFT_LatticeFrameConcretePlastic_vz0 "vz0" #define _IFT_LatticeFrameConcretePlastic_mx0 "mx0" #define _IFT_LatticeFrameConcretePlastic_my0 "my0" #define _IFT_LatticeFrameConcretePlastic_mz0 "mz0" #define _IFT_LatticeFrameConcretePlastic_nx01 "nx01" +#define _IFT_LatticeFrameConcretePlastic_vy01 "vy01" +#define _IFT_LatticeFrameConcretePlastic_vz01 "vz01" #define _IFT_LatticeFrameConcretePlastic_mx01 "mx01" #define _IFT_LatticeFrameConcretePlastic_my01 "my01" #define _IFT_LatticeFrameConcretePlastic_mz01 "mz01" @@ -80,16 +85,17 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, - RR_Converged - }; + RR_Converged, + RR_WrongSurface, + }; + protected: int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; - public: /// Constructor @@ -123,6 +129,10 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///maximum axial force in x-axis x-axis nx0 double nx0; + double vy0; + + double vz0; + ///maximum bending moment about x-axis mx0 double mx0; @@ -135,6 +145,11 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///maximum axial force in x-axis x-axis nx01 double nx01; + double vy01; + + double vz01; + + ///maximum bending moment about x-axis mx01 double mx01; @@ -156,8 +171,9 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///plastic flag double plasticFlag; - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged }; + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_WrongSurface}; // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. + // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; double initialYieldStress = 0.; @@ -166,23 +182,23 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial public: LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; - FloatArrayF< 4 >computeFVector(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + FloatArrayF< 6 >computeFVector(const FloatArrayF< 6 > &sigma, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; - FloatMatrixF< 4, 4 >computeDMMatrix(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &sigma, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; - FloatArrayF< 6 >giveReducedLatticeStrain(GaussPoint *gp, TimeStep *tStep) const; + FloatArrayF< 6 >giveLatticeStrain(GaussPoint *gp, TimeStep *tStep) const; - virtual FloatArrayF< 6 >giveReducedStrain(GaussPoint *gp, TimeStep *tStep) const; + virtual FloatArrayF< 6 >giveStrain(GaussPoint *gp, TimeStep *tStep) const; - FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &reducedStrain, TimeStep *tStep) const; + FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const; - void performRegularReturn(FloatArrayF< 4 > &stress, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; + void performRegularReturn(FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; - double computeYieldValue(const FloatArrayF< 4 > &sigma, GaussPoint *gp, TimeStep *tStep) const; + double computeYieldValue(const FloatArrayF< 6 > &sigma, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; - FloatMatrixF< 5, 5 >computeJacobian(const FloatArrayF< 4 > &sigma, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; + FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &sigma, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >giveFrameForces3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) override; @@ -205,6 +221,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial MaterialStatus *giveStatus(GaussPoint *gp) const override; protected: + }; } // end namespace oofem From 97f7e76e493f960cef63d24e0eb899f1be7e0519 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 18 Nov 2021 21:01:41 +0000 Subject: [PATCH 14/60] loopAndCheckK --- .../latticeframeconcreteplastic.C | 1057 +++++------------ .../latticeframeconcreteplastic.h | 10 +- 2 files changed, 285 insertions(+), 782 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 622b51efe..5b50441f3 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -157,51 +157,51 @@ LatticeFrameConcretePlastic::computeYieldValue( const FloatArrayF<6> &stress, co double my = stress.at( 5 ); double mz = stress.at( 6 ); { - double a1; + double ax; if ( k.at( 1 ) == 1 ) { - a1 = nx0; + ax = nx0; } else { - a1 = nx01; + ax = nx01; } - double a2; + double ay; if ( k.at( 2 ) == 1 ) { - a2 = vy0; + ay = vy0; } else { - a2 = vy01; + ay = vy01; } - double a3; + double az; if ( k.at( 3 ) == 1 ) { - a3 = vz0; + az = vz0; } else { - a3 = vz01; + az = vz01; } - double a4; + double bx; if ( k.at( 4 ) == 1 ) { - a4 = mx0; + bx = mx0; } else { - a4 = mx01; + bx = mx01; } - double a5; + double by; if ( k.at( 5 ) == 1 ) { - a5 = my0; + by = my0; } else { - a5 = my01; + by = my01; } - double a6; + double bz; if ( k.at( 6 ) == 1 ) { - a6 = mz0; + bz = mz0; } else { - a6 = mz01; + bz = mz01; } { - yieldValue = pow( nx / a1, 2. ) + pow( vy / a2, 2. ) + pow( vz / a3, 2. ) + pow( mx / a4, 2. ) + pow( my / a5, 2. ) + pow( mz / a6, 2. ) - 1.; + yieldValue = pow( nx / ax, 2. ) + pow( vy / ay, 2. ) + pow( vz / az, 2. ) + pow( mx / bx, 2. ) + pow( my / by, 2. ) + pow( mz / bz, 2. ) - 1.; } } return yieldValue; @@ -219,182 +219,260 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const double my = stress.at( 5 ); double mz = stress.at( 6 ); { - double a1; + double ax; if ( k.at( 1 ) == 1 ) { - a1 = nx0; + ax = nx0; } else { - a1 = nx01; + ax = nx01; } - double a2; + double ay; if ( k.at( 2 ) == 1 ) { - a2 = vy0; + ay = vy0; } else { - a2 = vy01; + ay = vy01; } - double a3; + double az; if ( k.at( 3 ) == 1 ) { - a3 = vz0; + az = vz0; } else { - a3 = vz01; + az = vz01; } - double a4; + double bx; if ( k.at( 4 ) == 1 ) { - a4 = mx0; + bx = mx0; } else { - a4 = mx01; + bx = mx01; } - double a5; + double by; if ( k.at( 5 ) == 1 ) { - a5 = my0; + by = my0; } else { - a5 = my01; + by = my01; } - double a6; + double bz; if ( k.at( 6 ) == 1 ) { - a6 = mz0; + bz = mz0; } else { - a6 = mz01; + bz = mz01; } + FloatArrayF<6> f; - f.at( 1 ) = 2. * nx / pow( a1, 2. ); - f.at( 2 ) = 2. * vy / pow( a2, 2. ); - f.at( 3 ) = 2. * vz / pow( a3, 2. ); - f.at( 4 ) = 2. * mx / pow( a4, 2. ); - f.at( 5 ) = 2. * my / pow( a5, 2. ); - f.at( 6 ) = 2. * mz / pow( a6, 2. ); + f.at( 1 ) = 2. * nx / pow( ax, 2. ); + f.at( 2 ) = 2. * vy / pow( ay, 2. ); + f.at( 3 ) = 2. * vz / pow( az, 2. ); + f.at( 4 ) = 2. * mx / pow( bx, 2. ); + f.at( 5 ) = 2. * my / pow( by, 2. ); + f.at( 6 ) = 2. * mz / pow( bz, 2. ); return f; } } - FloatMatrixF<6, 6> - LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const - { +FloatMatrixF<6, 6> +LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const +{ - double a1; - if ( k.at( 1 ) == 1 ) { - a1 = nx0; + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + + FloatMatrixF<6, 6> dm; + + // Derivatives of dGDSig + dm.at( 1, 1 ) = 2. / pow( ax, 2. ); + dm.at( 1, 2 ) = 0; + dm.at( 1, 3 ) = 0; + dm.at( 1, 4 ) = 0; + dm.at( 1, 5 ) = 0; + dm.at( 1, 6 ) = 0; + + + // Derivatives of dGDTau + dm.at( 2, 1 ) = 0; + dm.at( 2, 2 ) = 2. / pow( ay, 2. ); + dm.at( 2, 3 ) = 0; + dm.at( 2, 4 ) = 0; + dm.at( 2, 5 ) = 0; + dm.at( 2, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 3, 1 ) = 0; + dm.at( 3, 2 ) = 0; + dm.at( 3, 3 ) = 2. / pow( az, 2. ); + dm.at( 3, 4 ) = 0; + dm.at( 3, 5 ) = 0; + dm.at( 3, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 4, 1 ) = 0; + dm.at( 4, 2 ) = 0; + dm.at( 4, 3 ) = 0; + dm.at( 4, 4 ) = 2. / pow( bx, 2. ); + dm.at( 4, 5 ) = 0; + dm.at( 4, 6 ) = 0; + + // Derivates of evolution law + dm.at( 5, 1 ) = 0; + dm.at( 5, 2 ) = 0; + dm.at( 5, 3 ) = 0; + dm.at( 5, 4 ) = 0; + dm.at( 5, 5 ) = 2. / pow( by, 2. ); + dm.at( 5, 6 ) = 0; + + // Derivates of evolution law + dm.at( 6, 1 ) = 0; + dm.at( 6, 2 ) = 0; + dm.at( 6, 3 ) = 0; + dm.at( 6, 4 ) = 0; + dm.at( 6, 5 ) = 0; + dm.at( 6, 6 ) = 2. / pow( bz, 2. ); + + return dm; +} +// +FloatArrayF<6> +LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint *gp, TimeStep *tStep ) const +// returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes +{ + double alpha = this->give( tAlpha, gp ); + + return { + alpha, 0., 0., 0., 0., 0. + }; +} + +FloatArrayF<6> +LatticeFrameConcretePlastic::giveStrain( GaussPoint *gp, TimeStep *tStep ) const + +{ + auto status = static_cast( this->giveStatus( gp ) ); + return status->giveLatticeStrain(); +} +FloatArrayF<6> +LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const +{ + + // int surface = -1; + + // double transition = 0; + + + void + LatticeFrameConcretePlastic ::giveSwitches( FloatArray & k, int m ) + { + if ( stress.at( 1 ) >= 1 ) { + m.at( 1 ) = 1; } else { - a1 = nx01; + m.at( 1 ) = -1; } - double a2; - if ( k.at( 2 ) == 1 ) { - a2 = vy0; + + if ( stress.at( 2 ) >= 1 ) { + m.at( 2 ) = 1; } else { - a2 = vy01; + m.at( 2 ) = -1; } - double a3; - if ( k.at( 3 ) == 1 ) { - a3 = vz0; + + if ( stress.at( 3 ) >= 1 ) { + m.at( 3 ) = 1; } else { - a3 = vz01; + m.at( 3 ) = -1; } - double a4; - if ( k.at( 4 ) == 1 ) { - a4 = mx0; + if ( stress.at( 4 ) >= 1 ) { + m.at( 4 ) = 1; } else { - a4 = mx01; + m.at( 4 ) = -1; } - double a5; - if ( k.at( 5 ) == 1 ) { - a5 = my0; + if ( stress.at( 5 ) >= 1 ) { + m.at( 5 ) = 1; } else { - a5 = my01; + m.at( 5 ) = -1; } - double a6; - - if ( k.at( 6 ) == 1 ) { - a6 = mz0; + if ( stress.at( 6 ) >= 1 ) { + m.at( 6 ) = 1; } else { - a6 = mz01; + m.at( 6 ) = -1; + } + + int counter = 1; + for ( int xi = -1; xi < 2; xi + 2 ) { + for ( int yi = -1; yi < 2; yi + 2 ) { + for ( int zi = -1; zi < 2; zi + 2 ) { + for ( int xj = -1; xj < 2; zi + 2 ) { + for ( int yj = -1; yj < 2; zi + 2 ) { + for ( int zj = -1; zj < 2; zi + 2 ) { + if ( !( zj == 0 && yj == 0 && xj == 0 && zi == 0 && yi == 0 && xi == 0 ) ) { + if ( counter == m ) { + k( 0 ) = xi; + k( 1 ) = yi; + k( 2 ) = zi; + k( 3 ) = xj; + k( 4 ) = yj; + k( 5 ) = zj; + } + counter++; + } + } + } + } + } + } } - - - FloatMatrixF<6, 6> dm; - - // Derivatives of dGDSig - dm.at( 1, 1 ) = 2. / pow( a1, 2. ); - dm.at( 1, 2 ) = 0; - dm.at( 1, 3 ) = 0; - dm.at( 1, 4 ) = 0; - dm.at( 1, 5 ) = 0; - dm.at( 1, 6 ) = 0; - - - // Derivatives of dGDTau - dm.at( 2, 1 ) = 0; - dm.at( 2, 2 ) = 2. / pow( a2, 2. ); - dm.at( 2, 3 ) = 0; - dm.at( 2, 4 ) = 0; - dm.at( 2, 5 ) = 0; - dm.at( 2, 6 ) = 0; - - - // Derivates of evolution law - dm.at( 3, 1 ) = 0; - dm.at( 3, 2 ) = 0; - dm.at( 3, 3 ) = 2. / pow( a3, 2. ); - dm.at( 3, 4 ) = 0; - dm.at( 3, 5 ) = 0; - dm.at( 3, 6 ) = 0; - - - // Derivates of evolution law - dm.at( 4, 1 ) = 0; - dm.at( 4, 2 ) = 0; - dm.at( 4, 3 ) = 0; - dm.at( 4, 4 ) = 2. / pow( a4, 2. ); - dm.at( 4, 5 ) = 0; - dm.at( 4, 6 ) = 0; - - // Derivates of evolution law - dm.at( 5, 1 ) = 0; - dm.at( 5, 2 ) = 0; - dm.at( 5, 3 ) = 0; - dm.at( 5, 4 ) = 0; - dm.at( 5, 5 ) = 2. / pow( a5, 2. ); - dm.at( 5, 6 ) = 0; - - // Derivates of evolution law - dm.at( 6, 1 ) = 0; - dm.at( 6, 2 ) = 0; - dm.at( 6, 3 ) = 0; - dm.at( 6, 4 ) = 0; - dm.at( 6, 5 ) = 0; - dm.at( 6, 6 ) = 2. / pow( a6, 2. ); - - return dm; + return k; } - - FloatArrayF<6> - LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint * gp, TimeStep * tStep ) const - // returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes - { - double alpha = this->give( tAlpha, gp ); - - return { - alpha, 0., 0., 0., 0., 0. - }; - } - - FloatArrayF<6> - LatticeFrameConcretePlastic::giveStrain( GaussPoint * gp, TimeStep * tStep ) const - { - auto status = static_cast( this->giveStatus( gp ) ); - return status->giveLatticeStrain(); - } - +} FloatArrayF<6> LatticeFrameConcretePlastic::performPlasticityReturn( GaussPoint * gp, const FloatArrayF<6> &Strain, TimeStep *tStep ) const { + LatticeFrameConcretePlastic_ReturnResult returnResult = RR_Unknown; + int kIter = 0; double g = this->e / ( 2. * ( 1. + this->nu ) ); const double area = ( static_cast( gp->giveElement() ) )->giveArea(); const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); @@ -416,605 +494,10 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const /* Compute trial stress*/ auto stress = mult( tangent, strain - tempPlasticStrain ); - FloatArrayF<6> k; - - if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = 1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = 1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = 1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = 1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = 1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = -1; - k.at( 6 ) = -1; - } - - else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { - k.at( 1 ) = -1; - k.at( 2 ) = -1; - k.at( 3 ) = -1; - k.at( 4 ) = -1; - k.at( 5 ) = 1; - k.at( 6 ) = -1; - - } else { - OOFEM_ERROR( "This case should not exist" ); - } auto oldStrain = this->giveStrain( gp, tStep )[{ 0, 1, 2, 3, 4, 5 }]; + //test + auto k = checkStatus(stress, gp, tStep); /* Compute yield value*/ double yieldValue = computeYieldValue( stress, k, gp, tStep ); @@ -1032,9 +515,9 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { stress = mult( tangent, tempStrain - tempPlasticStrain ); performRegularReturn( stress, k, yieldValue, gp, tStep ); - if ( status->giveTempReturnResult() == RR_WrongSurface ) { - int RestartWithNewKValue; - } + //if ( status->giveTempReturnResult() == RR_WrongSurface ) { + // int RestartWithNewKValue; + //} if ( status->giveTempReturnResult() == RR_NotConverged ) { subIncrementCounter++; if ( subIncrementCounter > numberOfSubIncrements ) { @@ -1067,6 +550,22 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const deltaStrain = strain - convergedStrain; tempStrain = strain; subIncrementCounter = 0; + }else {//Converged + //Check the surface + + auto kCheck = checkStatus(stress, gp, tStep); + if ( kCheck == k ) { + kCheck=k; + }else{ + //ended up in a region for which other surface should have been used. + //Try with other surface + if ( kIter == 1 ) { + OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both k"); + } + k = kCheck; + returnResult = RR_NotConverged; + kIter++; + } } } } @@ -1145,58 +644,59 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const // double my = stress.at(3); // double mz = stress.at(4); - double a1; + double ax; if ( k.at( 1 ) == 1 ) { - a1 = nx0; + ax = nx0; } else { - a1 = nx01; + ax = nx01; } - double a2; + double ay; if ( k.at( 2 ) == 1 ) { - a2 = vy0; + ay = vy0; } else { - a2 = vy01; + ay = vy01; } - double a3; + double az; if ( k.at( 3 ) == 1 ) { - a3 = vz0; + az = vz0; } else { - a3 = vz01; + az = vz01; } - double a4; + double bx; if ( k.at( 4 ) == 1 ) { - a4 = mx0; + bx = mx0; } else { - a4 = mx01; + bx = mx01; } - double a5; + double by; if ( k.at( 5 ) == 1 ) { - a5 = my0; + by = my0; } else { - a5 = my01; + by = my01; } - double a6; + double bz; if ( k.at( 6 ) == 1 ) { - a6 = mz0; + bz = mz0; } else { - a6 = mz01; + bz = mz01; } + FloatArrayF<7> residualsNorm; - residualsNorm.at( 1 ) = residuals.at( 1 ) / a1; - residualsNorm.at( 2 ) = residuals.at( 2 ) / a2; - residualsNorm.at( 3 ) = residuals.at( 3 ) / a3; - residualsNorm.at( 4 ) = residuals.at( 4 ) / a4; - residualsNorm.at( 5 ) = residuals.at( 5 ) / a5; - residualsNorm.at( 6 ) = residuals.at( 6 ) / a6; + residualsNorm.at( 1 ) = residuals.at( 1 ) / ax; + residualsNorm.at( 2 ) = residuals.at( 2 ) / ay; + residualsNorm.at( 3 ) = residuals.at( 3 ) / az; + residualsNorm.at( 4 ) = residuals.at( 4 ) / bx; + residualsNorm.at( 5 ) = residuals.at( 5 ) / by; + residualsNorm.at( 6 ) = residuals.at( 6 ) / bz; residualsNorm.at( 7 ) = residuals.at( 7 ); normOfResiduals = norm( residualsNorm ); - //printf( "normOfResiduals=%e\n", normOfResiduals ); + printf( "normOfResiduals=%e\n", normOfResiduals ); if ( std::isnan( normOfResiduals ) ) { status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); return; @@ -1280,7 +780,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const jacobian.at( 2, 4 ) = 0.; jacobian.at( 2, 5 ) = 0.; jacobian.at( 2, 6 ) = 0.; - jacobian.at( 2, 7 ) = this->e * area * fVector.at( 2 ); + jacobian.at( 2, 7 ) = shearareay * g * fVector.at( 2 ); jacobian.at( 3, 1 ) = 0.; jacobian.at( 3, 2 ) = 0.; @@ -1288,7 +788,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const jacobian.at( 3, 4 ) = 0.; jacobian.at( 3, 5 ) = 0.; jacobian.at( 3, 6 ) = 0.; - jacobian.at( 3, 7 ) = this->e * area * fVector.at( 3 ); + jacobian.at( 3, 7 ) = shearareaz * g * fVector.at( 3 ); jacobian.at( 4, 1 ) = 0.; jacobian.at( 4, 2 ) = 0.; @@ -1296,23 +796,24 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const jacobian.at( 4, 4 ) = 1. + ik * g * deltaLambda * dMMatrix.at( 4, 4 ); jacobian.at( 4, 5 ) = 0.; jacobian.at( 4, 6 ) = 0.; - jacobian.at( 4, 7 ) = this->e * area * fVector.at( 4 ); + jacobian.at( 4, 7 ) = ik * this->e * fVector.at(4); jacobian.at( 5, 1 ) = 0.; jacobian.at( 5, 2 ) = 0.; jacobian.at( 5, 3 ) = 0.; jacobian.at( 5, 4 ) = 0.; - jacobian.at( 5, 5 ) = 1. + iy * g * deltaLambda * dMMatrix.at( 5, 5 ); + jacobian.at( 5, 5 ) = 1. + iy * this->e * deltaLambda * dMMatrix.at( 5, 5 ); jacobian.at( 5, 6 ) = 0.; - jacobian.at( 5, 7 ) = this->e * area * fVector.at( 5 ); + jacobian.at( 5, 7 ) = iy * this->e * fVector.at(5); + jacobian.at( 6, 1 ) = 0.; jacobian.at( 6, 2 ) = 0.; jacobian.at( 6, 3 ) = 0.; jacobian.at( 6, 4 ) = 0.; jacobian.at( 6, 5 ) = 0.; - jacobian.at( 6, 6 ) = 1. + iz * g * deltaLambda * dMMatrix.at( 6, 6 ); - jacobian.at( 6, 7 ) = this->e * area * fVector.at( 6 ); + jacobian.at( 6, 6 ) = 1. + this->e * iz * deltaLambda * dMMatrix.at( 6, 6 ); + jacobian.at( 6, 7 ) = this->e * iz* fVector.at( 6 ); jacobian.at( 7, 1 ) = fVector.at( 1 ); jacobian.at( 7, 2 ) = fVector.at( 2 ); diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index ac9bc0f09..0f53319da 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -86,7 +86,7 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, - RR_WrongSurface, + }; @@ -171,7 +171,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///plastic flag double plasticFlag; - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_WrongSurface}; + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown}; // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; @@ -195,7 +195,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const; void performRegularReturn(FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; - + void giveSwitches(IntArray &answer, int k); double computeYieldValue(const FloatArrayF< 6 > &sigma, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &sigma, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; @@ -221,7 +221,9 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial MaterialStatus *giveStatus(GaussPoint *gp) const override; protected: - + FloatArrayF<6> checkTransition( const FloatArrayF<6> &sigma, GaussPoint *gp, TimeStep *tStep ) const; + FloatArrayF<6> checkStatus( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const; + FloatArray giveSwitches( FloatArray &k, int m ); }; } // end namespace oofem From 0ccbfe4d4d64b820c490584269a5a04504ff5f0f Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 9 Dec 2021 20:55:07 +0000 Subject: [PATCH 15/60] plasticStrain --- .../latticeframeconcreteplastic.C | 956 ++++++++++++++---- .../latticeframeconcreteplastic.h | 19 +- 2 files changed, 756 insertions(+), 219 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 5b50441f3..c34146085 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -140,9 +140,24 @@ LatticeFrameConcretePlastic::giveStatus( GaussPoint *gp ) const gp->setMaterialStatus( status ); } } - +// return status; } +int +LatticeFrameConcretePlastic::giveIPValue(FloatArray &answer, + GaussPoint *gp, + InternalStateType type, + TimeStep *atTime) +{ + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + if ( type == IST_PlasticLatticeStrain ) { + answer = status->givePlasticLatticeStrain(); + return 1; + } else { + return LatticeStructuralMaterial::giveIPValue(answer, gp, type, atTime); + } +} double LatticeFrameConcretePlastic::computeYieldValue( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, @@ -218,7 +233,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const double mx = stress.at( 4 ); double my = stress.at( 5 ); double mz = stress.at( 6 ); - { + double ax; if ( k.at( 1 ) == 1 ) { ax = nx0; @@ -271,215 +286,745 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const return f; } -} -FloatMatrixF<6, 6> -LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const -{ - double ax; - if ( k.at( 1 ) == 1 ) { - ax = nx0; - } else { - ax = nx01; - } - double ay; - if ( k.at( 2 ) == 1 ) { - ay = vy0; - } else { - ay = vy01; - } - double az; - if ( k.at( 3 ) == 1 ) { - az = vz0; - } else { - az = vz01; + FloatMatrixF<6, 6> + LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const + { + + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + + FloatMatrixF<6, 6> dm; + + // Derivatives of dGDSig + dm.at( 1, 1 ) = 2. / pow( ax, 2. ); + dm.at( 1, 2 ) = 0; + dm.at( 1, 3 ) = 0; + dm.at( 1, 4 ) = 0; + dm.at( 1, 5 ) = 0; + dm.at( 1, 6 ) = 0; + + + // Derivatives of dGDTau + dm.at( 2, 1 ) = 0; + dm.at( 2, 2 ) = 2. / pow( ay, 2. ); + dm.at( 2, 3 ) = 0; + dm.at( 2, 4 ) = 0; + dm.at( 2, 5 ) = 0; + dm.at( 2, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 3, 1 ) = 0; + dm.at( 3, 2 ) = 0; + dm.at( 3, 3 ) = 2. / pow( az, 2. ); + dm.at( 3, 4 ) = 0; + dm.at( 3, 5 ) = 0; + dm.at( 3, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 4, 1 ) = 0; + dm.at( 4, 2 ) = 0; + dm.at( 4, 3 ) = 0; + dm.at( 4, 4 ) = 2. / pow( bx, 2. ); + dm.at( 4, 5 ) = 0; + dm.at( 4, 6 ) = 0; + + // Derivates of evolution law + dm.at( 5, 1 ) = 0; + dm.at( 5, 2 ) = 0; + dm.at( 5, 3 ) = 0; + dm.at( 5, 4 ) = 0; + dm.at( 5, 5 ) = 2. / pow( by, 2. ); + dm.at( 5, 6 ) = 0; + + // Derivates of evolution law + dm.at( 6, 1 ) = 0; + dm.at( 6, 2 ) = 0; + dm.at( 6, 3 ) = 0; + dm.at( 6, 4 ) = 0; + dm.at( 6, 5 ) = 0; + dm.at( 6, 6 ) = 2. / pow( bz, 2. ); + + return dm; } - double bx; - if ( k.at( 4 ) == 1 ) { - bx = mx0; - } else { - bx = mx01; + FloatArrayF<6> + LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint * gp, TimeStep * tStep ) const + // returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes + { + double alpha = this->give( tAlpha, gp ); + + return { + alpha, 0., 0., 0., 0., 0. + }; } - double by; - if ( k.at( 5 ) == 1 ) { - by = my0; - } else { - by = my01; + FloatArrayF<6> + LatticeFrameConcretePlastic::giveStrain( GaussPoint * gp, TimeStep * tStep ) const + { + auto status = static_cast( this->giveStatus( gp ) ); + return status->giveLatticeStrain(); } + const FloatArrayF<6> + LatticeFrameConcretePlastic::checkTransition(const FloatArrayF< 6 > &stress, GaussPoint *gp, TimeStep *tStep) const + { - double bz; + FloatArrayF<6> k; - if ( k.at( 6 ) == 1 ) { - bz = mz0; - } else { - bz = mz01; - } + if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } - FloatMatrixF<6, 6> dm; - - // Derivatives of dGDSig - dm.at( 1, 1 ) = 2. / pow( ax, 2. ); - dm.at( 1, 2 ) = 0; - dm.at( 1, 3 ) = 0; - dm.at( 1, 4 ) = 0; - dm.at( 1, 5 ) = 0; - dm.at( 1, 6 ) = 0; - - - // Derivatives of dGDTau - dm.at( 2, 1 ) = 0; - dm.at( 2, 2 ) = 2. / pow( ay, 2. ); - dm.at( 2, 3 ) = 0; - dm.at( 2, 4 ) = 0; - dm.at( 2, 5 ) = 0; - dm.at( 2, 6 ) = 0; - - - // Derivates of evolution law - dm.at( 3, 1 ) = 0; - dm.at( 3, 2 ) = 0; - dm.at( 3, 3 ) = 2. / pow( az, 2. ); - dm.at( 3, 4 ) = 0; - dm.at( 3, 5 ) = 0; - dm.at( 3, 6 ) = 0; - - - // Derivates of evolution law - dm.at( 4, 1 ) = 0; - dm.at( 4, 2 ) = 0; - dm.at( 4, 3 ) = 0; - dm.at( 4, 4 ) = 2. / pow( bx, 2. ); - dm.at( 4, 5 ) = 0; - dm.at( 4, 6 ) = 0; - - // Derivates of evolution law - dm.at( 5, 1 ) = 0; - dm.at( 5, 2 ) = 0; - dm.at( 5, 3 ) = 0; - dm.at( 5, 4 ) = 0; - dm.at( 5, 5 ) = 2. / pow( by, 2. ); - dm.at( 5, 6 ) = 0; - - // Derivates of evolution law - dm.at( 6, 1 ) = 0; - dm.at( 6, 2 ) = 0; - dm.at( 6, 3 ) = 0; - dm.at( 6, 4 ) = 0; - dm.at( 6, 5 ) = 0; - dm.at( 6, 6 ) = 2. / pow( bz, 2. ); - - return dm; -} + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } // -FloatArrayF<6> -LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint *gp, TimeStep *tStep ) const -// returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes -{ - double alpha = this->give( tAlpha, gp ); + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } - return { - alpha, 0., 0., 0., 0., 0. - }; -} + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; -FloatArrayF<6> -LatticeFrameConcretePlastic::giveStrain( GaussPoint *gp, TimeStep *tStep ) const + } -{ - auto status = static_cast( this->giveStatus( gp ) ); - return status->giveLatticeStrain(); -} -FloatArrayF<6> -LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const -{ + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; - // int surface = -1; + } - // double transition = 0; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } - void - LatticeFrameConcretePlastic ::giveSwitches( FloatArray & k, int m ) - { - if ( stress.at( 1 ) >= 1 ) { - m.at( 1 ) = 1; - } else { - m.at( 1 ) = -1; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; } - if ( stress.at( 2 ) >= 1 ) { - m.at( 2 ) = 1; - } else { - m.at( 2 ) = -1; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; } - if ( stress.at( 3 ) >= 1 ) { - m.at( 3 ) = 1; - } else { - m.at( 3 ) = -1; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; } - if ( stress.at( 4 ) >= 1 ) { - m.at( 4 ) = 1; - } else { - m.at( 4 ) = -1; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; } - if ( stress.at( 5 ) >= 1 ) { - m.at( 5 ) = 1; - } else { - m.at( 5 ) = -1; + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) >= 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = 1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) >= 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = 1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; } - if ( stress.at( 6 ) >= 1 ) { - m.at( 6 ) = 1; + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) >= 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = 1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) >= 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = 1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) >= 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = 1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) < 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = -1; + k.at( 6 ) = -1; + } + + else if ( stress.at( 1 ) < 0 && stress.at( 2 ) < 0 && stress.at( 3 ) < 0 && stress.at( 4 ) < 0 && stress.at( 5 ) >= 0 && stress.at( 6 ) < 0 ) { + k.at( 1 ) = -1; + k.at( 2 ) = -1; + k.at( 3 ) = -1; + k.at( 4 ) = -1; + k.at( 5 ) = 1; + k.at( 6 ) = -1; + + } else { - m.at( 6 ) = -1; - } - - int counter = 1; - for ( int xi = -1; xi < 2; xi + 2 ) { - for ( int yi = -1; yi < 2; yi + 2 ) { - for ( int zi = -1; zi < 2; zi + 2 ) { - for ( int xj = -1; xj < 2; zi + 2 ) { - for ( int yj = -1; yj < 2; zi + 2 ) { - for ( int zj = -1; zj < 2; zi + 2 ) { - if ( !( zj == 0 && yj == 0 && xj == 0 && zi == 0 && yi == 0 && xi == 0 ) ) { - if ( counter == m ) { - k( 0 ) = xi; - k( 1 ) = yi; - k( 2 ) = zi; - k( 3 ) = xj; - k( 4 ) = yj; - k( 5 ) = zj; - } - counter++; - } - } - } - } - } - } + OOFEM_ERROR( "This case should not exist" ); } + + return k; } -} FloatArrayF<6> LatticeFrameConcretePlastic::performPlasticityReturn( GaussPoint * gp, const FloatArrayF<6> &Strain, TimeStep *tStep ) const { LatticeFrameConcretePlastic_ReturnResult returnResult = RR_Unknown; int kIter = 0; - double g = this->e / ( 2. * ( 1. + this->nu ) ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); const double area = ( static_cast( gp->giveElement() ) )->giveArea(); - const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); auto status = static_cast( this->giveStatus( gp ) ); @@ -497,10 +1042,10 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi auto oldStrain = this->giveStrain( gp, tStep )[{ 0, 1, 2, 3, 4, 5 }]; //test - auto k = checkStatus(stress, gp, tStep); + auto k = checkTransition(stress, gp, tStep); /* Compute yield value*/ - double yieldValue = computeYieldValue( stress, k, gp, tStep ); + double yieldValue = computeYieldValue( stress, k, gp, tStep ); int subIncrementCounter = 0; /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ @@ -550,26 +1095,26 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi deltaStrain = strain - convergedStrain; tempStrain = strain; subIncrementCounter = 0; - }else {//Converged + } else {//Converged //Check the surface + FloatArrayF<6> kCheck = checkTransition(stress, gp, tStep); + + if ( kCheck.at(1) == k.at(1) && kCheck.at(2) == k.at(2) && kCheck.at(3) == k.at(3) && kCheck.at(4) == k.at(4) && kCheck.at(5) == k.at(5) && kCheck.at(6) == k.at(6) ) { + returnResult = RR_Converged; + } else { + //ended up in a region for which other surface should have been used. + //Try with other surface + if ( kIter == 1 ) { + OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both surfaces"); + } - auto kCheck = checkStatus(stress, gp, tStep); - if ( kCheck == k ) { - kCheck=k; - }else{ - //ended up in a region for which other surface should have been used. - //Try with other surface - if ( kIter == 1 ) { - OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both k"); - } - k = kCheck; - returnResult = RR_NotConverged; - kIter++; - } + k = kCheck; + returnResult = RR_NotConverged; + kIter++; + } } } } - //} // const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); // const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); @@ -633,16 +1178,6 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi return; } - // FloatArrayF< 5 >residualsNorm; - // residualsNorm.at(1) = residuals.at(1) / this->nx01; - // residualsNorm.at(2) = residuals.at(2) / this->mx01; - // residualsNorm.at(3) = residuals.at(3) / this->my01; - // residualsNorm.at(4) = residuals.at(4) / this->mz01; - // residualsNorm.at(5) = residuals.at(5); - // double nx = stress.at(1); - // double mx = stress.at(2); - // double my = stress.at(3); - // double mz = stress.at(4); double ax; if ( k.at( 1 ) == 1 ) { @@ -685,8 +1220,6 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi bz = mz01; } - - FloatArrayF<7> residualsNorm; residualsNorm.at( 1 ) = residuals.at( 1 ) / ax; residualsNorm.at( 2 ) = residuals.at( 2 ) / ay; @@ -711,7 +1244,6 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi } else { status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); } - unknowns.at( 7 ) = max( unknowns.at( 7 ), 0. ); // Keep deltaLambda greater than zero! /* Update increments final values and DeltaLambda*/ @@ -721,17 +1253,18 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi tempStress.at( 4 ) = unknowns.at( 4 ); tempStress.at( 5 ) = unknowns.at( 5 ); tempStress.at( 6 ) = unknowns.at( 6 ); - deltaLambda = unknowns.at( 7 ); + deltaLambda = unknowns.at( 7 ); /* Compute the fVector*/ auto FVector = computeFVector( tempStress, k, gp, tStep ); - double g = this->e / ( 2. * ( 1. + this->nu ) ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e * deltaLambda * FVector.at( 1 ); @@ -755,13 +1288,14 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi { auto dMMatrix = computeDMMatrix( stress, k, gp, tStep ); auto fVector = computeFVector( stress, k, gp, tStep ); - double g = this->e / ( 2. * ( 1. + this->nu ) ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + /* Compute matrix*/ @@ -796,7 +1330,7 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi jacobian.at( 4, 4 ) = 1. + ik * g * deltaLambda * dMMatrix.at( 4, 4 ); jacobian.at( 4, 5 ) = 0.; jacobian.at( 4, 6 ) = 0.; - jacobian.at( 4, 7 ) = ik * this->e * fVector.at(4); + jacobian.at( 4, 7 ) = ik * g * fVector.at(4); jacobian.at( 5, 1 ) = 0.; jacobian.at( 5, 2 ) = 0.; @@ -852,13 +1386,13 @@ LatticeFrameConcretePlastic::checkStatus( const FloatArrayF<6> &stress, GaussPoi static_cast( this->giveStatus( gp ) ); double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + FloatArrayF<6> d = { this->e * area, diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 0f53319da..69a531645 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -171,7 +171,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///plastic flag double plasticFlag; - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown}; + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known}; // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; @@ -182,23 +182,26 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial public: LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; - FloatArrayF< 6 >computeFVector(const FloatArrayF< 6 > &sigma, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; + FloatArrayF< 6 >computeFVector(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; - FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &sigma, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; FloatArrayF< 6 >giveLatticeStrain(GaussPoint *gp, TimeStep *tStep) const; + int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *atTime) override; virtual FloatArrayF< 6 >giveStrain(GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const; void performRegularReturn(FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; void giveSwitches(IntArray &answer, int k); - double computeYieldValue(const FloatArrayF< 6 > &sigma, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + double computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; - FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &sigma, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; + FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; + + IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k, GaussPoint *gp, TimeStep *tStep ) const; FloatArrayF< 6 >giveFrameForces3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) override; @@ -221,9 +224,9 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial MaterialStatus *giveStatus(GaussPoint *gp) const override; protected: - FloatArrayF<6> checkTransition( const FloatArrayF<6> &sigma, GaussPoint *gp, TimeStep *tStep ) const; - FloatArrayF<6> checkStatus( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const; - FloatArray giveSwitches( FloatArray &k, int m ); + const FloatArray checkStatus( FloatArrayF<6> f, GaussPoint *pPoint, TimeStep *pStep ) const; + IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k ) const; + const FloatArrayF<6> checkTransition( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const; }; } // end namespace oofem From 4844b0fe5b2c814b4ab824f8a04ade55b4b521ab Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 17 Feb 2022 10:45:34 +0000 Subject: [PATCH 16/60] plasticStrain --- src/sm/CMakeLists.txt | 1 + src/sm/Elements/LatticeElements/latticeframe3d.C | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 8bbbe2739..540bf8492 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -293,6 +293,7 @@ set (sm_material Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C Materials/LatticeMaterials/latticeframeelastic.C Materials/LatticeMaterials/latticeframesteelplastic.C + Materials/LatticeMaterials/latticeframeconcreteplastic.C ) if (USE_MFRONT) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d.C b/src/sm/Elements/LatticeElements/latticeframe3d.C index 796007989..bd37198bb 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d.C @@ -446,6 +446,7 @@ LatticeFrame3d::initializeFrom(InputRecord &ir) this->s = 0.; IR_GIVE_OPTIONAL_FIELD(ir, s, _IFT_LatticeFrame3d_s); + } @@ -467,8 +468,6 @@ LatticeFrame3d::computeLength() return length; } - - void LatticeFrame3d::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) // Returns the lumped mass matrix of the receiver. This expression is From 1ee9415bdab4861b2ef857368c58bfd5323fec54 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 17 Feb 2022 10:50:37 +0000 Subject: [PATCH 17/60] new --- .../latticeframeconcreteplastic.C | 917 ++++++++++++++++++ .../latticeframeconcreteplastic.h | 242 +++++ 2 files changed, 1159 insertions(+) create mode 100644 src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C create mode 100644 src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C new file mode 100644 index 000000000..06be8068b --- /dev/null +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -0,0 +1,917 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "latticeframeconcreteplastic.h" +#include "latticeframeelastic.h" +#include "latticestructuralmaterial.h" +#include "gausspoint.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "CrossSections/structuralcrosssection.h" +#include "engngm.h" +#include "mathfem.h" +#include "Elements/LatticeElements/latticestructuralelement.h" +#include "datastream.h" +#include "staggeredproblem.h" +#include "contextioerr.h" +#include "classfactory.h" + +namespace oofem { +REGISTER_Material( LatticeFrameConcretePlastic ); + +// constructor which creates a dummy material without a status and without random extension interface +// LatticeFrameConcretePlastic :: LatticeFrameConcretelPlastic(int n, Domain *d) : +// LatticeStructuralMaterial(n, d) +bool LatticeFrameConcretePlastic::hasMaterialModeCapability( MaterialMode mode ) const +{ + return ( mode == _3dLattice ); +} + + +void LatticeFrameConcretePlastic::initializeFrom( InputRecord &ir ) +{ + LatticeStructuralMaterial::initializeFrom( ir ); + + // Young's modulus of the material that the beam element is made of + IR_GIVE_FIELD( ir, this->e, _IFT_LatticeFrameConcretePlastic_e ); // Macro + + // Poisson's ratio of the material that the beam element is made of + IR_GIVE_FIELD( ir, this->nu, _IFT_LatticeFrameConcretePlastic_n ); // Macro + + // Nx0 + IR_GIVE_FIELD( ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0 ); // Macro + + // Nx01 + IR_GIVE_FIELD( ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01 ); // Macro + + // vy0 + IR_GIVE_FIELD( ir, this->vy0, _IFT_LatticeFrameConcretePlastic_vy0 ); // Macro + + // vy01 + IR_GIVE_FIELD( ir, this->vy01, _IFT_LatticeFrameConcretePlastic_vy01 ); // Macro + + // vz0 + IR_GIVE_FIELD( ir, this->vz0, _IFT_LatticeFrameConcretePlastic_vz0 ); // Macro + + // vz01 + IR_GIVE_FIELD( ir, this->vz01, _IFT_LatticeFrameConcretePlastic_vz01 ); // Macro + + // Mx0 + IR_GIVE_FIELD( ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0 ); // Macro + + // Mx01 + IR_GIVE_FIELD( ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01 ); // Macro + + // My0 + IR_GIVE_FIELD( ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0 ); // Macro + + // My01 + IR_GIVE_FIELD( ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01 ); // Macro + + // Mz0 + IR_GIVE_FIELD( ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0 ); // Macro + + // Mz01 + IR_GIVE_FIELD( ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01 ); // Macro + + yieldTol = 1.e-6; + IR_GIVE_FIELD( ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol ); // Macro + + this->newtonIter = 100; + IR_GIVE_FIELD( ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter ); // Macro + + numberOfSubIncrements = 10; + IR_GIVE_FIELD( ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub ); // Macro + + this->plasticFlag = 1; + IR_GIVE_OPTIONAL_FIELD( ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic ); // Macro + + // deltaAlphaPlasticUltimate; + IR_GIVE_OPTIONAL_FIELD(ir, this->dapu, _IFT_LatticeFrameConcretePlastic_dapu); + + +} + +MaterialStatus * +LatticeFrameConcretePlastic::CreateStatus( GaussPoint *gp ) const +{ + return new LatticeFrameConcretePlasticStatus( 1, LatticeFrameConcretePlastic::domain, gp ); +} + +MaterialStatus * +LatticeFrameConcretePlastic::giveStatus( GaussPoint *gp ) const +{ + // test + MaterialStatus *status = static_cast( gp->giveMaterialStatus() ); + if ( !status ) { + // create a new one + status = this->CreateStatus( gp ); + + if ( status ) { + gp->setMaterialStatus( status ); + } + } +// + return status; +} +int +LatticeFrameConcretePlastic::giveIPValue(FloatArray &answer, + GaussPoint *gp, + InternalStateType type, + TimeStep *atTime) +{ + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + if ( type == IST_PlasticLatticeStrain ) { + answer = status->givePlasticLatticeStrain(); + return 1; + } else { + return LatticeStructuralMaterial::giveIPValue(answer, gp, type, atTime); + } +} + +double +LatticeFrameConcretePlastic::computeYieldValue( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + GaussPoint *gp, + TimeStep *tStep ) const +{ + double yieldValue = 0.; + double nx = stress.at( 1 ); + double vy = stress.at( 2 ); + double vz = stress.at( 3 ); + double mx = stress.at( 4 ); + double my = stress.at( 5 ); + double mz = stress.at( 6 ); + { + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + + { + + yieldValue = pow( nx / ax, 2. ) + pow( vy / ay, 2. ) + pow( vz / az, 2. ) + pow( mx / bx, 2. ) + pow( my / by, 2. ) + pow( mz / bz, 2. ) - 1.; + } + } + return yieldValue; +} + +FloatArrayF<6> +LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + GaussPoint *gp, + TimeStep *tStep ) const +{ + double nx = stress.at( 1 ); + double vy = stress.at( 2 ); + double vz = stress.at( 3 ); + double mx = stress.at( 4 ); + double my = stress.at( 5 ); + double mz = stress.at( 6 ); + + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + + FloatArrayF<6> f; + f.at( 1 ) = 2. * nx / pow( ax, 2. ); + f.at( 2 ) = 2. * vy / pow( ay, 2. ); + f.at( 3 ) = 2. * vz / pow( az, 2. ); + f.at( 4 ) = 2. * mx / pow( bx, 2. ); + f.at( 5 ) = 2. * my / pow( by, 2. ); + f.at( 6 ) = 2. * mz / pow( bz, 2. ); + + return f; + } + + FloatMatrixF<6, 6> + LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const + { + + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + + FloatMatrixF<6, 6> dm; + + // Derivatives of dGDSig + dm.at( 1, 1 ) = 2. / pow( ax, 2. ); + dm.at( 1, 2 ) = 0; + dm.at( 1, 3 ) = 0; + dm.at( 1, 4 ) = 0; + dm.at( 1, 5 ) = 0; + dm.at( 1, 6 ) = 0; + + + // Derivatives of dGDTau + dm.at( 2, 1 ) = 0; + dm.at( 2, 2 ) = 2. / pow( ay, 2. ); + dm.at( 2, 3 ) = 0; + dm.at( 2, 4 ) = 0; + dm.at( 2, 5 ) = 0; + dm.at( 2, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 3, 1 ) = 0; + dm.at( 3, 2 ) = 0; + dm.at( 3, 3 ) = 2. / pow( az, 2. ); + dm.at( 3, 4 ) = 0; + dm.at( 3, 5 ) = 0; + dm.at( 3, 6 ) = 0; + + + // Derivates of evolution law + dm.at( 4, 1 ) = 0; + dm.at( 4, 2 ) = 0; + dm.at( 4, 3 ) = 0; + dm.at( 4, 4 ) = 2. / pow( bx, 2. ); + dm.at( 4, 5 ) = 0; + dm.at( 4, 6 ) = 0; + + // Derivates of evolution law + dm.at( 5, 1 ) = 0; + dm.at( 5, 2 ) = 0; + dm.at( 5, 3 ) = 0; + dm.at( 5, 4 ) = 0; + dm.at( 5, 5 ) = 2. / pow( by, 2. ); + dm.at( 5, 6 ) = 0; + + // Derivates of evolution law + dm.at( 6, 1 ) = 0; + dm.at( 6, 2 ) = 0; + dm.at( 6, 3 ) = 0; + dm.at( 6, 4 ) = 0; + dm.at( 6, 5 ) = 0; + dm.at( 6, 6 ) = 2. / pow( bz, 2. ); + + return dm; + } + + FloatArrayF<6> + LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint * gp, TimeStep * tStep ) const + // returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes + { + double alpha = this->give( tAlpha, gp ); + + return { + alpha, 0., 0., 0., 0., 0. + }; + } + + FloatArrayF<6> + LatticeFrameConcretePlastic::giveStrain( GaussPoint * gp, TimeStep * tStep ) const + { + auto status = static_cast( this->giveStatus( gp ) ); + return status->giveLatticeStrain(); + } + const FloatArrayF<6> + LatticeFrameConcretePlastic::checkTransition(const FloatArrayF< 6 > &stress, GaussPoint *gp, TimeStep *tStep) const + { + + FloatArrayF<6> k; + + IntArray m(6); + + if ( stress.at( 1 ) >= 0 ) { + m.at( 1 ) = 1; + } else { + m.at( 1 ) = -1; + } + + if ( stress.at( 2 ) >= 0 ) { + m.at( 2 ) = 1; + } else { + m.at( 2 ) = -1; + } + + if ( stress.at( 3 ) >= 0 ) { + m.at( 3 ) = 1; + } else { + m.at( 3 ) = -1; + } + + if ( stress.at( 4 ) >= 0 ) { + m.at( 4 ) = 1; + } else { + m.at( 4 ) = -1; + } + + if ( stress.at( 5 ) >= 0 ) { + m.at( 5 ) = 1; + } else { + m.at( 5 ) = -1; + } + + if ( stress.at( 6 ) >= 0 ) { + m.at( 6 ) = 1; + } else { + m.at( 6 ) = -1; + } + + int counter = 1; + for ( int xi = -1; xi < 2; xi+=2 ) { + for ( int yi = -1; yi < 2; yi+=2 ) { + for ( int zi = -1; zi < 2; zi+=2 ) { + for ( int xj = -1; xj < 2; xj+=2 ) { + for ( int yj = -1; yj < 2; yj+=2 ) { + for ( int zj = -1; zj < 2; zj+=2 ) { + if ( !( zj == 0 && yj == 0 && xj == 0 && zi == 0 && yi == 0 && xi == 0 ) ) { + if ( xi == m.at( 1 ) && yi == m.at( 2 ) && zi == m.at( 3 ) && xj == m.at( 4 ) && yj == m.at( 5 ) && zj == m.at( 6 ) ) { + k.at( 1 ) = xi; + k.at( 2 ) = yi; + k.at( 3 ) = zi; + k.at( 4 ) = xj; + k.at( 5 ) = yj; + k.at( 6 ) = zj; + } + counter++; + } + } + } + } + } + } + }if + (k.at( 1 ) != m.at( 1 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )) { + OOFEM_ERROR( "This case should not exist" ); + } + + return k; + } + +// + + FloatArrayF<6> + LatticeFrameConcretePlastic::performPlasticityReturn( GaussPoint * gp, const FloatArrayF<6> &Strain, TimeStep *tStep ) const + { + LatticeFrameConcretePlastic_ReturnResult returnResult = RR_Unknown; + int kIter = 0; + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + + auto status = static_cast( this->giveStatus( gp ) ); + + // Shear components are not used for plasticity return + auto strain = Strain[{ 0, 1, 2, 3, 4, 5 }]; + + /* Get plastic strain vector from status*/ + auto tempPlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; + double s = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); + + FloatArrayF<6> tangent = { area * this->e, g * shearareay, g * shearareaz, ik * g, iy * this->e, iz * this->e }; + + /* Compute trial stress*/ + auto stress = mult( tangent, strain - tempPlasticStrain ); + + + + auto oldStrain = this->giveStrain( gp, tStep )[{ 0, 1, 2, 3, 4, 5 }]; + //test + auto k = checkTransition(stress, gp, tStep); + + /* Compute yield value*/ + double yieldValue = computeYieldValue( stress, k, gp, tStep ); + int subIncrementCounter = 0; + + /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ + + if ( yieldValue > yieldTol ) { + int subIncrementFlag = 0; + auto convergedStrain = oldStrain; + auto tempStrain = strain; + auto deltaStrain = strain - oldStrain; + // To get into the loop + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { + stress = mult( tangent, tempStrain - tempPlasticStrain ); + performRegularReturn( stress, k, yieldValue, gp, tStep ); + //if ( status->giveTempReturnResult() == RR_WrongSurface ) { + // int RestartWithNewKValue; + //} + if ( status->giveTempReturnResult() == RR_NotConverged ) { + subIncrementCounter++; + if ( subIncrementCounter > numberOfSubIncrements ) { + OOFEM_LOG_INFO( "Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); + OOFEM_LOG_INFO( "Yield value %e \n", yieldValue ); + OOFEM_LOG_INFO( "ConvergedStrain value %e %e %e %e\n", convergedStrain.at( 1 ), convergedStrain.at( 2 ), convergedStrain.at( 3 ), convergedStrain.at( 4 ), convergedStrain.at( 5 ), convergedStrain.at( 6 ) ); + OOFEM_LOG_INFO( "tempStrain value %e %e %e %e\n", tempStrain.at( 1 ), tempStrain.at( 2 ), tempStrain.at( 3 ), tempStrain.at( 4 ), tempStrain.at( 5 ), tempStrain.at( 6 ) ); + OOFEM_LOG_INFO( "deltaStrain value %e %e %e %e\n", deltaStrain.at( 1 ), deltaStrain.at( 2 ), deltaStrain.at( 3 ), deltaStrain.at( 4 ), deltaStrain.at( 5 ), deltaStrain.at( 6 ) ); + OOFEM_LOG_INFO( "targetstrain value %e %e %e %e\n", strain.at( 1 ), strain.at( 2 ), strain.at( 3 ), strain.at( 4 ), strain.at( 5 ), strain.at( 6 ) ); + + OOFEM_ERROR( "LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up." ); + } + subIncrementFlag = 1; + deltaStrain *= 0.5; + tempStrain = convergedStrain + deltaStrain; + } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { + tempPlasticStrain.at( 1 ) = tempStrain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); + tempPlasticStrain.at( 2 ) = tempStrain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); + tempPlasticStrain.at( 3 ) = tempStrain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); + tempPlasticStrain.at( 4 ) = tempStrain.at( 4 ) - stress.at( 4 ) / ( ik * g ); + tempPlasticStrain.at( 5 ) = tempStrain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); + tempPlasticStrain.at( 6 ) = tempStrain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); + + + + status->letTempPlasticLatticeStrainBe( assemble<6>( tempPlasticStrain, { 0, 1, 2, 3, 4, 5 } ) ); + + subIncrementFlag = 0; + + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + convergedStrain = tempStrain; + deltaStrain = strain - convergedStrain; + tempStrain = strain; + subIncrementCounter = 0; + } else {//Converged + //Check the surface + FloatArrayF<6> kCheck = checkTransition(stress, gp, tStep); + + if ( kCheck.at(1) == k.at(1) && kCheck.at(2) == k.at(2) && kCheck.at(3) == k.at(3) && kCheck.at(4) == k.at(4) && kCheck.at(5) == k.at(5) && kCheck.at(6) == k.at(6) ) { + returnResult = RR_Converged; + } else { + //ended up in a region for which other surface should have been used. + //Try with other surface + if ( kIter == 1 ) { + OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both surfaces"); + } + + k = kCheck; + returnResult = RR_NotConverged; + kIter++; + } + } + } + } + // const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + // const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + + tempPlasticStrain.at( 1 ) = strain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); + tempPlasticStrain.at( 2 ) = strain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); + tempPlasticStrain.at( 3 ) = strain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); + tempPlasticStrain.at( 4 ) = strain.at( 4 ) - stress.at( 4 ) / ( ik * g ); + tempPlasticStrain.at( 5 ) = strain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); + tempPlasticStrain.at( 6 ) = strain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); + + + status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 1, 2, 3, 4, 5}) ); + auto answer = assemble< 6 >(stress, { 0, 1, 2, 3, 4, 5}); + // answer.at(2) = shearareay * g * reducedStrain.at(2); + // answer.at(3) = shearareaz * g * reducedStrain.at(3); + + return answer; + } + + Interface * + LatticeFrameConcretePlastic::giveInterface( InterfaceType type ) + { + return nullptr; + } +// + void + LatticeFrameConcretePlastic::performRegularReturn( FloatArrayF<6> & stress, const FloatArrayF<6> &k, + double yieldValue, + GaussPoint *gp, + TimeStep *tStep ) const + { + // Use material specific status + auto status = static_cast( this->giveStatus( gp ) ); + + double deltaLambda = 0.; + + auto trialStress = stress; + auto tempStress = trialStress; + + // initialise unknowns + FloatArrayF<7> unknowns; + unknowns.at( 1 ) = trialStress.at( 1 ); + unknowns.at( 2 ) = trialStress.at( 2 ); + unknowns.at( 3 ) = trialStress.at( 3 ); + unknowns.at( 4 ) = trialStress.at( 4 ); + unknowns.at( 5 ) = trialStress.at( 5 ); + unknowns.at( 6 ) = trialStress.at( 6 ); + unknowns.at( 7 ) = 0.; + + yieldValue = computeYieldValue( tempStress, k, gp, tStep ); + + // initiate residuals + FloatArrayF<7> residuals; + residuals.at( 7 ) = yieldValue; + double normOfResiduals = 1.; // just to get into the loop + int iterationCount = 0; + while ( normOfResiduals > yieldTol ) { + iterationCount++; + if ( iterationCount == newtonIter ) { + status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); + return; + } + + + double ax; + if ( k.at( 1 ) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at( 2 ) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at( 3 ) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; + + if ( k.at( 4 ) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; + + if ( k.at( 5 ) == 1 ) { + by = my0; + } else { + by = my01; + } + + double bz; + + if ( k.at( 6 ) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + + FloatArrayF<7> residualsNorm; + residualsNorm.at( 1 ) = residuals.at( 1 ) / ax; + residualsNorm.at( 2 ) = residuals.at( 2 ) / ay; + residualsNorm.at( 3 ) = residuals.at( 3 ) / az; + residualsNorm.at( 4 ) = residuals.at( 4 ) / bx; + residualsNorm.at( 5 ) = residuals.at( 5 ) / by; + residualsNorm.at( 6 ) = residuals.at( 6 ) / bz; + residualsNorm.at( 7 ) = residuals.at( 7 ); + normOfResiduals = norm( residualsNorm ); + printf( "normOfResiduals=%e\n", normOfResiduals ); + if ( std::isnan( normOfResiduals ) ) { + status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); + return; + } + + if ( normOfResiduals > yieldTol ) { + auto jacobian = computeJacobian( tempStress, k, deltaLambda, gp, tStep ); + + auto solution = solve_check( jacobian, residuals ); + if ( solution.first ) { + unknowns -= solution.second; + } else { + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); + } + unknowns.at( 7 ) = max( unknowns.at( 7 ), 0. ); // Keep deltaLambda greater than zero! + + /* Update increments final values and DeltaLambda*/ + tempStress.at( 1 ) = unknowns.at( 1 ); + tempStress.at( 2 ) = unknowns.at( 2 ); + tempStress.at( 3 ) = unknowns.at( 3 ); + tempStress.at( 4 ) = unknowns.at( 4 ); + tempStress.at( 5 ) = unknowns.at( 5 ); + tempStress.at( 6 ) = unknowns.at( 6 ); + deltaLambda = unknowns.at( 7 ); + + /* Compute the fVector*/ + auto FVector = computeFVector( tempStress, k, gp, tStep ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + + + + residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e * deltaLambda * FVector.at( 1 ); + residuals.at( 2 ) = tempStress.at( 2 ) - trialStress.at( 2 ) + shearareay * g * deltaLambda * FVector.at( 2 ); + residuals.at( 3 ) = tempStress.at( 3 ) - trialStress.at( 3 ) + shearareaz * g * deltaLambda * FVector.at( 3 ); + residuals.at( 4 ) = tempStress.at( 4 ) - trialStress.at( 4 ) + ik * g * deltaLambda * FVector.at( 4 ); + residuals.at( 5 ) = tempStress.at( 5 ) - trialStress.at( 5 ) + iy * this->e * deltaLambda * FVector.at( 5 ); + residuals.at( 6 ) = tempStress.at( 6 ) - trialStress.at( 6 ) + iz * this->e * deltaLambda * FVector.at( 6 ); + residuals.at( 7 ) = computeYieldValue( tempStress, k, gp, tStep ); + } + } + status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_Converged ); + stress = tempStress; + } + + FloatMatrixF<7, 7> + LatticeFrameConcretePlastic::computeJacobian( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, + const double deltaLambda, + GaussPoint *gp, + TimeStep *tStep ) const + { + auto dMMatrix = computeDMMatrix( stress, k, gp, tStep ); + auto fVector = computeFVector( stress, k, gp, tStep ); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + + + + /* Compute matrix*/ + FloatMatrixF<7, 7> jacobian; + jacobian.at( 1, 1 ) = 1. + this->e * area * deltaLambda * dMMatrix.at( 1, 1 ); + jacobian.at( 1, 2 ) = 0.; + jacobian.at( 1, 3 ) = 0.; + jacobian.at( 1, 4 ) = 0.; + jacobian.at( 1, 5 ) = 0.; + jacobian.at( 1, 6 ) = 0.; + jacobian.at( 1, 7 ) = this->e * area * fVector.at( 1 ); + + jacobian.at( 2, 1 ) = 0.; + jacobian.at( 2, 2 ) = 1. + shearareay * g * deltaLambda * dMMatrix.at( 2, 2 ); + jacobian.at( 2, 3 ) = 0.; + jacobian.at( 2, 4 ) = 0.; + jacobian.at( 2, 5 ) = 0.; + jacobian.at( 2, 6 ) = 0.; + jacobian.at( 2, 7 ) = shearareay * g * fVector.at( 2 ); + + jacobian.at( 3, 1 ) = 0.; + jacobian.at( 3, 2 ) = 0.; + jacobian.at( 3, 3 ) = 1. + shearareaz * g * deltaLambda * dMMatrix.at( 3, 3 ); + jacobian.at( 3, 4 ) = 0.; + jacobian.at( 3, 5 ) = 0.; + jacobian.at( 3, 6 ) = 0.; + jacobian.at( 3, 7 ) = shearareaz * g * fVector.at( 3 ); + + jacobian.at( 4, 1 ) = 0.; + jacobian.at( 4, 2 ) = 0.; + jacobian.at( 4, 3 ) = 0.; + jacobian.at( 4, 4 ) = 1. + ik * g * deltaLambda * dMMatrix.at( 4, 4 ); + jacobian.at( 4, 5 ) = 0.; + jacobian.at( 4, 6 ) = 0.; + jacobian.at( 4, 7 ) = ik * g * fVector.at(4); + + jacobian.at( 5, 1 ) = 0.; + jacobian.at( 5, 2 ) = 0.; + jacobian.at( 5, 3 ) = 0.; + jacobian.at( 5, 4 ) = 0.; + jacobian.at( 5, 5 ) = 1. + iy * this->e * deltaLambda * dMMatrix.at( 5, 5 ); + jacobian.at( 5, 6 ) = 0.; + jacobian.at( 5, 7 ) = iy * this->e * fVector.at(5); + + + jacobian.at( 6, 1 ) = 0.; + jacobian.at( 6, 2 ) = 0.; + jacobian.at( 6, 3 ) = 0.; + jacobian.at( 6, 4 ) = 0.; + jacobian.at( 6, 5 ) = 0.; + jacobian.at( 6, 6 ) = 1. + this->e * iz * deltaLambda * dMMatrix.at( 6, 6 ); + jacobian.at( 6, 7 ) = this->e * iz* fVector.at( 6 ); + + jacobian.at( 7, 1 ) = fVector.at( 1 ); + jacobian.at( 7, 2 ) = fVector.at( 2 ); + jacobian.at( 7, 3 ) = fVector.at( 3 ); + jacobian.at( 7, 4 ) = fVector.at( 4 ); + jacobian.at( 7, 5 ) = fVector.at( 5 ); + jacobian.at( 7, 6 ) = fVector.at( 6 ); + jacobian.at( 7, 7 ) = 0.; + + return jacobian; + } + + FloatArrayF<6> + LatticeFrameConcretePlastic::giveFrameForces3d( const FloatArrayF<6> &originalStrain, GaussPoint *gp, TimeStep *tStep ) + { + auto status = static_cast( this->giveStatus( gp ) ); + auto Strain = originalStrain; + auto thermalStrain = this->computeStressIndependentStrainVector( gp, tStep, VM_Total ); + if ( thermalStrain.giveSize() ) { + Strain -= FloatArrayF<6>( thermalStrain ); + } + auto stress = this->performPlasticityReturn( gp, Strain, tStep ); + auto PlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; + double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); + FloatArrayF<6> deltaAlphaPlastic; + deltaAlphaPlastic.at(5) = PlasticStrain.at(5)*le ; + deltaAlphaPlastic.at(6) = PlasticStrain.at(6)*le ; + + + double omega ; + + // if ( PlasticStrain.at(1)*le >= this->us || PlasticStrain.at(2)*le >= this->us || PlasticStrain.at(3)*le >= this->us || PlasticStrain.at(4)*le >= this->us || PlasticStrain.at(5)*le >= this->us || PlasticStrain.at(6)*le >= this->us ) { + if ( deltaAlphaPlastic.at(5) >= this->dapu || deltaAlphaPlastic.at(6) >= this->dapu){ + omega = 1; + } else {omega = 0;} + + stress *= ( 1. - omega ); + + status->letTempLatticeStrainBe( originalStrain ); + status->letTempLatticeStrainBe( Strain ); + status->letTempLatticeStressBe( stress ); + + return stress; + } + + + FloatMatrixF<6, 6> + LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix( MatResponseMode rmode, GaussPoint * gp, TimeStep * atTime ) const + { + static_cast( this->giveStatus( gp ) ); + + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + + + FloatArrayF<6> d = { + this->e * area, + g * shearareay, + g * shearareaz, + g * ik, + this->e * iy, + this->e * iz + }; + + return diag( d ); + } + + LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus( int n, Domain *d, GaussPoint *g ) : + LatticeMaterialStatus( g ) + { + } + + void + LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const + { + LatticeMaterialStatus::printOutputAt( file, tStep ); + + fprintf( file, "plasticStrains " ); + for ( double s : this->plasticLatticeStrain ) { + fprintf( file, "% .8e ", s ); + } + } +} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h new file mode 100644 index 000000000..ebc5b3831 --- /dev/null +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -0,0 +1,242 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef latticeframeconcreteplastic_h +#define latticeframeconcreteplastic_h + + +#include "latticestructuralmaterial.h" +#include "cltypes.h" +#include "randommaterialext.h" +#include "strainvector.h" +#include "stressvector.h" +#include "latticematstatus.h" +///@name Input fields for LatticeFrameConcrePlastic +//@{ +#define _IFT_LatticeFrameConcretePlastic_Name "LatticeFrameConcretePlastic" +#define _IFT_LatticeFrameConcretePlastic_talpha "talpha" +#define _IFT_LatticeFrameConcretePlastic_e "e" +#define _IFT_LatticeFrameConcretePlastic_n "n" +#define _IFT_LatticeFrameConcretePlastic_nx0 "nx0" +#define _IFT_LatticeFrameConcretePlastic_vy0 "vy0" +#define _IFT_LatticeFrameConcretePlastic_vz0 "vz0" +#define _IFT_LatticeFrameConcretePlastic_mx0 "mx0" +#define _IFT_LatticeFrameConcretePlastic_my0 "my0" +#define _IFT_LatticeFrameConcretePlastic_mz0 "mz0" +#define _IFT_LatticeFrameConcretePlastic_nx01 "nx01" +#define _IFT_LatticeFrameConcretePlastic_vy01 "vy01" +#define _IFT_LatticeFrameConcretePlastic_vz01 "vz01" +#define _IFT_LatticeFrameConcretePlastic_mx01 "mx01" +#define _IFT_LatticeFrameConcretePlastic_my01 "my01" +#define _IFT_LatticeFrameConcretePlastic_mz01 "mz01" +#define _IFT_LatticeFrameConcretePlastic_tol "tol" +#define _IFT_LatticeFrameConcretePlastic_iter "iter" +#define _IFT_LatticeFrameConcretePlastic_sub "sub" +#define _IFT_LatticeFrameConcretePlastic_plastic "plastic" +#define _IFT_LatticeFrameConcretePlastic_dapu "dapu" + + +//@} + +namespace oofem { +/** + * This class implements associated Material Status to LatticeFrameConcretePlastic. + * @authors: Gumaa Abdelrhim, Peter Grassl + */ + +class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus +{ +public: + + enum state_flag_values { + LatticeFrameConcretePlastic_Elastic, + LatticeFrameConcretePlastic_Unloading, + LatticeFrameConcretePlastic_Plastic, + }; + + + enum LatticeFrameConcretePlastic_ReturnResult { + RR_NotConverged, + RR_Converged, + + + + }; + +protected: + + int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; + + +public: + + /// Constructor + LatticeFrameConcretePlasticStatus(int n, Domain *d, GaussPoint *g); + + + void printOutputAt(FILE *file, TimeStep *tStep) const override; + + const char *giveClassName() const override { return "LatticeFrameConcretePlasticStatus"; } + + void letTempReturnResultBe(const int result) { tempReturnResult = result; } + + int giveTempReturnResult() const { return tempReturnResult; } +}; + + +/** + * This class implements a local random linear elastic model for lattice elements. + */ +class LatticeFrameConcretePlastic : public LatticeStructuralMaterial + +{ +protected: + + ///Normal modulus + double e; + + ///Ratio of shear and normal modulus + double nu; + + ///maximum axial force in x-axis x-axis nx0 + double nx0; + + double vy0; + + double vz0; + + ///maximum bending moment about x-axis mx0 + double mx0; + + ///maximum bending moment about x-axis my0 + double my0; + + ///maximum bending moment about x-axis mz0 + double mz0; + + ///maximum axial force in x-axis x-axis nx01 + double nx01; + + double vy01; + + double vz01; + + + ///maximum bending moment about x-axis mx01 + double mx01; + + ///maximum bending moment about x-axis my01 + double my01; + + ///maximum bending moment about x-axis mz01 + double mz01; + + /// yield tolerance + double yieldTol; + + /// maximum number of iterations for stress return + double newtonIter; + + ///number Of SubIncrements + double numberOfSubIncrements; + + ///plastic flag + double plasticFlag; + + ///udap + double dapu; + + + + + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known}; + // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. + // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; + + double initialYieldStress = 0.; + + // + +public: + LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; + + FloatArrayF< 6 >computeFVector(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; + + FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + + FloatArrayF< 6 >giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; + + FloatArrayF< 6 >giveLatticeStrain(GaussPoint *gp, TimeStep *tStep) const; + + int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *atTime) override; + virtual FloatArrayF< 6 >giveStrain(GaussPoint *gp, TimeStep *tStep) const; + + FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const; + + void performRegularReturn(FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; + void giveSwitches(IntArray &answer, int k); + double computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + + FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; + + IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k, GaussPoint *gp, TimeStep *tStep ) const; + + FloatArrayF< 6 >giveFrameForces3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) override; + + const char *giveInputRecordName() const override { return _IFT_LatticeFrameConcretePlastic_Name; } + + const char *giveClassName() const override { return "LatticeFrameConcretePlastic"; } + + void initializeFrom(InputRecord &ir) override; + + bool isCharacteristicMtrxSymmetric(MatResponseMode rMode) const override { return false; } + + Interface *giveInterface(InterfaceType) override; + + FloatMatrixF< 6, 6 >give3dFrameStiffnessMatrix(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; + + bool hasMaterialModeCapability(MaterialMode mode) const override; + + MaterialStatus *CreateStatus(GaussPoint *gp) const override; + + MaterialStatus *giveStatus(GaussPoint *gp) const override; + +protected: + const FloatArray checkStatus( FloatArrayF<6> f, GaussPoint *pPoint, TimeStep *pStep ) const; + IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k ) const; + const FloatArrayF<6> checkTransition( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const; +}; +} // end namespace oofem + +#endif From 56499c21b2ffa6b93715afeae708aca828dc61b8 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 24 Feb 2022 09:46:19 +0000 Subject: [PATCH 18/60] equivalentPlasticStrain --- .../latticeframeconcreteplastic.C | 17 ++++++++++------- .../latticeframeconcreteplastic.h | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 68bdcb5c4..5c27fbe85 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -120,8 +120,8 @@ void LatticeFrameConcretePlastic::initializeFrom( InputRecord &ir ) this->plasticFlag = 1; IR_GIVE_OPTIONAL_FIELD( ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic ); // Macro - // deltaAlphaPlasticUltimate; - IR_GIVE_OPTIONAL_FIELD(ir, this->dapu, _IFT_LatticeFrameConcretePlastic_dapu); + // deltaPlasticStrainUltimate; + IR_GIVE_OPTIONAL_FIELD(ir, this->wu, _IFT_LatticeFrameConcretePlastic_wu); } @@ -848,12 +848,15 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const auto stress = this->performPlasticityReturn( gp, Strain, tStep ); auto PlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - FloatArrayF<6> deltaAlphaPlastic; - deltaAlphaPlastic.at(5) = PlasticStrain.at(5) * le; - deltaAlphaPlastic.at(6) = PlasticStrain.at(6) * le; - double omega ; + double equivalentPlasticStrain=sqrt(pow (PlasticStrain.at(1), 2. )+ pow (PlasticStrain.at(2), 2. )+ pow (PlasticStrain.at(3), 2. )+ pow (PlasticStrain.at(4), 2. )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2. )); + double KappaD=equivalentPlasticStrain; + double omega; + // FloatArrayF<6> deltaAlphaPlastic; + //deltaAlphaPlastic.at(5) = PlasticStrain.at(5) * le; + //deltaAlphaPlastic.at(6) = PlasticStrain.at(6) * le; + //double omega ; // if ( PlasticStrain.at(1)*le >= this->us || PlasticStrain.at(2)*le >= this->us || PlasticStrain.at(3)*le >= this->us || PlasticStrain.at(4)*le >= this->us || PlasticStrain.at(5)*le >= this->us || PlasticStrain.at(6)*le >= this->us ) { - if ( deltaAlphaPlastic.at(5) >= this->dapu || deltaAlphaPlastic.at(6) >= this->dapu){ + if (KappaD*le >= this->wu) { omega = 1; } else {omega = 0;} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 9f71e6e6a..cee5d9638 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -64,7 +64,7 @@ #define _IFT_LatticeFrameConcretePlastic_iter "iter" #define _IFT_LatticeFrameConcretePlastic_sub "sub" #define _IFT_LatticeFrameConcretePlastic_plastic "plastic" -#define _IFT_LatticeFrameConcretePlastic_dapu "dapu" +#define _IFT_LatticeFrameConcretePlastic_wu "wu" //@} @@ -174,7 +174,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial double plasticFlag; ///udap - double dapu; + double wu; enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known}; From 89a09ca8015ff00d7c2958eb136ba7dcc0b3c75c Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Fri, 25 Feb 2022 11:34:58 +0000 Subject: [PATCH 19/60] equivalentPlasticStrain --- .../latticeframeconcreteplastic.C | 81 ++++++++++++++++--- .../latticeframeconcreteplastic.h | 42 +++++++++- 2 files changed, 108 insertions(+), 15 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 5c27fbe85..83addb070 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -8,7 +8,8 @@ * ##### ##### ## ###### ## ## * * - * OOFEM : Object Oriented Finite Element Code + * OOFEM : Obje + * ct Oriented Finite Element Code * * Copyright (C) 1993 - 2019 Borek Patzak * @@ -846,25 +847,31 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const Strain -= FloatArrayF<6>( thermalStrain ); } auto stress = this->performPlasticityReturn( gp, Strain, tStep ); - auto PlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; + auto PlasticStrain = status->giveTempPlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - double equivalentPlasticStrain=sqrt(pow (PlasticStrain.at(1), 2. )+ pow (PlasticStrain.at(2), 2. )+ pow (PlasticStrain.at(3), 2. )+ pow (PlasticStrain.at(4), 2. )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2. )); - double KappaD=equivalentPlasticStrain; + double equivalentStrain=sqrt(pow (PlasticStrain.at(1), 2. )+ pow (PlasticStrain.at(2), 2. )+ pow (PlasticStrain.at(3), 2. )+ pow (PlasticStrain.at(4), 2. )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2. )); + double kappaD=0; + if (equivalentStrain > status->giveKappaD()) + { kappaD=equivalentStrain;} + else {kappaD=status->giveKappaD();} + double omega; // FloatArrayF<6> deltaAlphaPlastic; //deltaAlphaPlastic.at(5) = PlasticStrain.at(5) * le; //deltaAlphaPlastic.at(6) = PlasticStrain.at(6) * le; //double omega ; // if ( PlasticStrain.at(1)*le >= this->us || PlasticStrain.at(2)*le >= this->us || PlasticStrain.at(3)*le >= this->us || PlasticStrain.at(4)*le >= this->us || PlasticStrain.at(5)*le >= this->us || PlasticStrain.at(6)*le >= this->us ) { - if (KappaD*le >= this->wu) { - omega = 1; - } else {omega = 0;} + if (kappaD*le >= this->wu) { + omega = 1.0; + } else {omega = status->giveDamage();} stress *= ( 1. - omega ); status->letTempLatticeStrainBe( originalStrain ); status->letTempLatticeStrainBe( Strain ); status->letTempLatticeStressBe( stress ); + status->setKappaD(kappaD); + status->setDamage(omega); return stress; } @@ -900,15 +907,67 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const LatticeMaterialStatus( g ) { } - void - LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const + LatticeFrameConcretePlasticStatus::initTempStatus() + { + LatticeMaterialStatus::initTempStatus(); + this->tempKappaD = this->kappaD; + this->tempDamage = this->damage; + } + void + LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const { LatticeMaterialStatus::printOutputAt( file, tStep ); - + fprintf( file, "plasticStrains " ); for ( double s : this->plasticLatticeStrain ) { fprintf( file, "% .8e ", s ); } } -} + void + LatticeFrameConcretePlasticStatus::updateYourself(TimeStep *atTime) + // + // updates variables (nonTemp variables describing situation at previous equilibrium state) + // after a new equilibrium state has been reached + // temporary variables are having values corresponding to newly reached equilibrium. + // + { + LatticeMaterialStatus::updateYourself(atTime); + this->kappaD = this->tempKappaD; + this->damage = this->tempDamage; + } + void + LatticeFrameConcretePlasticStatus::saveContext(DataStream &stream, ContextMode mode) + // + // saves full information stored in this Status + // no temp variables stored + // + { + LatticeMaterialStatus::saveContext(stream, mode); + + if ( !stream.write(& kappaD, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + if ( !stream.write(& damage, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + } + + void + LatticeFrameConcretePlasticStatus::restoreContext(DataStream &stream, ContextMode mode) + // + // restores full information stored in stream to this Status + // + { + LatticeMaterialStatus::restoreContext(stream, mode); + + if ( !stream.read(& kappaD, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + if ( !stream.read(& damage, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + } + + + } diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index cee5d9638..155ab68b6 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -84,15 +84,15 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus LatticeFrameConcretePlastic_Plastic, }; - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, - - - }; + double kappaD; + double tempKappaD; + double damage; + double tempDamage; protected: int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; @@ -111,6 +111,40 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus void letTempReturnResultBe(const int result) { tempReturnResult = result; } int giveTempReturnResult() const { return tempReturnResult; } + + double giveKappaD() const { return kappaD; } + + double giveTempKappaD() const { return tempKappaD; } + + // void setTempKappaD(double newKappa) { tempKappaD = newKappa; } + + double giveDamage() const { return damage; } + + double giveTempDamage() const { return tempDamage; } + + void setTempDamage(double newDamage) { tempDamage = newDamage; } + + + + + + + //double giveKappaD() const { return kappaD; } + + // double giveDamage() const { return damage; } + + void setKappaD(double newKappa) { tempKappaD = newKappa; } + + void setDamage(double newDamage) { tempDamage = newDamage; } + + void initTempStatus() override; + + void updateYourself(TimeStep *) override; + + void saveContext(DataStream &stream, ContextMode mode) override; + + void restoreContext(DataStream &stream, ContextMode mode) override; + }; From 10d3ab08972e31de896aafe823e57b0841b47374 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Fri, 25 Mar 2022 10:24:07 +0000 Subject: [PATCH 20/60] reviewCode --- .../latticeframeconcreteplastic.C | 128 ++++++++++++------ .../latticeframeconcreteplastic.h | 54 +++++--- 2 files changed, 119 insertions(+), 63 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 83addb070..287c6502b 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -8,8 +8,7 @@ * ##### ##### ## ###### ## ## * * - * OOFEM : Obje - * ct Oriented Finite Element Code + * OOFEM : Object Oriented Finite Element Code * * Copyright (C) 1993 - 2019 Borek Patzak * @@ -121,12 +120,23 @@ void LatticeFrameConcretePlastic::initializeFrom( InputRecord &ir ) this->plasticFlag = 1; IR_GIVE_OPTIONAL_FIELD( ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic ); // Macro - // deltaPlasticStrainUltimate; + // deltaAlphaPlasticUltimate; IR_GIVE_OPTIONAL_FIELD(ir, this->wu, _IFT_LatticeFrameConcretePlastic_wu); + IR_GIVE_FIELD(ir, wfone, _IFT_LatticeFrameConcretePlastic_wfone); -} + IR_GIVE_FIELD(ir, wftwo, _IFT_LatticeFrameConcretePlastic_wftwo); + + IR_GIVE_OPTIONAL_FIELD(ir, this->qzero, _IFT_LatticeFrameConcretePlastic_qzero); + + // deltaAlphaPlasticUltimate; + // IR_GIVE_OPTIONAL_FIELD(ir, this->wuone, _IFT_LatticeFrameConcretePlastic_wuone); + + // IR_GIVE_FIELD(ir, wfthree, _IFT_LatticeFrameConcretePlastic_wfthree); + // IR_GIVE_FIELD(ir, wffour, _IFT_LatticeFrameConcretePlastic_wffour); + +} MaterialStatus * LatticeFrameConcretePlastic::CreateStatus( GaussPoint *gp ) const { @@ -536,7 +546,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { stress = mult( tangent, tempStrain - tempPlasticStrain ); - performRegularReturn( stress, k, yieldValue, gp, tStep ); + performRegularReturn( stress, returnResult, k, yieldValue, gp, tStep ); //if ( status->giveTempReturnResult() == RR_WrongSurface ) { // int RestartWithNewKValue; //} @@ -557,7 +567,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const tempStrain = convergedStrain + deltaStrain; } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { tempPlasticStrain.at( 1 ) = tempStrain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); - tempPlasticStrain.at( 2 ) = tempStrain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); + tempPlasticStrain.at( 2 ) = tempStrain.at( 2 ) - stress.at( 2 ) / ( g * shearareay); tempPlasticStrain.at( 3 ) = tempStrain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); tempPlasticStrain.at( 4 ) = tempStrain.at( 4 ) - stress.at( 4 ) / ( ik * g ); tempPlasticStrain.at( 5 ) = tempStrain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); @@ -618,7 +628,7 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const } // void - LatticeFrameConcretePlastic::performRegularReturn( FloatArrayF<6> & stress, const FloatArrayF<6> &k, + LatticeFrameConcretePlastic::performRegularReturn( FloatArrayF<6> & stress, LatticeFrameConcretePlastic_ReturnResult, const FloatArrayF<6> &k, double yieldValue, GaussPoint *gp, TimeStep *tStep ) const @@ -744,9 +754,9 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const - residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e * deltaLambda * FVector.at( 1 ); + residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e* deltaLambda * FVector.at( 1 ); residuals.at( 2 ) = tempStress.at( 2 ) - trialStress.at( 2 ) + shearareay * g * deltaLambda * FVector.at( 2 ); - residuals.at( 3 ) = tempStress.at( 3 ) - trialStress.at( 3 ) + shearareaz * g * deltaLambda * FVector.at( 3 ); + residuals.at( 3 ) = tempStress.at( 3 ) - trialStress.at( 3 ) + shearareaz * g * deltaLambda * FVector.at( 3 ); residuals.at( 4 ) = tempStress.at( 4 ) - trialStress.at( 4 ) + ik * g * deltaLambda * FVector.at( 4 ); residuals.at( 5 ) = tempStress.at( 5 ) - trialStress.at( 5 ) + iy * this->e * deltaLambda * FVector.at( 5 ); residuals.at( 6 ) = tempStress.at( 6 ) - trialStress.at( 6 ) + iz * this->e * deltaLambda * FVector.at( 6 ); @@ -773,11 +783,9 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - - /* Compute matrix*/ FloatMatrixF<7, 7> jacobian; - jacobian.at( 1, 1 ) = 1. + this->e * area * deltaLambda * dMMatrix.at( 1, 1 ); + jacobian.at( 1, 1 ) = 1. + this->e * area* deltaLambda * dMMatrix.at( 1, 1 ); jacobian.at( 1, 2 ) = 0.; jacobian.at( 1, 3 ) = 0.; jacobian.at( 1, 4 ) = 0.; @@ -836,10 +844,10 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const return jacobian; } - FloatArrayF<6> LatticeFrameConcretePlastic::giveFrameForces3d( const FloatArrayF<6> &originalStrain, GaussPoint *gp, TimeStep *tStep ) { + auto status = static_cast( this->giveStatus( gp ) ); auto Strain = originalStrain; auto thermalStrain = this->computeStressIndependentStrainVector( gp, tStep, VM_Total ); @@ -849,23 +857,32 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const auto stress = this->performPlasticityReturn( gp, Strain, tStep ); auto PlasticStrain = status->giveTempPlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - double equivalentStrain=sqrt(pow (PlasticStrain.at(1), 2. )+ pow (PlasticStrain.at(2), 2. )+ pow (PlasticStrain.at(3), 2. )+ pow (PlasticStrain.at(4), 2. )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2. )); - double kappaD=0; - if (equivalentStrain > status->giveKappaD()) - { kappaD=equivalentStrain;} - else {kappaD=status->giveKappaD();} - - double omega; - // FloatArrayF<6> deltaAlphaPlastic; - //deltaAlphaPlastic.at(5) = PlasticStrain.at(5) * le; - //deltaAlphaPlastic.at(6) = PlasticStrain.at(6) * le; - //double omega ; - // if ( PlasticStrain.at(1)*le >= this->us || PlasticStrain.at(2)*le >= this->us || PlasticStrain.at(3)*le >= this->us || PlasticStrain.at(4)*le >= this->us || PlasticStrain.at(5)*le >= this->us || PlasticStrain.at(6)*le >= this->us ) { - if (kappaD*le >= this->wu) { - omega = 1.0; - } else {omega = status->giveDamage();} - - stress *= ( 1. - omega ); + double equivalentStrain=sqrt(pow (PlasticStrain.at(1), 2 )+ pow (PlasticStrain.at(2), 2 )+ pow (PlasticStrain.at(3), 2 )+pow (PlasticStrain.at(4), 2 )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2 )); + double kappaD = 0.0; + + if (equivalentStrain-wu > status->giveKappaD()){ + kappaD = equivalentStrain-wu; + } else {kappaD = status->giveKappaD();} + + double omega = 0.0; + if ( kappaD*le < wu ) { + omega = 0.; + } + else if ( kappaD*le > wu && kappaD*le < wfone ) { + omega = 1.-(1.-((1.-qzero)*(kappaD*le)/(wfone))); + } + else { + omega = 1.-(qzero-(qzero*(kappaD*le-wfone)/(wftwo-wfone))); + } + + if ( omega > 1.0 ) { + omega = 1.;} + else if ( omega < 0.0 ) { + omega = 0.; + } + + stress*= (1-omega); + status->letTempLatticeStrainBe( originalStrain ); status->letTempLatticeStrainBe( Strain ); @@ -913,16 +930,8 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const LatticeMaterialStatus::initTempStatus(); this->tempKappaD = this->kappaD; this->tempDamage = this->damage; - } - void - LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const - { - LatticeMaterialStatus::printOutputAt( file, tStep ); - - fprintf( file, "plasticStrains " ); - for ( double s : this->plasticLatticeStrain ) { - fprintf( file, "% .8e ", s ); - } + this->tempKappaDOne = this->kappaDOne; + this->tempDamageOne = this->damageOne; } void LatticeFrameConcretePlasticStatus::updateYourself(TimeStep *atTime) @@ -935,6 +944,18 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const LatticeMaterialStatus::updateYourself(atTime); this->kappaD = this->tempKappaD; this->damage = this->tempDamage; + this->kappaDOne = this->tempKappaDOne; + this->damageOne = this->tempDamageOne; + } + void + LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const + { + LatticeMaterialStatus::printOutputAt( file, tStep ); + + fprintf( file, "plasticStrains " ); + for ( double s : this->plasticLatticeStrain ) { + fprintf( file, "% .8e ", s ); + } } void LatticeFrameConcretePlasticStatus::saveContext(DataStream &stream, ContextMode mode) @@ -944,15 +965,26 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const // { LatticeMaterialStatus::saveContext(stream, mode); - + + + if ( !stream.write(& kappaD, 1) ) { THROW_CIOERR(CIO_IOERR); } + if ( !stream.write(& damage, 1) ) { THROW_CIOERR(CIO_IOERR); } + if ( !stream.write(& kappaDOne, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + + if ( !stream.write(& damageOne, 1) ) { + THROW_CIOERR(CIO_IOERR); + } } - + + void LatticeFrameConcretePlasticStatus::restoreContext(DataStream &stream, ContextMode mode) // @@ -960,14 +992,20 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const // { LatticeMaterialStatus::restoreContext(stream, mode); - + if ( !stream.read(& kappaD, 1) ) { THROW_CIOERR(CIO_IOERR); } + if ( !stream.read(& damage, 1) ) { THROW_CIOERR(CIO_IOERR); } - } - + if ( !stream.read(& kappaDOne, 1) ) { + THROW_CIOERR(CIO_IOERR); + } + if ( !stream.read(& damageOne, 1) ) { + THROW_CIOERR(CIO_IOERR); + } } +} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 155ab68b6..92a06bb13 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -65,6 +65,9 @@ #define _IFT_LatticeFrameConcretePlastic_sub "sub" #define _IFT_LatticeFrameConcretePlastic_plastic "plastic" #define _IFT_LatticeFrameConcretePlastic_wu "wu" +#define _IFT_LatticeFrameConcretePlastic_wfone "wfone" +#define _IFT_LatticeFrameConcretePlastic_wftwo "wftwo" +#define _IFT_LatticeFrameConcretePlastic_qzero "qzero" //@} @@ -83,21 +86,22 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus LatticeFrameConcretePlastic_Unloading, LatticeFrameConcretePlastic_Plastic, }; - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, }; - double kappaD; double tempKappaD; - double damage; + double kappaDOne; + double tempKappaDOne; + double damage; double tempDamage; + double damageOne; + double tempDamageOne; protected: int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; - public: /// Constructor @@ -112,30 +116,29 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus int giveTempReturnResult() const { return tempReturnResult; } - double giveKappaD() const { return kappaD; } + double giveKappaD() const { return tempKappaD; } double giveTempKappaD() const { return tempKappaD; } - // void setTempKappaD(double newKappa) { tempKappaD = newKappa; } - - double giveDamage() const { return damage; } - - double giveTempDamage() const { return tempDamage; } + double giveKappaDOne() const { return tempKappaDOne; } - void setTempDamage(double newDamage) { tempDamage = newDamage; } + double giveTempKappaDOne() const { return tempKappaDOne; } + void setKappaD(double newKappa) { tempKappaD = newKappa; } + void setKappaDOne(double newKappaOne) { tempKappaDOne = newKappaOne; } + double giveDamage() const { return damage; } + double giveTempDamage() const { return tempDamage; } + void setDamage(double newDamage) { tempDamage = newDamage; } - //double giveKappaD() const { return kappaD; } + double giveDamageOne() const { return damageOne; } - // double giveDamage() const { return damage; } + double giveTempDamageOne() const { return tempDamageOne; } - void setKappaD(double newKappa) { tempKappaD = newKappa; } - - void setDamage(double newDamage) { tempDamage = newDamage; } + void setDamageOne(double newDamageOne) { tempDamageOne = newDamageOne; } void initTempStatus() override; @@ -156,6 +159,8 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial { protected: + + ///Normal modulus double e; @@ -207,10 +212,21 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///plastic flag double plasticFlag; - ///udap + ///wu double wu; + ///wfone + double wfone; + + ///wfone + double wftwo; + + ///qzero + double qzero; + + + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known}; // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; @@ -235,8 +251,10 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial FloatArrayF< 6 >performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const; - void performRegularReturn(FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; + void performRegularReturn(FloatArrayF< 6 > &stress, LatticeFrameConcretePlastic_ReturnResult, const FloatArrayF< 6 > &k, double yieldValue, GaussPoint *gp, TimeStep *tStep) const; + void giveSwitches(IntArray &answer, int k); + double computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; From 9fd85ff8344ddc4e283eecb08969b1024d829996 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Wed, 11 May 2022 12:13:03 +0100 Subject: [PATCH 21/60] reviewCode --- .../latticeframeconcreteplastic.C | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 287c6502b..96e9197f9 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -860,20 +860,24 @@ LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const double equivalentStrain=sqrt(pow (PlasticStrain.at(1), 2 )+ pow (PlasticStrain.at(2), 2 )+ pow (PlasticStrain.at(3), 2 )+pow (PlasticStrain.at(4), 2 )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2 )); double kappaD = 0.0; - if (equivalentStrain-wu > status->giveKappaD()){ - kappaD = equivalentStrain-wu; + if (equivalentStrain-wu/le > status->giveKappaD()){ + kappaD = equivalentStrain-wu/le; } else {kappaD = status->giveKappaD();} double omega = 0.0; if ( kappaD*le < wu ) { omega = 0.; } - else if ( kappaD*le > wu && kappaD*le < wfone ) { - omega = 1.-(1.-((1.-qzero)*(kappaD*le)/(wfone))); - } - else { - omega = 1.-(qzero-(qzero*(kappaD*le-wfone)/(wftwo-wfone))); - } + + else if ( kappaD*le > wu && kappaD*le < wfone ) + { + omega =1-qzero-(1-qzero)*(wfone-kappaD*le)/(wfone-wu); + } + else + { + omega =1-qzero*(wftwo-kappaD*le)/(wftwo-wfone); + } + if ( omega > 1.0 ) { omega = 1.;} From 964ee36dcf3f96dcd3c15a5032a7f68d55914152 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 27 Jun 2022 10:02:14 +0100 Subject: [PATCH 22/60] clean up of latticeframconcreteplastic --- doc/theorymanual2/_static/.gitkeep | 0 .../latticeframeconcreteplastic.C | 1470 ++++++++--------- .../latticeframeconcreteplastic.h | 70 +- 3 files changed, 716 insertions(+), 824 deletions(-) delete mode 100644 doc/theorymanual2/_static/.gitkeep diff --git a/doc/theorymanual2/_static/.gitkeep b/doc/theorymanual2/_static/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 96e9197f9..b5c60eba8 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -10,7 +10,7 @@ * * OOFEM : Object Oriented Finite Element Code * - * Copyright (C) 1993 - 2019 Borek Patzak + * Copyright (C) 1993 - 2022 Borek Patzak * * * @@ -51,965 +51,879 @@ #include "classfactory.h" namespace oofem { -REGISTER_Material( LatticeFrameConcretePlastic ); +REGISTER_Material(LatticeFrameConcretePlastic); -// constructor which creates a dummy material without a status and without random extension interface -// LatticeFrameConcretePlastic :: LatticeFrameConcretelPlastic(int n, Domain *d) : -// LatticeStructuralMaterial(n, d) -bool LatticeFrameConcretePlastic::hasMaterialModeCapability( MaterialMode mode ) const +bool LatticeFrameConcretePlastic::hasMaterialModeCapability(MaterialMode mode) const { return ( mode == _3dLattice ); } -void LatticeFrameConcretePlastic::initializeFrom( InputRecord &ir ) +void LatticeFrameConcretePlastic::initializeFrom(InputRecord &ir) { - LatticeStructuralMaterial::initializeFrom( ir ); + LatticeStructuralMaterial::initializeFrom(ir); // Young's modulus of the material that the beam element is made of - IR_GIVE_FIELD( ir, this->e, _IFT_LatticeFrameConcretePlastic_e ); // Macro + IR_GIVE_FIELD(ir, this->e, _IFT_LatticeFrameConcretePlastic_e); // Macro // Poisson's ratio of the material that the beam element is made of - IR_GIVE_FIELD( ir, this->nu, _IFT_LatticeFrameConcretePlastic_n ); // Macro + IR_GIVE_FIELD(ir, this->nu, _IFT_LatticeFrameConcretePlastic_n); // Macro // Nx0 - IR_GIVE_FIELD( ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0 ); // Macro + IR_GIVE_FIELD(ir, this->nx0, _IFT_LatticeFrameConcretePlastic_nx0); // Macro // Nx01 - IR_GIVE_FIELD( ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01 ); // Macro + IR_GIVE_FIELD(ir, this->nx01, _IFT_LatticeFrameConcretePlastic_nx01); // Macro // vy0 - IR_GIVE_FIELD( ir, this->vy0, _IFT_LatticeFrameConcretePlastic_vy0 ); // Macro + IR_GIVE_FIELD(ir, this->vy0, _IFT_LatticeFrameConcretePlastic_vy0); // Macro // vy01 - IR_GIVE_FIELD( ir, this->vy01, _IFT_LatticeFrameConcretePlastic_vy01 ); // Macro + IR_GIVE_FIELD(ir, this->vy01, _IFT_LatticeFrameConcretePlastic_vy01); // Macro // vz0 - IR_GIVE_FIELD( ir, this->vz0, _IFT_LatticeFrameConcretePlastic_vz0 ); // Macro + IR_GIVE_FIELD(ir, this->vz0, _IFT_LatticeFrameConcretePlastic_vz0); // Macro // vz01 - IR_GIVE_FIELD( ir, this->vz01, _IFT_LatticeFrameConcretePlastic_vz01 ); // Macro + IR_GIVE_FIELD(ir, this->vz01, _IFT_LatticeFrameConcretePlastic_vz01); // Macro // Mx0 - IR_GIVE_FIELD( ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0 ); // Macro + IR_GIVE_FIELD(ir, this->mx0, _IFT_LatticeFrameConcretePlastic_mx0); // Macro // Mx01 - IR_GIVE_FIELD( ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01 ); // Macro + IR_GIVE_FIELD(ir, this->mx01, _IFT_LatticeFrameConcretePlastic_mx01); // Macro // My0 - IR_GIVE_FIELD( ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0 ); // Macro + IR_GIVE_FIELD(ir, this->my0, _IFT_LatticeFrameConcretePlastic_my0); // Macro // My01 - IR_GIVE_FIELD( ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01 ); // Macro + IR_GIVE_FIELD(ir, this->my01, _IFT_LatticeFrameConcretePlastic_my01); // Macro // Mz0 - IR_GIVE_FIELD( ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0 ); // Macro + IR_GIVE_FIELD(ir, this->mz0, _IFT_LatticeFrameConcretePlastic_mz0); // Macro // Mz01 - IR_GIVE_FIELD( ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01 ); // Macro + IR_GIVE_FIELD(ir, this->mz01, _IFT_LatticeFrameConcretePlastic_mz01); // Macro yieldTol = 1.e-6; - IR_GIVE_FIELD( ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol ); // Macro + IR_GIVE_FIELD(ir, this->yieldTol, _IFT_LatticeFrameConcretePlastic_tol); // Macro this->newtonIter = 100; - IR_GIVE_FIELD( ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter ); // Macro + IR_GIVE_FIELD(ir, this->newtonIter, _IFT_LatticeFrameConcretePlastic_iter); // Macro numberOfSubIncrements = 10; - IR_GIVE_FIELD( ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub ); // Macro + IR_GIVE_FIELD(ir, this->numberOfSubIncrements, _IFT_LatticeFrameConcretePlastic_sub); // Macro this->plasticFlag = 1; - IR_GIVE_OPTIONAL_FIELD( ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic ); // Macro + IR_GIVE_OPTIONAL_FIELD(ir, plasticFlag, _IFT_LatticeFrameConcretePlastic_plastic); // Macro - // deltaAlphaPlasticUltimate; + // wu IR_GIVE_OPTIONAL_FIELD(ir, this->wu, _IFT_LatticeFrameConcretePlastic_wu); + // wfone IR_GIVE_FIELD(ir, wfone, _IFT_LatticeFrameConcretePlastic_wfone); - - IR_GIVE_FIELD(ir, wftwo, _IFT_LatticeFrameConcretePlastic_wftwo); - - IR_GIVE_OPTIONAL_FIELD(ir, this->qzero, _IFT_LatticeFrameConcretePlastic_qzero); - - // deltaAlphaPlasticUltimate; - // IR_GIVE_OPTIONAL_FIELD(ir, this->wuone, _IFT_LatticeFrameConcretePlastic_wuone); - - // IR_GIVE_FIELD(ir, wfthree, _IFT_LatticeFrameConcretePlastic_wfthree); - - // IR_GIVE_FIELD(ir, wffour, _IFT_LatticeFrameConcretePlastic_wffour); - } MaterialStatus * -LatticeFrameConcretePlastic::CreateStatus( GaussPoint *gp ) const +LatticeFrameConcretePlastic::CreateStatus(GaussPoint *gp) const { - return new LatticeFrameConcretePlasticStatus( 1, LatticeFrameConcretePlastic::domain, gp ); + return new LatticeFrameConcretePlasticStatus(1, LatticeFrameConcretePlastic::domain, gp); } MaterialStatus * -LatticeFrameConcretePlastic::giveStatus( GaussPoint *gp ) const +LatticeFrameConcretePlastic::giveStatus(GaussPoint *gp) const { - // test - MaterialStatus *status = static_cast( gp->giveMaterialStatus() ); + MaterialStatus *status = static_cast< MaterialStatus * >( gp->giveMaterialStatus() ); if ( !status ) { // create a new one - status = this->CreateStatus( gp ); + status = this->CreateStatus(gp); if ( status ) { - gp->setMaterialStatus( status ); + gp->setMaterialStatus(status); } } -// + // return status; } int LatticeFrameConcretePlastic::giveIPValue(FloatArray &answer, - GaussPoint *gp, - InternalStateType type, - TimeStep *atTime) + GaussPoint *gp, + InternalStateType type, + TimeStep *atTime) { auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); if ( type == IST_PlasticLatticeStrain ) { + answer.resize(6); + answer.zero(); answer = status->givePlasticLatticeStrain(); return 1; + } else if ( type == IST_DamageScalar ) { + answer.resize(1); + answer.zero(); + answer.at(1) = status->giveDamage(); + return 1; } else { return LatticeStructuralMaterial::giveIPValue(answer, gp, type, atTime); } } double -LatticeFrameConcretePlastic::computeYieldValue( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, - GaussPoint *gp, - TimeStep *tStep ) const +LatticeFrameConcretePlastic::computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, + GaussPoint *gp, + TimeStep *tStep) const { double yieldValue = 0.; - double nx = stress.at( 1 ); - double vy = stress.at( 2 ); - double vz = stress.at( 3 ); - double mx = stress.at( 4 ); - double my = stress.at( 5 ); - double mz = stress.at( 6 ); - { - double ax; - if ( k.at( 1 ) == 1 ) { - ax = nx0; - } else { - ax = nx01; - } - double ay; - if ( k.at( 2 ) == 1 ) { - ay = vy0; - } else { - ay = vy01; - } - double az; - if ( k.at( 3 ) == 1 ) { - az = vz0; - } else { - az = vz01; - } - double bx; + double nx = stress.at(1); + double vy = stress.at(2); + double vz = stress.at(3); + double mx = stress.at(4); + double my = stress.at(5); + double mz = stress.at(6); + + double ax; + if ( k.at(1) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } + double ay; + if ( k.at(2) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } + double az; + if ( k.at(3) == 1 ) { + az = vz0; + } else { + az = vz01; + } + double bx; - if ( k.at( 4 ) == 1 ) { - bx = mx0; - } else { - bx = mx01; - } - double by; + if ( k.at(4) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } + double by; - if ( k.at( 5 ) == 1 ) { - by = my0; - } else { - by = my01; - } + if ( k.at(5) == 1 ) { + by = my0; + } else { + by = my01; + } - double bz; + double bz; - if ( k.at( 6 ) == 1 ) { - bz = mz0; - } else { - bz = mz01; - } + if ( k.at(6) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } - { - yieldValue = pow( nx / ax, 2. ) + pow( vy / ay, 2. ) + pow( vz / az, 2. ) + pow( mx / bx, 2. ) + pow( my / by, 2. ) + pow( mz / bz, 2. ) - 1.; - } - } + yieldValue = pow(nx / ax, 2.) + pow(vy / ay, 2.) + pow(vz / az, 2.) + pow(mx / bx, 2.) + pow(my / by, 2.) + pow(mz / bz, 2.) - 1.; + + return yieldValue; } -FloatArrayF<6> -LatticeFrameConcretePlastic::computeFVector( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, - GaussPoint *gp, - TimeStep *tStep ) const +FloatArrayF< 6 > +LatticeFrameConcretePlastic::computeFVector(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, + GaussPoint *gp, + TimeStep *tStep) const { - double nx = stress.at( 1 ); - double vy = stress.at( 2 ); - double vz = stress.at( 3 ); - double mx = stress.at( 4 ); - double my = stress.at( 5 ); - double mz = stress.at( 6 ); + double nx = stress.at(1); + double vy = stress.at(2); + double vz = stress.at(3); + double mx = stress.at(4); + double my = stress.at(5); + double mz = stress.at(6); + + double ax = 0.; + if ( k.at(1) == 1 ) { + ax = nx0; + } else { + ax = nx01; + } - double ax; - if ( k.at( 1 ) == 1 ) { - ax = nx0; - } else { - ax = nx01; - } - double ay; - if ( k.at( 2 ) == 1 ) { - ay = vy0; - } else { - ay = vy01; - } - double az; - if ( k.at( 3 ) == 1 ) { - az = vz0; - } else { - az = vz01; - } - double bx; + double ay = 0.; + if ( k.at(2) == 1 ) { + ay = vy0; + } else { + ay = vy01; + } - if ( k.at( 4 ) == 1 ) { - bx = mx0; - } else { - bx = mx01; - } - double by; + double az = 0.; + if ( k.at(3) == 1 ) { + az = vz0; + } else { + az = vz01; + } - if ( k.at( 5 ) == 1 ) { - by = my0; - } else { - by = my01; - } + double bx = 0.; + if ( k.at(4) == 1 ) { + bx = mx0; + } else { + bx = mx01; + } - double bz; + double by = 0.; + if ( k.at(5) == 1 ) { + by = my0; + } else { + by = my01; + } - if ( k.at( 6 ) == 1 ) { - bz = mz0; - } else { - bz = mz01; - } + double bz = 0.; + if ( k.at(6) == 1 ) { + bz = mz0; + } else { + bz = mz01; + } + FloatArrayF< 6 >f; + f.at(1) = 2. * nx / pow(ax, 2.); + f.at(2) = 2. * vy / pow(ay, 2.); + f.at(3) = 2. * vz / pow(az, 2.); + f.at(4) = 2. * mx / pow(bx, 2.); + f.at(5) = 2. * my / pow(by, 2.); + f.at(6) = 2. * mz / pow(bz, 2.); - FloatArrayF<6> f; - f.at( 1 ) = 2. * nx / pow( ax, 2. ); - f.at( 2 ) = 2. * vy / pow( ay, 2. ); - f.at( 3 ) = 2. * vz / pow( az, 2. ); - f.at( 4 ) = 2. * mx / pow( bx, 2. ); - f.at( 5 ) = 2. * my / pow( by, 2. ); - f.at( 6 ) = 2. * mz / pow( bz, 2. ); + return f; +} - return f; +FloatMatrixF< 6, 6 > +LatticeFrameConcretePlastic::computeDMMatrix(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const +{ + double ax = nx01; + if ( k.at(1) == 1 ) { + ax = nx0; } - FloatMatrixF<6, 6> - LatticeFrameConcretePlastic::computeDMMatrix( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep ) const - { - - double ax; - if ( k.at( 1 ) == 1 ) { - ax = nx0; - } else { - ax = nx01; - } - double ay; - if ( k.at( 2 ) == 1 ) { - ay = vy0; - } else { - ay = vy01; - } - double az; - if ( k.at( 3 ) == 1 ) { - az = vz0; - } else { - az = vz01; - } - double bx; - - if ( k.at( 4 ) == 1 ) { - bx = mx0; - } else { - bx = mx01; - } - double by; + double ay = vy01; + ; + if ( k.at(2) == 1 ) { + ay = vy0; + } - if ( k.at( 5 ) == 1 ) { - by = my0; - } else { - by = my01; - } + double az = vz01; + if ( k.at(3) == 1 ) { + az = vz0; + } - double bz; + double bx = mx01; + if ( k.at(4) == 1 ) { + bx = mx0; + } - if ( k.at( 6 ) == 1 ) { - bz = mz0; - } else { - bz = mz01; - } + double by = my01; + if ( k.at(5) == 1 ) { + by = my0; + } + double bz = mz01; + ; + if ( k.at(6) == 1 ) { + bz = mz0; + } - FloatMatrixF<6, 6> dm; + FloatArrayF< 6 >dm = { + 2. / pow(ax, 2.), + 2. / pow(ay, 2.), + 2. / pow(az, 2.), + 2. / pow(bx, 2.), + 2. / pow(by, 2.), + 2. / pow(bz, 2.) + }; - // Derivatives of dGDSig - dm.at( 1, 1 ) = 2. / pow( ax, 2. ); - dm.at( 1, 2 ) = 0; - dm.at( 1, 3 ) = 0; - dm.at( 1, 4 ) = 0; - dm.at( 1, 5 ) = 0; - dm.at( 1, 6 ) = 0; + return diag(dm); +} +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const +// returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes +{ + double alpha = this->give(tAlpha, gp); - // Derivatives of dGDTau - dm.at( 2, 1 ) = 0; - dm.at( 2, 2 ) = 2. / pow( ay, 2. ); - dm.at( 2, 3 ) = 0; - dm.at( 2, 4 ) = 0; - dm.at( 2, 5 ) = 0; - dm.at( 2, 6 ) = 0; + return { + alpha, 0., 0., 0., 0., 0. + }; +} +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveStrain(GaussPoint *gp, TimeStep *tStep) const +{ + auto status = static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); + return status->giveLatticeStrain(); +} - // Derivates of evolution law - dm.at( 3, 1 ) = 0; - dm.at( 3, 2 ) = 0; - dm.at( 3, 3 ) = 2. / pow( az, 2. ); - dm.at( 3, 4 ) = 0; - dm.at( 3, 5 ) = 0; - dm.at( 3, 6 ) = 0; +const FloatArrayF< 6 > +LatticeFrameConcretePlastic::checkTransition(const FloatArrayF< 6 > &stress, GaussPoint *gp, TimeStep *tStep) const +{ + FloatArrayF< 6 >k; + IntArray m(6); - // Derivates of evolution law - dm.at( 4, 1 ) = 0; - dm.at( 4, 2 ) = 0; - dm.at( 4, 3 ) = 0; - dm.at( 4, 4 ) = 2. / pow( bx, 2. ); - dm.at( 4, 5 ) = 0; - dm.at( 4, 6 ) = 0; + if ( stress.at(1) >= 0 ) { + m.at(1) = 1; + } else { + m.at(1) = -1; + } - // Derivates of evolution law - dm.at( 5, 1 ) = 0; - dm.at( 5, 2 ) = 0; - dm.at( 5, 3 ) = 0; - dm.at( 5, 4 ) = 0; - dm.at( 5, 5 ) = 2. / pow( by, 2. ); - dm.at( 5, 6 ) = 0; + if ( stress.at(2) >= 0 ) { + m.at(2) = 1; + } else { + m.at(2) = -1; + } - // Derivates of evolution law - dm.at( 6, 1 ) = 0; - dm.at( 6, 2 ) = 0; - dm.at( 6, 3 ) = 0; - dm.at( 6, 4 ) = 0; - dm.at( 6, 5 ) = 0; - dm.at( 6, 6 ) = 2. / pow( bz, 2. ); + if ( stress.at(3) >= 0 ) { + m.at(3) = 1; + } else { + m.at(3) = -1; + } - return dm; + if ( stress.at(4) >= 0 ) { + m.at(4) = 1; + } else { + m.at(4) = -1; } - FloatArrayF<6> - LatticeFrameConcretePlastic::giveThermalDilatationVector( GaussPoint * gp, TimeStep * tStep ) const - // returns a FloatArray(6) of initial strain vector caused by unit temperature in direction of gp (element) local axes - { - double alpha = this->give( tAlpha, gp ); + if ( stress.at(5) >= 0 ) { + m.at(5) = 1; + } else { + m.at(5) = -1; + } - return { - alpha, 0., 0., 0., 0., 0. - }; + if ( stress.at(6) >= 0 ) { + m.at(6) = 1; + } else { + m.at(6) = -1; } - FloatArrayF<6> - LatticeFrameConcretePlastic::giveStrain( GaussPoint * gp, TimeStep * tStep ) const - { - auto status = static_cast( this->giveStatus( gp ) ); - return status->giveLatticeStrain(); + int counter = 1; + for ( int xi = -1; xi < 2; xi += 2 ) { + for ( int yi = -1; yi < 2; yi += 2 ) { + for ( int zi = -1; zi < 2; zi += 2 ) { + for ( int xj = -1; xj < 2; xj += 2 ) { + for ( int yj = -1; yj < 2; yj += 2 ) { + for ( int zj = -1; zj < 2; zj += 2 ) { + if ( !( zj == 0 && yj == 0 && xj == 0 && zi == 0 && yi == 0 && xi == 0 ) ) { + if ( xi == m.at(1) && yi == m.at(2) && zi == m.at(3) && xj == m.at(4) && yj == m.at(5) && zj == m.at(6) ) { + k.at(1) = xi; + k.at(2) = yi; + k.at(3) = zi; + k.at(4) = xj; + k.at(5) = yj; + k.at(6) = zj; + } + counter++; + } + } + } + } + } + } + } + if + ( k.at(1) != m.at(1) && k.at(2) != m.at(2) && k.at(2) != m.at(2) && k.at(2) != m.at(2) && k.at(2) != m.at(2) && k.at(2) != m.at(2) ) { + OOFEM_ERROR("This case should not exist"); } - const FloatArrayF<6> - LatticeFrameConcretePlastic::checkTransition(const FloatArrayF< 6 > &stress, GaussPoint *gp, TimeStep *tStep) const - { - FloatArrayF<6> k; + return k; +} - IntArray m(6); +// - if ( stress.at( 1 ) >= 0 ) { - m.at( 1 ) = 1; - } else { - m.at( 1 ) = -1; - } +FloatArrayF< 6 > +LatticeFrameConcretePlastic::performPlasticityReturn(GaussPoint *gp, const FloatArrayF< 6 > &strain, TimeStep *tStep) const +{ + LatticeFrameConcretePlastic_ReturnResult returnResult = RR_Unknown; + int kIter = 0; + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); - if ( stress.at( 2 ) >= 0 ) { - m.at( 2 ) = 1; - } else { - m.at( 2 ) = -1; - } + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - if ( stress.at( 3 ) >= 0 ) { - m.at( 3 ) = 1; - } else { - m.at( 3 ) = -1; - } - if ( stress.at( 4 ) >= 0 ) { - m.at( 4 ) = 1; - } else { - m.at( 4 ) = -1; - } + /* Get plastic strain vector from status*/ + auto tempPlasticStrain = status->givePlasticLatticeStrain(); - if ( stress.at( 5 ) >= 0 ) { - m.at( 5 ) = 1; - } else { - m.at( 5 ) = -1; - } + FloatArrayF< 6 >tangent = { area *this->e, g *shearareay, g *shearareaz, ik *g, iy *this->e, iz *this->e }; - if ( stress.at( 6 ) >= 0 ) { - m.at( 6 ) = 1; - } else { - m.at( 6 ) = -1; - } + /* Compute trial stress*/ + auto stress = mult(tangent, strain - tempPlasticStrain); - int counter = 1; - for ( int xi = -1; xi < 2; xi+=2 ) { - for ( int yi = -1; yi < 2; yi+=2 ) { - for ( int zi = -1; zi < 2; zi+=2 ) { - for ( int xj = -1; xj < 2; xj+=2 ) { - for ( int yj = -1; yj < 2; yj+=2 ) { - for ( int zj = -1; zj < 2; zj+=2 ) { - if ( !( zj == 0 && yj == 0 && xj == 0 && zi == 0 && yi == 0 && xi == 0 ) ) { - if ( xi == m.at( 1 ) && yi == m.at( 2 ) && zi == m.at( 3 ) && xj == m.at( 4 ) && yj == m.at( 5 ) && zj == m.at( 6 ) ) { - k.at( 1 ) = xi; - k.at( 2 ) = yi; - k.at( 3 ) = zi; - k.at( 4 ) = xj; - k.at( 5 ) = yj; - k.at( 6 ) = zj; - } - counter++; - } - } - } - } - } - } - }if - (k.at( 1 ) != m.at( 1 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )&&k.at( 2 ) != m.at( 2 )) { - OOFEM_ERROR( "This case should not exist" ); - } - return k; - } -// + auto oldStrain = this->giveStrain(gp, tStep); + //test + auto k = checkTransition(stress, gp, tStep); - FloatArrayF<6> - LatticeFrameConcretePlastic::performPlasticityReturn( GaussPoint * gp, const FloatArrayF<6> &Strain, TimeStep *tStep ) const - { - LatticeFrameConcretePlastic_ReturnResult returnResult = RR_Unknown; - int kIter = 0; - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast( gp->giveElement() ) )->giveArea(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); - const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - - auto status = static_cast( this->giveStatus( gp ) ); - - // Shear components are not used for plasticity return - auto strain = Strain[{ 0, 1, 2, 3, 4, 5 }]; - - /* Get plastic strain vector from status*/ - auto tempPlasticStrain = status->givePlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; - - FloatArrayF<6> tangent = { area * this->e, g * shearareay, g * shearareaz, ik * g, iy * this->e, iz * this->e }; - - /* Compute trial stress*/ - auto stress = mult( tangent, strain - tempPlasticStrain ); - - - - auto oldStrain = this->giveStrain( gp, tStep )[{ 0, 1, 2, 3, 4, 5 }]; - //test - auto k = checkTransition(stress, gp, tStep); - - /* Compute yield value*/ - double yieldValue = computeYieldValue( stress, k, gp, tStep ); - int subIncrementCounter = 0; - - /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ - - if ( yieldValue > yieldTol ) { - int subIncrementFlag = 0; - auto convergedStrain = oldStrain; - auto tempStrain = strain; - auto deltaStrain = strain - oldStrain; - // To get into the loop - status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); - while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { - stress = mult( tangent, tempStrain - tempPlasticStrain ); - performRegularReturn( stress, returnResult, k, yieldValue, gp, tStep ); - //if ( status->giveTempReturnResult() == RR_WrongSurface ) { - // int RestartWithNewKValue; - //} - if ( status->giveTempReturnResult() == RR_NotConverged ) { - subIncrementCounter++; - if ( subIncrementCounter > numberOfSubIncrements ) { - OOFEM_LOG_INFO( "Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); - OOFEM_LOG_INFO( "Yield value %e \n", yieldValue ); - OOFEM_LOG_INFO( "ConvergedStrain value %e %e %e %e\n", convergedStrain.at( 1 ), convergedStrain.at( 2 ), convergedStrain.at( 3 ), convergedStrain.at( 4 ), convergedStrain.at( 5 ), convergedStrain.at( 6 ) ); - OOFEM_LOG_INFO( "tempStrain value %e %e %e %e\n", tempStrain.at( 1 ), tempStrain.at( 2 ), tempStrain.at( 3 ), tempStrain.at( 4 ), tempStrain.at( 5 ), tempStrain.at( 6 ) ); - OOFEM_LOG_INFO( "deltaStrain value %e %e %e %e\n", deltaStrain.at( 1 ), deltaStrain.at( 2 ), deltaStrain.at( 3 ), deltaStrain.at( 4 ), deltaStrain.at( 5 ), deltaStrain.at( 6 ) ); - OOFEM_LOG_INFO( "targetstrain value %e %e %e %e\n", strain.at( 1 ), strain.at( 2 ), strain.at( 3 ), strain.at( 4 ), strain.at( 5 ), strain.at( 6 ) ); - - OOFEM_ERROR( "LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up." ); - } - subIncrementFlag = 1; - deltaStrain *= 0.5; - tempStrain = convergedStrain + deltaStrain; - } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { - tempPlasticStrain.at( 1 ) = tempStrain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); - tempPlasticStrain.at( 2 ) = tempStrain.at( 2 ) - stress.at( 2 ) / ( g * shearareay); - tempPlasticStrain.at( 3 ) = tempStrain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); - tempPlasticStrain.at( 4 ) = tempStrain.at( 4 ) - stress.at( 4 ) / ( ik * g ); - tempPlasticStrain.at( 5 ) = tempStrain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); - tempPlasticStrain.at( 6 ) = tempStrain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); - - status->letTempPlasticLatticeStrainBe( assemble<6>( tempPlasticStrain, { 0, 1, 2, 3, 4, 5 } ) ); - - subIncrementFlag = 0; - - status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); - convergedStrain = tempStrain; - deltaStrain = strain - convergedStrain; - tempStrain = strain; - subIncrementCounter = 0; - } else {//Converged - //Check the surface - FloatArrayF<6> kCheck = checkTransition(stress, gp, tStep); - - if ( kCheck.at(1) == k.at(1) && kCheck.at(2) == k.at(2) && kCheck.at(3) == k.at(3) && kCheck.at(4) == k.at(4) && kCheck.at(5) == k.at(5) && kCheck.at(6) == k.at(6) ) { - returnResult = RR_Converged; - } else { - //ended up in a region for which other surface should have been used. - //Try with other surface - if ( kIter == 1 ) { - OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both surfaces"); - } + /* Compute yield value*/ + double yieldValue = computeYieldValue(stress, k, gp, tStep); + int subIncrementCounter = 0; + + /* Check yield condition, i.e. if the yield value is less than the yield tolerance. If yield condition is valid. Do perform regular return (closest point return)*/ + + if ( yieldValue > yieldTol ) { + int subIncrementFlag = 0; + auto convergedStrain = oldStrain; + auto tempStrain = strain; + auto deltaStrain = strain - oldStrain; + // To get into the loop + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + while ( status->giveTempReturnResult() == RR_NotConverged || subIncrementFlag == 1 ) { + stress = mult(tangent, tempStrain - tempPlasticStrain); + performRegularReturn(stress, returnResult, k, yieldValue, gp, tStep); + //if ( status->giveTempReturnResult() == RR_WrongSurface ) { + // int RestartWithNewKValue; + //} + if ( status->giveTempReturnResult() == RR_NotConverged ) { + subIncrementCounter++; + if ( subIncrementCounter > numberOfSubIncrements ) { + OOFEM_LOG_INFO( "Unstable element %d \n", gp->giveElement()->giveGlobalNumber() ); + OOFEM_LOG_INFO("Yield value %e \n", yieldValue); + OOFEM_LOG_INFO( "ConvergedStrain value %e %e %e %e\n", convergedStrain.at(1), convergedStrain.at(2), convergedStrain.at(3), convergedStrain.at(4), convergedStrain.at(5), convergedStrain.at(6) ); + OOFEM_LOG_INFO( "tempStrain value %e %e %e %e\n", tempStrain.at(1), tempStrain.at(2), tempStrain.at(3), tempStrain.at(4), tempStrain.at(5), tempStrain.at(6) ); + OOFEM_LOG_INFO( "deltaStrain value %e %e %e %e\n", deltaStrain.at(1), deltaStrain.at(2), deltaStrain.at(3), deltaStrain.at(4), deltaStrain.at(5), deltaStrain.at(6) ); + OOFEM_LOG_INFO( "targetstrain value %e %e %e %e\n", strain.at(1), strain.at(2), strain.at(3), strain.at(4), strain.at(5), strain.at(6) ); - k = kCheck; - returnResult = RR_NotConverged; - kIter++; + OOFEM_ERROR("LatticeFrameConcretePlastic :: performPlasticityReturn - Could not reach convergence with small deltaStrain, giving up."); + } + subIncrementFlag = 1; + deltaStrain *= 0.5; + tempStrain = convergedStrain + deltaStrain; + } else if ( status->giveTempReturnResult() == RR_Converged && subIncrementFlag == 1 ) { + tempPlasticStrain.at(1) = tempStrain.at(1) - stress.at(1) / ( area * this->e ); + tempPlasticStrain.at(2) = tempStrain.at(2) - stress.at(2) / ( g * shearareay ); + tempPlasticStrain.at(3) = tempStrain.at(3) - stress.at(3) / ( g * shearareaz ); + tempPlasticStrain.at(4) = tempStrain.at(4) - stress.at(4) / ( ik * g ); + tempPlasticStrain.at(5) = tempStrain.at(5) - stress.at(5) / ( iy * this->e ); + tempPlasticStrain.at(6) = tempStrain.at(6) - stress.at(6) / ( iz * this->e ); + + status->letTempPlasticLatticeStrainBe( assemble< 6 >(tempPlasticStrain, { 0, 1, 2, 3, 4, 5 }) ); + + subIncrementFlag = 0; + + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + convergedStrain = tempStrain; + deltaStrain = strain - convergedStrain; + tempStrain = strain; + subIncrementCounter = 0; + } else { //Converged + //Check the surface + FloatArrayF< 6 >kCheck = checkTransition(stress, gp, tStep); + + if ( kCheck.at(1) == k.at(1) && kCheck.at(2) == k.at(2) && kCheck.at(3) == k.at(3) && kCheck.at(4) == k.at(4) && kCheck.at(5) == k.at(5) && kCheck.at(6) == k.at(6) ) { + returnResult = RR_Converged; + } else { + //ended up in a region for which other surface should have been used. + //Try with other surface + if ( kIter == 1 ) { + OOFEM_ERROR("LatticePlasticityDamage :: performPlasticityReturn - Tried both surfaces"); } + + k = kCheck; + returnResult = RR_NotConverged; + kIter++; } } } - // const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); - // const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); - + } - tempPlasticStrain.at( 1 ) = strain.at( 1 ) - stress.at( 1 ) / ( area * this->e ); - tempPlasticStrain.at( 2 ) = strain.at( 2 ) - stress.at( 2 ) / ( g * shearareay ); - tempPlasticStrain.at( 3 ) = strain.at( 3 ) - stress.at( 3 ) / ( g * shearareaz ); - tempPlasticStrain.at( 4 ) = strain.at( 4 ) - stress.at( 4 ) / ( ik * g ); - tempPlasticStrain.at( 5 ) = strain.at( 5 ) - stress.at( 5 ) / ( iy * this->e ); - tempPlasticStrain.at( 6 ) = strain.at( 6 ) - stress.at( 6 ) / ( iz * this->e ); + tempPlasticStrain.at(1) = strain.at(1) - stress.at(1) / ( area * this->e ); + tempPlasticStrain.at(2) = strain.at(2) - stress.at(2) / ( g * shearareay ); + tempPlasticStrain.at(3) = strain.at(3) - stress.at(3) / ( g * shearareaz ); + tempPlasticStrain.at(4) = strain.at(4) - stress.at(4) / ( ik * g ); + tempPlasticStrain.at(5) = strain.at(5) - stress.at(5) / ( iy * this->e ); + tempPlasticStrain.at(6) = strain.at(6) - stress.at(6) / ( iz * this->e ); - status->letTempPlasticLatticeStrainBe(assemble< 6 >(tempPlasticStrain, { 0, 1, 2, 3, 4, 5}) ); - auto answer = assemble< 6 >(stress, { 0, 1, 2, 3, 4, 5}); - // answer.at(2) = shearareay * g * reducedStrain.at(2); - // answer.at(3) = shearareaz * g * reducedStrain.at(3); + status->letTempPlasticLatticeStrainBe(tempPlasticStrain); - return answer; - } + return stress; +} - Interface * - LatticeFrameConcretePlastic::giveInterface( InterfaceType type ) - { - return nullptr; - } +Interface * +LatticeFrameConcretePlastic::giveInterface(InterfaceType type) +{ + return nullptr; +} // - void - LatticeFrameConcretePlastic::performRegularReturn( FloatArrayF<6> & stress, LatticeFrameConcretePlastic_ReturnResult, const FloatArrayF<6> &k, - double yieldValue, - GaussPoint *gp, - TimeStep *tStep ) const - { - // Use material specific status - auto status = static_cast( this->giveStatus( gp ) ); - - double deltaLambda = 0.; - - auto trialStress = stress; - auto tempStress = trialStress; - - // initialise unknowns - FloatArrayF<7> unknowns; - unknowns.at( 1 ) = trialStress.at( 1 ); - unknowns.at( 2 ) = trialStress.at( 2 ); - unknowns.at( 3 ) = trialStress.at( 3 ); - unknowns.at( 4 ) = trialStress.at( 4 ); - unknowns.at( 5 ) = trialStress.at( 5 ); - unknowns.at( 6 ) = trialStress.at( 6 ); - unknowns.at( 7 ) = 0.; - - yieldValue = computeYieldValue( tempStress, k, gp, tStep ); - - // initiate residuals - FloatArrayF<7> residuals; - residuals.at( 7 ) = yieldValue; - double normOfResiduals = 1.; // just to get into the loop - int iterationCount = 0; - while ( normOfResiduals > yieldTol ) { - iterationCount++; - if ( iterationCount == newtonIter ) { - status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); - return; - } - - - double ax; - if ( k.at( 1 ) == 1 ) { - ax = nx0; - } else { - ax = nx01; - } - double ay; - if ( k.at( 2 ) == 1 ) { - ay = vy0; - } else { - ay = vy01; - } - double az; - if ( k.at( 3 ) == 1 ) { - az = vz0; - } else { - az = vz01; - } - double bx; +void +LatticeFrameConcretePlastic::performRegularReturn(FloatArrayF< 6 > &stress, LatticeFrameConcretePlastic_ReturnResult, const FloatArrayF< 6 > &k, + double yieldValue, + GaussPoint *gp, + TimeStep *tStep) const +{ + // Use material specific status + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); - if ( k.at( 4 ) == 1 ) { - bx = mx0; - } else { - bx = mx01; - } - double by; + double deltaLambda = 0.; - if ( k.at( 5 ) == 1 ) { - by = my0; - } else { - by = my01; - } + auto trialStress = stress; + auto tempStress = trialStress; - double bz; + // initialise unknowns + FloatArrayF< 7 >unknowns; + unknowns.at(1) = trialStress.at(1); + unknowns.at(2) = trialStress.at(2); + unknowns.at(3) = trialStress.at(3); + unknowns.at(4) = trialStress.at(4); + unknowns.at(5) = trialStress.at(5); + unknowns.at(6) = trialStress.at(6); + unknowns.at(7) = 0.; - if ( k.at( 6 ) == 1 ) { - bz = mz0; - } else { - bz = mz01; - } + yieldValue = computeYieldValue(tempStress, k, gp, tStep); - FloatArrayF<7> residualsNorm; - residualsNorm.at( 1 ) = residuals.at( 1 ) / ax; - residualsNorm.at( 2 ) = residuals.at( 2 ) / ay; - residualsNorm.at( 3 ) = residuals.at( 3 ) / az; - residualsNorm.at( 4 ) = residuals.at( 4 ) / bx; - residualsNorm.at( 5 ) = residuals.at( 5 ) / by; - residualsNorm.at( 6 ) = residuals.at( 6 ) / bz; - residualsNorm.at( 7 ) = residuals.at( 7 ); - normOfResiduals = norm( residualsNorm ); - printf( "normOfResiduals=%e\n", normOfResiduals ); - if ( std::isnan( normOfResiduals ) ) { - status->letTempReturnResultBe( LatticeFrameConcretePlasticStatus::RR_NotConverged ); - return; - } + // initiate residuals + FloatArrayF< 7 >residuals; + residuals.at(7) = yieldValue; + double normOfResiduals = 1.; // just to get into the loop + int iterationCount = 0; + while ( normOfResiduals > yieldTol ) { + iterationCount++; + if ( iterationCount == newtonIter ) { + status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); + return; + } - if ( normOfResiduals > yieldTol ) { - auto jacobian = computeJacobian( tempStress, k, deltaLambda, gp, tStep ); - auto solution = solve_check( jacobian, residuals ); - if ( solution.first ) { - unknowns -= solution.second; - } else { - status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_NotConverged ); - } - unknowns.at( 7 ) = max( unknowns.at( 7 ), 0. ); // Keep deltaLambda greater than zero! - - /* Update increments final values and DeltaLambda*/ - tempStress.at( 1 ) = unknowns.at( 1 ); - tempStress.at( 2 ) = unknowns.at( 2 ); - tempStress.at( 3 ) = unknowns.at( 3 ); - tempStress.at( 4 ) = unknowns.at( 4 ); - tempStress.at( 5 ) = unknowns.at( 5 ); - tempStress.at( 6 ) = unknowns.at( 6 ); - deltaLambda = unknowns.at( 7 ); - - /* Compute the fVector*/ - auto FVector = computeFVector( tempStress, k, gp, tStep ); - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast( gp->giveElement() ) )->giveArea(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); - const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - - - - residuals.at( 1 ) = tempStress.at( 1 ) - trialStress.at( 1 ) + area * this->e* deltaLambda * FVector.at( 1 ); - residuals.at( 2 ) = tempStress.at( 2 ) - trialStress.at( 2 ) + shearareay * g * deltaLambda * FVector.at( 2 ); - residuals.at( 3 ) = tempStress.at( 3 ) - trialStress.at( 3 ) + shearareaz * g * deltaLambda * FVector.at( 3 ); - residuals.at( 4 ) = tempStress.at( 4 ) - trialStress.at( 4 ) + ik * g * deltaLambda * FVector.at( 4 ); - residuals.at( 5 ) = tempStress.at( 5 ) - trialStress.at( 5 ) + iy * this->e * deltaLambda * FVector.at( 5 ); - residuals.at( 6 ) = tempStress.at( 6 ) - trialStress.at( 6 ) + iz * this->e * deltaLambda * FVector.at( 6 ); - residuals.at( 7 ) = computeYieldValue( tempStress, k, gp, tStep ); - } + double ax; + if ( k.at(1) == 1 ) { + ax = nx0; + } else { + ax = nx01; } - status->letTempReturnResultBe( LatticeFrameConcretePlastic::RR_Converged ); - stress = tempStress; - } - - FloatMatrixF<7, 7> - LatticeFrameConcretePlastic::computeJacobian( const FloatArrayF<6> &stress, const FloatArrayF<6> &k, - const double deltaLambda, - GaussPoint *gp, - TimeStep *tStep ) const - { - auto dMMatrix = computeDMMatrix( stress, k, gp, tStep ); - auto fVector = computeFVector( stress, k, gp, tStep ); - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast( gp->giveElement() ) )->giveArea(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); - const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); - - /* Compute matrix*/ - FloatMatrixF<7, 7> jacobian; - jacobian.at( 1, 1 ) = 1. + this->e * area* deltaLambda * dMMatrix.at( 1, 1 ); - jacobian.at( 1, 2 ) = 0.; - jacobian.at( 1, 3 ) = 0.; - jacobian.at( 1, 4 ) = 0.; - jacobian.at( 1, 5 ) = 0.; - jacobian.at( 1, 6 ) = 0.; - jacobian.at( 1, 7 ) = this->e * area * fVector.at( 1 ); - - jacobian.at( 2, 1 ) = 0.; - jacobian.at( 2, 2 ) = 1. + shearareay * g * deltaLambda * dMMatrix.at( 2, 2 ); - jacobian.at( 2, 3 ) = 0.; - jacobian.at( 2, 4 ) = 0.; - jacobian.at( 2, 5 ) = 0.; - jacobian.at( 2, 6 ) = 0.; - jacobian.at( 2, 7 ) = shearareay * g * fVector.at( 2 ); - - jacobian.at( 3, 1 ) = 0.; - jacobian.at( 3, 2 ) = 0.; - jacobian.at( 3, 3 ) = 1. + shearareaz * g * deltaLambda * dMMatrix.at( 3, 3 ); - jacobian.at( 3, 4 ) = 0.; - jacobian.at( 3, 5 ) = 0.; - jacobian.at( 3, 6 ) = 0.; - jacobian.at( 3, 7 ) = shearareaz * g * fVector.at( 3 ); - - jacobian.at( 4, 1 ) = 0.; - jacobian.at( 4, 2 ) = 0.; - jacobian.at( 4, 3 ) = 0.; - jacobian.at( 4, 4 ) = 1. + ik * g * deltaLambda * dMMatrix.at( 4, 4 ); - jacobian.at( 4, 5 ) = 0.; - jacobian.at( 4, 6 ) = 0.; - jacobian.at( 4, 7 ) = ik * g * fVector.at(4); - - jacobian.at( 5, 1 ) = 0.; - jacobian.at( 5, 2 ) = 0.; - jacobian.at( 5, 3 ) = 0.; - jacobian.at( 5, 4 ) = 0.; - jacobian.at( 5, 5 ) = 1. + iy * this->e * deltaLambda * dMMatrix.at( 5, 5 ); - jacobian.at( 5, 6 ) = 0.; - jacobian.at( 5, 7 ) = iy * this->e * fVector.at(5); - - - jacobian.at( 6, 1 ) = 0.; - jacobian.at( 6, 2 ) = 0.; - jacobian.at( 6, 3 ) = 0.; - jacobian.at( 6, 4 ) = 0.; - jacobian.at( 6, 5 ) = 0.; - jacobian.at( 6, 6 ) = 1. + this->e * iz * deltaLambda * dMMatrix.at( 6, 6 ); - jacobian.at( 6, 7 ) = this->e * iz* fVector.at( 6 ); - - jacobian.at( 7, 1 ) = fVector.at( 1 ); - jacobian.at( 7, 2 ) = fVector.at( 2 ); - jacobian.at( 7, 3 ) = fVector.at( 3 ); - jacobian.at( 7, 4 ) = fVector.at( 4 ); - jacobian.at( 7, 5 ) = fVector.at( 5 ); - jacobian.at( 7, 6 ) = fVector.at( 6 ); - jacobian.at( 7, 7 ) = 0.; - - return jacobian; - } - FloatArrayF<6> - LatticeFrameConcretePlastic::giveFrameForces3d( const FloatArrayF<6> &originalStrain, GaussPoint *gp, TimeStep *tStep ) - { - - auto status = static_cast( this->giveStatus( gp ) ); - auto Strain = originalStrain; - auto thermalStrain = this->computeStressIndependentStrainVector( gp, tStep, VM_Total ); - if ( thermalStrain.giveSize() ) { - Strain -= FloatArrayF<6>( thermalStrain ); + double ay; + if ( k.at(2) == 1 ) { + ay = vy0; + } else { + ay = vy01; } - auto stress = this->performPlasticityReturn( gp, Strain, tStep ); - auto PlasticStrain = status->giveTempPlasticLatticeStrain()[{ 0, 1, 2, 3, 4, 5 }]; - double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - double equivalentStrain=sqrt(pow (PlasticStrain.at(1), 2 )+ pow (PlasticStrain.at(2), 2 )+ pow (PlasticStrain.at(3), 2 )+pow (PlasticStrain.at(4), 2 )+ pow (PlasticStrain.at(5), 2. )+ pow (PlasticStrain.at(6), 2 )); - double kappaD = 0.0; - - if (equivalentStrain-wu/le > status->giveKappaD()){ - kappaD = equivalentStrain-wu/le; - } else {kappaD = status->giveKappaD();} - - double omega = 0.0; - if ( kappaD*le < wu ) { - omega = 0.; + double az; + if ( k.at(3) == 1 ) { + az = vz0; + } else { + az = vz01; } + double bx; - else if ( kappaD*le > wu && kappaD*le < wfone ) - { - omega =1-qzero-(1-qzero)*(wfone-kappaD*le)/(wfone-wu); + if ( k.at(4) == 1 ) { + bx = mx0; + } else { + bx = mx01; } - else - { - omega =1-qzero*(wftwo-kappaD*le)/(wftwo-wfone); + double by; + + if ( k.at(5) == 1 ) { + by = my0; + } else { + by = my01; } + double bz; - if ( omega > 1.0 ) { - omega = 1.;} - else if ( omega < 0.0 ) { - omega = 0.; + if ( k.at(6) == 1 ) { + bz = mz0; + } else { + bz = mz01; } - stress*= (1-omega); - + FloatArrayF< 7 >residualsNorm; + residualsNorm.at(1) = residuals.at(1) / ax; + residualsNorm.at(2) = residuals.at(2) / ay; + residualsNorm.at(3) = residuals.at(3) / az; + residualsNorm.at(4) = residuals.at(4) / bx; + residualsNorm.at(5) = residuals.at(5) / by; + residualsNorm.at(6) = residuals.at(6) / bz; + residualsNorm.at(7) = residuals.at(7); + normOfResiduals = norm(residualsNorm); + // printf( "normOfResiduals=%e\n", normOfResiduals ); + if ( std::isnan(normOfResiduals) ) { + status->letTempReturnResultBe(LatticeFrameConcretePlasticStatus::RR_NotConverged); + return; + } - status->letTempLatticeStrainBe( originalStrain ); - status->letTempLatticeStrainBe( Strain ); - status->letTempLatticeStressBe( stress ); - status->setKappaD(kappaD); - status->setDamage(omega); + if ( normOfResiduals > yieldTol ) { + auto jacobian = computeJacobian(tempStress, k, deltaLambda, gp, tStep); - return stress; + auto solution = solve_check(jacobian, residuals); + if ( solution.first ) { + unknowns -= solution.second; + } else { + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_NotConverged); + } + unknowns.at(7) = max(unknowns.at(7), 0.); // Keep deltaLambda greater than zero! + + /* Update increments final values and DeltaLambda*/ + tempStress.at(1) = unknowns.at(1); + tempStress.at(2) = unknowns.at(2); + tempStress.at(3) = unknowns.at(3); + tempStress.at(4) = unknowns.at(4); + tempStress.at(5) = unknowns.at(5); + tempStress.at(6) = unknowns.at(6); + deltaLambda = unknowns.at(7); + + /* Compute the fVector*/ + auto FVector = computeFVector(tempStress, k, gp, tStep); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + + residuals.at(1) = tempStress.at(1) - trialStress.at(1) + area * this->e * deltaLambda * FVector.at(1); + residuals.at(2) = tempStress.at(2) - trialStress.at(2) + shearareay * g * deltaLambda * FVector.at(2); + residuals.at(3) = tempStress.at(3) - trialStress.at(3) + shearareaz * g * deltaLambda * FVector.at(3); + residuals.at(4) = tempStress.at(4) - trialStress.at(4) + ik * g * deltaLambda * FVector.at(4); + residuals.at(5) = tempStress.at(5) - trialStress.at(5) + iy * this->e * deltaLambda * FVector.at(5); + residuals.at(6) = tempStress.at(6) - trialStress.at(6) + iz * this->e * deltaLambda * FVector.at(6); + residuals.at(7) = computeYieldValue(tempStress, k, gp, tStep); + } } + status->letTempReturnResultBe(LatticeFrameConcretePlastic::RR_Converged); + stress = tempStress; +} + +FloatMatrixF< 7, 7 > +LatticeFrameConcretePlastic::computeJacobian(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, + const double deltaLambda, + GaussPoint *gp, + TimeStep *tStep) const +{ + auto dMMatrix = computeDMMatrix(stress, k, gp, tStep); + auto fVector = computeFVector(stress, k, gp, tStep); + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + + /* Compute matrix*/ + FloatMatrixF< 7, 7 >jacobian; + jacobian.at(1, 1) = 1. + this->e * area * deltaLambda * dMMatrix.at(1, 1); + jacobian.at(1, 2) = 0.; + jacobian.at(1, 3) = 0.; + jacobian.at(1, 4) = 0.; + jacobian.at(1, 5) = 0.; + jacobian.at(1, 6) = 0.; + jacobian.at(1, 7) = this->e * area * fVector.at(1); + + jacobian.at(2, 1) = 0.; + jacobian.at(2, 2) = 1. + shearareay * g * deltaLambda * dMMatrix.at(2, 2); + jacobian.at(2, 3) = 0.; + jacobian.at(2, 4) = 0.; + jacobian.at(2, 5) = 0.; + jacobian.at(2, 6) = 0.; + jacobian.at(2, 7) = shearareay * g * fVector.at(2); + + jacobian.at(3, 1) = 0.; + jacobian.at(3, 2) = 0.; + jacobian.at(3, 3) = 1. + shearareaz * g * deltaLambda * dMMatrix.at(3, 3); + jacobian.at(3, 4) = 0.; + jacobian.at(3, 5) = 0.; + jacobian.at(3, 6) = 0.; + jacobian.at(3, 7) = shearareaz * g * fVector.at(3); + + jacobian.at(4, 1) = 0.; + jacobian.at(4, 2) = 0.; + jacobian.at(4, 3) = 0.; + jacobian.at(4, 4) = 1. + ik * g * deltaLambda * dMMatrix.at(4, 4); + jacobian.at(4, 5) = 0.; + jacobian.at(4, 6) = 0.; + jacobian.at(4, 7) = ik * g * fVector.at(4); + + jacobian.at(5, 1) = 0.; + jacobian.at(5, 2) = 0.; + jacobian.at(5, 3) = 0.; + jacobian.at(5, 4) = 0.; + jacobian.at(5, 5) = 1. + iy * this->e * deltaLambda * dMMatrix.at(5, 5); + jacobian.at(5, 6) = 0.; + jacobian.at(5, 7) = iy * this->e * fVector.at(5); + + + jacobian.at(6, 1) = 0.; + jacobian.at(6, 2) = 0.; + jacobian.at(6, 3) = 0.; + jacobian.at(6, 4) = 0.; + jacobian.at(6, 5) = 0.; + jacobian.at(6, 6) = 1. + this->e * iz * deltaLambda * dMMatrix.at(6, 6); + jacobian.at(6, 7) = this->e * iz * fVector.at(6); + + jacobian.at(7, 1) = fVector.at(1); + jacobian.at(7, 2) = fVector.at(2); + jacobian.at(7, 3) = fVector.at(3); + jacobian.at(7, 4) = fVector.at(4); + jacobian.at(7, 5) = fVector.at(5); + jacobian.at(7, 6) = fVector.at(6); + jacobian.at(7, 7) = 0.; + + return jacobian; +} - FloatMatrixF<6, 6> - LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix( MatResponseMode rmode, GaussPoint * gp, TimeStep * atTime ) const - { - static_cast( this->giveStatus( gp ) ); +FloatArrayF< 6 > +LatticeFrameConcretePlastic::giveFrameForces3d(const FloatArrayF< 6 > &originalStrain, GaussPoint *gp, TimeStep *tStep) +{ + auto status = static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + auto strain = originalStrain; + auto thermalStrain = this->computeStressIndependentStrainVector(gp, tStep, VM_Total); + if ( thermalStrain.giveSize() ) { + strain -= FloatArrayF< 6 >(thermalStrain); + } + auto stress = this->performPlasticityReturn(gp, strain, tStep); - double g = this->e / ( 2. * ( 1. + this->nu ) ); - const double area = ( static_cast( gp->giveElement() ) )->giveArea(); - const double shearareay = ( static_cast( gp->giveElement() ) )->giveShearAreaY(); - const double shearareaz = ( static_cast( gp->giveElement() ) )->giveShearAreaZ(); - const double ik = ( static_cast( gp->giveElement() ) )->giveIk(); - const double iy = ( static_cast( gp->giveElement() ) )->giveIy(); - const double iz = ( static_cast( gp->giveElement() ) )->giveIz(); + auto tempPlasticStrain = status->giveTempPlasticLatticeStrain(); + double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - FloatArrayF<6> d = { - this->e * area, - g * shearareay, - g * shearareaz, - g * ik, - this->e * iy, - this->e * iz - }; + double equivalentStrain = sqrt(pow(tempPlasticStrain.at(1), 2) + pow(tempPlasticStrain.at(2), 2) + pow(tempPlasticStrain.at(3), 2) + pow(tempPlasticStrain.at(4), 2) + pow(tempPlasticStrain.at(5), 2.) + pow(tempPlasticStrain.at(6), 2) ) - wu / le; + // printf("equivalentStrain = %e, wu/le = %e, le = %e\n", equivalentStrain, wu/le, le); - return diag( d ); - } + double tempKappaD = 0.0; - LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus( int n, Domain *d, GaussPoint *g ) : - LatticeMaterialStatus( g ) - { + if ( equivalentStrain > status->giveKappaD() ) { + tempKappaD = equivalentStrain; + } else { + tempKappaD = status->giveKappaD(); } - void - LatticeFrameConcretePlasticStatus::initTempStatus() - { - LatticeMaterialStatus::initTempStatus(); - this->tempKappaD = this->kappaD; - this->tempDamage = this->damage; - this->tempKappaDOne = this->kappaDOne; - this->tempDamageOne = this->damageOne; + + double omega = 0.0; + if ( tempKappaD <= 0. ) { + omega = 0.; + } else if ( tempKappaD > 0. ) { + omega = 1. - exp(-tempKappaD * le / ( wfone - wu ) ); + } else { + printf("Should not be here\n"); } - void - LatticeFrameConcretePlasticStatus::updateYourself(TimeStep *atTime) - // - // updates variables (nonTemp variables describing situation at previous equilibrium state) - // after a new equilibrium state has been reached - // temporary variables are having values corresponding to newly reached equilibrium. - // - { - LatticeMaterialStatus::updateYourself(atTime); - this->kappaD = this->tempKappaD; - this->damage = this->tempDamage; - this->kappaDOne = this->tempKappaDOne; - this->damageOne = this->tempDamageOne; - } - void - LatticeFrameConcretePlasticStatus::printOutputAt( FILE * file, TimeStep * tStep ) const - { - LatticeMaterialStatus::printOutputAt( file, tStep ); - - fprintf( file, "plasticStrains " ); - for ( double s : this->plasticLatticeStrain ) { - fprintf( file, "% .8e ", s ); - } + + if ( omega > 1.0 ) { + omega = 1.; + } else if ( omega < 0.0 ) { + omega = 0.; } - void - LatticeFrameConcretePlasticStatus::saveContext(DataStream &stream, ContextMode mode) - // - // saves full information stored in this Status - // no temp variables stored - // - { - LatticeMaterialStatus::saveContext(stream, mode); + stress *= ( 1. - omega ); + status->letTempLatticeStrainBe(originalStrain); + status->letTempReducedLatticeStrainBe(strain); + status->letTempLatticeStressBe(stress); + status->setTempKappaD(tempKappaD); + status->setTempDamage(omega); - if ( !stream.write(& kappaD, 1) ) { - THROW_CIOERR(CIO_IOERR); - } + return stress; +} - if ( !stream.write(& damage, 1) ) { - THROW_CIOERR(CIO_IOERR); - } - if ( !stream.write(& kappaDOne, 1) ) { - THROW_CIOERR(CIO_IOERR); - } - if ( !stream.write(& damageOne, 1) ) { - THROW_CIOERR(CIO_IOERR); - } +FloatMatrixF< 6, 6 > +LatticeFrameConcretePlastic::give3dFrameStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const +{ + static_cast< LatticeFrameConcretePlasticStatus * >( this->giveStatus(gp) ); + + double g = this->e / ( 2. * ( 1. + this->nu ) ); + const double area = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveArea(); + const double shearareay = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaY(); + const double shearareaz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveShearAreaZ(); + const double ik = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIk(); + const double iy = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIy(); + const double iz = ( static_cast< LatticeStructuralElement * >( gp->giveElement() ) )->giveIz(); + + + FloatArrayF< 6 >d = { + this->e * area, + g *shearareay, + g *shearareaz, + g *ik, + this->e * iy, + this->e * iz + }; + + return diag(d); +} + +LatticeFrameConcretePlasticStatus::LatticeFrameConcretePlasticStatus(int n, Domain *d, GaussPoint *g) : + LatticeMaterialStatus(g) +{} +void +LatticeFrameConcretePlasticStatus::initTempStatus() +{ + LatticeMaterialStatus::initTempStatus(); + this->tempKappaD = this->kappaD; + this->tempDamage = this->damage; +} + +void +LatticeFrameConcretePlasticStatus::updateYourself(TimeStep *atTime) +// +// updates variables (nonTemp variables describing situation at previous equilibrium state) +// after a new equilibrium state has been reached +// temporary variables are having values corresponding to newly reached equilibrium. +// +{ + LatticeMaterialStatus::updateYourself(atTime); + this->kappaD = this->tempKappaD; + this->damage = this->tempDamage; +} + +void +LatticeFrameConcretePlasticStatus::printOutputAt(FILE *file, TimeStep *tStep) const +{ + LatticeMaterialStatus::printOutputAt(file, tStep); + + fprintf(file, "plasticStrains "); + for ( double s : this->plasticLatticeStrain ) { + fprintf(file, "% .8e ", s); + } + fprintf(file, "kappad %.8e ", this->kappaD); + fprintf(file, "damage %.8e ", this->damage); +} + +void +LatticeFrameConcretePlasticStatus::saveContext(DataStream &stream, ContextMode mode) +// +// saves full information stored in this Status +// no temp variables stored +// +{ + LatticeMaterialStatus::saveContext(stream, mode); + + + + if ( !stream.write(& kappaD, 1) ) { + THROW_CIOERR(CIO_IOERR); } + if ( !stream.write(& damage, 1) ) { + THROW_CIOERR(CIO_IOERR); + } +} - void - LatticeFrameConcretePlasticStatus::restoreContext(DataStream &stream, ContextMode mode) - // - // restores full information stored in stream to this Status - // - { - LatticeMaterialStatus::restoreContext(stream, mode); - if ( !stream.read(& kappaD, 1) ) { - THROW_CIOERR(CIO_IOERR); - } +void +LatticeFrameConcretePlasticStatus::restoreContext(DataStream &stream, ContextMode mode) +// +// restores full information stored in stream to this Status +// +{ + LatticeMaterialStatus::restoreContext(stream, mode); - if ( !stream.read(& damage, 1) ) { - THROW_CIOERR(CIO_IOERR); - } - if ( !stream.read(& kappaDOne, 1) ) { - THROW_CIOERR(CIO_IOERR); - } + if ( !stream.read(& kappaD, 1) ) { + THROW_CIOERR(CIO_IOERR); + } - if ( !stream.read(& damageOne, 1) ) { - THROW_CIOERR(CIO_IOERR); - } + if ( !stream.read(& damage, 1) ) { + THROW_CIOERR(CIO_IOERR); } } +} diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index 92a06bb13..fa6d56bc2 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -10,7 +10,7 @@ * * OOFEM : Object Oriented Finite Element Code * - * Copyright (C) 1993 - 2019 Borek Patzak + * Copyright (C) 1993 - 2022 Borek Patzak * * * @@ -42,7 +42,7 @@ #include "strainvector.h" #include "stressvector.h" #include "latticematstatus.h" -///@name Input fields for LatticeFrameConcrePlastic +///@name Input fields for LatticeFrameConcretePlastic //@{ #define _IFT_LatticeFrameConcretePlastic_Name "LatticeFrameConcretePlastic" #define _IFT_LatticeFrameConcretePlastic_talpha "talpha" @@ -68,7 +68,6 @@ #define _IFT_LatticeFrameConcretePlastic_wfone "wfone" #define _IFT_LatticeFrameConcretePlastic_wftwo "wftwo" #define _IFT_LatticeFrameConcretePlastic_qzero "qzero" - //@} namespace oofem { @@ -90,16 +89,15 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus RR_NotConverged, RR_Converged, }; - double kappaD; - double tempKappaD; - double kappaDOne; - double tempKappaDOne; - double damage; - double tempDamage; - double damageOne; - double tempDamageOne; + protected: + double kappaD = 0.; + double tempKappaD = 0.; + double damage = 0.; + double tempDamage = 0.; + + int tempReturnResult = LatticeFrameConcretePlasticStatus::RR_NotConverged; public: @@ -116,29 +114,17 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus int giveTempReturnResult() const { return tempReturnResult; } - double giveKappaD() const { return tempKappaD; } - - double giveTempKappaD() const { return tempKappaD; } - - double giveKappaDOne() const { return tempKappaDOne; } - - double giveTempKappaDOne() const { return tempKappaDOne; } - - void setKappaD(double newKappa) { tempKappaD = newKappa; } + double giveKappaD() const { return this->kappaD; } - void setKappaDOne(double newKappaOne) { tempKappaDOne = newKappaOne; } + double giveTempKappaD() const { return this->tempKappaD; } - double giveDamage() const { return damage; } + void setTempKappaD(double newKappa) { this->tempKappaD = newKappa; } - double giveTempDamage() const { return tempDamage; } + double giveDamage() const { return this->damage; } - void setDamage(double newDamage) { tempDamage = newDamage; } + double giveTempDamage() const { return this->tempDamage; } - double giveDamageOne() const { return damageOne; } - - double giveTempDamageOne() const { return tempDamageOne; } - - void setDamageOne(double newDamageOne) { tempDamageOne = newDamageOne; } + void setTempDamage(double newDamage) { this->tempDamage = newDamage; } void initTempStatus() override; @@ -147,12 +133,11 @@ class LatticeFrameConcretePlasticStatus : public LatticeMaterialStatus void saveContext(DataStream &stream, ContextMode mode) override; void restoreContext(DataStream &stream, ContextMode mode) override; - }; /** - * This class implements a local random linear elastic model for lattice elements. + * This class implements a concrete plasticity model for concrete for frame elements. */ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial @@ -182,7 +167,7 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///maximum bending moment about x-axis mz0 double mz0; - + ///maximum axial force in x-axis x-axis nx01 double nx01; @@ -190,7 +175,6 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial double vz01; - ///maximum bending moment about x-axis mx01 double mx01; @@ -215,7 +199,6 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///wu double wu; - ///wfone double wfone; @@ -226,21 +209,16 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial double qzero; - - enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known}; - // mutable LatticeFrameConcretePlastic_ReturnResult returnResult = RR_NotConverged; /// FIXME: This must be removed. Not thread safe. Shouldn't be stored at all. - // enum LatticeFrameConcretePlastic_ReturnResult { RR_WrongSurface}; + enum LatticeFrameConcretePlastic_ReturnResult { RR_NotConverged, RR_Converged, RR_Unknown, RR_known }; double initialYieldStress = 0.; - // - public: LatticeFrameConcretePlastic(int n, Domain *d) : LatticeStructuralMaterial(n, d) { }; FloatArrayF< 6 >computeFVector(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; - FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + FloatMatrixF< 6, 6 >computeDMMatrix(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; @@ -255,11 +233,11 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial void giveSwitches(IntArray &answer, int k); - double computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF<6> &k, GaussPoint *gp, TimeStep *tStep) const; + double computeYieldValue(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, GaussPoint *gp, TimeStep *tStep) const; FloatMatrixF< 7, 7 >computeJacobian(const FloatArrayF< 6 > &stress, const FloatArrayF< 6 > &k, const double deltaLambda, GaussPoint *gp, TimeStep *tStep) const; - IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k, GaussPoint *gp, TimeStep *tStep ) const; + IntArray checkStatus(const FloatArrayF< 6 > &stress, IntArray &k, GaussPoint *gp, TimeStep *tStep) const; FloatArrayF< 6 >giveFrameForces3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) override; @@ -282,9 +260,9 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial MaterialStatus *giveStatus(GaussPoint *gp) const override; protected: - const FloatArray checkStatus( FloatArrayF<6> f, GaussPoint *pPoint, TimeStep *pStep ) const; - IntArray checkStatus( const FloatArrayF<6> &stress, IntArray &k ) const; - const FloatArrayF<6> checkTransition( const FloatArrayF<6> &stress, GaussPoint *gp, TimeStep *tStep ) const; + const FloatArray checkStatus(FloatArrayF< 6 >f, GaussPoint *pPoint, TimeStep *pStep) const; + IntArray checkStatus(const FloatArrayF< 6 > &stress, IntArray &k) const; + const FloatArrayF< 6 >checkTransition(const FloatArrayF< 6 > &stress, GaussPoint *gp, TimeStep *tStep) const; }; } // end namespace oofem From 10ecc87bfcebf517d8d69bf9bf86880b684f6125 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Wed, 13 Oct 2021 17:03:37 +0100 Subject: [PATCH 23/60] small clean up --- src/sm/Elements/LatticeElements/latticeframe3d.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d.C b/src/sm/Elements/LatticeElements/latticeframe3d.C index bd37198bb..abf39ae50 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d.C @@ -101,14 +101,14 @@ LatticeFrame3d::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, i answer.at(2, 3) = 0.; answer.at(2, 4) = 0.; answer.at(2, 5) = 0; - answer.at(2, 6) = -this->length*(1-this->s)/2.; + answer.at(2, 6) = -this->length*(1.-this->s)/2.; //Second node answer.at(2, 7) = 0.; answer.at(2, 8) = 1.; answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - answer.at(2, 12) = -this->length*(1+this->s)/2.; + answer.at(2, 12) = -this->length*(1.+this->s)/2.; //Shear displacement jump in z-plane //first node @@ -116,14 +116,14 @@ LatticeFrame3d::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, i answer.at(3, 2) = 0.; answer.at(3, 3) = -1.; answer.at(3, 4) = 0.; - answer.at(3, 5) = this->length*(1-this->s)/2.; + answer.at(3, 5) = this->length*(1.-this->s)/2.; answer.at(3, 6) = 0.; //Second node answer.at(3, 7) = 0.; answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - answer.at(3, 11) = this->length*(1+this->s)/2.; + answer.at(3, 11) = this->length*(1.+this->s)/2.; answer.at(3, 12) = 0.; //Rotation around x-axis From 008127495e45754f8ff8388f751f90c75ea79265 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 18 Aug 2022 11:37:04 +0100 Subject: [PATCH 24/60] reviewCode --- .../latticeframeconcreteplastic.C | 16 ++++++++++------ .../latticeframeconcreteplastic.h | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index b5c60eba8..9ce843dd2 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -120,8 +120,8 @@ void LatticeFrameConcretePlastic::initializeFrom(InputRecord &ir) // wu IR_GIVE_OPTIONAL_FIELD(ir, this->wu, _IFT_LatticeFrameConcretePlastic_wu); - // wfone - IR_GIVE_FIELD(ir, wfone, _IFT_LatticeFrameConcretePlastic_wfone); + // wf + IR_GIVE_FIELD(ir, wf, _IFT_LatticeFrameConcretePlastic_wf); } MaterialStatus * LatticeFrameConcretePlastic::CreateStatus(GaussPoint *gp) const @@ -788,7 +788,9 @@ LatticeFrameConcretePlastic::giveFrameForces3d(const FloatArrayF< 6 > &originalS double le = static_cast< LatticeStructuralElement * >( gp->giveElement() )->giveLength(); - double equivalentStrain = sqrt(pow(tempPlasticStrain.at(1), 2) + pow(tempPlasticStrain.at(2), 2) + pow(tempPlasticStrain.at(3), 2) + pow(tempPlasticStrain.at(4), 2) + pow(tempPlasticStrain.at(5), 2.) + pow(tempPlasticStrain.at(6), 2) ) - wu / le; + //double equivalentStrain = sqrt(pow(tempPlasticStrain.at(1), 2) + pow(tempPlasticStrain.at(2), 2) + pow(tempPlasticStrain.at(3), 2) + + // pow(tempPlasticStrain.at(4), 2) + pow(tempPlasticStrain.at(5), 2.) + pow(tempPlasticStrain.at(6), 2) ) - wu / le; + double equivalentStrain = sqrt(pow(tempPlasticStrain.at(4), 2) + pow(tempPlasticStrain.at(5), 2.) + pow(tempPlasticStrain.at(6), 2) ) - wu / le; // printf("equivalentStrain = %e, wu/le = %e, le = %e\n", equivalentStrain, wu/le, le); double tempKappaD = 0.0; @@ -803,7 +805,7 @@ LatticeFrameConcretePlastic::giveFrameForces3d(const FloatArrayF< 6 > &originalS if ( tempKappaD <= 0. ) { omega = 0.; } else if ( tempKappaD > 0. ) { - omega = 1. - exp(-tempKappaD * le / ( wfone - wu ) ); + omega = 1. - exp(-tempKappaD * le / ( wf ) ); } else { printf("Should not be here\n"); } @@ -885,8 +887,10 @@ LatticeFrameConcretePlasticStatus::printOutputAt(FILE *file, TimeStep *tStep) co for ( double s : this->plasticLatticeStrain ) { fprintf(file, "% .8e ", s); } - fprintf(file, "kappad %.8e ", this->kappaD); - fprintf(file, "damage %.8e ", this->damage); + //fprintf(file, "kappad %.8e ", this->kappaD); + // fprintf(file, "damage %.8e ", this->damage); + fprintf(file, ", kappaD %.8e, damage %.8e \n", this->kappaD, this->damage); + } void diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h index fa6d56bc2..bb75de887 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.h @@ -65,7 +65,7 @@ #define _IFT_LatticeFrameConcretePlastic_sub "sub" #define _IFT_LatticeFrameConcretePlastic_plastic "plastic" #define _IFT_LatticeFrameConcretePlastic_wu "wu" -#define _IFT_LatticeFrameConcretePlastic_wfone "wfone" +#define _IFT_LatticeFrameConcretePlastic_wf "wf" #define _IFT_LatticeFrameConcretePlastic_wftwo "wftwo" #define _IFT_LatticeFrameConcretePlastic_qzero "qzero" //@} @@ -199,10 +199,10 @@ class LatticeFrameConcretePlastic : public LatticeStructuralMaterial ///wu double wu; - ///wfone - double wfone; + ///wf + double wf; - ///wfone + ///wftwo double wftwo; ///qzero From 0c4e7238aee5434fbc53a28b5426427aaaa0faf3 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 18 Aug 2022 11:38:47 +0100 Subject: [PATCH 25/60] reviewCode2 --- src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C index 9ce843dd2..6d394b898 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframeconcreteplastic.C @@ -914,6 +914,7 @@ LatticeFrameConcretePlasticStatus::saveContext(DataStream &stream, ContextMode m } + void LatticeFrameConcretePlasticStatus::restoreContext(DataStream &stream, ContextMode mode) // From 39afe60741513a98e9193b9d4547d9032040f2f5 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Sat, 1 Oct 2022 21:03:07 +0100 Subject: [PATCH 26/60] newElement --- src/sm/CMakeLists.txt | 5 +- .../LatticeElements/latticeframe3dg.C | 530 ++++++++++++++++++ .../LatticeElements/latticeframe3dg.h | 126 +++++ 3 files changed, 659 insertions(+), 2 deletions(-) create mode 100644 src/sm/Elements/LatticeElements/latticeframe3dg.C create mode 100644 src/sm/Elements/LatticeElements/latticeframe3dg.h diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index dc3feb7b5..cd91da49c 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -96,6 +96,7 @@ set (sm_element Elements/LatticeElements/latticebeam3d.C Elements/LatticeElements/latticebeam3dboundary.C Elements/LatticeElements/latticeframe3d.C + Elements/LatticeElements/latticeframe3dg.C Elements/tet21ghostsolid.C Elements/quad1platesubsoil.C Elements/quad2platesubsoil.C @@ -424,8 +425,8 @@ set (sm ${sm_obsolete} ${sm_new} ${sm_boundary_conditions} - ${sm_quasicontinuum} - ) + ${sm_quasicontinuum} + Elements/LatticeElements/tStep.cpp Elements/LatticeElements/tStep.h) if (USE_PARALLEL) list (APPEND sm ${sm_parallel}) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C new file mode 100644 index 000000000..a8c93a095 --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -0,0 +1,530 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "domain.h" +#include "latticeframe3dg.h" +#include "../sm/Materials/LatticeMaterials/latticematstatus.h" +#include "node.h" +#include "material.h" +#include "gausspoint.h" +#include "gaussintegrationrule.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "intarray.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "mathfem.h" +#include "latticestructuralelement.h" +#include "contextioerr.h" +#include "datastream.h" +#include "classfactory.h" +#include "sm/CrossSections/latticecrosssection.h" + +#ifdef __OOFEG + #include "oofeggraphiccontext.h" + #include "../sm/Materials/structuralmaterial.h" +#endif + +namespace oofem { +REGISTER_Element(LatticeFrame3dg); + +LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeStructuralElement(n, aDomain) +{ + numberOfDofMans = 2; +} + +LatticeFrame3dg::~LatticeFrame3dg() +{} + +void +LatticeFrame3dg::computeBmatrixNAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui, TimeStep *tStep) +// Returns the strain matrix of the receiver. +{ + //Assemble Bmatrix (used to compute strains and rotations) + answer.resize(6, 12); + answer.zero(); + + this->length = computeLength(); + FloatArray u, stress, strain; + this->computeVectorOf(VM_Total, tStep, u); + if ( initialDisplacements ) { + u.subtract(* initialDisplacements); + } + + //Normal displacement jump in x-direction + //First node + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = sin(u.at(5))*this->length*(1.-this->s)/2.; + answer.at(1, 6) = sin(u.at(6))*this->length*(1.-this->s)/2.; + //Second node + answer.at(1, 7) = 1.; + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = sin(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(1, 12) = sin(u.at(6))*this->length*(1.+this->s)/2.; + + //Shear displacement jump in y-plane + //first node + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = 0.; + answer.at(2, 5) = 0; + answer.at(2, 6) = -cos(u.at(6))*this->length*(1.-this->s)/2.; + //Second node + answer.at(2, 7) = 0.; + answer.at(2, 8) = 1.; + answer.at(2, 9) = 0.; + answer.at(2, 10) = 0.; + answer.at(2, 11) = 0; + answer.at(2, 12) = -cos(u.at(6))*this->length*(1.+this->s)/2.; + + //Shear displacement jump in z-plane + //first node + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = 0.; + answer.at(3, 5) = cos(u.at(5))*this->length*(1.-this->s)/2.; + answer.at(3, 6) = 0.; + //Second node + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0.; + answer.at(3, 9) = 1.; + answer.at(3, 10) = 0.; + answer.at(3, 11) = cos(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(3, 12) = 0.; + + //Rotation around x-axis + //First node + answer.at(4, 1) = 0.; + answer.at(4, 2) = 0; + answer.at(4, 3) = 0.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0.; + answer.at(4, 9) = 0.; + answer.at(4, 10) = 1.; + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + //Rotation around y-axis + //First node + answer.at(5, 1) = 0.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = 0.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node + answer.at(5, 7) = 0.; + answer.at(5, 8) = 0.; + answer.at(5, 9) = 0.; + answer.at(5, 10) = 0.; + answer.at(5, 11) = 1.; + answer.at(5, 12) = 0.; + + //Rotation around z-axis + //First node + answer.at(6, 1) = 0.; + answer.at(6, 2) = 0.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node + answer.at(6, 7) = 0.; + answer.at(6, 8) = 0.; + answer.at(6, 9) = 0.; + answer.at(6, 10) = 0.; + answer.at(6, 11) = 0.; + answer.at(6, 12) = 1.; + + return; +} + +void +LatticeFrame3dg::giveGPCoordinates(FloatArray &coords) +{ + coords.resize(3); + coords = this->globalCentroid; + return; +} + +double +LatticeFrame3dg::giveLength() +{ + return this->length; +} + +void +LatticeFrame3dg::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +{ + answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); +} + +void +LatticeFrame3dg::computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) +{ + answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->giveFrameForces3d(strain, gp, tStep); +} + +int +LatticeFrame3dg::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) +{ + double ksi, n1, n2; + + ksi = lcoords.at(1); + n1 = ( 1. - ksi ) * 0.5; + n2 = ( 1. + ksi ) * 0.5; + + answer.resize(3); + answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); + answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); + answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); + + return 1; +} + +void +LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) +// Computes numerically the stiffness matrix of the receiver. +{ + FloatMatrix d, bi, bj, bjt, dbj, dij; + + this->length = computeLength(); + + answer.resize(12, 12); + answer.zero(); + this->computeBmatrixNAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + dbj.beProductOf(d, bj); + dbj.times(1. / length); + bjt.beTranspositionOf(bj); + answer.beProductOf(bjt, dbj); + + return; +} + +void LatticeFrame3dg::computeGaussPoints() +// Sets up the array of Gauss Points of the receiver. +{ + integrationRulesArray.resize(1); + integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 3) ); + integrationRulesArray [ 0 ]->SetUpPointsOnLine(1, _3dLattice); +} + +double LatticeFrame3dg::giveArea() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_Area, lc, this); +} + +double LatticeFrame3dg::giveIy() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); +} + +double LatticeFrame3dg::giveIz() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); +} + +double LatticeFrame3dg::giveIk() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); +} + +double LatticeFrame3dg::giveShearAreaY() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); +} + +double LatticeFrame3dg::giveShearAreaZ() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); +} +void +LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) +// Computes the vector containing the strains at the Gauss point gp of +// the receiver, at time step tStep. The nature of these strains depends +// on the element's type. +{ + FloatMatrix b; + FloatArray u; + + if ( !this->LatticeFrame3dg::isActivated(tStep) ) { + answer.resize(StructuralMaterial :: giveSizeOfVoigtSymVector(gp->giveMaterialMode() ) ); + answer.zero(); + return; + } + + LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto oldStrain =lmatStat ->giveLatticeStrain(); + + this->LatticeFrame3dg::computeBmatrixNAt(gp, b, tStep); + this->computeVectorOf(VM_Incremental, tStep, u); + + answer.beProductOf(b, u); + answer.times(1./this->length); + + + // subtract initial displacements, if defined + // if ( initialDisplacements ) { + // u.subtract(* initialDisplacements); + // } + answer += oldStrain; +} + +void +LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) +{ + FloatMatrix b, bt; + FloatArray u, stress, strain; + FloatArray incrementalStress; + FloatArray incrementalInternalForces; + FloatArray oldInternalForces; + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); + + this->length = computeLength(); + + this->computeVectorOf(VM_Total, tStep, u); + + //if ( initialDisplacements ) { + // u.subtract(* initialDisplacements); + //} + + //zero answer will resize accordingly when adding first contribution + //answer.clear(); + + this->LatticeFrame3dg::computeBmatrixNAt(gp, b , tStep); + bt.beTranspositionOf(b); + + this->computeStrainVector(strain, gp, tStep); + this->computeStressVector(stress, strain, gp, tStep); + + LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + + auto oldStress = lmatStat->giveLatticeStress(); + oldInternalForces.beProductOf(bt, oldStress); + + incrementalStress.beDifferenceOf(stress, oldStress); + + incrementalInternalForces.beProductOf(bt, incrementalStress); + + answer=oldInternalForces + incrementalInternalForces; + + + + // if ( useUpdatedGpRecord == 1 ) { + // LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + // stress = lmatStat->giveLatticeStress(); + // } else { + // if ( !this->isActivated(tStep) ) { + // strain.zero(); + // } + // strain.beProductOf(b, u); +// strain.times(1./this->length); + // this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + // } + + // answer.beProductOf(bt, stress); + + if ( !this->isActivated(tStep) ) { + answer.zero(); + return; + } +} + +bool +LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) +{ + FloatMatrix lcs; + answer.resize(12, 12); + answer.zero(); + + this->giveLocalCoordinateSystem(lcs); + for ( int i = 1; i <= 3; i++ ) { + for ( int j = 1; j <= 3; j++ ) { + answer.at(i, j) = lcs.at(i, j); + answer.at(i + 3, j + 3) = lcs.at(i, j); + answer.at(i + 6, j + 6) = lcs.at(i, j); + answer.at(i + 9, j + 9) = lcs.at(i, j); + } + } + + return 1; +} + +int +LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) +{ + FloatArray lx, ly, lz, help(3); + Node *nodeA, *nodeB; + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + + lx.beDifferenceOf(nodeB->giveCoordinates(), nodeA->giveCoordinates() ); + lx.normalize(); + + if ( this->referenceNode ) { + Node *refNode = this->giveDomain()->giveNode(this->referenceNode); + help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); + + lz.beVectorProductOf(lx, help); + lz.normalize(); + } else if ( this->zaxis.giveSize() > 0 ) { + lz = this->zaxis; + lz.add(lz.dotProduct(lx), lx); + lz.normalize(); + } else { + FloatMatrix rot(3, 3); + double theta = referenceAngle * M_PI / 180.0; + + rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); + rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); + rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); + + rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); + rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); + rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); + + rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); + rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); + rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); + + help.at(3) = 1.0; // up-vector + // here is ly is used as a temp var + if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical + ly = { + 0., 1., 0. + }; + } else { + ly.beVectorProductOf(lx, help); + } + lz.beProductOf(rot, ly); + lz.normalize(); + } + + ly.beVectorProductOf(lz, lx); + ly.normalize(); + + answer.resize(3, 3); + answer.zero(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(1, i) = lx.at(i); + answer.at(2, i) = ly.at(i); + answer.at(3, i) = lz.at(i); + } + + return 1; +} + + +void +LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const +{ + answer = { + D_u, D_v, D_w, R_u, R_v, R_w + }; +} + +void +LatticeFrame3dg::initializeFrom(InputRecord &ir) +{ + LatticeStructuralElement::initializeFrom(ir); + + referenceNode = 0; + referenceAngle = 0; + this->zaxis.clear(); + if ( ir.hasField(_IFT_LatticeFrame3dg_zaxis) ) { + IR_GIVE_FIELD(ir, this->zaxis, _IFT_LatticeFrame3dg_zaxis); + } else if ( ir.hasField(_IFT_LatticeFrame3dg_refnode) ) { + IR_GIVE_FIELD(ir, referenceNode, _IFT_LatticeFrame3dg_refnode); + if ( referenceNode == 0 ) { + OOFEM_WARNING("wrong reference node specified. Using default orientation."); + } + } else if ( ir.hasField(_IFT_LatticeFrame3dg_refangle) ) { + IR_GIVE_FIELD(ir, referenceAngle, _IFT_LatticeFrame3dg_refangle); + } else { + throw ValueInputException(ir, _IFT_LatticeFrame3dg_zaxis, "axis, reference node, or angle not set"); + } + + this->s = 0.; + IR_GIVE_OPTIONAL_FIELD(ir, s, _IFT_LatticeFrame3dg_s); + +} + + +double +LatticeFrame3dg::computeLength() +{ + double dx, dy, dz; + Node *nodeA, *nodeB; + + if ( length == 0. ) { + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); + dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); + dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); + length = sqrt(dx * dx + dy * dy + dz * dz); + } + + return length; +} + +void +LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) +// Returns the lumped mass matrix of the receiver. This expression is +// valid in both local and global axes. +{ + GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); + double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); + double halfMass = density * computeVolumeAround(gp) / 2.; + answer.resize(12, 12); + answer.zero(); + answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; + answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; +} +} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h new file mode 100644 index 000000000..158196fe3 --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -0,0 +1,126 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef latticeframe3dg_h +#define latticeframe3dg_h + +#include "latticestructuralelement.h" + +///@name Input fields for LatticeFrame3dg +//@{ +#define _IFT_LatticeFrame3dg_Name "latticeframe3dg" +#define _IFT_LatticeFrame3dg_refnode "refnode" +#define _IFT_LatticeFrame3dg_refangle "refangle" +#define _IFT_LatticeFrame3dg_zaxis "zaxis" +#define _IFT_LatticeFrame3dg_s "s" +//@} + +namespace oofem { +/** + * This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. + * Authors: Gumaa Abdelrhim and Peter Grassl + */ + +class LatticeFrame3dg : public LatticeStructuralElement +{ +protected: + int referenceNode; + FloatArray zaxis; + double referenceAngle = 0; + double kappa; + double length = 0.; + double iy, iz, ik; + double area, shearareay, shearareaz; + double s; + FloatMatrix localCoordinateSystem; + + FloatArray midPoint, globalCentroid, normal; + +public: + LatticeFrame3dg(int n, Domain *); + virtual ~LatticeFrame3dg(); + + + int giveLocalCoordinateSystem(FloatMatrix &answer) override; + + int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; + + double computeLength() override; + + double giveLength() override; + + double giveArea() override; + + double giveIy() override; + + double giveIz() override; + + double giveIk() override; + + double giveShearAreaY() override; + + double giveShearAreaZ() override; + + int computeNumberOfDofs() override { return 12; } + + void giveDofManDofIDMask(int inode, IntArray &) const override; + + virtual void giveGPCoordinates(FloatArray &coords); + + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } + const char *giveClassName() const override { return "latticeframe3dg"; } + void initializeFrom(InputRecord &ir) override; + + + Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + + +protected: + //void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + bool computeGtoLRotationMatrix(FloatMatrix &) override; + void computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) override; + void computeMassMatrix(FloatMatrix &answer, TimeStep *tStep) override + { this->computeLumpedMassMatrix(answer, tStep); } + void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; + void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) override; + void computeGaussPoints() override; + integrationDomain giveIntegrationDomain() const override { return _Line; } + virtual void computeBmatrixNAt( GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui, TimeStep *tStep ); + virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; + void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; + +}; +} // end namespace oofem +#endif From fe968a10a81b4e97d75b732c73735e87ac705e2e Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Thu, 6 Oct 2022 10:03:40 +0100 Subject: [PATCH 27/60] fix of nolinear frame3d element --- src/sm/CMakeLists.txt | 2 +- .../LatticeElements/latticeframe3dg.C | 239 +----------------- .../LatticeElements/latticeframe3dg.h | 45 +--- 3 files changed, 8 insertions(+), 278 deletions(-) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index cd91da49c..a894920f0 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -426,7 +426,7 @@ set (sm ${sm_new} ${sm_boundary_conditions} ${sm_quasicontinuum} - Elements/LatticeElements/tStep.cpp Elements/LatticeElements/tStep.h) + ) if (USE_PARALLEL) list (APPEND sm ${sm_parallel}) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index a8c93a095..6d89f640f 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -45,7 +45,7 @@ #include "floatarray.h" #include "floatarrayf.h" #include "mathfem.h" -#include "latticestructuralelement.h" +#include "latticeframe3d.h" #include "contextioerr.h" #include "datastream.h" #include "classfactory.h" @@ -59,7 +59,7 @@ namespace oofem { REGISTER_Element(LatticeFrame3dg); -LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeStructuralElement(n, aDomain) +LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) { numberOfDofMans = 2; } @@ -68,7 +68,7 @@ LatticeFrame3dg::~LatticeFrame3dg() {} void -LatticeFrame3dg::computeBmatrixNAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui, TimeStep *tStep) + LatticeFrame3dg::computeBmatrixNAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -181,48 +181,6 @@ LatticeFrame3dg::computeBmatrixNAt(GaussPoint *aGaussPoint, FloatMatrix &answer, return; } -void -LatticeFrame3dg::giveGPCoordinates(FloatArray &coords) -{ - coords.resize(3); - coords = this->globalCentroid; - return; -} - -double -LatticeFrame3dg::giveLength() -{ - return this->length; -} - -void -LatticeFrame3dg::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) -{ - answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); -} - -void -LatticeFrame3dg::computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) -{ - answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->giveFrameForces3d(strain, gp, tStep); -} - -int -LatticeFrame3dg::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) -{ - double ksi, n1, n2; - - ksi = lcoords.at(1); - n1 = ( 1. - ksi ) * 0.5; - n2 = ( 1. + ksi ) * 0.5; - - answer.resize(3); - answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); - answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); - answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); - - return 1; -} void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, @@ -246,44 +204,7 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo return; } -void LatticeFrame3dg::computeGaussPoints() -// Sets up the array of Gauss Points of the receiver. -{ - integrationRulesArray.resize(1); - integrationRulesArray [ 0 ].reset( new GaussIntegrationRule(1, this, 1, 3) ); - integrationRulesArray [ 0 ]->SetUpPointsOnLine(1, _3dLattice); -} - -double LatticeFrame3dg::giveArea() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_Area, lc, this); -} - -double LatticeFrame3dg::giveIy() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); -} - -double LatticeFrame3dg::giveIz() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); -} - -double LatticeFrame3dg::giveIk() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); -} - -double LatticeFrame3dg::giveShearAreaY() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); -} - -double LatticeFrame3dg::giveShearAreaZ() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); -} -void + void LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of // the receiver, at time step tStep. The nature of these strains depends @@ -375,156 +296,4 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, return; } } - -bool -LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) -{ - FloatMatrix lcs; - answer.resize(12, 12); - answer.zero(); - - this->giveLocalCoordinateSystem(lcs); - for ( int i = 1; i <= 3; i++ ) { - for ( int j = 1; j <= 3; j++ ) { - answer.at(i, j) = lcs.at(i, j); - answer.at(i + 3, j + 3) = lcs.at(i, j); - answer.at(i + 6, j + 6) = lcs.at(i, j); - answer.at(i + 9, j + 9) = lcs.at(i, j); - } - } - - return 1; -} - -int -LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) -{ - FloatArray lx, ly, lz, help(3); - Node *nodeA, *nodeB; - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - - lx.beDifferenceOf(nodeB->giveCoordinates(), nodeA->giveCoordinates() ); - lx.normalize(); - - if ( this->referenceNode ) { - Node *refNode = this->giveDomain()->giveNode(this->referenceNode); - help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); - - lz.beVectorProductOf(lx, help); - lz.normalize(); - } else if ( this->zaxis.giveSize() > 0 ) { - lz = this->zaxis; - lz.add(lz.dotProduct(lx), lx); - lz.normalize(); - } else { - FloatMatrix rot(3, 3); - double theta = referenceAngle * M_PI / 180.0; - - rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); - rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); - rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); - - rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); - rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); - rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); - - rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); - rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); - rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); - - help.at(3) = 1.0; // up-vector - // here is ly is used as a temp var - if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical - ly = { - 0., 1., 0. - }; - } else { - ly.beVectorProductOf(lx, help); - } - lz.beProductOf(rot, ly); - lz.normalize(); - } - - ly.beVectorProductOf(lz, lx); - ly.normalize(); - - answer.resize(3, 3); - answer.zero(); - for ( int i = 1; i <= 3; i++ ) { - answer.at(1, i) = lx.at(i); - answer.at(2, i) = ly.at(i); - answer.at(3, i) = lz.at(i); - } - - return 1; -} - - -void -LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const -{ - answer = { - D_u, D_v, D_w, R_u, R_v, R_w - }; -} - -void -LatticeFrame3dg::initializeFrom(InputRecord &ir) -{ - LatticeStructuralElement::initializeFrom(ir); - - referenceNode = 0; - referenceAngle = 0; - this->zaxis.clear(); - if ( ir.hasField(_IFT_LatticeFrame3dg_zaxis) ) { - IR_GIVE_FIELD(ir, this->zaxis, _IFT_LatticeFrame3dg_zaxis); - } else if ( ir.hasField(_IFT_LatticeFrame3dg_refnode) ) { - IR_GIVE_FIELD(ir, referenceNode, _IFT_LatticeFrame3dg_refnode); - if ( referenceNode == 0 ) { - OOFEM_WARNING("wrong reference node specified. Using default orientation."); - } - } else if ( ir.hasField(_IFT_LatticeFrame3dg_refangle) ) { - IR_GIVE_FIELD(ir, referenceAngle, _IFT_LatticeFrame3dg_refangle); - } else { - throw ValueInputException(ir, _IFT_LatticeFrame3dg_zaxis, "axis, reference node, or angle not set"); - } - - this->s = 0.; - IR_GIVE_OPTIONAL_FIELD(ir, s, _IFT_LatticeFrame3dg_s); - -} - - -double -LatticeFrame3dg::computeLength() -{ - double dx, dy, dz; - Node *nodeA, *nodeB; - - if ( length == 0. ) { - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); - dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); - dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); - length = sqrt(dx * dx + dy * dy + dz * dz); - } - - return length; -} - -void -LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) -// Returns the lumped mass matrix of the receiver. This expression is -// valid in both local and global axes. -{ - GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); - double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); - double halfMass = density * computeVolumeAround(gp) / 2.; - answer.resize(12, 12); - answer.zero(); - answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; - answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; -} } // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 158196fe3..b5170148b 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -35,7 +35,7 @@ #ifndef latticeframe3dg_h #define latticeframe3dg_h -#include "latticestructuralelement.h" +#include "latticeframe3d.h" ///@name Input fields for LatticeFrame3dg //@{ @@ -52,7 +52,7 @@ namespace oofem { * Authors: Gumaa Abdelrhim and Peter Grassl */ -class LatticeFrame3dg : public LatticeStructuralElement +class LatticeFrame3dg : public LatticeFrame3d { protected: int referenceNode; @@ -72,52 +72,13 @@ class LatticeFrame3dg : public LatticeStructuralElement virtual ~LatticeFrame3dg(); - int giveLocalCoordinateSystem(FloatMatrix &answer) override; - - int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; - - double computeLength() override; - - double giveLength() override; - - double giveArea() override; - - double giveIy() override; - - double giveIz() override; - - double giveIk() override; - - double giveShearAreaY() override; - - double giveShearAreaZ() override; - - int computeNumberOfDofs() override { return 12; } - - void giveDofManDofIDMask(int inode, IntArray &) const override; - - virtual void giveGPCoordinates(FloatArray &coords); - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } const char *giveClassName() const override { return "latticeframe3dg"; } - void initializeFrom(InputRecord &ir) override; - - - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } protected: - //void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; - bool computeGtoLRotationMatrix(FloatMatrix &) override; - void computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) override; - void computeMassMatrix(FloatMatrix &answer, TimeStep *tStep) override - { this->computeLumpedMassMatrix(answer, tStep); } void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; - void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) override; - void computeGaussPoints() override; - integrationDomain giveIntegrationDomain() const override { return _Line; } - virtual void computeBmatrixNAt( GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui, TimeStep *tStep ); + virtual void computeBmatrixNAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; From c7a83f57beeeb0b7ff0cda89ca840554d557d233 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 20 Oct 2022 10:01:51 +0100 Subject: [PATCH 28/60] NewElement --- .../LatticeElements/latticeframe3dg.C | 79 ++++++------------- .../LatticeElements/latticeframe3dg.h | 2 +- 2 files changed, 26 insertions(+), 55 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 6d89f640f..1b7aff44b 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -68,7 +68,7 @@ LatticeFrame3dg::~LatticeFrame3dg() {} void - LatticeFrame3dg::computeBmatrixNAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) + LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -76,11 +76,8 @@ void answer.zero(); this->length = computeLength(); - FloatArray u, stress, strain; + FloatArray u; this->computeVectorOf(VM_Total, tStep, u); - if ( initialDisplacements ) { - u.subtract(* initialDisplacements); - } //Normal displacement jump in x-direction //First node @@ -193,7 +190,7 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); - this->computeBmatrixNAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); + this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); dbj.beProductOf(d, bj); @@ -212,6 +209,7 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS { FloatMatrix b; FloatArray u; + FloatArray incrementalStrain; if ( !this->LatticeFrame3dg::isActivated(tStep) ) { answer.resize(StructuralMaterial :: giveSizeOfVoigtSymVector(gp->giveMaterialMode() ) ); @@ -220,20 +218,15 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS } LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto oldStrain =lmatStat ->giveLatticeStrain(); + auto Strain =lmatStat ->giveLatticeStrain(); - this->LatticeFrame3dg::computeBmatrixNAt(gp, b, tStep); + this->computeBmatrixAt( integrationRulesArray[0]->getIntegrationPoint( 0 ), b, tStep ); this->computeVectorOf(VM_Incremental, tStep, u); - answer.beProductOf(b, u); - answer.times(1./this->length); - + answer.beProductOf(b, u); + answer.times(1./this->length); - // subtract initial displacements, if defined - // if ( initialDisplacements ) { - // u.subtract(* initialDisplacements); - // } - answer += oldStrain; + answer +=Strain; } void @@ -245,55 +238,33 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, FloatArray incrementalStress; FloatArray incrementalInternalForces; FloatArray oldInternalForces; - GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); - this->computeVectorOf(VM_Total, tStep, u); - - //if ( initialDisplacements ) { - // u.subtract(* initialDisplacements); - //} - - //zero answer will resize accordingly when adding first contribution - //answer.clear(); - - this->LatticeFrame3dg::computeBmatrixNAt(gp, b , tStep); - bt.beTranspositionOf(b); - - this->computeStrainVector(strain, gp, tStep); - this->computeStressVector(stress, strain, gp, tStep); - - LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - - auto oldStress = lmatStat->giveLatticeStress(); - oldInternalForces.beProductOf(bt, oldStress); + //this->computeVectorOf( VM_Total, tStep, u ); + // answer.clear(); - incrementalStress.beDifferenceOf(stress, oldStress); + this->computeBmatrixAt( integrationRulesArray[0]->getIntegrationPoint( 0 ), b, tStep ); + bt.beTranspositionOf( b ); - incrementalInternalForces.beProductOf(bt, incrementalStress); + //Total stress + this->LatticeFrame3dg::computeStrainVector(strain, gp, tStep); + this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); - answer=oldInternalForces + incrementalInternalForces; + //Old stresses + LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); + auto oldStress = lmatStat->giveLatticeStress(); + oldInternalForces.beProductOf(bt, oldStress); + incrementalStress.beDifferenceOf(oldStress, stress); + answer.beProductOf(bt, incrementalStress); + answer +=oldInternalForces; - // if ( useUpdatedGpRecord == 1 ) { - // LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - // stress = lmatStat->giveLatticeStress(); - // } else { - // if ( !this->isActivated(tStep) ) { - // strain.zero(); - // } - // strain.beProductOf(b, u); -// strain.times(1./this->length); - // this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - // } - // answer.beProductOf(bt, stress); - if ( !this->isActivated(tStep) ) { - answer.zero(); return; - } + } } // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index b5170148b..e232e0a93 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -78,7 +78,7 @@ class LatticeFrame3dg : public LatticeFrame3d protected: void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - virtual void computeBmatrixNAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); + virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; From dc13071cfe50730b75dd7f96291ae225f62d86e5 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 1 Nov 2022 13:59:30 +0000 Subject: [PATCH 29/60] giveLocalCoordinateSystem --- .../LatticeElements/latticeframe3dg.C | 288 +++++++++++++++--- .../LatticeElements/latticeframe3dg.h | 7 +- 2 files changed, 253 insertions(+), 42 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 1b7aff44b..ba2e84153 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -78,7 +78,8 @@ void this->length = computeLength(); FloatArray u; this->computeVectorOf(VM_Total, tStep, u); - + //printf("u/n"); + //u.printYourself(); //Normal displacement jump in x-direction //First node answer.at(1, 1) = -1.; @@ -92,8 +93,8 @@ void answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = sin(u.at(5))*this->length*(1.+this->s)/2.; - answer.at(1, 12) = sin(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(1, 11) = sin(u.at(10))*this->length*(1.+this->s)/2.; + answer.at(1, 12) = sin(u.at(12))*this->length*(1.+this->s)/2.; //Shear displacement jump in y-plane //first node @@ -109,7 +110,7 @@ void answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - answer.at(2, 12) = -cos(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(2, 12) = -cos(u.at(12))*this->length*(1.+this->s)/2.; //Shear displacement jump in z-plane //first node @@ -124,7 +125,7 @@ void answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - answer.at(3, 11) = cos(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(3, 11) = cos(u.at(10))*this->length*(1.+this->s)/2.; answer.at(3, 12) = 0.; //Rotation around x-axis @@ -178,30 +179,142 @@ void return; } +void +LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) +{ + //Assemble BFmatrix (used to compute forces ) + answer.resize(12, 6); + answer.zero(); + + this->length = computeLength(); + FloatArray u; + this->computeVectorOf(VM_Total, tStep, u); + + //First Nx1 + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = 0.; + answer.at(1, 6) = 0.; + + //Second Nx2 + answer.at(7, 1) = 1.; + answer.at(7, 2) = 0.; + answer.at(7, 3) = 0.; + answer.at(7, 4) = 0.; + answer.at(7, 5) = 0.; + answer.at(7, 6) = 0.; + + //Shear Y + //first node Fy1 + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = 0.; + answer.at(2, 5) = 0; + answer.at(2, 6) = 0.; + //Second node Fy2 + answer.at(8, 1) = 0.; + answer.at(8, 2) = 1.; + answer.at(8, 3) = 0.; + answer.at(8, 4) = 0.; + answer.at(8, 5) = 0; + answer.at(8, 6) = 0.; + + //Shear Z + //first node Fz1 + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = 0.; + answer.at(3, 5) = 0.; + answer.at(3, 6) = 0.; + //Second node Fz2 + answer.at(9, 1) = 0.; + answer.at(9, 2) = 0.; + answer.at(9, 3) = 1.; + answer.at(9, 4) = 0.; + answer.at(9, 5) = 0.; + answer.at(9, 6) = 0.; + + //Torsion x + //First node Mx1 + answer.at(4, 1) = 0.; + answer.at(4, 2) = -sin(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(4, 3) = -sin(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node Mx2 + answer.at(10, 1) = 0.; + answer.at(10, 2) = sin(u.at(10))*this->length*(1.+this->s)/2.; + answer.at(10, 3) = sin(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(10, 4) = 1.; + answer.at(10, 5) = 0.; + answer.at(10, 6) = 0.; + + //Moment around y-axis + //First node my1 + answer.at(5, 1) = sin(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = cos(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node My2 + answer.at(11, 1) = sin(u.at(10))*this->length*(1.+this->s)/2.; + answer.at(11, 2) = 0.; + answer.at(11, 3) = cos(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(11, 4) = 0.; + answer.at(11, 5) = 1.; + answer.at(11, 6) = 0.; + + //Moment around z-axis + //First node Mz1 + answer.at(6, 1) = sin(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(6, 2) = -cos(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node Mz2 + answer.at(12, 1) = sin(u.at(10))*this->length*(1.+this->s)/2.; + answer.at(12, 2) = -cos(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(12, 3) = 0.; + answer.at(12, 4) = 0.; + answer.at(12, 5) = 0.; + answer.at(12, 6) = 1.; + + return; +} + void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) // Computes numerically the stiffness matrix of the receiver. { - FloatMatrix d, bi, bj, bjt, dbj, dij; + FloatMatrix d, bi, bj, bjt, dbj, dij, bf; this->length = computeLength(); answer.resize(12, 12); answer.zero(); - this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); + this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf, tStep); + this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); dbj.beProductOf(d, bj); dbj.times(1. / length); bjt.beTranspositionOf(bj); - answer.beProductOf(bjt, dbj); - + answer.beProductOf(bf, dbj); + // printf("answer/n"); + //answer.printYourself(); return; } - void +void LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of // the receiver, at time step tStep. The nature of these strains depends @@ -217,54 +330,151 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS return; } - LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto Strain =lmatStat ->giveLatticeStrain(); - - this->computeBmatrixAt( integrationRulesArray[0]->getIntegrationPoint( 0 ), b, tStep ); - this->computeVectorOf(VM_Incremental, tStep, u); + this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b, tStep); + this->computeVectorOf(VM_Total, tStep, u); answer.beProductOf(b, u); - answer.times(1./this->length); - answer +=Strain; -} + answer.times(1./this->length); + // printf("Strain/n"); + //answer.printYourself(); + } void LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, - TimeStep *tStep, int useUpdatedGpRecord) + TimeStep *tStep, int useUpdatedGpRecord) { - FloatMatrix b, bt; + FloatMatrix b, bt, bf; FloatArray u, stress, strain; - FloatArray incrementalStress; - FloatArray incrementalInternalForces; - FloatArray oldInternalForces; this->length = computeLength(); - GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); - //this->computeVectorOf( VM_Total, tStep, u ); - // answer.clear(); + this->computeVectorOf(VM_Total, tStep, u); + + if ( initialDisplacements ) { + u.subtract(* initialDisplacements); + } + + // zero answer will resize accordingly when adding first contribution + answer.clear(); + + this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf, tStep); - this->computeBmatrixAt( integrationRulesArray[0]->getIntegrationPoint( 0 ), b, tStep ); - bt.beTranspositionOf( b ); + if ( useUpdatedGpRecord == 1 ) { + LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + stress = lmatStat->giveLatticeStress(); + } else { + if ( !this->isActivated(tStep) ) { + strain.zero(); + } + this->LatticeFrame3dg::computeStrainVector( strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep ); + this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + } + // printf("Stress/n"); + //stress.printYourself(); - //Total stress - this->LatticeFrame3dg::computeStrainVector(strain, gp, tStep); - this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); + answer.beProductOf(bf, stress); + //printf("Force/n"); + //answer.printYourself(); + if ( !this->isActivated(tStep) ) { + answer.zero(); + return; + } +} +bool +LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer, TimeStep *tStep) +{ + FloatMatrix lcs; + answer.resize(12, 12); + answer.zero(); - //Old stresses - LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); - auto oldStress = lmatStat->giveLatticeStress(); - oldInternalForces.beProductOf(bt, oldStress); + this->giveLocalCoordinateSystem(lcs, tStep); + for ( int i = 1; i <= 3; i++ ) { + for ( int j = 1; j <= 3; j++ ) { + answer.at(i, j) = lcs.at(i, j); + answer.at(i + 3, j + 3) = lcs.at(i, j); + answer.at(i + 6, j + 6) = lcs.at(i, j); + answer.at(i + 9, j + 9) = lcs.at(i, j); + } + } - incrementalStress.beDifferenceOf(oldStress, stress); - answer.beProductOf(bt, incrementalStress); + return 1; +} +int +LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer, TimeStep *tStep) +{ + FloatArray lx, ly, lz, help(3); + FloatArray coord; + FloatArray uA, uB, u; - answer +=oldInternalForces; + Node *nodeA, *nodeB; + this->computeVectorOf(VM_Total, tStep, u); + nodeA = this->giveNode(1); + coord = nodeA->giveCoordinates(); + uA = { u.at(1), u.at(2), u.at(3) } ; + uA += coord; + + nodeB = this->giveNode(2); + nodeB->giveCoordinates(); + coord = nodeB->giveCoordinates(); + uB = { u.at(7), u.at(8), u.at(9) } ; + uB += coord; + + lx.beDifferenceOf(uB, uA ); + lx.normalize(); + + if ( this->referenceNode ) { + Node *refNode = this->giveDomain()->giveNode(this->referenceNode); + help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); + + lz.beVectorProductOf(lx, help); + lz.normalize(); + } else if ( this->zaxis.giveSize() > 0 ) { + lz = this->zaxis; + lz.add(lz.dotProduct(lx), lx); + lz.normalize(); + } else { + FloatMatrix rot(3, 3); + double theta = referenceAngle * M_PI / 180.0; + + rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); + rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); + rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); + + rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); + rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); + rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); + + rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); + rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); + rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); + + help.at(3) = 1.0; // up-vector + // here is ly is used as a temp var + if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical + ly = { + 0., 1., 0. + }; + } else { + ly.beVectorProductOf(lx, help); + } + lz.beProductOf(rot, ly); + lz.normalize(); + } + ly.beVectorProductOf(lz, lx); + ly.normalize(); - return; + answer.resize(3, 3); + answer.zero(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(1, i) = lx.at(i); + answer.at(2, i) = ly.at(i); + answer.at(3, i) = lz.at(i); + } + return 1; } + } // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index e232e0a93..75709194e 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -70,7 +70,7 @@ class LatticeFrame3dg : public LatticeFrame3d public: LatticeFrame3dg(int n, Domain *); virtual ~LatticeFrame3dg(); - + int giveLocalCoordinateSystem(FloatMatrix &answer, TimeStep *tStep) ; const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } const char *giveClassName() const override { return "latticeframe3dg"; } @@ -78,10 +78,11 @@ class LatticeFrame3dg : public LatticeFrame3d protected: void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); + virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - + bool computeGtoLRotationMatrix(FloatMatrix &, TimeStep *tStep) ; + virtual void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); }; } // end namespace oofem #endif From 8aea76470d1ff4cda096cd78d5d73a30847d3a67 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 1 Nov 2022 14:08:09 +0000 Subject: [PATCH 30/60] giveLocalCoordinateSystem --- src/sm/Elements/LatticeElements/latticeframe3dg.C | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index ba2e84153..112104bba 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -411,6 +411,7 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer, TimeStep *tStep this->computeVectorOf(VM_Total, tStep, u); nodeA = this->giveNode(1); + nodeA->giveCoordinates(); coord = nodeA->giveCoordinates(); uA = { u.at(1), u.at(2), u.at(3) } ; uA += coord; From e2c28fa6bf0b61caaf94234610460db4e44fe90a Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Fri, 4 Nov 2022 17:19:28 +0000 Subject: [PATCH 31/60] tried to fix issue with timestep --- .../Elements/LatticeElements/latticeframe3d.h | 2 +- .../LatticeElements/latticeframe3dg.C | 42 ++++++++++--------- .../LatticeElements/latticeframe3dg.h | 11 +++-- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d.h b/src/sm/Elements/LatticeElements/latticeframe3d.h index e7e9fbf81..c22c8dda0 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d.h +++ b/src/sm/Elements/LatticeElements/latticeframe3d.h @@ -110,7 +110,7 @@ class LatticeFrame3d : public LatticeStructuralElement protected: - void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + virtual void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; bool computeGtoLRotationMatrix(FloatMatrix &) override; void computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) override; void computeMassMatrix(FloatMatrix &answer, TimeStep *tStep) override diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 112104bba..0c9a1dee3 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -50,6 +50,7 @@ #include "datastream.h" #include "classfactory.h" #include "sm/CrossSections/latticecrosssection.h" +#include "engngm.h" #ifdef __OOFEG #include "oofeggraphiccontext.h" @@ -68,7 +69,7 @@ LatticeFrame3dg::~LatticeFrame3dg() {} void - LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) + LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -76,6 +77,9 @@ void answer.zero(); this->length = computeLength(); + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + FloatArray u; this->computeVectorOf(VM_Total, tStep, u); //printf("u/n"); @@ -180,13 +184,16 @@ void } void -LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep) +LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) { //Assemble BFmatrix (used to compute forces ) answer.resize(12, 6); answer.zero(); this->length = computeLength(); + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + FloatArray u; this->computeVectorOf(VM_Total, tStep, u); @@ -301,8 +308,8 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); - this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf, tStep); - this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj, tStep); + computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); + computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); dbj.beProductOf(d, bj); @@ -330,7 +337,7 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS return; } - this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b, tStep); + this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); this->computeVectorOf(VM_Total, tStep, u); answer.beProductOf(b, u); @@ -358,7 +365,7 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, // zero answer will resize accordingly when adding first contribution answer.clear(); - this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf, tStep); + this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); if ( useUpdatedGpRecord == 1 ) { LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); @@ -382,13 +389,13 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, } } bool -LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer, TimeStep *tStep) +LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) { FloatMatrix lcs; answer.resize(12, 12); answer.zero(); - this->giveLocalCoordinateSystem(lcs, tStep); + this->giveLocalCoordinateSystem(lcs); for ( int i = 1; i <= 3; i++ ) { for ( int j = 1; j <= 3; j++ ) { answer.at(i, j) = lcs.at(i, j); @@ -401,27 +408,22 @@ LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer, TimeStep *tStep return 1; } int -LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer, TimeStep *tStep) +LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) { FloatArray lx, ly, lz, help(3); FloatArray coord; FloatArray uA, uB, u; + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + Node *nodeA, *nodeB; - this->computeVectorOf(VM_Total, tStep, u); - nodeA = this->giveNode(1); - nodeA->giveCoordinates(); - coord = nodeA->giveCoordinates(); - uA = { u.at(1), u.at(2), u.at(3) } ; - uA += coord; - nodeB = this->giveNode(2); - nodeB->giveCoordinates(); - coord = nodeB->giveCoordinates(); - uB = { u.at(7), u.at(8), u.at(9) } ; - uB += coord; + //This is not working yet. It only works so far if displacements are translations only. We could do it DOf by DOF or we could understand better hte updated Langragian version that seems to be implemented. I will let you know. + nodeA->giveUpdatedCoordinates(uA,tStep,1); + nodeB->giveUpdatedCoordinates(uB,tStep,1); + lx.beDifferenceOf(uB, uA ); lx.normalize(); diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 75709194e..eedd173d8 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -70,7 +70,7 @@ class LatticeFrame3dg : public LatticeFrame3d public: LatticeFrame3dg(int n, Domain *); virtual ~LatticeFrame3dg(); - int giveLocalCoordinateSystem(FloatMatrix &answer, TimeStep *tStep) ; + int giveLocalCoordinateSystem(FloatMatrix &answer) override; const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } const char *giveClassName() const override { return "latticeframe3dg"; } @@ -78,11 +78,14 @@ class LatticeFrame3dg : public LatticeFrame3d protected: void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); + void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - bool computeGtoLRotationMatrix(FloatMatrix &, TimeStep *tStep) ; - virtual void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep ); + bool computeGtoLRotationMatrix(FloatMatrix &) override; + + void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + }; } // end namespace oofem #endif From cbda20d99aaba9715ed798eaa92161d666efdd60 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Sat, 5 Nov 2022 17:38:53 +0000 Subject: [PATCH 32/60] further change concerning timestep --- src/sm/Elements/LatticeElements/latticeframe3dg.C | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 0c9a1dee3..cf8d63972 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -412,7 +412,7 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) { FloatArray lx, ly, lz, help(3); FloatArray coord; - FloatArray uA, uB, u; + FloatArray uA(3), uB(3); TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); @@ -421,8 +421,13 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) nodeB = this->giveNode(2); //This is not working yet. It only works so far if displacements are translations only. We could do it DOf by DOF or we could understand better hte updated Langragian version that seems to be implemented. I will let you know. - nodeA->giveUpdatedCoordinates(uA,tStep,1); - nodeB->giveUpdatedCoordinates(uB,tStep,1); + uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); + uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); + uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); + + uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); + uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); + uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); lx.beDifferenceOf(uB, uA ); lx.normalize(); From 44482d6e62f5ef27d09788274de630447b3f3cdb Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Fri, 11 Nov 2022 20:07:34 +0000 Subject: [PATCH 33/60] tried to fix issue with B matrix --- .../LatticeElements/latticeframe3dg.C | 94 +++++++++++++------ 1 file changed, 64 insertions(+), 30 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index cf8d63972..1c17c242c 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -69,7 +69,7 @@ LatticeFrame3dg::~LatticeFrame3dg() {} void - LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) +LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -78,27 +78,44 @@ void this->length = computeLength(); - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); FloatArray u; this->computeVectorOf(VM_Total, tStep, u); - //printf("u/n"); - //u.printYourself(); + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; //Normal displacement jump in x-direction //First node answer.at(1, 1) = -1.; answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - answer.at(1, 5) = sin(u.at(5))*this->length*(1.-this->s)/2.; - answer.at(1, 6) = sin(u.at(6))*this->length*(1.-this->s)/2.; + if ( u.at(5) == 0 ) { + answer.at(1, 5) = 0; + } else { + answer.at(1, 5) = l1*(1-cos(u.at(5)))/u.at(5); + } + if ( u.at(6) == 0 ) { + answer.at(1, 6) = 0; + } else { + answer.at(1, 6) = l1*(1-cos(u.at(6)))/u.at(6); + } + // //Second node answer.at(1, 7) = 1.; answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = sin(u.at(10))*this->length*(1.+this->s)/2.; - answer.at(1, 12) = sin(u.at(12))*this->length*(1.+this->s)/2.; + if ( u.at(11) == 0 ) { + answer.at(1, 11) = 0; + } else { + answer.at(1, 11) = l2*(1-cos(u.at(11)))/u.at(11); + } + if ( u.at(12) == 0 ) { + answer.at(1, 12) = 0; + } else { + answer.at(1, 12) = l2*(1-cos(u.at(12)))/u.at(12); + } //Shear displacement jump in y-plane //first node @@ -107,14 +124,22 @@ void answer.at(2, 3) = 0.; answer.at(2, 4) = 0.; answer.at(2, 5) = 0; - answer.at(2, 6) = -cos(u.at(6))*this->length*(1.-this->s)/2.; + if ( u.at(6) == 0 ) { + answer.at( 2, 6 ) = l1; + } else { + answer.at( 2, 6 ) = -sin( u.at( 6 ) ) * l1/u.at(6); + } //Second node answer.at(2, 7) = 0.; answer.at(2, 8) = 1.; answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - answer.at(2, 12) = -cos(u.at(12))*this->length*(1.+this->s)/2.; + if ( u.at(12) == 0 ) { + answer.at(2, 12) = l2; + } else { + answer.at( 2, 12 ) = -sin( u.at( 12 ) ) * l2/u.at(12); + } //Shear displacement jump in z-plane //first node @@ -122,14 +147,22 @@ void answer.at(3, 2) = 0.; answer.at(3, 3) = -1.; answer.at(3, 4) = 0.; - answer.at(3, 5) = cos(u.at(5))*this->length*(1.-this->s)/2.; + if ( u.at(5) == 0 ) { + answer.at(3, 5) = l1; + } else { + answer.at( 3, 5 ) = sin( u.at( 5 ) ) * l1/u.at(5); + } answer.at(3, 6) = 0.; //Second node answer.at(3, 7) = 0.; answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - answer.at(3, 11) = cos(u.at(10))*this->length*(1.+this->s)/2.; + if ( u.at(11) == 0 ) { + answer.at(3, 11) = l2; + } else { + answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); + } answer.at(3, 12) = 0.; //Rotation around x-axis @@ -193,10 +226,11 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) this->length = computeLength(); TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - + FloatArray u; this->computeVectorOf(VM_Total, tStep, u); - + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; //First Nx1 answer.at(1, 1) = -1.; answer.at(1, 2) = 0.; @@ -248,46 +282,46 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) //Torsion x //First node Mx1 answer.at(4, 1) = 0.; - answer.at(4, 2) = -sin(u.at(5))*this->length*(1.+this->s)/2.; - answer.at(4, 3) = -sin(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(4, 2) = -sin(u.at(5))*l1; + answer.at(4, 3) = -sin(u.at(6))*l1; answer.at(4, 4) = -1.; answer.at(4, 5) = 0.; answer.at(4, 6) = 0.; //Second node Mx2 answer.at(10, 1) = 0.; - answer.at(10, 2) = sin(u.at(10))*this->length*(1.+this->s)/2.; - answer.at(10, 3) = sin(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(10, 2) = sin(u.at(11))*l2; + answer.at(10, 3) = sin(u.at(12))*l2; answer.at(10, 4) = 1.; answer.at(10, 5) = 0.; answer.at(10, 6) = 0.; //Moment around y-axis //First node my1 - answer.at(5, 1) = sin(u.at(5))*this->length*(1.+this->s)/2.; + answer.at(5, 1) = sin(u.at(5))*l1; answer.at(5, 2) = 0.; - answer.at(5, 3) = cos(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(5, 3) = cos(u.at(5))*l1; answer.at(5, 4) = 0.; answer.at(5, 5) = -1.; answer.at(5, 6) = 0.; //Second node My2 - answer.at(11, 1) = sin(u.at(10))*this->length*(1.+this->s)/2.; + answer.at(11, 1) = sin(u.at(11))*l2; answer.at(11, 2) = 0.; - answer.at(11, 3) = cos(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(11, 3) = cos(u.at(11))*l2; answer.at(11, 4) = 0.; answer.at(11, 5) = 1.; answer.at(11, 6) = 0.; //Moment around z-axis //First node Mz1 - answer.at(6, 1) = sin(u.at(5))*this->length*(1.+this->s)/2.; - answer.at(6, 2) = -cos(u.at(6))*this->length*(1.+this->s)/2.; + answer.at(6, 1) = sin(u.at(6))*l1; + answer.at(6, 2) = -cos(u.at(6))*l1; answer.at(6, 3) = 0.; answer.at(6, 4) = 0.; answer.at(6, 5) = 0.; answer.at(6, 6) = -1.; //Second node Mz2 - answer.at(12, 1) = sin(u.at(10))*this->length*(1.+this->s)/2.; - answer.at(12, 2) = -cos(u.at(12))*this->length*(1.+this->s)/2.; + answer.at(12, 1) = sin(u.at(12))*l2; + answer.at(12, 2) = -cos(u.at(12))*l2; answer.at(12, 3) = 0.; answer.at(12, 4) = 0.; answer.at(12, 5) = 0.; @@ -316,8 +350,8 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo dbj.times(1. / length); bjt.beTranspositionOf(bj); answer.beProductOf(bf, dbj); - // printf("answer/n"); - //answer.printYourself(); + printf("Bmatrix/n"); + bj.printYourself(); return; } @@ -415,7 +449,7 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) FloatArray uA(3), uB(3); TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - + Node *nodeA, *nodeB; nodeA = this->giveNode(1); nodeB = this->giveNode(2); @@ -428,7 +462,7 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); - + lx.beDifferenceOf(uB, uA ); lx.normalize(); From 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 14 Nov 2022 11:50:44 +0000 Subject: [PATCH 34/60] fix of zero check in latticeframe3dg --- .../LatticeElements/latticeframe3dg.C | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 1c17c242c..351dfa117 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -72,7 +72,10 @@ void LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) // Returns the strain matrix of the receiver. { - //Assemble Bmatrix (used to compute strains and rotations) + + double tol=1.e-16; + + //Assemble Bmatrix (used to compute strains and rotations) answer.resize(6, 12); answer.zero(); @@ -90,15 +93,15 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - if ( u.at(5) == 0 ) { - answer.at(1, 5) = 0; + if ( fabs(u.at(5)) <= tol ) { + answer.at(1, 5) = 0.; } else { - answer.at(1, 5) = l1*(1-cos(u.at(5)))/u.at(5); + answer.at(1, 5) = l1*(1. - cos(u.at(5)))/u.at(5); } - if ( u.at(6) == 0 ) { - answer.at(1, 6) = 0; + if ( fabs(u.at(6)) <= tol ) { + answer.at(1, 6) = 0.; } else { - answer.at(1, 6) = l1*(1-cos(u.at(6)))/u.at(6); + answer.at(1, 6) = l1*(1. - cos(u.at(6)))/u.at(6); } // //Second node @@ -106,15 +109,15 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - if ( u.at(11) == 0 ) { + if ( fabs(u.at(11)) <= tol ) { answer.at(1, 11) = 0; } else { - answer.at(1, 11) = l2*(1-cos(u.at(11)))/u.at(11); + answer.at(1, 11) = l2*(1.-cos(u.at(11)))/u.at(11); } - if ( u.at(12) == 0 ) { - answer.at(1, 12) = 0; + if ( fabs(u.at(12)) <= tol ) { + answer.at(1, 12) = 0.; } else { - answer.at(1, 12) = l2*(1-cos(u.at(12)))/u.at(12); + answer.at(1, 12) = l2*(1.-cos(u.at(12)))/u.at(12); } //Shear displacement jump in y-plane @@ -124,7 +127,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(2, 3) = 0.; answer.at(2, 4) = 0.; answer.at(2, 5) = 0; - if ( u.at(6) == 0 ) { + if ( fabs(u.at(6)) <= tol ) { answer.at( 2, 6 ) = l1; } else { answer.at( 2, 6 ) = -sin( u.at( 6 ) ) * l1/u.at(6); @@ -135,7 +138,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - if ( u.at(12) == 0 ) { + if ( fabs(u.at(12)) <= tol ) { answer.at(2, 12) = l2; } else { answer.at( 2, 12 ) = -sin( u.at( 12 ) ) * l2/u.at(12); @@ -147,7 +150,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(3, 2) = 0.; answer.at(3, 3) = -1.; answer.at(3, 4) = 0.; - if ( u.at(5) == 0 ) { + if ( fabs(u.at(5)) <= tol ) { answer.at(3, 5) = l1; } else { answer.at( 3, 5 ) = sin( u.at( 5 ) ) * l1/u.at(5); @@ -158,7 +161,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - if ( u.at(11) == 0 ) { + if ( fabs(u.at(11)) <= tol ) { answer.at(3, 11) = l2; } else { answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); @@ -348,10 +351,10 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo dbj.beProductOf(d, bj); dbj.times(1. / length); - bjt.beTranspositionOf(bj); + // bjt.beTranspositionOf(bj); answer.beProductOf(bf, dbj); - printf("Bmatrix/n"); - bj.printYourself(); + // printf("Bmatrix/n"); + // bj.printYourself(); return; } From 3e37882444d44da603442bee60fc92857987e07b Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 22 Nov 2022 13:53:14 +0000 Subject: [PATCH 35/60] issue with matrix --- .../LatticeElements/latticeframe3dg.C | 124 ++++++++---------- .../LatticeElements/latticeframe3dg.h | 3 +- 2 files changed, 58 insertions(+), 69 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 1c17c242c..551904ca6 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -53,8 +53,8 @@ #include "engngm.h" #ifdef __OOFEG - #include "oofeggraphiccontext.h" - #include "../sm/Materials/structuralmaterial.h" +#include "oofeggraphiccontext.h" +#include "../sm/Materials/structuralmaterial.h" #endif namespace oofem { @@ -68,6 +68,7 @@ LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeFrame3d(n, aDo LatticeFrame3dg::~LatticeFrame3dg() {} + void LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) // Returns the strain matrix of the receiver. @@ -75,11 +76,10 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, //Assemble Bmatrix (used to compute strains and rotations) answer.resize(6, 12); answer.zero(); - - this->length = computeLength(); - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + this->length = computeLength(); + double tol=1.e-16; FloatArray u; this->computeVectorOf(VM_Total, tStep, u); double l1 = this->length*(1.-this->s)/2; @@ -90,15 +90,15 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - if ( u.at(5) == 0 ) { - answer.at(1, 5) = 0; + if ( fabs(u.at(5)) <= tol ) { + answer.at(1, 5) = 0.; } else { - answer.at(1, 5) = l1*(1-cos(u.at(5)))/u.at(5); + answer.at(1, 5) = l1*(1. - cos(u.at(5)))/u.at(5); } - if ( u.at(6) == 0 ) { - answer.at(1, 6) = 0; + if ( fabs(u.at(6)) <= tol ) { + answer.at(1, 6) = 0.; } else { - answer.at(1, 6) = l1*(1-cos(u.at(6)))/u.at(6); + answer.at(1, 6) = l1*(1. - cos(u.at(6)))/u.at(6); } // //Second node @@ -106,15 +106,15 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - if ( u.at(11) == 0 ) { + if ( fabs(u.at(11)) <= tol ) { answer.at(1, 11) = 0; } else { - answer.at(1, 11) = l2*(1-cos(u.at(11)))/u.at(11); + answer.at(1, 11) = -l2*(1.-cos(u.at(11)))/u.at(11); } - if ( u.at(12) == 0 ) { - answer.at(1, 12) = 0; + if ( fabs(u.at(12)) <= tol ) { + answer.at(1, 12) = 0.; } else { - answer.at(1, 12) = l2*(1-cos(u.at(12)))/u.at(12); + answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); } //Shear displacement jump in y-plane @@ -124,7 +124,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(2, 3) = 0.; answer.at(2, 4) = 0.; answer.at(2, 5) = 0; - if ( u.at(6) == 0 ) { + if ( fabs(u.at(6)) <= tol ) { answer.at( 2, 6 ) = l1; } else { answer.at( 2, 6 ) = -sin( u.at( 6 ) ) * l1/u.at(6); @@ -135,7 +135,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(2, 9) = 0.; answer.at(2, 10) = 0.; answer.at(2, 11) = 0; - if ( u.at(12) == 0 ) { + if ( fabs(u.at(12)) <= tol ) { answer.at(2, 12) = l2; } else { answer.at( 2, 12 ) = -sin( u.at( 12 ) ) * l2/u.at(12); @@ -147,7 +147,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(3, 2) = 0.; answer.at(3, 3) = -1.; answer.at(3, 4) = 0.; - if ( u.at(5) == 0 ) { + if ( fabs(u.at(5)) <= tol ) { answer.at(3, 5) = l1; } else { answer.at( 3, 5 ) = sin( u.at( 5 ) ) * l1/u.at(5); @@ -158,10 +158,10 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(3, 8) = 0.; answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; - if ( u.at(11) == 0 ) { - answer.at(3, 11) = l2; + if ( fabs(u.at(11)) <= tol ) { + answer.at(3, 11) = l2; } else { - answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); + answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); } answer.at(3, 12) = 0.; @@ -304,7 +304,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(5, 5) = -1.; answer.at(5, 6) = 0.; //Second node My2 - answer.at(11, 1) = sin(u.at(11))*l2; + answer.at(11, 1) = -sin(u.at(11))*l2; answer.at(11, 2) = 0.; answer.at(11, 3) = cos(u.at(11))*l2; answer.at(11, 4) = 0.; @@ -320,7 +320,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(6, 5) = 0.; answer.at(6, 6) = -1.; //Second node Mz2 - answer.at(12, 1) = sin(u.at(12))*l2; + answer.at(12, 1) = -sin(u.at(12))*l2; answer.at(12, 2) = -cos(u.at(12))*l2; answer.at(12, 3) = 0.; answer.at(12, 4) = 0.; @@ -331,6 +331,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) } + void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) @@ -342,16 +343,14 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); - computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); + this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); dbj.beProductOf(d, bj); dbj.times(1. / length); bjt.beTranspositionOf(bj); answer.beProductOf(bf, dbj); - printf("Bmatrix/n"); - bj.printYourself(); return; } @@ -370,57 +369,46 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS answer.zero(); return; } - + LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto Strain =lmatStat ->giveLatticeStrain(); this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); - - this->computeVectorOf(VM_Total, tStep, u); + this->computeVectorOf(VM_Incremental, tStep, u); answer.beProductOf(b, u); - answer.times(1./this->length); - // printf("Strain/n"); - //answer.printYourself(); - } - + answer +=Strain; +} void LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) { FloatMatrix b, bt, bf; FloatArray u, stress, strain; + FloatArray incrementalStress; + FloatArray incrementalInternalForces; + FloatArray oldInternalForces; + FloatArray totalInternalForces; - this->length = computeLength(); - - this->computeVectorOf(VM_Total, tStep, u); - - if ( initialDisplacements ) { - u.subtract(* initialDisplacements); - } - - // zero answer will resize accordingly when adding first contribution - answer.clear(); + // auto tempPlasticStrain = status->givePlasticLatticeStrain(); + this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); + bt.beTranspositionOf( b ); + // Total stress + this->LatticeFrame3dg::computeStrainVector( strain, gp, tStep ); + this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); + totalInternalForces.beProductOf( bf, stress ); + // Old stresses + LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); + auto oldStress= lmatStat->giveLatticeStress(); + oldInternalForces.beProductOf( bf, oldStress ); + incrementalStress.beDifferenceOf( stress, oldStress ); + answer.beProductOf( bf, incrementalStress ); + answer += oldInternalForces; + //totalInternalForces = strain.at(6) - stress.at(6); + + //status->letTotalInernalforcesBe(tempTotalInternalForces); - if ( useUpdatedGpRecord == 1 ) { - LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - stress = lmatStat->giveLatticeStress(); - } else { - if ( !this->isActivated(tStep) ) { - strain.zero(); - } - this->LatticeFrame3dg::computeStrainVector( strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep ); - this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - } - // printf("Stress/n"); - //stress.printYourself(); - - answer.beProductOf(bf, stress); - //printf("Force/n"); - //answer.printYourself(); - if ( !this->isActivated(tStep) ) { - answer.zero(); - return; - } } bool LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) @@ -429,7 +417,7 @@ LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) answer.resize(12, 12); answer.zero(); - this->giveLocalCoordinateSystem(lcs); + this->LatticeFrame3dg::giveLocalCoordinateSystem(lcs); for ( int i = 1; i <= 3; i++ ) { for ( int j = 1; j <= 3; j++ ) { answer.at(i, j) = lcs.at(i, j); @@ -519,4 +507,6 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) return 1; } + + } // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index eedd173d8..57de3b5b5 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -83,8 +83,7 @@ class LatticeFrame3dg : public LatticeFrame3d virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; bool computeGtoLRotationMatrix(FloatMatrix &) override; - - void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); }; } // end namespace oofem From a75a76d5655da35d9be5624fa124da98c85d56a8 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 22 Nov 2022 13:59:21 +0000 Subject: [PATCH 36/60] issue with matrix --- src/sm/Elements/LatticeElements/latticeframe3dg.C | 2 +- src/sm/Elements/LatticeElements/latticeframe3dg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 551904ca6..421a3d887 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -116,7 +116,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, } else { answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); } - +// //Shear displacement jump in y-plane //first node answer.at(2, 1) = 0.; diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 57de3b5b5..45686cb62 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -66,7 +66,7 @@ class LatticeFrame3dg : public LatticeFrame3d FloatMatrix localCoordinateSystem; FloatArray midPoint, globalCentroid, normal; - +// public: LatticeFrame3dg(int n, Domain *); virtual ~LatticeFrame3dg(); From 98d64cfe2fb2294e16033b3b2889578f4f9c4073 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 22 Nov 2022 14:00:29 +0000 Subject: [PATCH 37/60] issue with matrix --- src/sm/Elements/LatticeElements/latticeframe3dg.C | 2 +- src/sm/Elements/LatticeElements/latticeframe3dg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 421a3d887..551904ca6 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -116,7 +116,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, } else { answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); } -// + //Shear displacement jump in y-plane //first node answer.at(2, 1) = 0.; diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 45686cb62..57de3b5b5 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -66,7 +66,7 @@ class LatticeFrame3dg : public LatticeFrame3d FloatMatrix localCoordinateSystem; FloatArray midPoint, globalCentroid, normal; -// + public: LatticeFrame3dg(int n, Domain *); virtual ~LatticeFrame3dg(); From d318d25d6d2fb8951361abac10bf1657ca62bb04 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 22 Nov 2022 14:09:44 +0000 Subject: [PATCH 38/60] issue --- src/sm/Elements/Beams/libeam3dnl2.C | 1 + src/sm/Elements/LatticeElements/latticeframe3d.C | 10 ++++------ src/sm/Elements/LatticeElements/latticeframe3dg.C | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sm/Elements/Beams/libeam3dnl2.C b/src/sm/Elements/Beams/libeam3dnl2.C index 0168fd731..45cd8f315 100644 --- a/src/sm/Elements/Beams/libeam3dnl2.C +++ b/src/sm/Elements/Beams/libeam3dnl2.C @@ -432,6 +432,7 @@ LIBeam3dNL2 :: computeGaussPoints() void LIBeam3dNL2 :: computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) + { answer = this->giveStructuralCrossSection()->give3dBeamStiffMtrx(rMode, gp, tStep); } diff --git a/src/sm/Elements/LatticeElements/latticeframe3d.C b/src/sm/Elements/LatticeElements/latticeframe3d.C index abf39ae50..542a7eaa0 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d.C @@ -241,7 +241,8 @@ LatticeFrame3d::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMod dbj.times(1. / length); bjt.beTranspositionOf(bj); answer.beProductOf(bjt, dbj); - + //printf("answer/n"); + //answer.printYourself(); return; } @@ -305,6 +306,7 @@ LatticeFrame3d::giveInternalForcesVector(FloatArray &answer, answer.clear(); this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + bt.beTranspositionOf(b); if ( useUpdatedGpRecord == 1 ) { @@ -318,17 +320,13 @@ LatticeFrame3d::giveInternalForcesVector(FloatArray &answer, strain.times(1./this->length); this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); } - answer.beProductOf(bt, stress); - if ( !this->isActivated(tStep) ) { answer.zero(); return; } } - - bool LatticeFrame3d::computeGtoLRotationMatrix(FloatMatrix &answer) { @@ -357,10 +355,10 @@ LatticeFrame3d::giveLocalCoordinateSystem(FloatMatrix &answer) Node *nodeA, *nodeB; nodeA = this->giveNode(1); nodeB = this->giveNode(2); - lx.beDifferenceOf(nodeB->giveCoordinates(), nodeA->giveCoordinates() ); lx.normalize(); + if ( this->referenceNode ) { Node *refNode = this->giveDomain()->giveNode(this->referenceNode); help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 551904ca6..421a3d887 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -116,7 +116,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, } else { answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); } - +// //Shear displacement jump in y-plane //first node answer.at(2, 1) = 0.; From 1b3fb24a37db290b84573b6143de9610a15e1d59 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 22 Nov 2022 15:32:41 +0000 Subject: [PATCH 39/60] issue with matrices --- .../LatticeElements/latticeframe3dg.C | 44 +++---------------- .../LatticeElements/latticeframe3dg.h | 5 ++- 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index b361b0668..d168b5c37 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -73,10 +73,7 @@ void LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) // Returns the strain matrix of the receiver. { - - double tol=1.e-16; - - //Assemble Bmatrix (used to compute strains and rotations) + //Assemble Bmatrix (used to compute strains and rotations) answer.resize(6, 12); answer.zero(); TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); @@ -96,11 +93,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, if ( fabs(u.at(5)) <= tol ) { answer.at(1, 5) = 0.; } else { -<<<<<<< HEAD answer.at(1, 5) = l1*(1. - cos(u.at(5)))/u.at(5); -======= - answer.at(1, 5) = l1*(1. - cos(u.at(5)))/u.at(5); ->>>>>>> 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe } if ( fabs(u.at(6)) <= tol ) { answer.at(1, 6) = 0.; @@ -116,22 +109,14 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, if ( fabs(u.at(11)) <= tol ) { answer.at(1, 11) = 0; } else { -<<<<<<< HEAD answer.at(1, 11) = -l2*(1.-cos(u.at(11)))/u.at(11); -======= - answer.at(1, 11) = l2*(1.-cos(u.at(11)))/u.at(11); ->>>>>>> 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe } if ( fabs(u.at(12)) <= tol ) { answer.at(1, 12) = 0.; } else { -<<<<<<< HEAD answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); -======= - answer.at(1, 12) = l2*(1.-cos(u.at(12)))/u.at(12); ->>>>>>> 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe } -// + //Shear displacement jump in y-plane //first node answer.at(2, 1) = 0.; @@ -174,11 +159,7 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, answer.at(3, 9) = 1.; answer.at(3, 10) = 0.; if ( fabs(u.at(11)) <= tol ) { -<<<<<<< HEAD answer.at(3, 11) = l2; -======= - answer.at(3, 11) = l2; ->>>>>>> 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe } else { answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); } @@ -349,8 +330,6 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) return; } - - void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) @@ -368,13 +347,10 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo dbj.beProductOf(d, bj); dbj.times(1. / length); - // bjt.beTranspositionOf(bj); + bjt.beTranspositionOf(bj); answer.beProductOf(bf, dbj); -<<<<<<< HEAD -======= - // printf("Bmatrix/n"); - // bj.printYourself(); ->>>>>>> 8b84bfe5ffc7ec1a98411bbd4e124d9b4d1eebfe + //printf("answer/n"); + //answer.printYourself(); return; } @@ -388,11 +364,6 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS FloatArray u; FloatArray incrementalStrain; - if ( !this->LatticeFrame3dg::isActivated(tStep) ) { - answer.resize(StructuralMaterial :: giveSizeOfVoigtSymVector(gp->giveMaterialMode() ) ); - answer.zero(); - return; - } LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); auto Strain =lmatStat ->giveLatticeStrain(); this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); @@ -400,7 +371,9 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS answer.beProductOf(b, u); answer.times(1./this->length); answer +=Strain; + } + void LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) @@ -412,7 +385,6 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, FloatArray oldInternalForces; FloatArray totalInternalForces; - // auto tempPlasticStrain = status->givePlasticLatticeStrain(); this->length = computeLength(); GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); @@ -430,9 +402,7 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, answer.beProductOf( bf, incrementalStress ); answer += oldInternalForces; //totalInternalForces = strain.at(6) - stress.at(6); - //status->letTotalInernalforcesBe(tempTotalInternalForces); - } bool LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 020c701d1..eedd173d8 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -83,8 +83,9 @@ class LatticeFrame3dg : public LatticeFrame3d virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; bool computeGtoLRotationMatrix(FloatMatrix &) override; - void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); -// + + void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + }; } // end namespace oofem #endif From ea3301621fac15c61a622a645c111d5447cdab6c Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Sat, 26 Nov 2022 14:25:48 +0000 Subject: [PATCH 40/60] giveInternalForcesVector --- .../LatticeElements/latticeframe3dg.C | 83 ++++++++++- .../LatticeElements/latticeframe3dg.h | 130 ++++++++++-------- .../LatticeMaterials/latticematstatus.C | 12 ++ .../LatticeMaterials/latticematstatus.h | 24 +++- 4 files changed, 181 insertions(+), 68 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index d168b5c37..aa00a543a 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -109,12 +109,12 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, if ( fabs(u.at(11)) <= tol ) { answer.at(1, 11) = 0; } else { - answer.at(1, 11) = -l2*(1.-cos(u.at(11)))/u.at(11); + answer.at(1, 11) = l2*(1.-cos(u.at(11)))/u.at(11); } if ( fabs(u.at(12)) <= tol ) { answer.at(1, 12) = 0.; } else { - answer.at(1, 12) = -l2*(1.-cos(u.at(12)))/u.at(12); + answer.at(1, 12) = l2*(1.-cos(u.at(12)))/u.at(12); } //Shear displacement jump in y-plane @@ -304,7 +304,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(5, 5) = -1.; answer.at(5, 6) = 0.; //Second node My2 - answer.at(11, 1) = -sin(u.at(11))*l2; + answer.at(11, 1) = sin(u.at(11))*l2; answer.at(11, 2) = 0.; answer.at(11, 3) = cos(u.at(11))*l2; answer.at(11, 4) = 0.; @@ -320,7 +320,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(6, 5) = 0.; answer.at(6, 6) = -1.; //Second node Mz2 - answer.at(12, 1) = -sin(u.at(12))*l2; + answer.at(12, 1) = sin(u.at(12))*l2; answer.at(12, 2) = -cos(u.at(12))*l2; answer.at(12, 3) = 0.; answer.at(12, 4) = 0.; @@ -329,10 +329,14 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) return; } - +void +LatticeFrame3dg::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +{ + answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); +} void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) + TimeStep *tStep) // Computes numerically the stiffness matrix of the receiver. { FloatMatrix d, bi, bj, bjt, dbj, dij, bf; @@ -500,7 +504,72 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) return 1; } +void +LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const +{ + answer = { + D_u, D_v, D_w, R_u, R_v, R_w + }; +} +void +LatticeFrame3dg::initializeFrom(InputRecord &ir) +{ + LatticeStructuralElement::initializeFrom(ir); + + referenceNode = 0; + referenceAngle = 0; + this->zaxis.clear(); + if ( ir.hasField(_IFT_LatticeFrame3d_zaxis) ) { + IR_GIVE_FIELD(ir, this->zaxis, _IFT_LatticeFrame3dg_zaxis); + } else if ( ir.hasField(_IFT_LatticeFrame3d_refnode) ) { + IR_GIVE_FIELD(ir, referenceNode, _IFT_LatticeFrame3dg_refnode); + if ( referenceNode == 0 ) { + OOFEM_WARNING("wrong reference node specified. Using default orientation."); + } + } else if ( ir.hasField(_IFT_LatticeFrame3d_refangle) ) { + IR_GIVE_FIELD(ir, referenceAngle, _IFT_LatticeFrame3dg_refangle); + } else { + throw ValueInputException(ir, _IFT_LatticeFrame3d_zaxis, "axis, reference node, or angle not set"); + } + + this->s = 0.; + IR_GIVE_OPTIONAL_FIELD(ir, s, _IFT_LatticeFrame3d_s); + +} + + +double +LatticeFrame3dg::computeLength() +{ + double dx, dy, dz; + Node *nodeA, *nodeB; + + if ( length == 0. ) { + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); + dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); + dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); + length = sqrt(dx * dx + dy * dy + dz * dz); + } + + return length; +} + +void +LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) +// Returns the lumped mass matrix of the receiver. This expression is +// valid in both local and global axes. +{ + GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); + double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); + double halfMass = density * computeVolumeAround(gp) / 2.; + answer.resize(12, 12); + answer.zero(); + answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; + answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; +} -} // end namespace oofem +} // end namespace oofem \ No newline at end of file diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index eedd173d8..1f489d23b 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -1,36 +1,36 @@ /* - * - * ##### ##### ###### ###### ### ### - * ## ## ## ## ## ## ## ### ## - * ## ## ## ## #### #### ## # ## - * ## ## ## ## ## ## ## ## - * ## ## ## ## ## ## ## ## - * ##### ##### ## ###### ## ## - * - * - * OOFEM : Object Oriented Finite Element Code - * - * Copyright (C) 1993 - 2019 Borek Patzak - * - * - * - * Czech Technical University, Faculty of Civil Engineering, - * Department of Structural Mechanics, 166 29 Prague, Czech Republic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ +* +* ##### ##### ###### ###### ### ### +* ## ## ## ## ## ## ## ### ## +* ## ## ## ## #### #### ## # ## +* ## ## ## ## ## ## ## ## +* ## ## ## ## ## ## ## ## +* ##### ##### ## ###### ## ## +* +* +* OOFEM : Object Oriented Finite Element Code +* +* Copyright (C) 1993 - 2019 Borek Patzak +* +* +* +* Czech Technical University, Faculty of Civil Engineering, +* Department of Structural Mechanics, 166 29 Prague, Czech Republic +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ #ifndef latticeframe3dg_h #define latticeframe3dg_h @@ -48,44 +48,54 @@ namespace oofem { /** - * This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. - * Authors: Gumaa Abdelrhim and Peter Grassl - */ +* This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. +* Authors: Gumaa Abdelrhim and Peter Grassl +*/ class LatticeFrame3dg : public LatticeFrame3d { protected: - int referenceNode; - FloatArray zaxis; - double referenceAngle = 0; - double kappa; - double length = 0.; - double iy, iz, ik; - double area, shearareay, shearareaz; - double s; - FloatMatrix localCoordinateSystem; - - FloatArray midPoint, globalCentroid, normal; + int referenceNode; + FloatArray zaxis; + double referenceAngle = 0; + double kappa; + double length = 0.; + double iy, iz, ik; + double area, shearareay, shearareaz; + double s; + FloatMatrix localCoordinateSystem; + + FloatArray midPoint, globalCentroid, normal; public: - LatticeFrame3dg(int n, Domain *); - virtual ~LatticeFrame3dg(); - int giveLocalCoordinateSystem(FloatMatrix &answer) override; + LatticeFrame3dg(int n, Domain *); + virtual ~LatticeFrame3dg(); - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } - const char *giveClassName() const override { return "latticeframe3dg"; } + double computeLength() override; + void initializeFrom(InputRecord &ir) override; + void giveDofManDofIDMask(int inode, IntArray &) const override; + + int giveLocalCoordinateSystem(FloatMatrix &answer) override; + + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } + const char *giveClassName() const override { return "latticeframe3dg"; } + + void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; + + Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } -protected: - void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; - // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; - virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; - void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - bool computeGtoLRotationMatrix(FloatMatrix &) override; - void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + protected: + void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; + void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; + virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; + bool computeGtoLRotationMatrix(FloatMatrix &) override; + void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + void computeLumpedMassMatrix( FloatMatrix &answer, TimeStep *tStep )override; }; } // end namespace oofem -#endif +#endif \ No newline at end of file diff --git a/src/sm/Materials/LatticeMaterials/latticematstatus.C b/src/sm/Materials/LatticeMaterials/latticematstatus.C index e5f3e1c8f..fb9e5ddcc 100644 --- a/src/sm/Materials/LatticeMaterials/latticematstatus.C +++ b/src/sm/Materials/LatticeMaterials/latticematstatus.C @@ -54,6 +54,8 @@ LatticeMaterialStatus :: initTempStatus() this->tempLatticeStrain = this->latticeStrain; + this->tempInternalForces = this->internalForces; + this->tempLatticeStress = this->latticeStress; this->tempReducedLatticeStrain = this->reducedLatticeStrain; @@ -78,6 +80,8 @@ LatticeMaterialStatus :: updateYourself(TimeStep *atTime) { MaterialStatus :: updateYourself(atTime); + this->internalForces = this->tempInternalForces; + this->latticeStress = this->tempLatticeStress; this->latticeStrain = this->tempLatticeStrain; @@ -146,6 +150,10 @@ LatticeMaterialStatus :: saveContext(DataStream &stream, ContextMode mode) THROW_CIOERR(iores); } + if ( ( iores = internalForces.storeYourself(stream) ) != CIO_OK ) { + THROW_CIOERR(iores); + } + if ( ( iores = latticeStrain.storeYourself(stream) ) != CIO_OK ) { THROW_CIOERR(iores); } @@ -194,6 +202,10 @@ LatticeMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode) THROW_CIOERR(iores); } + if ( ( iores = internalForces.restoreYourself(stream) ) != CIO_OK ) { + THROW_CIOERR(iores); + } + if ( ( iores = latticeStress.restoreYourself(stream) ) != CIO_OK ) { THROW_CIOERR(iores); } diff --git a/src/sm/Materials/LatticeMaterials/latticematstatus.h b/src/sm/Materials/LatticeMaterials/latticematstatus.h index 125136184..80baa51f5 100644 --- a/src/sm/Materials/LatticeMaterials/latticematstatus.h +++ b/src/sm/Materials/LatticeMaterials/latticematstatus.h @@ -78,6 +78,9 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Non-equilibrated plastic lattice strain FloatArrayF< 6 >oldPlasticLatticeStrain; + /// Internal Forces + FloatArrayF< 12 >internalForces; + /// Equilibriated damage lattice strain FloatArrayF< 6 >damageLatticeStrain; @@ -101,6 +104,12 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus ///Increment of dissipation double deltaDissipation = 0.; + // ///Internal lForces + // double internalForces=0; + + // ///temp Internal Forces + // double tempInternalForces=0; + /// Non-equilibrated increment of dissipation double tempDeltaDissipation = 0.; @@ -139,8 +148,10 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Returns lattice strain. const FloatArrayF< 6 > &giveLatticeStrain() const { return this->latticeStrain; } + + /// Returns lattice strain. - const FloatArrayF< 6 > &giveTempLatticeStrain() const { return this->tempLatticeStress; } + const FloatArrayF< 6 > &giveTempLatticeStrain() const { return this->tempLatticeStrain; } /// Returns reduced lattice strain. const FloatArrayF< 6 > &giveReducedLatticeStrain() const { return reducedLatticeStrain; } @@ -162,6 +173,9 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Returns temp lattice stress. const FloatArrayF< 6 > &giveTempLatticeStress() const { return this->tempLatticeStress; } + /// Returns temp lattice stress. + const FloatArrayF< 12 > &giveTempInternalForces() const { return this->tempInternalForces; } + /// Returns temp damage lattice strain. const FloatArrayF< 6 > &giveTempDamageLatticeStrain() const { return this->tempDamageLatticeStrain; } @@ -177,6 +191,12 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Assigns the temp value of lattice stress. void letTempLatticeStressBe(const FloatArrayF< 6 > &v) { this->tempLatticeStress = v; } + /// Assigns the temp value of lattice stress. + void letTempInternalForcesBe(const FloatArrayF< 12 > &v) { this->tempInternalForces = v; } + + /// Assigns the temp value of lattice stress. + void letInternalForcesBe(const FloatArrayF< 12 > &v) { this->internalForces = v; } + /// Assigns the temp value of damage lattice strain. void letTempDamageLatticeStrainBe(const FloatArrayF< 6 > &v) { this->tempDamageLatticeStrain = v; } @@ -240,6 +260,8 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus void saveContext(DataStream &stream, ContextMode mode) override; void restoreContext(DataStream &stream, ContextMode mode) override; + /// temp Internal Forces + FloatArrayF< 12 >tempInternalForces; }; } // end namespace oofem #endif // matstatus_h From 1f56598bb65c587582a30b76266bfddf66122e03 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 5 Dec 2022 17:34:46 +0000 Subject: [PATCH 41/60] additional changes to latticeframe3dg --- .../LatticeElements/latticeframe3dg.C | 230 ++++++++++++------ .../LatticeElements/latticeframe3dg.h | 5 +- .../LatticeMaterials/latticematstatus.C | 11 + .../LatticeMaterials/latticematstatus.h | 14 +- 4 files changed, 170 insertions(+), 90 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index aa00a543a..b1bc2c06c 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -68,9 +68,9 @@ LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeFrame3d(n, aDo LatticeFrame3dg::~LatticeFrame3dg() {} - + void -LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) +LatticeFrame3dg::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -81,7 +81,8 @@ LatticeFrame3dg::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, this->length = computeLength(); double tol=1.e-16; FloatArray u; - this->computeVectorOf(VM_Total, tStep, u); + // this->computeVectorOf(VM_Total, tStep, u); + this->computeVectorOf(VM_Incremental, tStep, u); double l1 = this->length*(1.-this->s)/2; double l2 = this->length*(1.+this->s)/2; //Normal displacement jump in x-direction @@ -228,10 +229,12 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); FloatArray u; - this->computeVectorOf(VM_Total, tStep, u); + this->computeVectorOf(VM_Incremental, tStep, u); + // this->computeVectorOf(VM_Total, tStep, u); double l1 = this->length*(1.-this->s)/2; double l2 = this->length*(1.+this->s)/2; - //First Nx1 + + //Nx1 answer.at(1, 1) = -1.; answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; @@ -239,7 +242,48 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(1, 5) = 0.; answer.at(1, 6) = 0.; - //Second Nx2 + //Fy1 + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = 0.; + answer.at(2, 5) = 0; + answer.at(2, 6) = 0.; + + //Fz1 + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = 0.; + answer.at(3, 5) = 0.; + answer.at(3, 6) = 0.; + + //Mx1 + answer.at(4, 1) = 0.; + answer.at(4, 2) = -sin(u.at(5))*l1; + answer.at(4, 3) = -sin(u.at(6))*l1; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + + //My1 + answer.at(5, 1) = sin(u.at(5))*l1; + answer.at(5, 2) = 0.; + answer.at(5, 3) = cos(u.at(5))*l1; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + + //Mz1 + answer.at(6, 1) = sin(u.at(6))*l1; + answer.at(6, 2) = -cos(u.at(6))*l1; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + + + //Nx2 answer.at(7, 1) = 1.; answer.at(7, 2) = 0.; answer.at(7, 3) = 0.; @@ -247,15 +291,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(7, 5) = 0.; answer.at(7, 6) = 0.; - //Shear Y - //first node Fy1 - answer.at(2, 1) = 0.; - answer.at(2, 2) = -1.; - answer.at(2, 3) = 0.; - answer.at(2, 4) = 0.; - answer.at(2, 5) = 0; - answer.at(2, 6) = 0.; - //Second node Fy2 + //Fy2 answer.at(8, 1) = 0.; answer.at(8, 2) = 1.; answer.at(8, 3) = 0.; @@ -263,15 +299,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(8, 5) = 0; answer.at(8, 6) = 0.; - //Shear Z - //first node Fz1 - answer.at(3, 1) = 0.; - answer.at(3, 2) = 0.; - answer.at(3, 3) = -1.; - answer.at(3, 4) = 0.; - answer.at(3, 5) = 0.; - answer.at(3, 6) = 0.; - //Second node Fz2 + //Fz2 answer.at(9, 1) = 0.; answer.at(9, 2) = 0.; answer.at(9, 3) = 1.; @@ -279,15 +307,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(9, 5) = 0.; answer.at(9, 6) = 0.; - //Torsion x - //First node Mx1 - answer.at(4, 1) = 0.; - answer.at(4, 2) = -sin(u.at(5))*l1; - answer.at(4, 3) = -sin(u.at(6))*l1; - answer.at(4, 4) = -1.; - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; - //Second node Mx2 + //Mx2 answer.at(10, 1) = 0.; answer.at(10, 2) = sin(u.at(11))*l2; answer.at(10, 3) = sin(u.at(12))*l2; @@ -295,15 +315,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(10, 5) = 0.; answer.at(10, 6) = 0.; - //Moment around y-axis - //First node my1 - answer.at(5, 1) = sin(u.at(5))*l1; - answer.at(5, 2) = 0.; - answer.at(5, 3) = cos(u.at(5))*l1; - answer.at(5, 4) = 0.; - answer.at(5, 5) = -1.; - answer.at(5, 6) = 0.; - //Second node My2 + //My2 answer.at(11, 1) = sin(u.at(11))*l2; answer.at(11, 2) = 0.; answer.at(11, 3) = cos(u.at(11))*l2; @@ -311,15 +323,7 @@ LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) answer.at(11, 5) = 1.; answer.at(11, 6) = 0.; - //Moment around z-axis - //First node Mz1 - answer.at(6, 1) = sin(u.at(6))*l1; - answer.at(6, 2) = -cos(u.at(6))*l1; - answer.at(6, 3) = 0.; - answer.at(6, 4) = 0.; - answer.at(6, 5) = 0.; - answer.at(6, 6) = -1.; - //Second node Mz2 + //Mz2 answer.at(12, 1) = sin(u.at(12))*l2; answer.at(12, 2) = -cos(u.at(12))*l2; answer.at(12, 3) = 0.; @@ -345,7 +349,7 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); - this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); + this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); @@ -369,13 +373,13 @@ LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeS FloatArray incrementalStrain; LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto Strain =lmatStat ->giveLatticeStrain(); - this->LatticeFrame3dg::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + auto strain =lmatStat ->giveLatticeStrain(); + this->LatticeFrame3dg::computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); this->computeVectorOf(VM_Incremental, tStep, u); + //this->computeVectorOf(VM_Total, tStep, u); answer.beProductOf(b, u); answer.times(1./this->length); - answer +=Strain; - + answer += strain; } void @@ -384,30 +388,31 @@ LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, { FloatMatrix b, bt, bf; FloatArray u, stress, strain; - FloatArray incrementalStress; - FloatArray incrementalInternalForces; - FloatArray oldInternalForces; - FloatArray totalInternalForces; - this->length = computeLength(); GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - bt.beTranspositionOf( b ); + // bt.beTranspositionOf( b ); // Total stress this->LatticeFrame3dg::computeStrainVector( strain, gp, tStep ); this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); - totalInternalForces.beProductOf( bf, stress ); + // totalInternalForces.beProductOf( bf, stress ); // Old stresses LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); auto oldStress= lmatStat->giveLatticeStress(); - oldInternalForces.beProductOf( bf, oldStress ); + + auto oldInternalForces = lmatStat->giveInternalForces(); + + FloatArray incrementalStress; incrementalStress.beDifferenceOf( stress, oldStress ); + answer.beProductOf( bf, incrementalStress ); + //answer.beProductOf( bf, stress ); answer += oldInternalForces; - //totalInternalForces = strain.at(6) - stress.at(6); - //status->letTotalInernalforcesBe(tempTotalInternalForces); + + lmatStat->letTempInternalForcesBe(answer); } + bool LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) { @@ -431,27 +436,49 @@ int LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) { FloatArray lx, ly, lz, help(3); - FloatArray coord; - FloatArray uA(3), uB(3); - + FloatArray coordA, coordB; + FloatArray uA(6),uAIncr(6), uB(6),uBIncr(6); + IntArray dofid = {1,2,3,4,5,6}; + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - + Node *nodeA, *nodeB; nodeA = this->giveNode(1); nodeB = this->giveNode(2); + + + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); + nodeA->giveUnknownVector(uAIncr,dofid,VM_Incremental,tStep,false); + // nodeA->giveUnknownVectorOfType(uA, DisplacementVector, VM_Total, tStep); + // nodeA->giveUnknownVectorOfType(uAIncr, DisplacementVector, VM_Incremental, tStep); + for(int i=1;i<=3;i++){ + coordA.at(i) += uA.at(i)-uAIncr.at(i); + } - //This is not working yet. It only works so far if displacements are translations only. We could do it DOf by DOF or we could understand better hte updated Langragian version that seems to be implemented. I will let you know. - uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); - uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); - uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); - uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); - uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); - uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); + + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + nodeB->giveUnknownVector(uBIncr,dofid,VM_Incremental,tStep,false); - lx.beDifferenceOf(uB, uA ); - lx.normalize(); + // nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordB.at(i) += uB.at(i)-uBIncr.at(i); + } + + /* uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); */ + /* uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); */ + /* uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); */ + + /* uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); */ + /* uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); */ + /* uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); */ + + lx.beDifferenceOf(coordB, coordA ); + lx.normalize(); + if ( this->referenceNode ) { Node *refNode = this->giveDomain()->giveNode(this->referenceNode); help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); @@ -504,7 +531,10 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) return 1; } -void + + + + void LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const { answer = { @@ -557,6 +587,44 @@ LatticeFrame3dg::computeLength() return length; } +double +LatticeFrame3dg::computeCurrentLength() +{ + + TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); + if(tStep->isTheFirstStep()){ + tStep = this->domain->giveEngngModel()->giveCurrentStep(); + } + + + double dx, dy, dz; + Node *nodeA, *nodeB; + double currentLength; + FloatArray uA(6), uB(6), coordA(3), coordB(3); + IntArray dofid = {1,2,3,4,5,6}; + + nodeA = this->giveNode(1); + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordA.at(i) += uA.at(i); + } + + nodeB = this->giveNode(2); + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordB.at(i) += uB.at(i); + } + + dx = coordB.at(1) - coordA.at(1); + dy = coordB.at(2) - coordA.at(2); + dz = coordB.at(3) - coordA.at(3); + currentLength = sqrt(dx * dx + dy * dy + dz * dz); + + return currentLength; +} + void LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) // Returns the lumped mass matrix of the receiver. This expression is @@ -572,4 +640,4 @@ LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) } -} // end namespace oofem \ No newline at end of file +} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 1f489d23b..93f88a44a 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -72,6 +72,7 @@ class LatticeFrame3dg : public LatticeFrame3d virtual ~LatticeFrame3dg(); double computeLength() override; + double computeCurrentLength(); void initializeFrom(InputRecord &ir) override; void giveDofManDofIDMask(int inode, IntArray &) const override; @@ -88,7 +89,7 @@ class LatticeFrame3dg : public LatticeFrame3d protected: void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + void computeBDmatrixAt(GaussPoint *, FloatMatrix &); // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; bool computeGtoLRotationMatrix(FloatMatrix &) override; @@ -98,4 +99,4 @@ class LatticeFrame3dg : public LatticeFrame3d void computeLumpedMassMatrix( FloatMatrix &answer, TimeStep *tStep )override; }; } // end namespace oofem -#endif \ No newline at end of file +#endif diff --git a/src/sm/Materials/LatticeMaterials/latticematstatus.C b/src/sm/Materials/LatticeMaterials/latticematstatus.C index fb9e5ddcc..55a734652 100644 --- a/src/sm/Materials/LatticeMaterials/latticematstatus.C +++ b/src/sm/Materials/LatticeMaterials/latticematstatus.C @@ -170,6 +170,10 @@ LatticeMaterialStatus :: saveContext(DataStream &stream, ContextMode mode) THROW_CIOERR(iores); } + if ( ( iores = internalForces.storeYourself(stream) ) != CIO_OK ) { + THROW_CIOERR(iores); + } + if ( !stream.write(le) ) { THROW_CIOERR(CIO_IOERR); } @@ -222,6 +226,11 @@ LatticeMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode) THROW_CIOERR(iores); } + if ( ( iores = internalForces.restoreYourself(stream) ) != CIO_OK ) { + THROW_CIOERR(iores); + } + + if ( !stream.read(le) ) { THROW_CIOERR(CIO_IOERR); } @@ -237,5 +246,7 @@ LatticeMaterialStatus :: restoreContext(DataStream &stream, ContextMode mode) if ( !stream.read(crackFlag) ) { THROW_CIOERR(CIO_IOERR); } + + } } // end namespace oofem diff --git a/src/sm/Materials/LatticeMaterials/latticematstatus.h b/src/sm/Materials/LatticeMaterials/latticematstatus.h index 80baa51f5..b5093fc4b 100644 --- a/src/sm/Materials/LatticeMaterials/latticematstatus.h +++ b/src/sm/Materials/LatticeMaterials/latticematstatus.h @@ -78,9 +78,10 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Non-equilibrated plastic lattice strain FloatArrayF< 6 >oldPlasticLatticeStrain; - /// Internal Forces + /// Equilibrated Internal Forces FloatArrayF< 12 >internalForces; - + ///Non-equilibrated Internal Forces + FloatArrayF< 12 >tempInternalForces; /// Equilibriated damage lattice strain FloatArrayF< 6 >damageLatticeStrain; @@ -179,6 +180,10 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Returns temp damage lattice strain. const FloatArrayF< 6 > &giveTempDamageLatticeStrain() const { return this->tempDamageLatticeStrain; } + /// Returns temp damage lattice strain. + const FloatArrayF< 12 > &giveInternalForces() const { return this->internalForces; } + + /// Assigns the temp value of lattice strain. void letTempLatticeStrainBe(const FloatArrayF< 6 > &v) { this->tempLatticeStrain = v; } @@ -194,9 +199,6 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus /// Assigns the temp value of lattice stress. void letTempInternalForcesBe(const FloatArrayF< 12 > &v) { this->tempInternalForces = v; } - /// Assigns the temp value of lattice stress. - void letInternalForcesBe(const FloatArrayF< 12 > &v) { this->internalForces = v; } - /// Assigns the temp value of damage lattice strain. void letTempDamageLatticeStrainBe(const FloatArrayF< 6 > &v) { this->tempDamageLatticeStrain = v; } @@ -260,8 +262,6 @@ class LatticeMaterialStatus : public MaterialStatus, public RandomMaterialStatus void saveContext(DataStream &stream, ContextMode mode) override; void restoreContext(DataStream &stream, ContextMode mode) override; - /// temp Internal Forces - FloatArrayF< 12 >tempInternalForces; }; } // end namespace oofem #endif // matstatus_h From c7d96e0cc7f7babdcc39ce80d8d023770b4dfffc Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Mon, 23 Jan 2023 19:08:01 +0000 Subject: [PATCH 42/60] InternalForcesIssue --- .../LatticeElements/latticeframe3dg.C | 98 ++++++++++++------- .../LatticeElements/latticeframe3dg.h | 17 +++- 2 files changed, 77 insertions(+), 38 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index b1bc2c06c..71f3ee68f 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -70,7 +70,7 @@ LatticeFrame3dg::~LatticeFrame3dg() void -LatticeFrame3dg::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) +LatticeFrame3dg::computeBDmatrixAt(GaussPoint *gp, FloatMatrix &answer) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -338,6 +338,22 @@ LatticeFrame3dg::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMod { answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); } +int +LatticeFrame3dg::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) +{ + double ksi, n1, n2; + + ksi = lcoords.at(1); + n1 = ( 1. - ksi ) * 0.5; + n2 = ( 1. + ksi ) * 0.5; + + answer.resize(3); + answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); + answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); + answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); + + return 1; +} void LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) @@ -350,8 +366,12 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); + printf("Bmatrix/n"); + bj.printYourself(); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); + printf("BFmatrix/n"); + bf.printYourself(); dbj.beProductOf(d, bj); dbj.times(1. / length); @@ -362,6 +382,37 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo return; } + +double LatticeFrame3dg::giveArea() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_Area, lc, this); +} + +double LatticeFrame3dg::giveIy() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); +} + +double LatticeFrame3dg::giveIz() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); +} + +double LatticeFrame3dg::giveIk() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); +} + +double LatticeFrame3dg::giveShearAreaY() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); +} + +double LatticeFrame3dg::giveShearAreaZ() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); +} + void LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of @@ -439,14 +490,14 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) FloatArray coordA, coordB; FloatArray uA(6),uAIncr(6), uB(6),uBIncr(6); IntArray dofid = {1,2,3,4,5,6}; - + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - + Node *nodeA, *nodeB; nodeA = this->giveNode(1); nodeB = this->giveNode(2); - - + + coordA = nodeA->giveCoordinates(); nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); nodeA->giveUnknownVector(uAIncr,dofid,VM_Incremental,tStep,false); @@ -456,8 +507,6 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) coordA.at(i) += uA.at(i)-uAIncr.at(i); } - - coordB = nodeB->giveCoordinates(); nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); nodeB->giveUnknownVector(uBIncr,dofid,VM_Incremental,tStep,false); @@ -466,7 +515,7 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) for(int i=1;i<=3;i++){ coordB.at(i) += uB.at(i)-uBIncr.at(i); } - + /* uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); */ /* uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); */ /* uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); */ @@ -475,10 +524,10 @@ LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) /* uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); */ /* uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); */ - + lx.beDifferenceOf(coordB, coordA ); lx.normalize(); - + if ( this->referenceNode ) { Node *refNode = this->giveDomain()->giveNode(this->referenceNode); help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); @@ -545,30 +594,11 @@ LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const void LatticeFrame3dg::initializeFrom(InputRecord &ir) { - LatticeStructuralElement::initializeFrom(ir); - - referenceNode = 0; - referenceAngle = 0; - this->zaxis.clear(); - if ( ir.hasField(_IFT_LatticeFrame3d_zaxis) ) { - IR_GIVE_FIELD(ir, this->zaxis, _IFT_LatticeFrame3dg_zaxis); - } else if ( ir.hasField(_IFT_LatticeFrame3d_refnode) ) { - IR_GIVE_FIELD(ir, referenceNode, _IFT_LatticeFrame3dg_refnode); - if ( referenceNode == 0 ) { - OOFEM_WARNING("wrong reference node specified. Using default orientation."); - } - } else if ( ir.hasField(_IFT_LatticeFrame3d_refangle) ) { - IR_GIVE_FIELD(ir, referenceAngle, _IFT_LatticeFrame3dg_refangle); - } else { - throw ValueInputException(ir, _IFT_LatticeFrame3d_zaxis, "axis, reference node, or angle not set"); - } + LatticeFrame3d::initializeFrom(ir); - this->s = 0.; - IR_GIVE_OPTIONAL_FIELD(ir, s, _IFT_LatticeFrame3d_s); - -} +} double LatticeFrame3dg::computeLength() { @@ -601,8 +631,8 @@ LatticeFrame3dg::computeCurrentLength() Node *nodeA, *nodeB; double currentLength; FloatArray uA(6), uB(6), coordA(3), coordB(3); - IntArray dofid = {1,2,3,4,5,6}; - + IntArray dofid = {1,2,3,4,5,6}; + nodeA = this->giveNode(1); coordA = nodeA->giveCoordinates(); nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); @@ -621,7 +651,7 @@ LatticeFrame3dg::computeCurrentLength() dy = coordB.at(2) - coordA.at(2); dz = coordB.at(3) - coordA.at(3); currentLength = sqrt(dx * dx + dy * dy + dz * dz); - + return currentLength; } diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h index 93f88a44a..f9b29d3cd 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.h @@ -40,10 +40,7 @@ ///@name Input fields for LatticeFrame3dg //@{ #define _IFT_LatticeFrame3dg_Name "latticeframe3dg" -#define _IFT_LatticeFrame3dg_refnode "refnode" -#define _IFT_LatticeFrame3dg_refangle "refangle" -#define _IFT_LatticeFrame3dg_zaxis "zaxis" -#define _IFT_LatticeFrame3dg_s "s" + //@} namespace oofem { @@ -70,7 +67,19 @@ class LatticeFrame3dg : public LatticeFrame3d public: LatticeFrame3dg(int n, Domain *); virtual ~LatticeFrame3dg(); + int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; + + double giveArea() override; + + double giveIy() override; + + double giveIz() override; + + double giveIk() override; + + double giveShearAreaY() override; + double giveShearAreaZ() override; double computeLength() override; double computeCurrentLength(); void initializeFrom(InputRecord &ir) override; From 923956f38c3e36c293f73beb5ce0906d89ae2628 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Sat, 18 Feb 2023 14:01:56 +0000 Subject: [PATCH 43/60] forReview --- src/sm/Elements/LatticeElements/latticeframe3dg.C | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C index 71f3ee68f..a92cebcc9 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dg.C @@ -70,7 +70,7 @@ LatticeFrame3dg::~LatticeFrame3dg() void -LatticeFrame3dg::computeBDmatrixAt(GaussPoint *gp, FloatMatrix &answer) +LatticeFrame3dg::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) // Returns the strain matrix of the receiver. { //Assemble Bmatrix (used to compute strains and rotations) @@ -366,12 +366,12 @@ LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMo answer.resize(12, 12); answer.zero(); this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); - printf("Bmatrix/n"); - bj.printYourself(); + //printf("Bmatrix/n"); + // bj.printYourself(); this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - printf("BFmatrix/n"); - bf.printYourself(); + // printf("BFmatrix/n"); + // bf.printYourself(); dbj.beProductOf(d, bj); dbj.times(1. / length); From a7e34e5e6727833996a3baf511eee3dd161a533c Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Wed, 12 Apr 2023 14:47:35 +0100 Subject: [PATCH 44/60] forReview --- src/sm/CMakeLists.txt | 2 + .../LatticeElements/latticeframe3d3g.C | 868 ++++++++++++++++++ .../LatticeElements/latticeframe3d3g.h | 111 +++ 3 files changed, 981 insertions(+) create mode 100644 src/sm/Elements/LatticeElements/latticeframe3d3g.C create mode 100644 src/sm/Elements/LatticeElements/latticeframe3d3g.h diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index a894920f0..510dbdd14 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -97,6 +97,8 @@ set (sm_element Elements/LatticeElements/latticebeam3dboundary.C Elements/LatticeElements/latticeframe3d.C Elements/LatticeElements/latticeframe3dg.C + Elements/LatticeElements/latticeframe3d3g.C + Elements/LatticeElements/latticeframe3dv.C Elements/tet21ghostsolid.C Elements/quad1platesubsoil.C Elements/quad2platesubsoil.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.C b/src/sm/Elements/LatticeElements/latticeframe3d3g.C new file mode 100644 index 000000000..86f69bd0a --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.C @@ -0,0 +1,868 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2019 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "domain.h" +#include "latticeframe3d3g.h" +#include "../sm/Materials/LatticeMaterials/latticematstatus.h" +#include "node.h" +#include "material.h" +#include "gausspoint.h" +#include "gaussintegrationrule.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "intarray.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "mathfem.h" +#include "latticeframe3d.h" +#include "contextioerr.h" +#include "datastream.h" +#include "classfactory.h" +#include "sm/CrossSections/latticecrosssection.h" +#include "engngm.h" + +#ifdef __OOFEG +#include "oofeggraphiccontext.h" +#include "../sm/Materials/structuralmaterial.h" +#endif + +namespace oofem { +REGISTER_Element(LatticeFrame3d3g); + +LatticeFrame3d3g::LatticeFrame3d3g(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) +{ + numberOfDofMans = 2; +} + +LatticeFrame3d3g::~LatticeFrame3d3g() +{} + + +void +LatticeFrame3d3g::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) +// Returns the strain matrix of the receiver. +{ + //Assemble Bmatrix (used to compute strains and rotations) + answer.resize(6, 12); + answer.zero(); + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + + this->length = computeLength(); + double tol=1.e-16; + FloatArray u; + // this->computeVectorOf(VM_Total, tStep, u); + this->computeVectorOf(VM_Incremental, tStep, u); + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; + //Normal displacement jump in x-direction + //First node + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + if ( fabs(u.at(5)) <= tol ) { + answer.at(1, 5) = 0.; + } else { + answer.at(1, 5) = l1*(1. - cos(u.at(5))*cos(u.at(6)))/u.at(5); + } + if ( fabs(u.at(6)) <= tol ) { + answer.at(1, 6) = 0.; + } else { + answer.at(1, 6) = l1*(1. - cos(u.at(5))*cos(u.at(6)))/u.at(6); + } + // + //Second node + answer.at(1, 7) = 1.; + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + if ( fabs(u.at(11)) <= tol ) { + answer.at(1, 11) = 0; + } else { + answer.at(1, 11) = l2*(1.-cos(u.at(11))*cos(u.at(12)))/u.at(11); + } + if ( fabs(u.at(12)) <= tol ) { + answer.at(1, 12) = 0.; + } else { + answer.at(1, 12) = l2*(1.-cos(u.at(11))*cos(u.at(12)))/u.at(12); + } + + //Shear displacement jump in y-plane + //first node + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = 0.; + answer.at(2, 5) = 0; + if ( fabs(u.at(6)) <= tol ) { + answer.at( 2, 6 ) = l1; + } else { + answer.at( 2, 6 ) = -(cos( u.at( 4 ) )*sin( u.at( 6 ) )+sin( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ) )* l1/u.at(6); + } + //Second node + answer.at(2, 7) = 0.; + answer.at(2, 8) = 1.; + answer.at(2, 9) = 0.; + answer.at(2, 10) = 0.; + answer.at(2, 11) = 0; + if ( fabs(u.at(12)) <= tol ) { + answer.at(2, 12) = l2; + } else { + answer.at( 2, 12 ) = -(cos( u.at( 10 ) )*sin( u.at( 12 ) )+sin( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ) ) * l2/u.at(12); + } + + //Shear displacement jump in z-plane + //first node + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = 0.; + if ( fabs(u.at(5)) <= tol ) { + answer.at(3, 5) = l1; + } else { + answer.at( 3, 5 ) = -(sin( u.at( 4 ) )*sin( u.at( 6 ) )-cos( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) )) * l1/u.at(5); + } + answer.at(3, 6) = 0.; + //Second node + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0.; + answer.at(3, 9) = 1.; + answer.at(3, 10) = 0.; + if ( fabs(u.at(11)) <= tol ) { + answer.at(3, 11) = l2; + } else { + answer.at( 3, 11 ) = -(sin( u.at( 10 ) )*sin( u.at( 12 ) )-cos( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) )) *l2/u.at(11); + } + answer.at(3, 12) = 0.; + + //Rotation around x-axis + //First node + answer.at(4, 1) = 0.; + answer.at(4, 2) = 0; + answer.at(4, 3) = 0.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0.; + answer.at(4, 9) = 0.; + answer.at(4, 10) = 1.; + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + //Rotation around y-axis + //First node + answer.at(5, 1) = 0.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = 0.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node + answer.at(5, 7) = 0.; + answer.at(5, 8) = 0.; + answer.at(5, 9) = 0.; + answer.at(5, 10) = 0.; + answer.at(5, 11) = 1.; + answer.at(5, 12) = 0.; + + //Rotation around z-axis + //First node + answer.at(6, 1) = 0.; + answer.at(6, 2) = 0.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node + answer.at(6, 7) = 0.; + answer.at(6, 8) = 0.; + answer.at(6, 9) = 0.; + answer.at(6, 10) = 0.; + answer.at(6, 11) = 0.; + answer.at(6, 12) = 1.; + + return; +} + +void +LatticeFrame3d3g::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) +{ + //Assemble BFmatrix (used to compute forces ) + answer.resize(12, 6); + answer.zero(); + double tol=1.e-16; + + this->length = computeLength(); + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + + FloatArray u; + this->computeVectorOf(VM_Incremental, tStep, u); + // this->computeVectorOf(VM_Total, tStep, u); + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; + + //Nx1 + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = 0.; + answer.at(1, 6) = 0.; + + //Fy1 + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = 0.; + answer.at(2, 5) = 0; + answer.at(2, 6) = 0.; + + //Fz1 + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = 0.; + answer.at(3, 5) = 0.; + answer.at(3, 6) = 0.; + + //Mx1 + answer.at(4, 1) = 0.; + answer.at(4, 2) = -sin(u.at(5))*l1; + answer.at(4, 3) = -sin(u.at(6))*l1; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + + //My1 + answer.at(5, 1) = (sin( u.at( 4 ) )*sin( u.at( 6 ) )-cos( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ))*l1; + answer.at(5, 2) = 0.; + answer.at(5, 3) = cos(u.at(5))*cos(u.at(6))*l1; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + + //Mz1 + answer.at(6, 1) = (cos( u.at( 4 ) )*sin( u.at( 6 ) )+sin( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ) )* l1; + answer.at(6, 2) = -cos(u.at(5))*cos(u.at(6))*l1; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + + + //Nx2 + answer.at(7, 1) = 1.; + answer.at(7, 2) = 0.; + answer.at(7, 3) = 0.; + answer.at(7, 4) = 0.; + answer.at(7, 5) = 0.; + answer.at(7, 6) = 0.; + + //Fy2 + answer.at(8, 1) = 0.; + answer.at(8, 2) = 1.; + answer.at(8, 3) = 0.; + answer.at(8, 4) = 0.; + answer.at(8, 5) = 0; + answer.at(8, 6) = 0.; + + //Fz2 + answer.at(9, 1) = 0.; + answer.at(9, 2) = 0.; + answer.at(9, 3) = 1.; + answer.at(9, 4) = 0.; + answer.at(9, 5) = 0.; + answer.at(9, 6) = 0.; + + //Mx2 + answer.at(10, 1) = 0.; + answer.at(10, 2) = sin(u.at(11))*l2; + answer.at(10, 3) = sin(u.at(12))*l2; + answer.at(10, 4) = 1.; + answer.at(10, 5) = 0.; + answer.at(10, 6) = 0.; + + //My2 + answer.at(11, 1) = (sin( u.at( 10 ) )*sin( u.at( 12 ) )-cos( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ))*l2; + answer.at(11, 2) = 0.; + answer.at(11, 3) = cos(u.at(11))*cos(u.at(12))*l2; + answer.at(11, 4) = 0.; + answer.at(11, 5) = 1.; + answer.at(11, 6) = 0.; + + //Mz2 + answer.at(12, 1) = (cos( u.at( 10 ) )*sin( u.at( 12 ) )+sin( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ) )*l2; + answer.at(12, 2) = -cos(u.at(11))*cos(u.at(12))*l2; + answer.at(12, 3) = 0.; + answer.at(12, 4) = 0.; + answer.at(12, 5) = 0.; + answer.at(12, 6) = 1.; + + return; +} +void +LatticeFrame3d3g::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +{ + answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); +} +int +LatticeFrame3d3g::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) +{ + double ksi, n1, n2; + + ksi = lcoords.at(1); + n1 = ( 1. - ksi ) * 0.5; + n2 = ( 1. + ksi ) * 0.5; + + answer.resize(3); + answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); + answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); + answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); + + return 1; +} +void +LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) +// Computes numerically the stiffness matrix of the receiver. +{ + FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; + FloatArray u; + this->length = computeLength(); + answer.resize(12, 12); + answer.zero(); + + this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); + this->LatticeFrame3d::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + //printf("Bmatrix/n"); + // bj.printYourself(); + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); + // printf("BFmatrix/n"); + // bf.printYourself(); + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; + this->computeVectorOf(VM_Incremental, tStep, u); + dbj.beProductOf(d, bj); + dbj.times(1. / length); + bjt.beTranspositionOf(bj); + bt.beTranspositionOf(b); + + // answer.beProductOf(bt, dbj); + //answer.beProductOf(bf, dbj); + //Axial 1 + answer.at(1,1)= d.at(1,1); + answer.at(1,2)= 0.; + answer.at(1,3)= 0.; + answer.at(1,4)= 0.; + answer.at(1,5)= -d.at(1, 1)*l1*sin(u.at(5))*cos(u.at(6)); + answer.at(1,6)= -d.at(1, 1)*l1*cos(u.at(5))*sin(u.at(6)); + answer.at(1,7)= -d.at(1,1); + answer.at(1,8)= 0.; + answer.at(1,9)= 0.; + answer.at(1,10)= 0.; + answer.at(1,11)= -d.at(1, 1)*l2*sin(u.at(11))*cos(u.at(12)); + answer.at(1,12)= -d.at(1, 1)*l2*cos(u.at(11))*sin(u.at(12)); + + //Shear Y 1 + answer.at(2,1)= 0; + answer.at(2,2)= d.at(2,2); + answer.at(2,3)= 0.; + answer.at(2,4)= d.at(2,2)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(2,5)= d.at(2, 2)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(2,6)= d.at(2, 2)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(2,7)= 0.; + answer.at(2,8)= -d.at(2,2); + answer.at(2,9)= 0.; + answer.at(2,10)= d.at(2,2)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(2,11)= d.at(2, 2)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(2,12)= d.at(2, 2)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + + + //Shear Z 1 + answer.at(3,1)= 0; + answer.at(3,2)= 0.; + answer.at(3,3)= d.at(3,3); + answer.at(3,4)= d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(3,5)= -d.at(3, 3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; + answer.at(3,6)= d.at(3, 3)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(3,7)= 0.; + answer.at(3,8)= 0; + answer.at(3,9)= -d.at(3,3); + answer.at(3,10)= d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(3,11)= -d.at(3, 3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; + answer.at(3,12)= d.at(3, 3)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + + // Mx 1 + answer.at(4,1)= 0; + answer.at(4,2)= 0.; + answer.at(4,3)= 0.; + answer.at(4,4)= d.at(4,4); + answer.at(4,5)= 0.; + answer.at(4,6)= 0.; + answer.at(4,7)= 0.; + answer.at(4,8)= 0; + answer.at(4,9)= 0.; + answer.at(4,10)= -d.at(4,4); + answer.at(4,11)= 0.; + answer.at(4,12)= 0.; + + // My 1 + answer.at(5,1)= -d.at(1,1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(5,2)= 0.; + answer.at(5,3)= -d.at(3,3)*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(5,4)= d.at(1,1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+d.at(3,3)*(-cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1); + answer.at(5,5)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(5))*cos(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1))+d.at(3,3)*(-(u.at(9)-u.at(3))*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(4))*sin(u.at(6))*l1*sin(u.at(5))*cos(u.at(6))*l1+cos(u.at(4))*cos(2*u.at(5))*cos(u.at(6))*l1*cos(u.at(6))*l1)+d.at(5,5); + answer.at(5,6)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+d.at(3,3)*(-(u.at(9)-u.at(3))*cos(u.at(5))*sin(u.at(6))*l1+sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*sin(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*sin(u.at(6))*l1-sin(u.at(4))*cos(2*u.at(6))*l1*cos(u.at(5))*l1-cos(u.at(4))*sin(u.at(5))*2*sin(u.at(6))*cos(u.at(6))*l1*cos(u.at(5))*l1); + answer.at(5,7)= d.at(1,1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(5,8)= 0; + answer.at(5,9)= d.at(3,3)*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(5,10)= d.at(3,3)*(-cos(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); + answer.at(5,11)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(11))*cos(u.at(12))*l2)+d.at(3,3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1)-d.at(5,5); + answer.at(5,12)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(3,3)*(-sin(u.at(10))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); + + // Mz 1 + answer.at(6,1)= -d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(6,2)= d.at(2, 2)*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(6,3)= 0; + answer.at(6,4)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-d.at(2, 2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1); + answer.at(6,5)= d.at(1,1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(5))*cos(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1)-d.at(2,2)*(-(u.at(8)-u.at(2))*l1*sin(u.at(5))*cos(u.at(6))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(5))*cos(u.at(6))*l1-sin(u.at(4))*cos(u.at(5)*2)*cos(u.at(6))*l1*cos(u.at(6))*l1); + answer.at(6,6)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)- d.at(2, 2)*((-u.at(8)+u.at(2))*cos(u.at(5))*sin(u.at(6))*l1+l1*l2*cos(u.at(10))*sin(u.at(12))*cos(u.at(5))*sin(u.at(6))+l1*l2*sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*cos(u.at(5))*sin(u.at(6))-cos(u.at(4))*cos(u.at(5))*cos(2*u.at(6))*l1*l1+sin(u.at(4))*sin(u.at(5))*cos(u.at(5))*cos(u.at(6))*sin(u.at(6))*2*l1*l1)+d.at(6, 6); + answer.at(6,7)= d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1;; + answer.at(6,8)= -d.at(2, 2)*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(6,9)= 0.; + answer.at(6,10)= -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); + answer.at(6,11)= d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(11))*cos(u.at(12))*l2-d.at(2,2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); + answer.at(6,12)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(11))*sin(u.at(12))*l2)-d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(11))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1)-d.at(6, 6); + + //Axial 2 + answer.at(7,1)= -d.at(1,1); + answer.at(7,2)= 0.; + answer.at(7,3)= 0.; + answer.at(7,4)= 0.; + answer.at(7,5)= d.at(1, 1)*l1*sin(u.at(5))*cos(u.at(6)); + answer.at(7,6)= d.at(1, 1)*l1*cos(u.at(5))*sin(u.at(6)); + answer.at(7,7)= d.at(1,1); + answer.at(7,8)= 0.; + answer.at(7,9)= 0.; + answer.at(7,10)= 0.; + answer.at(7,11)= d.at(1, 1)*l2*sin(u.at(11))*cos(u.at(12)); + answer.at(7,12)= d.at(1, 1)*l2*cos(u.at(11))*sin(u.at(12)); + + //Shear Y 2 + answer.at(8,1)= 0; + answer.at(8,2)= -d.at(2,2); + answer.at(8,3)= 0.; + answer.at(8,4)= d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(8,5)= -d.at(2, 2)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1; + answer.at(8,6)= -d.at(2, 2)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(8,7)= 0.; + answer.at(8,8)= d.at(2,2); + answer.at(8,9)= 0.; + answer.at(8,10)= d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(8,11)= -d.at(2, 2)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(8,12)= -d.at(2, 2)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + + //Shear Z 2 + answer.at(9,1)= 0; + answer.at(9,2)= 0.; + answer.at(9,3)= -d.at(3,3); + answer.at(9,4)= -d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(9,5)= d.at(3, 3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; + answer.at(9,6)= -d.at(3, 3)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(9,7)= 0.; + answer.at(9,8)= 0; + answer.at(9,9)= d.at(3,3); + answer.at(9,10)= -d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(9,11)= d.at(3, 3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; + answer.at(9,12)= -d.at(3, 3)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + + // Mx 2 + answer.at(10,1)= 0; + answer.at(10,2)= 0.; + answer.at(10,3)= 0.; + answer.at(10,4)= -d.at(4,4); + answer.at(10,5)= 0.; + answer.at(10,6)= 0.; + answer.at(10,7)= 0.; + answer.at(10,8)= 0; + answer.at(10,9)= 0.; + answer.at(10,10)= d.at(4,4); + answer.at(10,11)= 0.; + answer.at(10,12)= 0.; + + // My 2 + answer.at(11,1)= -d.at(1,1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(12))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(11,2)= 0.; + answer.at(11,3)= -d.at(3,3)*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(11,4)= d.at(3,3)*(-cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2);; + answer.at(11,5)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(5))*cos(u.at(6))*l1)+d.at(3,3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(5,5); + answer.at(11,6)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)+d.at(3,3)*(-sin(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); + answer.at(11,7)= d.at(1,1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(12))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(11,8)= 0; + answer.at(11,9)= d.at(3,3)*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(11,10)= d.at(1,1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+d.at(3,3)*(-cos(u.at(10))*sin(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2);; + answer.at(11,11)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(11))*cos(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2))+d.at(3,3)*(-(u.at(9)-u.at(3))*sin(u.at(11))*cos(u.at(12))*l2+sin(u.at(10))*sin(u.at(12))*l2*sin(u.at(11))*cos(u.at(12))*l2+cos(u.at(10))*cos(2*u.at(11))*cos(u.at(12))*l2*cos(u.at(12))*l2 +sin(u.at(4))*sin(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*cos(2*u.at(5))*cos(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2)+d.at(5,5); + answer.at(11,12)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(11))*sin(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)+d.at(3,3)*(-(u.at(9)-u.at(3))*cos(u.at(11))*sin(u.at(12))*l2-sin(u.at(10))*cos(2*u.at(12))*cos(u.at(11))*l2*l2-cos(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*2*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2); + // Mz 2 + answer.at(12,1)= -d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(12,2)= d.at(2, 2)*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(12,3)= 0.; + answer.at(12,4)= -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); + answer.at(12,5)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(5))*cos(u.at(6))*l1-d.at(2,2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); + answer.at(12,6)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)-d.at(2,2)*(-cos(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(6,6); + answer.at(12,7)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(12,8)= -d.at(2, 2)*cos(u.at(11))*cos(u.at(12))*l2; + answer.at(12,9)= 0.; + answer.at(12,10)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-d.at(2, 2)*(sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2); + answer.at(12,11)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(11))*cos(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*l2*sin(u.at(11))*cos(u.at(12))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(11))*cos(u.at(12))*l2-sin(u.at(10))*cos(2*u.at(11))*cos(u.at(12))*l2*cos(u.at(12))*l2+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2); + answer.at(12,12)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*cos(u.at(11))*sin(u.at(12))*sin(u.at(12))*l2-cos(u.at(10))*cos(2*u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(6,6); + // + answer.times(1. / length); + // printf("answerDD/n"); + // answer.printYourself(); + return; +} +double LatticeFrame3d3g::giveArea() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_Area, lc, this); +} + +double LatticeFrame3d3g::giveIy() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); +} + +double LatticeFrame3d3g::giveIz() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); +} + +double LatticeFrame3d3g::giveIk() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); +} + +double LatticeFrame3d3g::giveShearAreaY() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); +} + +double LatticeFrame3d3g::giveShearAreaZ() { + FloatArray lc(1); + return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); +} + +void +LatticeFrame3d3g :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) +// Computes the vector containing the strains at the Gauss point gp of +// the receiver, at time step tStep. The nature of these strains depends +// on the element's type. +{ + FloatMatrix b; + FloatArray u; + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; + this->computeVectorOf(VM_Incremental, tStep, u); + LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain =lmatStat ->giveLatticeStrain(); + this->LatticeFrame3d3g::computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + //answer.beProductOf(b, u); + answer.resize(6); + answer.at(1)= (1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1+u.at(7)-u.at(1); + answer.at(2)= -(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+u.at(8)-u.at(2); + answer.at(3)= -(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+u.at(9)-u.at(3); + answer.at(4)= u.at(10)-u.at(4); + answer.at(5)= u.at(11)-u.at(5); + answer.at(6)= u.at(12)-u.at(6); + answer.times(1./this->length); + printf("STRAIN/n"); + answer.printYourself(); + answer += strain; +} +// +void +LatticeFrame3d3g::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) +{ + FloatMatrix b, bt, bf; + FloatArray u, stress, strain; + this->computeVectorOf(VM_Incremental, tStep, u); + this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); + this->LatticeFrame3d3g::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); + // bt.beTranspositionOf( b ); + // Total stress + this->LatticeFrame3d3g::computeStrainVector( strain, gp, tStep ); + this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); + // totalInternalForces.beProductOf( bf, stress ); + // Old stresses + LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); + auto oldStress= lmatStat->giveLatticeStress(); + + auto oldInternalForces = lmatStat->giveInternalForces(); + double l1 = this->length*(1.-this->s)/2; + double l2 = this->length*(1.+this->s)/2; + FloatArray incrementalStress; + incrementalStress.beDifferenceOf( stress, oldStress ); + //printf("incrementalStress/n"); + //incrementalStress.printYourself(); + answer.resize(12); + answer.at(1)= -incrementalStress.at(1), + answer.at(2)= -incrementalStress.at(2); + answer.at(3)= -incrementalStress.at(3); + answer.at(4)= -incrementalStress.at(4); + answer.at(5)= incrementalStress.at(1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+incrementalStress.at(3)*(cos(u.at(5))*cos(u.at(6)))*l2-incrementalStress.at(5); + answer.at(6)= incrementalStress.at(1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(2)*(cos(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(6); + answer.at(7)= incrementalStress.at(1); + answer.at(8)= incrementalStress.at(2); + answer.at(9)= incrementalStress.at(3); + answer.at(10)= incrementalStress.at(4); + answer.at(11)= incrementalStress.at(1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(3)*(cos(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(5); + answer.at(12)= incrementalStress.at(1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-incrementalStress.at(2)*(cos(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(6); //answer.beProductOf( bf, stress ); + answer += oldInternalForces; + printf("answerFORCE/n"); + answer.printYourself(); + lmatStat->letTempInternalForcesBe(answer); +} +bool +LatticeFrame3d3g::computeGtoLRotationMatrix(FloatMatrix &answer) +{ + FloatMatrix lcs; + answer.resize(12, 12); + answer.zero(); + + this->LatticeFrame3d3g::giveLocalCoordinateSystem(lcs); + for ( int i = 1; i <= 3; i++ ) { + for ( int j = 1; j <= 3; j++ ) { + answer.at(i, j) = lcs.at(i, j); + answer.at(i + 3, j + 3) = lcs.at(i, j); + answer.at(i + 6, j + 6) = lcs.at(i, j); + answer.at(i + 9, j + 9) = lcs.at(i, j); + } + } + + return 1; +} +int +LatticeFrame3d3g::giveLocalCoordinateSystem(FloatMatrix &answer) +{ + FloatArray lx, ly, lz, help(3); + FloatArray coordA, coordB; + FloatArray uA(6),uAIncr(6), uB(6),uBIncr(6); + IntArray dofid = {1,2,3,4,5,6}; + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + + Node *nodeA, *nodeB; + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + + + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); + nodeA->giveUnknownVector(uAIncr,dofid,VM_Incremental,tStep,false); + // nodeA->giveUnknownVectorOfType(uA, DisplacementVector, VM_Total, tStep); + // nodeA->giveUnknownVectorOfType(uAIncr, DisplacementVector, VM_Incremental, tStep); + for(int i=1;i<=3;i++){ + coordA.at(i) += uA.at(i)-uAIncr.at(i); + } + + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + nodeB->giveUnknownVector(uBIncr,dofid,VM_Incremental,tStep,false); + + // nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordB.at(i) += uB.at(i)-uBIncr.at(i); + } + + /* uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); */ + /* uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); */ + /* uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); */ + + /* uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); */ + /* uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); */ + /* uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); */ + + + lx.beDifferenceOf(coordB, coordA ); + lx.normalize(); + + if ( this->referenceNode ) { + Node *refNode = this->giveDomain()->giveNode(this->referenceNode); + help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); + + lz.beVectorProductOf(lx, help); + lz.normalize(); + } else if ( this->zaxis.giveSize() > 0 ) { + lz = this->zaxis; + lz.add(lz.dotProduct(lx), lx); + lz.normalize(); + } else { + FloatMatrix rot(3, 3); + double theta = referenceAngle * M_PI / 180.0; + + rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); + rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); + rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); + + rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); + rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); + rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); + + rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); + rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); + rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); + + help.at(3) = 1.0; // up-vector + // here is ly is used as a temp var + if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical + ly = { + 0., 1., 0. + }; + } else { + ly.beVectorProductOf(lx, help); + } + lz.beProductOf(rot, ly); + lz.normalize(); + } + + ly.beVectorProductOf(lz, lx); + ly.normalize(); + + answer.resize(3, 3); + answer.zero(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(1, i) = lx.at(i); + answer.at(2, i) = ly.at(i); + answer.at(3, i) = lz.at(i); + } + + return 1; +} + + + + void +LatticeFrame3d3g::giveDofManDofIDMask(int inode, IntArray &answer) const +{ + answer = { + D_u, D_v, D_w, R_u, R_v, R_w + }; +} + +void +LatticeFrame3d3g::initializeFrom(InputRecord &ir) +{ + LatticeFrame3d::initializeFrom(ir); + + + +} +double +LatticeFrame3d3g::computeLength() +{ + double dx, dy, dz; + Node *nodeA, *nodeB; + + if ( length == 0. ) { + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); + dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); + dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); + length = sqrt(dx * dx + dy * dy + dz * dz); + } + + return length; +} + +double +LatticeFrame3d3g::computeCurrentLength() +{ + + TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); + if(tStep->isTheFirstStep()){ + tStep = this->domain->giveEngngModel()->giveCurrentStep(); + } + + + double dx, dy, dz; + Node *nodeA, *nodeB; + double currentLength; + FloatArray uA(6), uB(6), coordA(3), coordB(3); + IntArray dofid = {1,2,3,4,5,6}; + + nodeA = this->giveNode(1); + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordA.at(i) += uA.at(i); + } + + nodeB = this->giveNode(2); + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); + for(int i=1;i<=3;i++){ + coordB.at(i) += uB.at(i); + } + + dx = coordB.at(1) - coordA.at(1); + dy = coordB.at(2) - coordA.at(2); + dz = coordB.at(3) - coordA.at(3); + currentLength = sqrt(dx * dx + dy * dy + dz * dz); + + return currentLength; +} + +void +LatticeFrame3d3g::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) +// Returns the lumped mass matrix of the receiver. This expression is +// valid in both local and global axes. +{ + GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); + double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); + double halfMass = density * computeVolumeAround(gp) / 2.; + answer.resize(12, 12); + answer.zero(); + answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; + answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; +} + + +} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.h b/src/sm/Elements/LatticeElements/latticeframe3d3g.h new file mode 100644 index 000000000..880c6e793 --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.h @@ -0,0 +1,111 @@ +/* +* +* ##### ##### ###### ###### ### ### +* ## ## ## ## ## ## ## ### ## +* ## ## ## ## #### #### ## # ## +* ## ## ## ## ## ## ## ## +* ## ## ## ## ## ## ## ## +* ##### ##### ## ###### ## ## +* +* +* OOFEM : Object Oriented Finite Element Code +* +* Copyright (C) 1993 - 2019 Borek Patzak +* +* +* +* Czech Technical University, Faculty of Civil Engineering, +* Department of Structural Mechanics, 166 29 Prague, Czech Republic +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef latticeframe3d3g_h +#define latticeframe3d3g_h + +#include "latticeframe3d.h" + +///@name Input fields for LatticeFrame3d3g +//@{ +#define _IFT_LatticeFrame3d3g_Name "latticeframe3d3g" + +//@} + +namespace oofem { +/** +* This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. +* Authors: Gumaa Abdelrhim and Peter Grassl +*/ + +class LatticeFrame3d3g : public LatticeFrame3d +{ +protected: + int referenceNode; + FloatArray zaxis; + double referenceAngle = 0; + double kappa; + double length = 0.; + double iy, iz, ik; + double area, shearareay, shearareaz; + double s; + FloatMatrix localCoordinateSystem; + + FloatArray midPoint, globalCentroid, normal; + +public: + LatticeFrame3d3g(int n, Domain *); + virtual ~LatticeFrame3d3g(); + int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; + + double giveArea() override; + + double giveIy() override; + + double giveIz() override; + + double giveIk() override; + + double giveShearAreaY() override; + + double giveShearAreaZ() override; + double computeLength() override; + double computeCurrentLength(); + void initializeFrom(InputRecord &ir) override; + void giveDofManDofIDMask(int inode, IntArray &) const override; + + int giveLocalCoordinateSystem(FloatMatrix &answer) override; + + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3d3g_Name; } + const char *giveClassName() const override { return "latticeframe3d3g"; } + + void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; + + Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + + + + protected: + void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; + void computeBDmatrixAt(GaussPoint *, FloatMatrix &); + // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; + virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; + bool computeGtoLRotationMatrix(FloatMatrix &) override; + void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); + + void computeLumpedMassMatrix( FloatMatrix &answer, TimeStep *tStep )override; +}; +} // end namespace oofem +#endif From 586a1830a3d2b18cd45b297216bdde4348d6718a Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Mon, 24 Apr 2023 09:35:00 +0100 Subject: [PATCH 45/60] forReview --- .../LatticeElements/latticeframe3d3g.C | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.C b/src/sm/Elements/LatticeElements/latticeframe3d3g.C index 86f69bd0a..7a88c439f 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.C @@ -402,15 +402,15 @@ LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM answer.at(2,1)= 0; answer.at(2,2)= d.at(2,2); answer.at(2,3)= 0.; - answer.at(2,4)= d.at(2,2)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(2,5)= d.at(2, 2)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(2,6)= d.at(2, 2)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(2,4)= -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(2,5)= -d.at(2, 2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; + answer.at(2,6)= -d.at(2, 2)*(-cos(u.at(4))*cos(u.at(6))+sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; answer.at(2,7)= 0.; answer.at(2,8)= -d.at(2,2); answer.at(2,9)= 0.; - answer.at(2,10)= d.at(2,2)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(2,11)= d.at(2, 2)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(2,12)= d.at(2, 2)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + answer.at(2,10)= -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(2,11)= -d.at(2, 2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; + answer.at(2,12)= -d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; //Shear Z 1 @@ -461,7 +461,7 @@ LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM answer.at(6,3)= 0; answer.at(6,4)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-d.at(2, 2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1); answer.at(6,5)= d.at(1,1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(5))*cos(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1)-d.at(2,2)*(-(u.at(8)-u.at(2))*l1*sin(u.at(5))*cos(u.at(6))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(5))*cos(u.at(6))*l1-sin(u.at(4))*cos(u.at(5)*2)*cos(u.at(6))*l1*cos(u.at(6))*l1); - answer.at(6,6)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)- d.at(2, 2)*((-u.at(8)+u.at(2))*cos(u.at(5))*sin(u.at(6))*l1+l1*l2*cos(u.at(10))*sin(u.at(12))*cos(u.at(5))*sin(u.at(6))+l1*l2*sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*cos(u.at(5))*sin(u.at(6))-cos(u.at(4))*cos(u.at(5))*cos(2*u.at(6))*l1*l1+sin(u.at(4))*sin(u.at(5))*cos(u.at(5))*cos(u.at(6))*sin(u.at(6))*2*l1*l1)+d.at(6, 6); + answer.at(6,6)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)- d.at(2, 2)*((-u.at(8)+u.at(2))*cos(u.at(5))*sin(u.at(6))*l1+l1*l2*cos(u.at(10))*sin(u.at(12))*cos(u.at(5))*sin(u.at(6))+l1*l2*sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*cos(u.at(5))*sin(u.at(6))-cos(u.at(4))*cos(u.at(5))*cos(2*u.at(6))*l1*l1+sin(u.at(4))*sin(u.at(5))*cos(u.at(5))*cos(u.at(6))*sin(u.at(6))*2*l1*l1)+d.at(6, 6); answer.at(6,7)= d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1;; answer.at(6,8)= -d.at(2, 2)*cos(u.at(5))*cos(u.at(6))*l1; answer.at(6,9)= 0.; @@ -488,26 +488,26 @@ LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM answer.at(8,2)= -d.at(2,2); answer.at(8,3)= 0.; answer.at(8,4)= d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(8,5)= -d.at(2, 2)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(8,6)= -d.at(2, 2)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; + answer.at(8,5)= d.at(2, 2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; + answer.at(8,6)= d.at(2, 2)*(-cos(u.at(4))*cos(u.at(6))+sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; answer.at(8,7)= 0.; answer.at(8,8)= d.at(2,2); answer.at(8,9)= 0.; answer.at(8,10)= d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(8,11)= -d.at(2, 2)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(8,12)= -d.at(2, 2)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; + answer.at(8,11)= d.at(2, 2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; + answer.at(8,12)= d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; //Shear Z 2 answer.at(9,1)= 0; answer.at(9,2)= 0.; answer.at(9,3)= -d.at(3,3); - answer.at(9,4)= -d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(9,4)= d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; answer.at(9,5)= d.at(3, 3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; answer.at(9,6)= -d.at(3, 3)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; answer.at(9,7)= 0.; answer.at(9,8)= 0; answer.at(9,9)= d.at(3,3); - answer.at(9,10)= -d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(9,10)= d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; answer.at(9,11)= d.at(3, 3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; answer.at(9,12)= -d.at(3, 3)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; @@ -544,17 +544,17 @@ LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM answer.at(12,3)= 0.; answer.at(12,4)= -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); answer.at(12,5)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(5))*cos(u.at(6))*l1-d.at(2,2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); - answer.at(12,6)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)-d.at(2,2)*(-cos(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(6,6); + answer.at(12,6)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)-d.at(2,2)*(-cos(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(6,6); answer.at(12,7)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; answer.at(12,8)= -d.at(2, 2)*cos(u.at(11))*cos(u.at(12))*l2; answer.at(12,9)= 0.; answer.at(12,10)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-d.at(2, 2)*(sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2); answer.at(12,11)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(11))*cos(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*l2*sin(u.at(11))*cos(u.at(12))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(11))*cos(u.at(12))*l2-sin(u.at(10))*cos(2*u.at(11))*cos(u.at(12))*l2*cos(u.at(12))*l2+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2); - answer.at(12,12)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*cos(u.at(11))*sin(u.at(12))*sin(u.at(12))*l2-cos(u.at(10))*cos(2*u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(6,6); + answer.at(12,12)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(11))*sin(u.at(12))*l2)+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*cos(u.at(11))*sin(u.at(12))*l2-cos(u.at(10))*cos(2*u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(6,6); // answer.times(1. / length); - // printf("answerDD/n"); - // answer.printYourself(); + printf("answerSM/n"); + answer.printYourself(); return; } double LatticeFrame3d3g::giveArea() { @@ -646,7 +646,7 @@ LatticeFrame3d3g::giveInternalForcesVector(FloatArray &answer, answer.at(2)= -incrementalStress.at(2); answer.at(3)= -incrementalStress.at(3); answer.at(4)= -incrementalStress.at(4); - answer.at(5)= incrementalStress.at(1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+incrementalStress.at(3)*(cos(u.at(5))*cos(u.at(6)))*l2-incrementalStress.at(5); + answer.at(5)= incrementalStress.at(1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+incrementalStress.at(3)*(cos(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(5); answer.at(6)= incrementalStress.at(1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(2)*(cos(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(6); answer.at(7)= incrementalStress.at(1); answer.at(8)= incrementalStress.at(2); From d6c623071e87bcfa0e5da99e2e4fef846e5e0445 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Wed, 26 Apr 2023 15:17:17 +0100 Subject: [PATCH 46/60] clean up of latticeframe3d3g --- src/sm/CMakeLists.txt | 1 - .../LatticeElements/latticeframe3d3g.C | 1166 ++++++----------- .../LatticeElements/latticeframe3d3g.h | 128 +- 3 files changed, 426 insertions(+), 869 deletions(-) diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 510dbdd14..8294aaacc 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -98,7 +98,6 @@ set (sm_element Elements/LatticeElements/latticeframe3d.C Elements/LatticeElements/latticeframe3dg.C Elements/LatticeElements/latticeframe3d3g.C - Elements/LatticeElements/latticeframe3dv.C Elements/tet21ghostsolid.C Elements/quad1platesubsoil.C Elements/quad2platesubsoil.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.C b/src/sm/Elements/LatticeElements/latticeframe3d3g.C index 7a88c439f..153825996 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.C @@ -10,7 +10,7 @@ * * OOFEM : Object Oriented Finite Element Code * - * Copyright (C) 1993 - 2019 Borek Patzak + * Copyright (C) 1993 - 2023 Borek Patzak * * * @@ -53,816 +53,412 @@ #include "engngm.h" #ifdef __OOFEG -#include "oofeggraphiccontext.h" -#include "../sm/Materials/structuralmaterial.h" + #include "oofeggraphiccontext.h" + #include "../sm/Materials/structuralmaterial.h" #endif namespace oofem { -REGISTER_Element(LatticeFrame3d3g); - -LatticeFrame3d3g::LatticeFrame3d3g(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) -{ - numberOfDofMans = 2; -} - -LatticeFrame3d3g::~LatticeFrame3d3g() -{} - - -void -LatticeFrame3d3g::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) -// Returns the strain matrix of the receiver. -{ - //Assemble Bmatrix (used to compute strains and rotations) - answer.resize(6, 12); - answer.zero(); - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - this->length = computeLength(); - double tol=1.e-16; - FloatArray u; - // this->computeVectorOf(VM_Total, tStep, u); - this->computeVectorOf(VM_Incremental, tStep, u); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - //Normal displacement jump in x-direction - //First node - answer.at(1, 1) = -1.; - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - if ( fabs(u.at(5)) <= tol ) { - answer.at(1, 5) = 0.; - } else { - answer.at(1, 5) = l1*(1. - cos(u.at(5))*cos(u.at(6)))/u.at(5); - } - if ( fabs(u.at(6)) <= tol ) { - answer.at(1, 6) = 0.; - } else { - answer.at(1, 6) = l1*(1. - cos(u.at(5))*cos(u.at(6)))/u.at(6); - } - // - //Second node - answer.at(1, 7) = 1.; - answer.at(1, 8) = 0.; - answer.at(1, 9) = 0.; - answer.at(1, 10) = 0.; - if ( fabs(u.at(11)) <= tol ) { - answer.at(1, 11) = 0; - } else { - answer.at(1, 11) = l2*(1.-cos(u.at(11))*cos(u.at(12)))/u.at(11); - } - if ( fabs(u.at(12)) <= tol ) { - answer.at(1, 12) = 0.; - } else { - answer.at(1, 12) = l2*(1.-cos(u.at(11))*cos(u.at(12)))/u.at(12); - } + REGISTER_Element(LatticeFrame3d3g); - //Shear displacement jump in y-plane - //first node - answer.at(2, 1) = 0.; - answer.at(2, 2) = -1.; - answer.at(2, 3) = 0.; - answer.at(2, 4) = 0.; - answer.at(2, 5) = 0; - if ( fabs(u.at(6)) <= tol ) { - answer.at( 2, 6 ) = l1; - } else { - answer.at( 2, 6 ) = -(cos( u.at( 4 ) )*sin( u.at( 6 ) )+sin( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ) )* l1/u.at(6); + LatticeFrame3d3g::LatticeFrame3d3g(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) + { + numberOfDofMans = 2; } - //Second node - answer.at(2, 7) = 0.; - answer.at(2, 8) = 1.; - answer.at(2, 9) = 0.; - answer.at(2, 10) = 0.; - answer.at(2, 11) = 0; - if ( fabs(u.at(12)) <= tol ) { - answer.at(2, 12) = l2; - } else { - answer.at( 2, 12 ) = -(cos( u.at( 10 ) )*sin( u.at( 12 ) )+sin( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ) ) * l2/u.at(12); + + LatticeFrame3d3g::~LatticeFrame3d3g() + {} + + void + LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) + // Computes numerically the stiffness matrix of the receiver. + { + FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; + FloatArray u; + this->length = computeLength(); + answer.resize(12, 12); + answer.zero(); + + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + + this->computeVectorOf(VM_Incremental, tStep, u); + + //Axial 1 + answer.at(1, 1) = d.at(1, 1); + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = -d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); + answer.at(1, 6) = -d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(1, 7) = -d.at(1, 1); + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = -d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); + answer.at(1, 12) = -d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + + //Shear Y 1 + answer.at(2, 1) = 0; + answer.at(2, 2) = d.at(2, 2); + answer.at(2, 3) = 0.; + answer.at(2, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(2, 5) = -d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(2, 6) = -d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(2, 7) = 0.; + answer.at(2, 8) = -d.at(2, 2); + answer.at(2, 9) = 0.; + answer.at(2, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(2, 11) = -d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(2, 12) = -d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + //Shear Z 1 + answer.at(3, 1) = 0; + answer.at(3, 2) = 0.; + answer.at(3, 3) = d.at(3, 3); + answer.at(3, 4) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(3, 5) = -d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(3, 6) = d.at(3, 3) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0; + answer.at(3, 9) = -d.at(3, 3); + answer.at(3, 10) = d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(3, 11) = -d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(3, 12) = d.at(3, 3) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + // Mx 1 + answer.at(4, 1) = 0; + answer.at(4, 2) = 0.; + answer.at(4, 3) = 0.; + answer.at(4, 4) = d.at(4, 4); + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0; + answer.at(4, 9) = 0.; + answer.at(4, 10) = -d.at(4, 4); + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + // My 1 + answer.at(5, 1) = -d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 2) = 0.; + answer.at(5, 3) = -d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(5, 4) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(5, 5) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + cos( u.at(4) ) * cos( 2 * u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(6) ) * l1 ) + d.at(5, 5); + answer.at(5, 6) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(5) ) * sin( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * cos( u.at(5) ) * sin( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 - sin( u.at(4) ) * cos( 2 * u.at(6) ) * l1 * cos( u.at(5) ) * l1 - cos( u.at(4) ) * sin( u.at(5) ) * 2 * sin( u.at(6) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * l1 ); + answer.at(5, 7) = d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 8) = 0; + answer.at(5, 9) = d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(5, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(5, 11) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ) + d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(5, 5); + answer.at(5, 12) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + + // Mz 1 + answer.at(6, 1) = -d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(6, 2) = d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 3) = 0; + answer.at(6, 4) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(6, 5) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) + cos( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(4) ) * cos(u.at(5) * 2) * cos( u.at(6) ) * l1 * cos( u.at(6) ) * l1 ); + answer.at(6, 6) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(5) ) * sin( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( -u.at(8) + u.at(2) ) * cos( u.at(5) ) * sin( u.at(6) ) * l1 + l1 * l2 * cos( u.at(10) ) * sin( u.at(12) ) * cos( u.at(5) ) * sin( u.at(6) ) + l1 * l2 * sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * cos( u.at(5) ) * sin( u.at(6) ) - cos( u.at(4) ) * cos( u.at(5) ) * cos( 2 * u.at(6) ) * l1 * l1 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(5) ) * cos( u.at(6) ) * sin( u.at(6) ) * 2 * l1 * l1 ) + d.at(6, 6); + answer.at(6, 7) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + ; + answer.at(6, 8) = -d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 9) = 0.; + answer.at(6, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(6, 11) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(6, 12) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) - d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(6, 6); + + //Axial 2 + answer.at(7, 1) = -d.at(1, 1); + answer.at(7, 2) = 0.; + answer.at(7, 3) = 0.; + answer.at(7, 4) = 0.; + answer.at(7, 5) = d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); + answer.at(7, 6) = d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(7, 7) = d.at(1, 1); + answer.at(7, 8) = 0.; + answer.at(7, 9) = 0.; + answer.at(7, 10) = 0.; + answer.at(7, 11) = d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); + answer.at(7, 12) = d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + + //Shear Y 2 + answer.at(8, 1) = 0; + answer.at(8, 2) = -d.at(2, 2); + answer.at(8, 3) = 0.; + answer.at(8, 4) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(8, 5) = d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(8, 6) = d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(8, 7) = 0.; + answer.at(8, 8) = d.at(2, 2); + answer.at(8, 9) = 0.; + answer.at(8, 10) = d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(8, 11) = d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(8, 12) = d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + //Shear Z 2 + answer.at(9, 1) = 0; + answer.at(9, 2) = 0.; + answer.at(9, 3) = -d.at(3, 3); + answer.at(9, 4) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(9, 5) = d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(9, 6) = -d.at(3, 3) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(9, 7) = 0.; + answer.at(9, 8) = 0; + answer.at(9, 9) = d.at(3, 3); + answer.at(9, 10) = d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(9, 11) = d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(9, 12) = -d.at(3, 3) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + // Mx 2 + answer.at(10, 1) = 0; + answer.at(10, 2) = 0.; + answer.at(10, 3) = 0.; + answer.at(10, 4) = -d.at(4, 4); + answer.at(10, 5) = 0.; + answer.at(10, 6) = 0.; + answer.at(10, 7) = 0.; + answer.at(10, 8) = 0; + answer.at(10, 9) = 0.; + answer.at(10, 10) = d.at(4, 4); + answer.at(10, 11) = 0.; + answer.at(10, 12) = 0.; + + // My 2 + answer.at(11, 1) = -d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 2) = 0.; + answer.at(11, 3) = -d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(11, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + ; + answer.at(11, 5) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 ) + d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(5, 5); + answer.at(11, 6) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 ) + d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(11, 7) = d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 8) = 0; + answer.at(11, 9) = d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(11, 10) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + ; + answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + cos( u.at(10) ) * cos( 2 * u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * cos( 2 * u.at(5) ) * cos( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ) + d.at(5, 5); + answer.at(11, 12) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(11) ) * sin( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * cos( u.at(11) ) * sin( u.at(12) ) * l2 - sin( u.at(10) ) * cos( 2 * u.at(12) ) * cos( u.at(11) ) * l2 * l2 - cos( u.at(10) ) * sin( u.at(11) ) * 2 * cos( u.at(12) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * l2 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * 2 * cos( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ); + + // Mz 2 + answer.at(12, 1) = -d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(12, 2) = d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 3) = 0.; + answer.at(12, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(12, 5) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(12, 6) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 ) - d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(6, 6); + answer.at(12, 7) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(12, 8) = -d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 9) = 0.; + answer.at(12, 10) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(12, 11) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(10) ) * cos( 2 * u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(12) ) * l2 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(12, 12) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * cos( u.at(11) ) * sin( u.at(12) ) * l2 - cos( u.at(10) ) * cos( 2 * u.at(12) ) * l2 * cos( u.at(11) ) * l2 + sin( u.at(10) ) * sin( u.at(11) ) * 2 * cos( u.at(12) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * l2 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + d.at(6, 6); + + answer.times(1. / length); + + return; } - //Shear displacement jump in z-plane - //first node - answer.at(3, 1) = 0.; - answer.at(3, 2) = 0.; - answer.at(3, 3) = -1.; - answer.at(3, 4) = 0.; - if ( fabs(u.at(5)) <= tol ) { - answer.at(3, 5) = l1; - } else { - answer.at( 3, 5 ) = -(sin( u.at( 4 ) )*sin( u.at( 6 ) )-cos( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) )) * l1/u.at(5); + void + LatticeFrame3d3g::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) + // Computes the vector containing the strains at the Gauss point gp of + // the receiver, at time step tStep. The nature of these strains depends + // on the element's type. + { + FloatMatrix b; + FloatArray u; + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + this->computeVectorOf(VM_Incremental, tStep, u); + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain = lmatStat->giveLatticeStrain(); + + answer.resize(6); + answer.at(1) = ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(7) - u.at(1); + answer.at(2) = -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(8) - u.at(2); + answer.at(3) = -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(9) - u.at(3); + answer.at(4) = u.at(10) - u.at(4); + answer.at(5) = u.at(11) - u.at(5); + answer.at(6) = u.at(12) - u.at(6); + answer.times(1. / this->length); + + answer += strain; } - answer.at(3, 6) = 0.; - //Second node - answer.at(3, 7) = 0.; - answer.at(3, 8) = 0.; - answer.at(3, 9) = 1.; - answer.at(3, 10) = 0.; - if ( fabs(u.at(11)) <= tol ) { - answer.at(3, 11) = l2; - } else { - answer.at( 3, 11 ) = -(sin( u.at( 10 ) )*sin( u.at( 12 ) )-cos( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) )) *l2/u.at(11); + // + void + LatticeFrame3d3g::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) + { + FloatMatrix b, bt, bf; + FloatArray u, stress, strain; + this->computeVectorOf(VM_Incremental, tStep, u); + this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); + + // Total stress + this->LatticeFrame3d3g::computeStrainVector(strain, gp, tStep); + this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + // Old stresses + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto oldStress = lmatStat->giveLatticeStress(); + + auto oldInternalForces = lmatStat->giveInternalForces(); + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + FloatArray incrementalStress; + incrementalStress.beDifferenceOf(stress, oldStress); + + answer.resize(12); + answer.at(1) = -incrementalStress.at(1), + answer.at(2) = -incrementalStress.at(2); + answer.at(3) = -incrementalStress.at(3); + answer.at(4) = -incrementalStress.at(4); + answer.at(5) = incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); + answer.at(6) = incrementalStress.at(1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(6); + answer.at(7) = incrementalStress.at(1); + answer.at(8) = incrementalStress.at(2); + answer.at(9) = incrementalStress.at(3); + answer.at(10) = incrementalStress.at(4); + answer.at(11) = incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); + answer.at(12) = incrementalStress.at(1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(6); + answer += oldInternalForces; + + lmatStat->letTempInternalForcesBe(answer); } - answer.at(3, 12) = 0.; - - //Rotation around x-axis - //First node - answer.at(4, 1) = 0.; - answer.at(4, 2) = 0; - answer.at(4, 3) = 0.; - answer.at(4, 4) = -1.; - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; - //Second node - answer.at(4, 7) = 0.; - answer.at(4, 8) = 0.; - answer.at(4, 9) = 0.; - answer.at(4, 10) = 1.; - answer.at(4, 11) = 0.; - answer.at(4, 12) = 0.; - - //Rotation around y-axis - //First node - answer.at(5, 1) = 0.; - answer.at(5, 2) = 0.; - answer.at(5, 3) = 0.; - answer.at(5, 4) = 0.; - answer.at(5, 5) = -1.; - answer.at(5, 6) = 0.; - //Second node - answer.at(5, 7) = 0.; - answer.at(5, 8) = 0.; - answer.at(5, 9) = 0.; - answer.at(5, 10) = 0.; - answer.at(5, 11) = 1.; - answer.at(5, 12) = 0.; - - //Rotation around z-axis - //First node - answer.at(6, 1) = 0.; - answer.at(6, 2) = 0.; - answer.at(6, 3) = 0.; - answer.at(6, 4) = 0.; - answer.at(6, 5) = 0.; - answer.at(6, 6) = -1.; - //Second node - answer.at(6, 7) = 0.; - answer.at(6, 8) = 0.; - answer.at(6, 9) = 0.; - answer.at(6, 10) = 0.; - answer.at(6, 11) = 0.; - answer.at(6, 12) = 1.; - - return; -} - -void -LatticeFrame3d3g::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) -{ - //Assemble BFmatrix (used to compute forces ) - answer.resize(12, 6); - answer.zero(); - double tol=1.e-16; - - this->length = computeLength(); - - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - FloatArray u; - this->computeVectorOf(VM_Incremental, tStep, u); - // this->computeVectorOf(VM_Total, tStep, u); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - - //Nx1 - answer.at(1, 1) = -1.; - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - answer.at(1, 5) = 0.; - answer.at(1, 6) = 0.; - - //Fy1 - answer.at(2, 1) = 0.; - answer.at(2, 2) = -1.; - answer.at(2, 3) = 0.; - answer.at(2, 4) = 0.; - answer.at(2, 5) = 0; - answer.at(2, 6) = 0.; - - //Fz1 - answer.at(3, 1) = 0.; - answer.at(3, 2) = 0.; - answer.at(3, 3) = -1.; - answer.at(3, 4) = 0.; - answer.at(3, 5) = 0.; - answer.at(3, 6) = 0.; - - //Mx1 - answer.at(4, 1) = 0.; - answer.at(4, 2) = -sin(u.at(5))*l1; - answer.at(4, 3) = -sin(u.at(6))*l1; - answer.at(4, 4) = -1.; - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; - - //My1 - answer.at(5, 1) = (sin( u.at( 4 ) )*sin( u.at( 6 ) )-cos( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ))*l1; - answer.at(5, 2) = 0.; - answer.at(5, 3) = cos(u.at(5))*cos(u.at(6))*l1; - answer.at(5, 4) = 0.; - answer.at(5, 5) = -1.; - answer.at(5, 6) = 0.; - - //Mz1 - answer.at(6, 1) = (cos( u.at( 4 ) )*sin( u.at( 6 ) )+sin( u.at( 4 ) )*sin( u.at( 5 ) )*cos( u.at( 6 ) ) )* l1; - answer.at(6, 2) = -cos(u.at(5))*cos(u.at(6))*l1; - answer.at(6, 3) = 0.; - answer.at(6, 4) = 0.; - answer.at(6, 5) = 0.; - answer.at(6, 6) = -1.; - - - //Nx2 - answer.at(7, 1) = 1.; - answer.at(7, 2) = 0.; - answer.at(7, 3) = 0.; - answer.at(7, 4) = 0.; - answer.at(7, 5) = 0.; - answer.at(7, 6) = 0.; - - //Fy2 - answer.at(8, 1) = 0.; - answer.at(8, 2) = 1.; - answer.at(8, 3) = 0.; - answer.at(8, 4) = 0.; - answer.at(8, 5) = 0; - answer.at(8, 6) = 0.; - - //Fz2 - answer.at(9, 1) = 0.; - answer.at(9, 2) = 0.; - answer.at(9, 3) = 1.; - answer.at(9, 4) = 0.; - answer.at(9, 5) = 0.; - answer.at(9, 6) = 0.; - - //Mx2 - answer.at(10, 1) = 0.; - answer.at(10, 2) = sin(u.at(11))*l2; - answer.at(10, 3) = sin(u.at(12))*l2; - answer.at(10, 4) = 1.; - answer.at(10, 5) = 0.; - answer.at(10, 6) = 0.; - - //My2 - answer.at(11, 1) = (sin( u.at( 10 ) )*sin( u.at( 12 ) )-cos( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ))*l2; - answer.at(11, 2) = 0.; - answer.at(11, 3) = cos(u.at(11))*cos(u.at(12))*l2; - answer.at(11, 4) = 0.; - answer.at(11, 5) = 1.; - answer.at(11, 6) = 0.; - - //Mz2 - answer.at(12, 1) = (cos( u.at( 10 ) )*sin( u.at( 12 ) )+sin( u.at( 10 ) )*sin( u.at( 11 ) )*cos( u.at( 12 ) ) )*l2; - answer.at(12, 2) = -cos(u.at(11))*cos(u.at(12))*l2; - answer.at(12, 3) = 0.; - answer.at(12, 4) = 0.; - answer.at(12, 5) = 0.; - answer.at(12, 6) = 1.; - - return; -} -void -LatticeFrame3d3g::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) -{ - answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); -} -int -LatticeFrame3d3g::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) -{ - double ksi, n1, n2; - - ksi = lcoords.at(1); - n1 = ( 1. - ksi ) * 0.5; - n2 = ( 1. + ksi ) * 0.5; - - answer.resize(3); - answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); - answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); - answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); - - return 1; -} -void -LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) -// Computes numerically the stiffness matrix of the receiver. -{ - FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; - FloatArray u; - this->length = computeLength(); - answer.resize(12, 12); - answer.zero(); - - this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); - this->LatticeFrame3d::computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); - //printf("Bmatrix/n"); - // bj.printYourself(); - this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - // printf("BFmatrix/n"); - // bf.printYourself(); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - this->computeVectorOf(VM_Incremental, tStep, u); - dbj.beProductOf(d, bj); - dbj.times(1. / length); - bjt.beTranspositionOf(bj); - bt.beTranspositionOf(b); - - // answer.beProductOf(bt, dbj); - //answer.beProductOf(bf, dbj); - //Axial 1 - answer.at(1,1)= d.at(1,1); - answer.at(1,2)= 0.; - answer.at(1,3)= 0.; - answer.at(1,4)= 0.; - answer.at(1,5)= -d.at(1, 1)*l1*sin(u.at(5))*cos(u.at(6)); - answer.at(1,6)= -d.at(1, 1)*l1*cos(u.at(5))*sin(u.at(6)); - answer.at(1,7)= -d.at(1,1); - answer.at(1,8)= 0.; - answer.at(1,9)= 0.; - answer.at(1,10)= 0.; - answer.at(1,11)= -d.at(1, 1)*l2*sin(u.at(11))*cos(u.at(12)); - answer.at(1,12)= -d.at(1, 1)*l2*cos(u.at(11))*sin(u.at(12)); - - //Shear Y 1 - answer.at(2,1)= 0; - answer.at(2,2)= d.at(2,2); - answer.at(2,3)= 0.; - answer.at(2,4)= -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(2,5)= -d.at(2, 2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; - answer.at(2,6)= -d.at(2, 2)*(-cos(u.at(4))*cos(u.at(6))+sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; - answer.at(2,7)= 0.; - answer.at(2,8)= -d.at(2,2); - answer.at(2,9)= 0.; - answer.at(2,10)= -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(2,11)= -d.at(2, 2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; - answer.at(2,12)= -d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; - - - //Shear Z 1 - answer.at(3,1)= 0; - answer.at(3,2)= 0.; - answer.at(3,3)= d.at(3,3); - answer.at(3,4)= d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(3,5)= -d.at(3, 3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; - answer.at(3,6)= d.at(3, 3)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; - answer.at(3,7)= 0.; - answer.at(3,8)= 0; - answer.at(3,9)= -d.at(3,3); - answer.at(3,10)= d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(3,11)= -d.at(3, 3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; - answer.at(3,12)= d.at(3, 3)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; - - // Mx 1 - answer.at(4,1)= 0; - answer.at(4,2)= 0.; - answer.at(4,3)= 0.; - answer.at(4,4)= d.at(4,4); - answer.at(4,5)= 0.; - answer.at(4,6)= 0.; - answer.at(4,7)= 0.; - answer.at(4,8)= 0; - answer.at(4,9)= 0.; - answer.at(4,10)= -d.at(4,4); - answer.at(4,11)= 0.; - answer.at(4,12)= 0.; - - // My 1 - answer.at(5,1)= -d.at(1,1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(5,2)= 0.; - answer.at(5,3)= -d.at(3,3)*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(5,4)= d.at(1,1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+d.at(3,3)*(-cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1); - answer.at(5,5)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(5))*cos(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1))+d.at(3,3)*(-(u.at(9)-u.at(3))*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(4))*sin(u.at(6))*l1*sin(u.at(5))*cos(u.at(6))*l1+cos(u.at(4))*cos(2*u.at(5))*cos(u.at(6))*l1*cos(u.at(6))*l1)+d.at(5,5); - answer.at(5,6)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+d.at(3,3)*(-(u.at(9)-u.at(3))*cos(u.at(5))*sin(u.at(6))*l1+sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*sin(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*sin(u.at(6))*l1-sin(u.at(4))*cos(2*u.at(6))*l1*cos(u.at(5))*l1-cos(u.at(4))*sin(u.at(5))*2*sin(u.at(6))*cos(u.at(6))*l1*cos(u.at(5))*l1); - answer.at(5,7)= d.at(1,1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(5,8)= 0; - answer.at(5,9)= d.at(3,3)*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(5,10)= d.at(3,3)*(-cos(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); - answer.at(5,11)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(11))*cos(u.at(12))*l2)+d.at(3,3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1)-d.at(5,5); - answer.at(5,12)= d.at(1,1)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(3,3)*(-sin(u.at(10))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); - - // Mz 1 - answer.at(6,1)= -d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(6,2)= d.at(2, 2)*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(6,3)= 0; - answer.at(6,4)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-d.at(2, 2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(5))*cos(u.at(6))*l1); - answer.at(6,5)= d.at(1,1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(5))*cos(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1)-d.at(2,2)*(-(u.at(8)-u.at(2))*l1*sin(u.at(5))*cos(u.at(6))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*sin(u.at(5))*cos(u.at(6))*l1+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(5))*cos(u.at(6))*l1-sin(u.at(4))*cos(u.at(5)*2)*cos(u.at(6))*l1*cos(u.at(6))*l1); - answer.at(6,6)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(5))*sin(u.at(6))*l1+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)- d.at(2, 2)*((-u.at(8)+u.at(2))*cos(u.at(5))*sin(u.at(6))*l1+l1*l2*cos(u.at(10))*sin(u.at(12))*cos(u.at(5))*sin(u.at(6))+l1*l2*sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*cos(u.at(5))*sin(u.at(6))-cos(u.at(4))*cos(u.at(5))*cos(2*u.at(6))*l1*l1+sin(u.at(4))*sin(u.at(5))*cos(u.at(5))*cos(u.at(6))*sin(u.at(6))*2*l1*l1)+d.at(6, 6); - answer.at(6,7)= d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1;; - answer.at(6,8)= -d.at(2, 2)*cos(u.at(5))*cos(u.at(6))*l1; - answer.at(6,9)= 0.; - answer.at(6,10)= -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); - answer.at(6,11)= d.at(1, 1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*sin(u.at(11))*cos(u.at(12))*l2-d.at(2,2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1); - answer.at(6,12)= d.at(1, 1)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*cos(u.at(11))*sin(u.at(12))*l2)-d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1+sin(u.at(10))*sin(u.at(11))*sin(u.at(12))*l2*cos(u.at(5))*cos(u.at(6))*l1)-d.at(6, 6); - - //Axial 2 - answer.at(7,1)= -d.at(1,1); - answer.at(7,2)= 0.; - answer.at(7,3)= 0.; - answer.at(7,4)= 0.; - answer.at(7,5)= d.at(1, 1)*l1*sin(u.at(5))*cos(u.at(6)); - answer.at(7,6)= d.at(1, 1)*l1*cos(u.at(5))*sin(u.at(6)); - answer.at(7,7)= d.at(1,1); - answer.at(7,8)= 0.; - answer.at(7,9)= 0.; - answer.at(7,10)= 0.; - answer.at(7,11)= d.at(1, 1)*l2*sin(u.at(11))*cos(u.at(12)); - answer.at(7,12)= d.at(1, 1)*l2*cos(u.at(11))*sin(u.at(12)); - - //Shear Y 2 - answer.at(8,1)= 0; - answer.at(8,2)= -d.at(2,2); - answer.at(8,3)= 0.; - answer.at(8,4)= d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(8,5)= d.at(2, 2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; - answer.at(8,6)= d.at(2, 2)*(-cos(u.at(4))*cos(u.at(6))+sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; - answer.at(8,7)= 0.; - answer.at(8,8)= d.at(2,2); - answer.at(8,9)= 0.; - answer.at(8,10)= d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(8,11)= d.at(2, 2)*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; - answer.at(8,12)= d.at(2, 2)*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; - - //Shear Z 2 - answer.at(9,1)= 0; - answer.at(9,2)= 0.; - answer.at(9,3)= -d.at(3,3); - answer.at(9,4)= d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(9,5)= d.at(3, 3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1; - answer.at(9,6)= -d.at(3, 3)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1; - answer.at(9,7)= 0.; - answer.at(9,8)= 0; - answer.at(9,9)= d.at(3,3); - answer.at(9,10)= d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(9,11)= d.at(3, 3)*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2; - answer.at(9,12)= -d.at(3, 3)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2; - - // Mx 2 - answer.at(10,1)= 0; - answer.at(10,2)= 0.; - answer.at(10,3)= 0.; - answer.at(10,4)= -d.at(4,4); - answer.at(10,5)= 0.; - answer.at(10,6)= 0.; - answer.at(10,7)= 0.; - answer.at(10,8)= 0; - answer.at(10,9)= 0.; - answer.at(10,10)= d.at(4,4); - answer.at(10,11)= 0.; - answer.at(10,12)= 0.; - - // My 2 - answer.at(11,1)= -d.at(1,1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(12))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(11,2)= 0.; - answer.at(11,3)= -d.at(3,3)*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(11,4)= d.at(3,3)*(-cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2);; - answer.at(11,5)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(5))*cos(u.at(6))*l1)+d.at(3,3)*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(5,5); - answer.at(11,6)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)+d.at(3,3)*(-sin(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); - answer.at(11,7)= d.at(1,1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(12))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(11,8)= 0; - answer.at(11,9)= d.at(3,3)*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(11,10)= d.at(1,1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+d.at(3,3)*(-cos(u.at(10))*sin(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2-sin(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2);; - answer.at(11,11)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(11))*cos(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2))+d.at(3,3)*(-(u.at(9)-u.at(3))*sin(u.at(11))*cos(u.at(12))*l2+sin(u.at(10))*sin(u.at(12))*l2*sin(u.at(11))*cos(u.at(12))*l2+cos(u.at(10))*cos(2*u.at(11))*cos(u.at(12))*l2*cos(u.at(12))*l2 +sin(u.at(4))*sin(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*cos(2*u.at(5))*cos(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2)+d.at(5,5); - answer.at(11,12)= d.at(1,1)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(11))*sin(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)+d.at(3,3)*(-(u.at(9)-u.at(3))*cos(u.at(11))*sin(u.at(12))*l2-sin(u.at(10))*cos(2*u.at(12))*cos(u.at(11))*l2*l2-cos(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*2*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2); - // Mz 2 - answer.at(12,1)= -d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(12,2)= d.at(2, 2)*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(12,3)= 0.; - answer.at(12,4)= -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); - answer.at(12,5)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(5))*cos(u.at(6))*l1-d.at(2,2)*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2); - answer.at(12,6)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*cos(u.at(5))*sin(u.at(6))*l1)-d.at(2,2)*(-cos(u.at(4))*cos(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*sin(u.at(6))*l1*cos(u.at(11))*cos(u.at(12))*l2)-d.at(6,6); - answer.at(12,7)= d.at(1, 1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(12,8)= -d.at(2, 2)*cos(u.at(11))*cos(u.at(12))*l2; - answer.at(12,9)= 0.; - answer.at(12,10)= d.at(1, 1)*((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-d.at(2, 2)*(sin(u.at(10))*sin(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2-cos(u.at(10))*sin(u.at(11))*cos(u.at(12))*l2*cos(u.at(11))*cos(u.at(12))*l2); - answer.at(12,11)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*sin(u.at(11))*cos(u.at(12))*l2+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*sin(u.at(10))*cos(u.at(11))*cos(u.at(12))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*l2*sin(u.at(11))*cos(u.at(12))+cos(u.at(10))*sin(u.at(12))*l2*sin(u.at(11))*cos(u.at(12))*l2-sin(u.at(10))*cos(2*u.at(11))*cos(u.at(12))*l2*cos(u.at(12))*l2+cos(u.at(4))*sin(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*sin(u.at(11))*cos(u.at(12))*l2); - answer.at(12,12)= d.at(1,1)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(11))*sin(u.at(12))*l2)+((u.at(7)-u.at(1))+(1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(2,2)*(-(u.at(8)-u.at(2))*cos(u.at(11))*sin(u.at(12))*l2-cos(u.at(10))*cos(2*u.at(12))*l2*cos(u.at(11))*l2+sin(u.at(10))*sin(u.at(11))*2*cos(u.at(12))*sin(u.at(12))*l2*cos(u.at(11))*l2+cos(u.at(4))*sin(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2+sin(u.at(4))*sin(u.at(5))*cos(u.at(6))*l1*cos(u.at(11))*sin(u.at(12))*l2)+d.at(6,6); - // - answer.times(1. / length); - printf("answerSM/n"); - answer.printYourself(); - return; -} -double LatticeFrame3d3g::giveArea() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_Area, lc, this); -} - -double LatticeFrame3d3g::giveIy() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); -} - -double LatticeFrame3d3g::giveIz() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); -} - -double LatticeFrame3d3g::giveIk() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); -} - -double LatticeFrame3d3g::giveShearAreaY() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); -} - -double LatticeFrame3d3g::giveShearAreaZ() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); -} - -void -LatticeFrame3d3g :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) -// Computes the vector containing the strains at the Gauss point gp of -// the receiver, at time step tStep. The nature of these strains depends -// on the element's type. -{ - FloatMatrix b; - FloatArray u; - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - this->computeVectorOf(VM_Incremental, tStep, u); - LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto strain =lmatStat ->giveLatticeStrain(); - this->LatticeFrame3d3g::computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); - //answer.beProductOf(b, u); - answer.resize(6); - answer.at(1)= (1-cos(u.at(11))*cos(u.at(12)))*l2+(1-cos(u.at(5))*cos(u.at(6)))*l1+u.at(7)-u.at(1); - answer.at(2)= -(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+u.at(8)-u.at(2); - answer.at(3)= -(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+u.at(9)-u.at(3); - answer.at(4)= u.at(10)-u.at(4); - answer.at(5)= u.at(11)-u.at(5); - answer.at(6)= u.at(12)-u.at(6); - answer.times(1./this->length); - printf("STRAIN/n"); - answer.printYourself(); - answer += strain; -} -// -void -LatticeFrame3d3g::giveInternalForcesVector(FloatArray &answer, - TimeStep *tStep, int useUpdatedGpRecord) -{ - FloatMatrix b, bt, bf; - FloatArray u, stress, strain; - this->computeVectorOf(VM_Incremental, tStep, u); - this->length = computeLength(); - GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); - this->LatticeFrame3d3g::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - // bt.beTranspositionOf( b ); - // Total stress - this->LatticeFrame3d3g::computeStrainVector( strain, gp, tStep ); - this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); - // totalInternalForces.beProductOf( bf, stress ); - // Old stresses - LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); - auto oldStress= lmatStat->giveLatticeStress(); - - auto oldInternalForces = lmatStat->giveInternalForces(); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - FloatArray incrementalStress; - incrementalStress.beDifferenceOf( stress, oldStress ); - //printf("incrementalStress/n"); - //incrementalStress.printYourself(); - answer.resize(12); - answer.at(1)= -incrementalStress.at(1), - answer.at(2)= -incrementalStress.at(2); - answer.at(3)= -incrementalStress.at(3); - answer.at(4)= -incrementalStress.at(4); - answer.at(5)= incrementalStress.at(1)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1+incrementalStress.at(3)*(cos(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(5); - answer.at(6)= incrementalStress.at(1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(2)*(cos(u.at(5))*cos(u.at(6)))*l1-incrementalStress.at(6); - answer.at(7)= incrementalStress.at(1); - answer.at(8)= incrementalStress.at(2); - answer.at(9)= incrementalStress.at(3); - answer.at(10)= incrementalStress.at(4); - answer.at(11)= incrementalStress.at(1)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(3)*(cos(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(5); - answer.at(12)= incrementalStress.at(1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-incrementalStress.at(2)*(cos(u.at(11))*cos(u.at(12)))*l2+incrementalStress.at(6); //answer.beProductOf( bf, stress ); - answer += oldInternalForces; - printf("answerFORCE/n"); - answer.printYourself(); - lmatStat->letTempInternalForcesBe(answer); -} -bool -LatticeFrame3d3g::computeGtoLRotationMatrix(FloatMatrix &answer) -{ - FloatMatrix lcs; - answer.resize(12, 12); - answer.zero(); - - this->LatticeFrame3d3g::giveLocalCoordinateSystem(lcs); - for ( int i = 1; i <= 3; i++ ) { - for ( int j = 1; j <= 3; j++ ) { - answer.at(i, j) = lcs.at(i, j); - answer.at(i + 3, j + 3) = lcs.at(i, j); - answer.at(i + 6, j + 6) = lcs.at(i, j); - answer.at(i + 9, j + 9) = lcs.at(i, j); + + int + LatticeFrame3d3g::giveLocalCoordinateSystem(FloatMatrix &answer) + { + FloatArray lx, ly, lz, help(3); + FloatArray coordA, coordB; + FloatArray uA(6), uAIncr(6), uB(6), uBIncr(6); + IntArray dofid = { + 1, 2, 3, 4, 5, 6 + }; + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + + Node *nodeA, *nodeB; + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + + //We need to determine the local coordinate system from last step. + //Therefore, subtract the displacement increments from total displacement and then update the coordinates with these displacements. + + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); + nodeA->giveUnknownVector(uAIncr, dofid, VM_Incremental, tStep, false); + for (int i = 1; i <= 3; i++) { + coordA.at(i) += uA.at(i) - uAIncr.at(i); } - } - return 1; -} -int -LatticeFrame3d3g::giveLocalCoordinateSystem(FloatMatrix &answer) -{ - FloatArray lx, ly, lz, help(3); - FloatArray coordA, coordB; - FloatArray uA(6),uAIncr(6), uB(6),uBIncr(6); - IntArray dofid = {1,2,3,4,5,6}; - - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - Node *nodeA, *nodeB; - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - - - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); - nodeA->giveUnknownVector(uAIncr,dofid,VM_Incremental,tStep,false); - // nodeA->giveUnknownVectorOfType(uA, DisplacementVector, VM_Total, tStep); - // nodeA->giveUnknownVectorOfType(uAIncr, DisplacementVector, VM_Incremental, tStep); - for(int i=1;i<=3;i++){ - coordA.at(i) += uA.at(i)-uAIncr.at(i); - } + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); + nodeB->giveUnknownVector(uBIncr, dofid, VM_Incremental, tStep, false); - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - nodeB->giveUnknownVector(uBIncr,dofid,VM_Incremental,tStep,false); + for (int i = 1; i <= 3; i++) { + coordB.at(i) += uB.at(i) - uBIncr.at(i); + } - // nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordB.at(i) += uB.at(i)-uBIncr.at(i); - } + lx.beDifferenceOf(coordB, coordA); + lx.normalize(); - /* uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); */ - /* uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); */ - /* uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); */ - - /* uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); */ - /* uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); */ - /* uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); */ - - - lx.beDifferenceOf(coordB, coordA ); - lx.normalize(); - - if ( this->referenceNode ) { - Node *refNode = this->giveDomain()->giveNode(this->referenceNode); - help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); - - lz.beVectorProductOf(lx, help); - lz.normalize(); - } else if ( this->zaxis.giveSize() > 0 ) { - lz = this->zaxis; - lz.add(lz.dotProduct(lx), lx); - lz.normalize(); - } else { - FloatMatrix rot(3, 3); - double theta = referenceAngle * M_PI / 180.0; - - rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); - rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); - rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); - - rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); - rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); - rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); - - rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); - rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); - rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); - - help.at(3) = 1.0; // up-vector - // here is ly is used as a temp var - if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical - ly = { - 0., 1., 0. - }; - } else { - ly.beVectorProductOf(lx, help); - } - lz.beProductOf(rot, ly); - lz.normalize(); - } - ly.beVectorProductOf(lz, lx); - ly.normalize(); + if ( this->referenceNode ) { + Node *refNode = this->giveDomain()->giveNode(this->referenceNode); + help.beDifferenceOf( refNode->giveCoordinates(), nodeA->giveCoordinates() ); - answer.resize(3, 3); - answer.zero(); - for ( int i = 1; i <= 3; i++ ) { - answer.at(1, i) = lx.at(i); - answer.at(2, i) = ly.at(i); - answer.at(3, i) = lz.at(i); - } + lz.beVectorProductOf(lx, help); + lz.normalize(); + } else if ( this->zaxis.giveSize() > 0 ) { + lz = this->zaxis; + lz.add(lz.dotProduct(lx), lx); + lz.normalize(); + } else { + FloatMatrix rot(3, 3); + double theta = referenceAngle * M_PI / 180.0; + + rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); + rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); + rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); + + rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); + rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); + rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); + + rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); + rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); + rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); + + help.at(3) = 1.0; // up-vector + + // here is ly is used as a temp var + if ( fabs( lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical + ly = { + 0., 1., 0. + }; + } else { + ly.beVectorProductOf(lx, help); + } + lz.beProductOf(rot, ly); + lz.normalize(); + } - return 1; -} + ly.beVectorProductOf(lz, lx); + ly.normalize(); - + answer.resize(3, 3); + answer.zero(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(1, i) = lx.at(i); + answer.at(2, i) = ly.at(i); + answer.at(3, i) = lz.at(i); + } - void -LatticeFrame3d3g::giveDofManDofIDMask(int inode, IntArray &answer) const -{ - answer = { - D_u, D_v, D_w, R_u, R_v, R_w - }; -} + return 1; + } -void -LatticeFrame3d3g::initializeFrom(InputRecord &ir) -{ - LatticeFrame3d::initializeFrom(ir); + double + LatticeFrame3d3g::computeCurrentLength() + { + TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); + if ( tStep->isTheFirstStep() ) { + tStep = this->domain->giveEngngModel()->giveCurrentStep(); + } -} -double -LatticeFrame3d3g::computeLength() -{ - double dx, dy, dz; - Node *nodeA, *nodeB; + double dx, dy, dz; + Node *nodeA, *nodeB; + double currentLength; + FloatArray uA(6), uB(6), coordA(3), coordB(3); + IntArray dofid = { + 1, 2, 3, 4, 5, 6 + }; - if ( length == 0. ) { nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); - dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); - dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); - length = sqrt(dx * dx + dy * dy + dz * dz); - } + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); + for (int i = 1; i <= 3; i++) { + coordA.at(i) += uA.at(i); + } - return length; -} - -double -LatticeFrame3d3g::computeCurrentLength() -{ - - TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); - if(tStep->isTheFirstStep()){ - tStep = this->domain->giveEngngModel()->giveCurrentStep(); - } - - - double dx, dy, dz; - Node *nodeA, *nodeB; - double currentLength; - FloatArray uA(6), uB(6), coordA(3), coordB(3); - IntArray dofid = {1,2,3,4,5,6}; - - nodeA = this->giveNode(1); - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordA.at(i) += uA.at(i); - } - - nodeB = this->giveNode(2); - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordB.at(i) += uB.at(i); - } - - dx = coordB.at(1) - coordA.at(1); - dy = coordB.at(2) - coordA.at(2); - dz = coordB.at(3) - coordA.at(3); - currentLength = sqrt(dx * dx + dy * dy + dz * dz); - - return currentLength; -} - -void -LatticeFrame3d3g::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) -// Returns the lumped mass matrix of the receiver. This expression is -// valid in both local and global axes. -{ - GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); - double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); - double halfMass = density * computeVolumeAround(gp) / 2.; - answer.resize(12, 12); - answer.zero(); - answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; - answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; -} + nodeB = this->giveNode(2); + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); + for (int i = 1; i <= 3; i++) { + coordB.at(i) += uB.at(i); + } + dx = coordB.at(1) - coordA.at(1); + dy = coordB.at(2) - coordA.at(2); + dz = coordB.at(3) - coordA.at(3); + currentLength = sqrt(dx * dx + dy * dy + dz * dz); + return currentLength; + } } // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.h b/src/sm/Elements/LatticeElements/latticeframe3d3g.h index 880c6e793..f5707277a 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.h +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.h @@ -1,36 +1,36 @@ /* -* -* ##### ##### ###### ###### ### ### -* ## ## ## ## ## ## ## ### ## -* ## ## ## ## #### #### ## # ## -* ## ## ## ## ## ## ## ## -* ## ## ## ## ## ## ## ## -* ##### ##### ## ###### ## ## -* -* -* OOFEM : Object Oriented Finite Element Code -* -* Copyright (C) 1993 - 2019 Borek Patzak -* -* -* -* Czech Technical University, Faculty of Civil Engineering, -* Department of Structural Mechanics, 166 29 Prague, Czech Republic -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2023 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #ifndef latticeframe3d3g_h #define latticeframe3d3g_h @@ -45,67 +45,29 @@ namespace oofem { /** -* This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. -* Authors: Gumaa Abdelrhim and Peter Grassl -*/ + * This class implements a geometric nonlinear 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It is an extension of a geometric linear 3-dimensional frame element. It belongs to the group of lattice models in OOFEM. + * Authors: Gumaa Abdelrhim and Peter Grassl + */ class LatticeFrame3d3g : public LatticeFrame3d { protected: - int referenceNode; - FloatArray zaxis; - double referenceAngle = 0; - double kappa; - double length = 0.; - double iy, iz, ik; - double area, shearareay, shearareaz; - double s; - FloatMatrix localCoordinateSystem; - - FloatArray midPoint, globalCentroid, normal; public: - LatticeFrame3d3g(int n, Domain *); - virtual ~LatticeFrame3d3g(); - int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; - - double giveArea() override; - - double giveIy() override; - - double giveIz() override; - - double giveIk() override; - - double giveShearAreaY() override; + LatticeFrame3d3g(int n, Domain *); + virtual ~LatticeFrame3d3g(); + double computeCurrentLength(); - double giveShearAreaZ() override; - double computeLength() override; - double computeCurrentLength(); - void initializeFrom(InputRecord &ir) override; - void giveDofManDofIDMask(int inode, IntArray &) const override; + int giveLocalCoordinateSystem(FloatMatrix &answer) override; - int giveLocalCoordinateSystem(FloatMatrix &answer) override; + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3d3g_Name; } + const char *giveClassName() const override { return "latticeframe3d3g"; } - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3d3g_Name; } - const char *giveClassName() const override { return "latticeframe3d3g"; } + void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - - - - protected: - void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - void computeBDmatrixAt(GaussPoint *, FloatMatrix &); - // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; - virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; - bool computeGtoLRotationMatrix(FloatMatrix &) override; - void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; - void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); - - void computeLumpedMassMatrix( FloatMatrix &answer, TimeStep *tStep )override; +protected: + void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; + virtual void computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) override; }; } // end namespace oofem #endif From 087cf9815cbb6109a1ae82bee7b4d4e052c02b37 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 17 Aug 2023 13:41:53 +0100 Subject: [PATCH 47/60] forReview --- .../LatticeElements/latticeframe3d3g.C | 119 +++++++++--------- 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.C b/src/sm/Elements/LatticeElements/latticeframe3d3g.C index 153825996..97ef74bc9 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.C +++ b/src/sm/Elements/LatticeElements/latticeframe3d3g.C @@ -118,58 +118,57 @@ namespace oofem { answer.at(3, 1) = 0; answer.at(3, 2) = 0.; answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(3, 4) = -d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; answer.at(3, 5) = -d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(3, 6) = d.at(3, 3) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(3, 6) = -d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; answer.at(3, 7) = 0.; answer.at(3, 8) = 0; answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(3, 10) = -d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(3, 11) = -d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(3, 12) = d.at(3, 3) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(3, 12) = -d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; // Mx 1 answer.at(4, 1) = 0; - answer.at(4, 2) = 0.; - answer.at(4, 3) = 0.; - answer.at(4, 4) = d.at(4, 4); - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; + answer.at(4, 2) = d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(4, 3) = d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(4, 4) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+d.at(4,4); + answer.at(4, 5) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)* (-cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1); + answer.at(4, 6) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1); answer.at(4, 7) = 0.; - answer.at(4, 8) = 0; - answer.at(4, 9) = 0.; - answer.at(4, 10) = -d.at(4, 4); - answer.at(4, 11) = 0.; - answer.at(4, 12) = 0.; + answer.at(4, 8) = -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(4, 9) = -d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + answer.at(4, 10) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2))-d.at(4,4); + answer.at(4, 11) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2)); + answer.at(4, 12) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)); // My 1 answer.at(5, 1) = -d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; answer.at(5, 2) = 0.; answer.at(5, 3) = -d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 4) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); - answer.at(5, 5) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + cos( u.at(4) ) * cos( 2 * u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(6) ) * l1 ) + d.at(5, 5); - answer.at(5, 6) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(5) ) * sin( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * cos( u.at(5) ) * sin( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 - sin( u.at(4) ) * cos( 2 * u.at(6) ) * l1 * cos( u.at(5) ) * l1 - cos( u.at(4) ) * sin( u.at(5) ) * 2 * sin( u.at(6) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * l1 ); + answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1* ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(5, 5) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( - cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*(cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(5) ) * cos( u.at(6) ))*l1 )+ d.at(5, 5); + answer.at(5, 6) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(cos( u.at(5) ) * sin( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(5) ) * sin( u.at(6) ))*l1); answer.at(5, 7) = d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; answer.at(5, 8) = 0; answer.at(5, 9) = d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); - answer.at(5, 11) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ) + d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(5, 5); - answer.at(5, 12) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); + answer.at(5, 10) = d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(5, 11) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*(cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 )- d.at(5, 5); + answer.at(5, 12) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2); // Mz 1 answer.at(6, 1) = -d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; answer.at(6, 2) = d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; answer.at(6, 3) = 0; - answer.at(6, 4) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); - answer.at(6, 5) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) + cos( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - sin( u.at(4) ) * cos(u.at(5) * 2) * cos( u.at(6) ) * l1 * cos( u.at(6) ) * l1 ); - answer.at(6, 6) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(5) ) * sin( u.at(6) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( -u.at(8) + u.at(2) ) * cos( u.at(5) ) * sin( u.at(6) ) * l1 + l1 * l2 * cos( u.at(10) ) * sin( u.at(12) ) * cos( u.at(5) ) * sin( u.at(6) ) + l1 * l2 * sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * cos( u.at(5) ) * sin( u.at(6) ) - cos( u.at(4) ) * cos( u.at(5) ) * cos( 2 * u.at(6) ) * l1 * l1 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(5) ) * cos( u.at(6) ) * sin( u.at(6) ) * 2 * l1 * l1 ) + d.at(6, 6); + answer.at(6, 4) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) ); + answer.at(6, 5) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(5) ) * cos( u.at(6) ) * l1 ) ); + answer.at(6, 6) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*( (cos( u.at(5) ) * sin( u.at(6) ) ) * l1 )+ ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)* ( -cos( u.at(5) ) * sin( u.at(6) ) * l1 ))+d.at(6, 6); answer.at(6, 7) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - ; answer.at(6, 8) = -d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; answer.at(6, 9) = 0.; - answer.at(6, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); - answer.at(6, 11) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ); - answer.at(6, 12) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) - d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) * l2 * cos( u.at(5) ) * cos( u.at(6) ) * l1 ) - d.at(6, 6); + answer.at(6, 10) = - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) ); + answer.at(6, 11) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*( (sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) ); + answer.at(6, 12) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*((cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2) )-d.at(6, 6); //Axial 2 answer.at(7, 1) = -d.at(1, 1); @@ -203,59 +202,56 @@ namespace oofem { answer.at(9, 1) = 0; answer.at(9, 2) = 0.; answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(9, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; answer.at(9, 5) = d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(9, 6) = -d.at(3, 3) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(9, 6) = d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; answer.at(9, 7) = 0.; answer.at(9, 8) = 0; answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(9, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(9, 11) = d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(9, 12) = -d.at(3, 3) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(9, 12) = d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; // Mx 2 answer.at(10, 1) = 0; - answer.at(10, 2) = 0.; - answer.at(10, 3) = 0.; - answer.at(10, 4) = -d.at(4, 4); - answer.at(10, 5) = 0.; - answer.at(10, 6) = 0.; + answer.at(10, 2) = -d.at(2,2)*(-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2); + answer.at(10, 3) = -d.at(3,3)*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2); + answer.at(10, 4) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1))-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1))-d.at(4,4); + answer.at(10, 5) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1); + answer.at(10, 6) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1))-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)); answer.at(10, 7) = 0.; - answer.at(10, 8) = 0; - answer.at(10, 9) = 0.; - answer.at(10, 10) = d.at(4, 4); - answer.at(10, 11) = 0.; - answer.at(10, 12) = 0.; - + answer.at(10, 8) = -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(10, 9) = -d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + answer.at(10, 10) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+d.at(4,4); + answer.at(10, 11) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2); + answer.at(10, 12) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(10))*cos(u.at(12))-cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2); // My 2 answer.at(11, 1) = -d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(11, 2) = 0.; answer.at(11, 3) = -d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); - ; - answer.at(11, 5) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 ) + d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(5, 5); - answer.at(11, 6) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 ) + d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); + answer.at(11, 4) = d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(11, 5) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*(cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )- d.at(5, 5); + answer.at(11, 6) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1); answer.at(11, 7) = d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(11, 8) = 0; answer.at(11, 9) = d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 10) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); - ; - answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + cos( u.at(10) ) * cos( 2 * u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * cos( 2 * u.at(5) ) * cos( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ) + d.at(5, 5); - answer.at(11, 12) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(11) ) * sin( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( -( u.at(9) - u.at(3) ) * cos( u.at(11) ) * sin( u.at(12) ) * l2 - sin( u.at(10) ) * cos( 2 * u.at(12) ) * cos( u.at(11) ) * l2 * l2 - cos( u.at(10) ) * sin( u.at(11) ) * 2 * cos( u.at(12) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * l2 + sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * 2 * cos( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ); + answer.at(11, 10) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2); + answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(sin( u.at(11) ) * cos( u.at(12) ) ) * l2+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( - cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*(cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(11) ) * cos( u.at(12) ))*l2 )+ d.at(5, 5); + answer.at(11, 12) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( cos( u.at(11) ) * sin( u.at(12) ) ) * l2+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(11) ) * sin( u.at(12) ))*l2); // Mz 2 answer.at(12, 1) = -d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(12, 2) = d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; answer.at(12, 3) = 0.; - answer.at(12, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); - answer.at(12, 5) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(5) ) * cos( u.at(6) ) * l1 - d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); - answer.at(12, 6) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * cos( u.at(5) ) * sin( u.at(6) ) * l1 ) - d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(6, 6); + answer.at(12, 4) = - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) ); + answer.at(12, 5) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 )) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1)); + answer.at(12, 6) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( (cos( u.at(5) ) * sin( u.at(6) ) ) * l1 )) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1))-d.at(6, 6); answer.at(12, 7) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; answer.at(12, 8) = -d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; answer.at(12, 9) = 0.; - answer.at(12, 10) = d.at(1, 1) * ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(11) ) * cos( u.at(12) ) * l2 ); - answer.at(12, 11) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) * l2 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(12) ) * l2 * sin( u.at(11) ) * cos( u.at(12) ) * l2 - sin( u.at(10) ) * cos( 2 * u.at(11) ) * cos( u.at(12) ) * l2 * cos( u.at(12) ) * l2 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * sin( u.at(11) ) * cos( u.at(12) ) * l2 ); - answer.at(12, 12) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( -( u.at(8) - u.at(2) ) * cos( u.at(11) ) * sin( u.at(12) ) * l2 - cos( u.at(10) ) * cos( 2 * u.at(12) ) * l2 * cos( u.at(11) ) * l2 + sin( u.at(10) ) * sin( u.at(11) ) * 2 * cos( u.at(12) ) * sin( u.at(12) ) * l2 * cos( u.at(11) ) * l2 + cos( u.at(4) ) * sin( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) * l1 * cos( u.at(11) ) * sin( u.at(12) ) * l2 ) + d.at(6, 6); + answer.at(12, 10) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2)); + answer.at(12, 11) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( (sin( u.at(11) ) * cos( u.at(12) ) ) * l2)+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(11) ) * cos( u.at(12) ) * l2 )); + answer.at(12, 12) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(( sin( u.at(11) ) * cos( u.at(12) ) ) * l2)+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(11) ) * sin( u.at(12) ) * l2 ))+d.at(6, 6); answer.times(1. / length); @@ -284,7 +280,8 @@ namespace oofem { answer.at(5) = u.at(11) - u.at(5); answer.at(6) = u.at(12) - u.at(6); answer.times(1. / this->length); - + // printf("Strain/n"); + // answer.printYourself(); answer += strain; } // @@ -316,14 +313,14 @@ namespace oofem { answer.at(1) = -incrementalStress.at(1), answer.at(2) = -incrementalStress.at(2); answer.at(3) = -incrementalStress.at(3); - answer.at(4) = -incrementalStress.at(4); - answer.at(5) = incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); + answer.at(4) = +incrementalStress.at(2)*( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 -incrementalStress.at(3)*( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1-incrementalStress.at(4); + answer.at(5) = -incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); answer.at(6) = incrementalStress.at(1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(6); answer.at(7) = incrementalStress.at(1); answer.at(8) = incrementalStress.at(2); answer.at(9) = incrementalStress.at(3); - answer.at(10) = incrementalStress.at(4); - answer.at(11) = incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); + answer.at(10) = incrementalStress.at(2)*( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 -incrementalStress.at(3)*( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2+incrementalStress.at(4); + answer.at(11) = -incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); answer.at(12) = incrementalStress.at(1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(6); answer += oldInternalForces; From 3fa5bf7a479ba2fac12a4d86614a9ad069665601 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 28 Aug 2023 10:56:58 +0100 Subject: [PATCH 48/60] rename latticeframe3dnl and add docu --- doc/elementlibmanual/elementlibmanual.tex | 40 +- src/sm/CMakeLists.txt | 2 +- .../LatticeElements/latticeframe3d3g.C | 461 ------------------ .../LatticeElements/latticeframe3dnl.C | 420 ++++++++++++++++ ...{latticeframe3d3g.h => latticeframe3dnl.h} | 26 +- 5 files changed, 446 insertions(+), 503 deletions(-) delete mode 100644 src/sm/Elements/LatticeElements/latticeframe3d3g.C create mode 100644 src/sm/Elements/LatticeElements/latticeframe3dnl.C rename src/sm/Elements/LatticeElements/{latticeframe3d3g.h => latticeframe3dnl.h} (65%) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index e808620a7..356b268c0 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -454,7 +454,7 @@ \subsubsection{Latticelink3dboundary} \end{elementsummary} \subsubsection{latticeframe3d element} -latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure ~\ref{latticeframe3dfig}. The element is based on the Rigid Body Spring Model originally developed by Kawai and later delveloped by Bolander for modelling fracture in concrete. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies, which is the mid-cross-section of the element. The properties of the mid-cross-section are internally computed from its vertices which are given as input in the global coordinate sytem. Displacement jumps are computed at the mid-cross-section, which are smeared out over the element length in the form of strains. The input parameters +Latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure ~\ref{latticeframe3dfig}. The element is based on the Rigid Body Spring Model originally developed by Kawai and later delveloped by Bolander for modelling fracture in concrete. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies, which is the mid-cross-section of the element. The properties of the mid-cross-section are internally computed from its vertices which are given as input in the global coordinate sytem. Displacement jumps are computed at the mid-cross-section, which are smeared out over the element length in the form of strains. The input parameters for this element are shown in Table ~\ref{tab:my_label}. \begin{figure}[htb] \centering @@ -463,29 +463,13 @@ \subsubsection{latticeframe3d element} \caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point.} \label{latticeframe3dfig} \end{figure} -\begin{table}[!h] -\centering -\begin{tabular}{|l|l|} -\hline -Keyword&lattice3d\\ -Description&3d lattice frame element\\ -\hline -Parameters&refnode: sets reference node todetermine the local coo-\\ -&rdinatesystem ofelement. \\ -CS properties&Area, inertia moment along y and z axis ($iy$ and $iz$ p-\\ -& arameters),torsion inertia moment $(ik)$ parameter and \\ -&either cross section area shear correction factor (beam \\ -&shear coeff parameter) or equivalent shear areas (shear\\ -&area $y$ and shear area $z$ parameters) are required.\\ -&These cross section properties are assumed to be dened \\ -&in local coordinate system of element.\\ -Unknowns&Six dofs ($u$-displacement, $v$-displacement, $w$-displacem-\\ -&ent, $u$-rotation, $v$-rotation and $w$-rotation) are required\\ & in each node.\\ -\hline -\end{tabular} -\caption{Material properities of steel} -\label{tab:my_label} -\end{table} +\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{{ \inField{zaxis}{ra} }{rn}}{latticeframe3d element summary}{latticeframe3dsummary} +\elementParam{\param{zaxis}: z-axis of local coordinate system } +\elementDescription{CS properties}{Area, inertia moment along y and z axis (\param{iy} and \param{iz} parameters), torsion inertia moment (\param{ik} parameter) and either cross section area shear correction factor (\param{beamshearcoeff} parameter) or equivalent shear areas (\param{shearareay} and \param{shearareaz} parameters) are required. These cross section properties are assumed to be defined in local coordinate system of element.} +\elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} +\elementDescription{Reference}{\cite{Toi91, Toi93, AbdGra23}} +\end{elementsummary} + %----------------------------------------------------------------------------------------------- \clearpage \subsection{Plane Stress Elements} @@ -2227,17 +2211,15 @@ \subsubsection{Tet1\_3D\_SUPG element} %\printbibliography \begin{thebibliography}{99} - - \bibitem{RobertCook1989} R. D. Cook and D. S. Malkus and M. E. Plesha, ``Concepts and Applications of Finite Element Analysis'', Third Edition, isbn: 0-471-84788-7, 1989. \bibitem{BittnarSejnoha1996} Z. Bittnar and J. Sejnoha, ``Numerical Methods in Structural Mechanics'',Thomas Telford,isbn:978-0784401705, 1996. \bibitem{RagnarLarsson2011} R. Larsson and J. Mediavilla and M. Fagerström, ``Dynamic fracture modeling in shell structures based on XFEM'', International Journal for Numerical Methods in Engineering, vol. 86, no. 4-5, 499--527, 2011. \bibitem{GraJir10} P. Grassl and M. Jir\'{a}sek, ``Meso-scale approach to modelling the fracture process zone of concrete subjected to uniaxial tension'', International Journal of Solids and Structures, vol. 47, iss. 7-8, pp. 957-968, 2010.. \bibitem{GraBol16} P. Grassl, J. Bolander, ``Three-Dimensional Network Model for Coupling of Fracture and Mass Transport in Quasi-Brittle Geomaterials'', Materials, 9, 782, 2016 \bibitem{AthWheGra18} I. Athanasiadis, S. Wheeler and P. Grassl. ``Hydro-mechanical network modelling of particulate composites'', International Journal of Solids and Structures, vol. 130-131, pp. 49-60, 2018. -\bibitem{GraAnt19} P. Grassl and A. Antonelli. ``3D network modelling of fracture processes in fibre-reinforced geomaterials'', International Journal of Solids and Structures, vol. 156-157, Pages 234-242, 2019. - - +\bibitem{GraAnt19} P. Grassl and A. Antonelli. ``3D network modelling of fracture processes in fibre-reinforced geomaterials'', International Journal of Solids and Structures, vol. 156-157, pp. 234-242, 2019. +\bibitem{Toi91} Y. Toi. ``Shifted integration technique in one‐dimensional plastic collapse analysis using linear and cubic finite elements'', International Journal for Numerical Methods in Engineering 31, no. 8, pp. 1537-1552, 1991. +\bibitem{AbdGra23} G. Abdelrhim and P. Grassl. ``On a geometric nonlinear Timoshenko frame element with material nonlinearity'', Annual Conference of the UK Association for Computational Mechanics (UKACM), The University of Warwick, UK, 19-21 April 2023. \end{thebibliography} \end{document} diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 8294aaacc..7a75c8991 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -97,7 +97,7 @@ set (sm_element Elements/LatticeElements/latticebeam3dboundary.C Elements/LatticeElements/latticeframe3d.C Elements/LatticeElements/latticeframe3dg.C - Elements/LatticeElements/latticeframe3d3g.C + Elements/LatticeElements/latticeframe3dnl.C Elements/tet21ghostsolid.C Elements/quad1platesubsoil.C Elements/quad2platesubsoil.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.C b/src/sm/Elements/LatticeElements/latticeframe3d3g.C deleted file mode 100644 index 97ef74bc9..000000000 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.C +++ /dev/null @@ -1,461 +0,0 @@ -/* - * - * ##### ##### ###### ###### ### ### - * ## ## ## ## ## ## ## ### ## - * ## ## ## ## #### #### ## # ## - * ## ## ## ## ## ## ## ## - * ## ## ## ## ## ## ## ## - * ##### ##### ## ###### ## ## - * - * - * OOFEM : Object Oriented Finite Element Code - * - * Copyright (C) 1993 - 2023 Borek Patzak - * - * - * - * Czech Technical University, Faculty of Civil Engineering, - * Department of Structural Mechanics, 166 29 Prague, Czech Republic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "domain.h" -#include "latticeframe3d3g.h" -#include "../sm/Materials/LatticeMaterials/latticematstatus.h" -#include "node.h" -#include "material.h" -#include "gausspoint.h" -#include "gaussintegrationrule.h" -#include "floatmatrix.h" -#include "floatmatrixf.h" -#include "intarray.h" -#include "floatarray.h" -#include "floatarrayf.h" -#include "mathfem.h" -#include "latticeframe3d.h" -#include "contextioerr.h" -#include "datastream.h" -#include "classfactory.h" -#include "sm/CrossSections/latticecrosssection.h" -#include "engngm.h" - -#ifdef __OOFEG - #include "oofeggraphiccontext.h" - #include "../sm/Materials/structuralmaterial.h" -#endif - -namespace oofem { - REGISTER_Element(LatticeFrame3d3g); - - LatticeFrame3d3g::LatticeFrame3d3g(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) - { - numberOfDofMans = 2; - } - - LatticeFrame3d3g::~LatticeFrame3d3g() - {} - - void - LatticeFrame3d3g::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) - // Computes numerically the stiffness matrix of the receiver. - { - FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; - FloatArray u; - this->length = computeLength(); - answer.resize(12, 12); - answer.zero(); - - this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - - this->computeVectorOf(VM_Incremental, tStep, u); - - //Axial 1 - answer.at(1, 1) = d.at(1, 1); - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - answer.at(1, 5) = -d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); - answer.at(1, 6) = -d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); - answer.at(1, 7) = -d.at(1, 1); - answer.at(1, 8) = 0.; - answer.at(1, 9) = 0.; - answer.at(1, 10) = 0.; - answer.at(1, 11) = -d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); - answer.at(1, 12) = -d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); - - //Shear Y 1 - answer.at(2, 1) = 0; - answer.at(2, 2) = d.at(2, 2); - answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(2, 5) = -d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(2, 6) = -d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; - answer.at(2, 7) = 0.; - answer.at(2, 8) = -d.at(2, 2); - answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(2, 11) = -d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(2, 12) = -d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; - - //Shear Z 1 - answer.at(3, 1) = 0; - answer.at(3, 2) = 0.; - answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(3, 5) = -d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(3, 6) = -d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; - answer.at(3, 7) = 0.; - answer.at(3, 8) = 0; - answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(3, 11) = -d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(3, 12) = -d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; - - // Mx 1 - answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(4, 3) = d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(4, 4) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)+d.at(4,4); - answer.at(4, 5) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)* (-cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1); - answer.at(4, 6) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1); - answer.at(4, 7) = 0.; - answer.at(4, 8) = -d.at(2,2)*(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(4, 9) = -d.at(3,3)*(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - answer.at(4, 10) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2))-d.at(4,4); - answer.at(4, 11) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2)); - answer.at(4, 12) = -d.at(2,2)*((sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2))-d.at(3,3)*((cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1*(-(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)); - - // My 1 - answer.at(5, 1) = -d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(5, 2) = 0.; - answer.at(5, 3) = -d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1* ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(5, 5) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( - cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*(cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(5) ) * cos( u.at(6) ))*l1 )+ d.at(5, 5); - answer.at(5, 6) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(cos( u.at(5) ) * sin( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(5) ) * sin( u.at(6) ))*l1); - answer.at(5, 7) = d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 10) = d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(5, 11) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*(cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 )- d.at(5, 5); - answer.at(5, 12) = d.at(1, 1) * (( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(5) ) * cos( u.at(6) ))*l1*( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2); - - // Mz 1 - answer.at(6, 1) = -d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(6, 2) = d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(6, 3) = 0; - answer.at(6, 4) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) ); - answer.at(6, 5) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(5) ) * cos( u.at(6) ) * l1 ) ); - answer.at(6, 6) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*( (cos( u.at(5) ) * sin( u.at(6) ) ) * l1 )+ ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)* ( -cos( u.at(5) ) * sin( u.at(6) ) * l1 ))+d.at(6, 6); - answer.at(6, 7) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(6, 8) = -d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(6, 9) = 0.; - answer.at(6, 10) = - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) ); - answer.at(6, 11) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*( (sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) ); - answer.at(6, 12) = d.at(1, 1) * (( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1*((cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * (( cos( u.at(5) ) * cos( u.at(6) ) * l1 )*(-( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2) )-d.at(6, 6); - - //Axial 2 - answer.at(7, 1) = -d.at(1, 1); - answer.at(7, 2) = 0.; - answer.at(7, 3) = 0.; - answer.at(7, 4) = 0.; - answer.at(7, 5) = d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); - answer.at(7, 6) = d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); - answer.at(7, 7) = d.at(1, 1); - answer.at(7, 8) = 0.; - answer.at(7, 9) = 0.; - answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); - answer.at(7, 12) = d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); - - //Shear Y 2 - answer.at(8, 1) = 0; - answer.at(8, 2) = -d.at(2, 2); - answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(8, 5) = d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(8, 6) = d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; - answer.at(8, 7) = 0.; - answer.at(8, 8) = d.at(2, 2); - answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(8, 11) = d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(8, 12) = d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; - - //Shear Z 2 - answer.at(9, 1) = 0; - answer.at(9, 2) = 0.; - answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(9, 5) = d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(9, 6) = d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; - answer.at(9, 7) = 0.; - answer.at(9, 8) = 0; - answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(9, 11) = d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(9, 12) = d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; - - // Mx 2 - answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2,2)*(-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2); - answer.at(10, 3) = -d.at(3,3)*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2); - answer.at(10, 4) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(-sin(u.at(4))*sin(u.at(6))+cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1))-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1))-d.at(4,4); - answer.at(10, 5) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(4))*cos(u.at(5))*cos(u.at(6)))*l1); - answer.at(10, 6) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(4))*cos(u.at(6))-sin(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1))-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(sin(u.at(4))*cos(u.at(6))+cos(u.at(4))*sin(u.at(5))*sin(u.at(6)))*l1)); - answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2,2)*(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(10, 9) = -d.at(3,3)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - answer.at(10, 10) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-sin(u.at(10))*sin(u.at(12))+cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2)+d.at(4,4); - answer.at(10, 11) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(-cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(cos(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(11))*cos(u.at(12)))*l2); - answer.at(10, 12) = -d.at(2,2)*((sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-cos(u.at(10))*cos(u.at(12))+sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2+(u.at(8)-u.at(2)-(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(sin(u.at(10))*cos(u.at(12))+cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2)-d.at(3,3)*((cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2*(-sin(u.at(10))*cos(u.at(12))-cos(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2+(u.at(9)-u.at(3)-(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2-(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1)*(cos(u.at(10))*cos(u.at(12))-sin(u.at(10))*sin(u.at(11))*sin(u.at(12)))*l2); - // My 2 - answer.at(11, 1) = -d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(11, 2) = 0.; - answer.at(11, 3) = -d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 4) = d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(11, 5) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*(cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )- d.at(5, 5); - answer.at(11, 6) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1); - answer.at(11, 7) = d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(11, 8) = 0; - answer.at(11, 9) = d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 10) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2); - answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(sin( u.at(11) ) * cos( u.at(12) ) ) * l2+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( - cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*(cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(11) ) * cos( u.at(12) ))*l2 )+ d.at(5, 5); - answer.at(11, 12) = d.at(1, 1) * (( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( cos( u.at(11) ) * sin( u.at(12) ) ) * l2+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * (( cos( u.at(11) ) * cos( u.at(12) ))*l2*( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2+( ( u.at(9) - u.at(3) )-( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(11) ) * sin( u.at(12) ))*l2); - - // Mz 2 - answer.at(12, 1) = -d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(12, 2) = d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(12, 3) = 0.; - answer.at(12, 4) = - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1) ); - answer.at(12, 5) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 )) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-(sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1)); - answer.at(12, 6) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( (cos( u.at(5) ) * sin( u.at(6) ) ) * l1 )) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1))-d.at(6, 6); - answer.at(12, 7) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(12, 8) = -d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(12, 9) = 0.; - answer.at(12, 10) = d.at(1, 1) * (( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2)); - answer.at(12, 11) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*( (sin( u.at(11) ) * cos( u.at(12) ) ) * l2)+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -sin( u.at(11) ) * cos( u.at(12) ) * l2 )); - answer.at(12, 12) = d.at(1, 1) * (( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2*(( sin( u.at(11) ) * cos( u.at(12) ) ) * l2)+( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 )*( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2) - d.at(2, 2) * (( cos( u.at(11) ) * cos( u.at(12) ) * l2 )*(-( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2)+(( u.at(8) - u.at(2) )-( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2-( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1)*( -cos( u.at(11) ) * sin( u.at(12) ) * l2 ))+d.at(6, 6); - - answer.times(1. / length); - - return; - } - - void - LatticeFrame3d3g::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) - // Computes the vector containing the strains at the Gauss point gp of - // the receiver, at time step tStep. The nature of these strains depends - // on the element's type. - { - FloatMatrix b; - FloatArray u; - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - this->computeVectorOf(VM_Incremental, tStep, u); - LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto strain = lmatStat->giveLatticeStrain(); - - answer.resize(6); - answer.at(1) = ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(7) - u.at(1); - answer.at(2) = -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(8) - u.at(2); - answer.at(3) = -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(9) - u.at(3); - answer.at(4) = u.at(10) - u.at(4); - answer.at(5) = u.at(11) - u.at(5); - answer.at(6) = u.at(12) - u.at(6); - answer.times(1. / this->length); - // printf("Strain/n"); - // answer.printYourself(); - answer += strain; - } - // - void - LatticeFrame3d3g::giveInternalForcesVector(FloatArray &answer, - TimeStep *tStep, int useUpdatedGpRecord) - { - FloatMatrix b, bt, bf; - FloatArray u, stress, strain; - this->computeVectorOf(VM_Incremental, tStep, u); - this->length = computeLength(); - GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); - - // Total stress - this->LatticeFrame3d3g::computeStrainVector(strain, gp, tStep); - this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - - // Old stresses - LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto oldStress = lmatStat->giveLatticeStress(); - - auto oldInternalForces = lmatStat->giveInternalForces(); - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - FloatArray incrementalStress; - incrementalStress.beDifferenceOf(stress, oldStress); - - answer.resize(12); - answer.at(1) = -incrementalStress.at(1), - answer.at(2) = -incrementalStress.at(2); - answer.at(3) = -incrementalStress.at(3); - answer.at(4) = +incrementalStress.at(2)*( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 -incrementalStress.at(3)*( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1-incrementalStress.at(4); - answer.at(5) = -incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); - answer.at(6) = incrementalStress.at(1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(6); - answer.at(7) = incrementalStress.at(1); - answer.at(8) = incrementalStress.at(2); - answer.at(9) = incrementalStress.at(3); - answer.at(10) = incrementalStress.at(2)*( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 -incrementalStress.at(3)*( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2+incrementalStress.at(4); - answer.at(11) = -incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); - answer.at(12) = incrementalStress.at(1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(6); - answer += oldInternalForces; - - lmatStat->letTempInternalForcesBe(answer); - } - - int - LatticeFrame3d3g::giveLocalCoordinateSystem(FloatMatrix &answer) - { - FloatArray lx, ly, lz, help(3); - FloatArray coordA, coordB; - FloatArray uA(6), uAIncr(6), uB(6), uBIncr(6); - IntArray dofid = { - 1, 2, 3, 4, 5, 6 - }; - - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - Node *nodeA, *nodeB; - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - - //We need to determine the local coordinate system from last step. - //Therefore, subtract the displacement increments from total displacement and then update the coordinates with these displacements. - - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); - nodeA->giveUnknownVector(uAIncr, dofid, VM_Incremental, tStep, false); - for (int i = 1; i <= 3; i++) { - coordA.at(i) += uA.at(i) - uAIncr.at(i); - } - - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); - nodeB->giveUnknownVector(uBIncr, dofid, VM_Incremental, tStep, false); - - for (int i = 1; i <= 3; i++) { - coordB.at(i) += uB.at(i) - uBIncr.at(i); - } - - lx.beDifferenceOf(coordB, coordA); - lx.normalize(); - - - if ( this->referenceNode ) { - Node *refNode = this->giveDomain()->giveNode(this->referenceNode); - help.beDifferenceOf( refNode->giveCoordinates(), nodeA->giveCoordinates() ); - - lz.beVectorProductOf(lx, help); - lz.normalize(); - } else if ( this->zaxis.giveSize() > 0 ) { - lz = this->zaxis; - lz.add(lz.dotProduct(lx), lx); - lz.normalize(); - } else { - FloatMatrix rot(3, 3); - double theta = referenceAngle * M_PI / 180.0; - - rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); - rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); - rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); - - rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); - rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); - rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); - - rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); - rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); - rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); - - help.at(3) = 1.0; // up-vector - - // here is ly is used as a temp var - if ( fabs( lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical - ly = { - 0., 1., 0. - }; - } else { - ly.beVectorProductOf(lx, help); - } - lz.beProductOf(rot, ly); - lz.normalize(); - } - - ly.beVectorProductOf(lz, lx); - ly.normalize(); - - answer.resize(3, 3); - answer.zero(); - for ( int i = 1; i <= 3; i++ ) { - answer.at(1, i) = lx.at(i); - answer.at(2, i) = ly.at(i); - answer.at(3, i) = lz.at(i); - } - - return 1; - } - - - double - LatticeFrame3d3g::computeCurrentLength() - { - TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); - if ( tStep->isTheFirstStep() ) { - tStep = this->domain->giveEngngModel()->giveCurrentStep(); - } - - - double dx, dy, dz; - Node *nodeA, *nodeB; - double currentLength; - FloatArray uA(6), uB(6), coordA(3), coordB(3); - IntArray dofid = { - 1, 2, 3, 4, 5, 6 - }; - - nodeA = this->giveNode(1); - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); - for (int i = 1; i <= 3; i++) { - coordA.at(i) += uA.at(i); - } - - nodeB = this->giveNode(2); - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); - for (int i = 1; i <= 3; i++) { - coordB.at(i) += uB.at(i); - } - - dx = coordB.at(1) - coordA.at(1); - dy = coordB.at(2) - coordA.at(2); - dz = coordB.at(3) - coordA.at(3); - currentLength = sqrt(dx * dx + dy * dy + dz * dz); - - return currentLength; - } -} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C new file mode 100644 index 000000000..e8331180d --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -0,0 +1,420 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2023 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "domain.h" +#include "latticeframe3dnl.h" +#include "../sm/Materials/LatticeMaterials/latticematstatus.h" +#include "node.h" +#include "material.h" +#include "gausspoint.h" +#include "gaussintegrationrule.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "intarray.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "mathfem.h" +#include "latticeframe3d.h" +#include "contextioerr.h" +#include "datastream.h" +#include "classfactory.h" +#include "sm/CrossSections/latticecrosssection.h" +#include "engngm.h" + +#ifdef __OOFEG + #include "oofeggraphiccontext.h" + #include "../sm/Materials/structuralmaterial.h" +#endif + +namespace oofem { + REGISTER_Element(LatticeFrame3dNL); + + LatticeFrame3dNL::LatticeFrame3dNL(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) + { + numberOfDofMans = 2; + } + + LatticeFrame3dNL::~LatticeFrame3dNL() + {} + + void + LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) + { + FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; + FloatArray u; + this->length = computeLength(); + answer.resize(12, 12); + answer.zero(); + + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + + this->computeVectorOf(VM_Incremental, tStep, u); + + //Axial 1 + answer.at(1, 1) = d.at(1, 1); + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = -d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); + answer.at(1, 6) = -d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(1, 7) = -d.at(1, 1); + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = -d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); + answer.at(1, 12) = -d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + + //Shear Y 1 + answer.at(2, 1) = 0; + answer.at(2, 2) = d.at(2, 2); + answer.at(2, 3) = 0.; + answer.at(2, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(2, 5) = -d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(2, 6) = -d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(2, 7) = 0.; + answer.at(2, 8) = -d.at(2, 2); + answer.at(2, 9) = 0.; + answer.at(2, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(2, 11) = -d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(2, 12) = -d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + //Shear Z 1 + answer.at(3, 1) = 0; + answer.at(3, 2) = 0.; + answer.at(3, 3) = d.at(3, 3); + answer.at(3, 4) = -d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(3, 5) = -d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(3, 6) = -d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0; + answer.at(3, 9) = -d.at(3, 3); + answer.at(3, 10) = -d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(3, 11) = -d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(3, 12) = -d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + // Mx 1 + answer.at(4, 1) = 0; + answer.at(4, 2) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(4, 3) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(4, 4) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(4, 4); + answer.at(4, 5) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(4, 6) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ); + answer.at(4, 7) = 0.; + answer.at(4, 8) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(4, 9) = -d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(4, 10) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(4, 4); + answer.at(4, 11) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); + answer.at(4, 12) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ); + + // My 1 + answer.at(5, 1) = -d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 2) = 0.; + answer.at(5, 3) = -d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(5, 5) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(5, 5); + answer.at(5, 6) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ); + answer.at(5, 7) = d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 8) = 0; + answer.at(5, 9) = d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(5, 10) = d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(5, 11) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(5, 5); + answer.at(5, 12) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + + // Mz 1 + answer.at(6, 1) = -d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(6, 2) = d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 3) = 0; + answer.at(6, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); + answer.at(6, 5) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(5) ) * cos( u.at(6) ) * l1 ) ); + answer.at(6, 6) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(5) ) * sin( u.at(6) ) * l1 ) ) + d.at(6, 6); + answer.at(6, 7) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(6, 8) = -d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 9) = 0.; + answer.at(6, 10) = -d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); + answer.at(6, 11) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); + answer.at(6, 12) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(6, 6); + + //Axial 2 + answer.at(7, 1) = -d.at(1, 1); + answer.at(7, 2) = 0.; + answer.at(7, 3) = 0.; + answer.at(7, 4) = 0.; + answer.at(7, 5) = d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); + answer.at(7, 6) = d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(7, 7) = d.at(1, 1); + answer.at(7, 8) = 0.; + answer.at(7, 9) = 0.; + answer.at(7, 10) = 0.; + answer.at(7, 11) = d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); + answer.at(7, 12) = d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + + //Shear Y 2 + answer.at(8, 1) = 0; + answer.at(8, 2) = -d.at(2, 2); + answer.at(8, 3) = 0.; + answer.at(8, 4) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(8, 5) = d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(8, 6) = d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(8, 7) = 0.; + answer.at(8, 8) = d.at(2, 2); + answer.at(8, 9) = 0.; + answer.at(8, 10) = d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(8, 11) = d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(8, 12) = d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + //Shear Z 2 + answer.at(9, 1) = 0; + answer.at(9, 2) = 0.; + answer.at(9, 3) = -d.at(3, 3); + answer.at(9, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(9, 5) = d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(9, 6) = d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(9, 7) = 0.; + answer.at(9, 8) = 0; + answer.at(9, 9) = d.at(3, 3); + answer.at(9, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(9, 11) = d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(9, 12) = d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + + // Mx 2 + answer.at(10, 1) = 0; + answer.at(10, 2) = -d.at(2, 2) * ( -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(10, 3) = -d.at(3, 3) * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(10, 4) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(4, 4); + answer.at(10, 5) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(10, 6) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ); + answer.at(10, 7) = 0.; + answer.at(10, 8) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(10, 9) = -d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(10, 10) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(4, 4); + answer.at(10, 11) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(10, 12) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + + // My 2 + answer.at(11, 1) = -d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 2) = 0.; + answer.at(11, 3) = -d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(11, 4) = d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); + answer.at(11, 5) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(5, 5); + answer.at(11, 6) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ); + answer.at(11, 7) = d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 8) = 0; + answer.at(11, 9) = d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(11, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); + answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(5, 5); + answer.at(11, 12) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + + // Mz 2 + answer.at(12, 1) = -d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(12, 2) = d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 3) = 0.; + answer.at(12, 4) = -d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); + answer.at(12, 5) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); + answer.at(12, 6) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(6, 6); + answer.at(12, 7) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(12, 8) = -d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 9) = 0.; + answer.at(12, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); + answer.at(12, 11) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(11) ) * cos( u.at(12) ) * l2 ) ); + answer.at(12, 12) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(11) ) * sin( u.at(12) ) * l2 ) ) + d.at(6, 6); + + answer.times(1. / length); + + return; + } + + void + LatticeFrame3dNL::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) + // Computes the vector containing the strains at the Gauss point gp of + // the receiver, at time step tStep. The nature of these strains depends + // on the element's type. + { + FloatMatrix b; + FloatArray u; + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + this->computeVectorOf(VM_Incremental, tStep, u); + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain = lmatStat->giveLatticeStrain(); + + answer.resize(6); + answer.at(1) = ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(7) - u.at(1); + answer.at(2) = -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(8) - u.at(2); + answer.at(3) = -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(9) - u.at(3); + answer.at(4) = u.at(10) - u.at(4); + answer.at(5) = u.at(11) - u.at(5); + answer.at(6) = u.at(12) - u.at(6); + answer.times(1. / this->length); + // printf("Strain/n"); + // answer.printYourself(); + answer += strain; + } + // + void + LatticeFrame3dNL::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) + { + FloatMatrix b, bt, bf; + FloatArray u, stress, strain; + this->computeVectorOf(VM_Incremental, tStep, u); + this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); + + // Total stress + this->LatticeFrame3dNL::computeStrainVector(strain, gp, tStep); + this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + // Old stresses + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto oldStress = lmatStat->giveLatticeStress(); + + auto oldInternalForces = lmatStat->giveInternalForces(); + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + FloatArray incrementalStress; + incrementalStress.beDifferenceOf(stress, oldStress); + + answer.resize(12); + answer.at(1) = -incrementalStress.at(1), + answer.at(2) = -incrementalStress.at(2); + answer.at(3) = -incrementalStress.at(3); + answer.at(4) = +incrementalStress.at(2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(4); + answer.at(5) = -incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); + answer.at(6) = incrementalStress.at(1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(6); + answer.at(7) = incrementalStress.at(1); + answer.at(8) = incrementalStress.at(2); + answer.at(9) = incrementalStress.at(3); + answer.at(10) = incrementalStress.at(2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(4); + answer.at(11) = -incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); + answer.at(12) = incrementalStress.at(1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(6); + answer += oldInternalForces; + + lmatStat->letTempInternalForcesBe(answer); + } + + int + LatticeFrame3dNL::giveLocalCoordinateSystem(FloatMatrix &answer) + { + FloatArray lx, ly, lz, help(3); + FloatArray coordA, coordB; + FloatArray uA(6), uAIncr(6), uB(6), uBIncr(6); + IntArray dofid = { + 1, 2, 3, 4, 5, 6 + }; + + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + + Node *nodeA, *nodeB; + nodeA = this->giveNode(1); + nodeB = this->giveNode(2); + + //Local coordinate system is determined from the displacement of last step. + + coordA = nodeA->giveCoordinates(); + nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); + nodeA->giveUnknownVector(uAIncr, dofid, VM_Incremental, tStep, false); + for (int i = 1; i <= 3; i++) { + coordA.at(i) += uA.at(i) - uAIncr.at(i); + } + + coordB = nodeB->giveCoordinates(); + nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); + nodeB->giveUnknownVector(uBIncr, dofid, VM_Incremental, tStep, false); + + for (int i = 1; i <= 3; i++) { + coordB.at(i) += uB.at(i) - uBIncr.at(i); + } + + lx.beDifferenceOf(coordB, coordA); + lx.normalize(); + + + if ( this->referenceNode ) { + Node *refNode = this->giveDomain()->giveNode(this->referenceNode); + help.beDifferenceOf( refNode->giveCoordinates(), nodeA->giveCoordinates() ); + + lz.beVectorProductOf(lx, help); + lz.normalize(); + } else if ( this->zaxis.giveSize() > 0 ) { + lz = this->zaxis; + lz.add(lz.dotProduct(lx), lx); + lz.normalize(); + } else { + FloatMatrix rot(3, 3); + double theta = referenceAngle * M_PI / 180.0; + + rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); + rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); + rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); + + rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); + rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); + rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); + + rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); + rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); + rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); + + help.at(3) = 1.0; // up-vector + + // here is ly is used as a temp var + if ( fabs( lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical + ly = { + 0., 1., 0. + }; + } else { + ly.beVectorProductOf(lx, help); + } + lz.beProductOf(rot, ly); + lz.normalize(); + } + + ly.beVectorProductOf(lz, lx); + ly.normalize(); + + answer.resize(3, 3); + answer.zero(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(1, i) = lx.at(i); + answer.at(2, i) = ly.at(i); + answer.at(3, i) = lz.at(i); + } + + return 1; + } +} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3d3g.h b/src/sm/Elements/LatticeElements/latticeframe3dnl.h similarity index 65% rename from src/sm/Elements/LatticeElements/latticeframe3d3g.h rename to src/sm/Elements/LatticeElements/latticeframe3dnl.h index f5707277a..bd03c275e 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3d3g.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.h @@ -37,31 +37,33 @@ #include "latticeframe3d.h" -///@name Input fields for LatticeFrame3d3g +///@name Input fields for LatticeFrame3dNL //@{ -#define _IFT_LatticeFrame3d3g_Name "latticeframe3d3g" +#define _IFT_LatticeFrame3dNL_Name "latticeframe3d3g" //@} namespace oofem { /** - * This class implements a geometric nonlinear 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It is an extension of a geometric linear 3-dimensional frame element. It belongs to the group of lattice models in OOFEM. - * Authors: Gumaa Abdelrhim and Peter Grassl - */ +This class implements a geometric nonlinear 3-dimensional frame element. It is an extension of a geometric linear 3-dimensional frame element based on rigid body spring theory called LatticeFrame3D presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in the OOFEM structure, but can be used as a standard 3D beam element. +References: +Toi, Y. (1991). Shifted integration technique in one‐dimensional plastic collapse analysis using linear and cubic finite elements. International Journal for Numerical Methods in Engineering, 31(8), 1537-1552. +Toi, Y., & Isobe, D. (1993). Adaptively shifted integration technique for finite element collapse analysis of framed structures. International Journal for Numerical Methods in Engineering, 36(14), 2323-2339. +Authors: Gumaa Abdelrhim and Peter Grassl, 2023 +*/ -class LatticeFrame3d3g : public LatticeFrame3d +class LatticeFrame3dNL : public LatticeFrame3d { protected: public: - LatticeFrame3d3g(int n, Domain *); - virtual ~LatticeFrame3d3g(); - double computeCurrentLength(); - + LatticeFrame3dNL(int n, Domain *); + virtual ~LatticeFrame3dNL(); + int giveLocalCoordinateSystem(FloatMatrix &answer) override; - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3d3g_Name; } - const char *giveClassName() const override { return "latticeframe3d3g"; } + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dNL_Name; } + const char *giveClassName() const override { return "latticeframe3dnl"; } void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; From 2a2aee7119b454ae698b29501b5bbb30aa11557a Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 28 Aug 2023 14:56:12 +0100 Subject: [PATCH 49/60] description of latticeframe3d elements --- doc/elementlibmanual/elementlibmanual.tex | 36 +++++++++++++++-------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index ff7d7ed48..696f9e144 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -437,7 +437,7 @@ \subsubsection{Lattice3dBoundary element} \elementDescription{Reference}{\cite{AthWheGra18}} \end{elementsummary} -\subsubsection{Latticelink3d} +\subsubsection{Latticelink3d element} This element represents a two-node 3d link element connecting 3d beam and 3d lattice elements. Each node has six degrees of freedom. The input parameters for this element are shown in Table~\ref{latticelink3dsummary}. @@ -451,7 +451,7 @@ \subsubsection{Latticelink3d} \elementDescription{Reference}{\cite{GraAnt19}} \end{elementsummary} -\subsubsection{Latticelink3dboundary} +\subsubsection{Latticelink3dboundary element} Represents three-node 3d boundary link element connecting 3d beam and 3d lattice elements. The first two nodes have the same meaning as for latticelink3d. The third node is used to control the loading of the periodic cell using three normal (xx, yy and zz) and three shear strain (yz, xz, xy) components. The specific input parameters for this element in addition of those for latticelink3d are shown in Table~\ref{latticelink3dboundarysummary}. @@ -461,17 +461,27 @@ \subsubsection{Latticelink3dboundary} \elementDescription{Reference}{\cite{GraAnt19}} \end{elementsummary} -\subsubsection{latticeframe3d element} -Latticeframe3d represents a two-node 3d lattice element. Each node has six degrees of freedom as shown in Figure ~\ref{latticeframe3dfig}. The element is based on the Rigid Body Spring Model originally developed by Kawai and later delveloped by Bolander for modelling fracture in concrete. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies, which is the mid-cross-section of the element. The properties of the mid-cross-section are internally computed from its vertices which are given as input in the global coordinate sytem. Displacement jumps are computed at the mid-cross-section, which are smeared out over the element length in the form of strains. The input parameters -for this element are shown in Table ~\ref{tab:my_label}. -\begin{figure}[htb] -\centering -\includegraphics[width=0.3\textwidth]{./latticeframe.png} -\includegraphics[width=0.3\textwidth]{./latticeframe1.png} -\caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point.} -\label{latticeframe3dfig} -\end{figure} -\begin{elementsummary}{latticeframe3d}{3d lattice frame element}{{ \inField{zaxis}{ra} }{rn}}{latticeframe3d element summary}{latticeframe3dsummary} + \subsubsection{Latticeframe3d element} + Latticeframe3d represents a two-node linear 3d frame element. Each node has six degrees of freedom, namely three translations and three rotations. The element is based on the link between rigid body spring and Timoshenko frame models. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies. Displacement jumps are computed at the contact facet, which are smeared out over the element length in the form of strains. The input parameters for this element are shown in Table ~\ref{latticeframe3dsummary}. For the computation of the nodal forces, the initial configuration is used. +%% \begin{figure}[htb] +%% \centering +%% \includegraphics[width=0.3\textwidth]{./latticeframe.png} +%% \includegraphics[width=0.3\textwidth]{./latticeframe1.png} +%% \caption{latticeframe3d element. Node numbering, DOF numbering, cross-section vertices and local coordinate system at integration point.} +%% \label{latticeframe3dfig} +%% \end{figure} + + \begin{elementsummary}{latticeframe3d}{3d lattice frame element}{{ \field{zaxis}{ra} }{rn}}{latticeframe3d element summary}{latticeframe3dsummary} +\elementParam{\param{zaxis}: z-axis of local coordinate system } +\elementDescription{CS properties}{Area, inertia moment along y and z axis (\param{iy} and \param{iz} parameters), torsion inertia moment (\param{ik} parameter) and either cross section area shear correction factor (\param{beamshearcoeff} parameter) or equivalent shear areas (\param{shearareay} and \param{shearareaz} parameters) are required. These cross section properties are assumed to be defined in local coordinate system of element.} +\elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} +\elementDescription{Reference}{\cite{Toi91, Toi93}} +\end{elementsummary} + + \subsubsection{Latticeframe3dnl element} + Latticeframe3dnl represents a two-node nonlinear 3d frame element. Each node has six degrees of freedom, namely three translations and three rotations. The element is based on the link between rigid body spring and Timoshenko frame models. The main idea is to model the elastic and inelastic response of a connection of two nodes by a set of springs located at the contact facet of two rigid bodies. Displacement jumps are computed at the contact facet considering the incrementally deformed geometry, which are smeared out over the element length in the form of strains. The input parameters for this element are shown in Table ~\ref{latticeframe3dnlsummary}. For the computation of the nodal forces, the incrementally deformed configuration is used. At the start of each step the local co-ordinate system is updated with the displacements of the previous step. + + \begin{elementsummary}{latticeframe3dnl}{3d lattice frame element}{{ \field{zaxis}{ra} }{rn}}{latticeframe3d element summary}{latticeframe3dnlsummary} \elementParam{\param{zaxis}: z-axis of local coordinate system } \elementDescription{CS properties}{Area, inertia moment along y and z axis (\param{iy} and \param{iz} parameters), torsion inertia moment (\param{ik} parameter) and either cross section area shear correction factor (\param{beamshearcoeff} parameter) or equivalent shear areas (\param{shearareay} and \param{shearareaz} parameters) are required. These cross section properties are assumed to be defined in local coordinate system of element.} \elementDescription{Unknowns}{Six dofs ($u$-displacement, $v$-displacement, $w$-displacement, $u$-rotation, $v$-rotation and $w$-rotation) are required in each node.} From a019263917a2ad592f4e57bd07cf89b642eb8c57 Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Mon, 28 Aug 2023 15:04:36 +0100 Subject: [PATCH 50/60] remove old nonlinear frame element --- src/sm/CMakeLists.txt | 1 - .../LatticeElements/latticeframe3dg.C | 673 ------------------ .../LatticeElements/latticeframe3dg.h | 111 --- 3 files changed, 785 deletions(-) delete mode 100644 src/sm/Elements/LatticeElements/latticeframe3dg.C delete mode 100644 src/sm/Elements/LatticeElements/latticeframe3dg.h diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 81ca4be75..334e030d2 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -97,7 +97,6 @@ set (sm_element Elements/LatticeElements/latticebeam3d.C Elements/LatticeElements/latticebeam3dboundary.C Elements/LatticeElements/latticeframe3d.C - Elements/LatticeElements/latticeframe3dg.C Elements/LatticeElements/latticeframe3dnl.C Elements/tet21ghostsolid.C Elements/quad1platesubsoil.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.C b/src/sm/Elements/LatticeElements/latticeframe3dg.C deleted file mode 100644 index a92cebcc9..000000000 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.C +++ /dev/null @@ -1,673 +0,0 @@ -/* - * - * ##### ##### ###### ###### ### ### - * ## ## ## ## ## ## ## ### ## - * ## ## ## ## #### #### ## # ## - * ## ## ## ## ## ## ## ## - * ## ## ## ## ## ## ## ## - * ##### ##### ## ###### ## ## - * - * - * OOFEM : Object Oriented Finite Element Code - * - * Copyright (C) 1993 - 2019 Borek Patzak - * - * - * - * Czech Technical University, Faculty of Civil Engineering, - * Department of Structural Mechanics, 166 29 Prague, Czech Republic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "domain.h" -#include "latticeframe3dg.h" -#include "../sm/Materials/LatticeMaterials/latticematstatus.h" -#include "node.h" -#include "material.h" -#include "gausspoint.h" -#include "gaussintegrationrule.h" -#include "floatmatrix.h" -#include "floatmatrixf.h" -#include "intarray.h" -#include "floatarray.h" -#include "floatarrayf.h" -#include "mathfem.h" -#include "latticeframe3d.h" -#include "contextioerr.h" -#include "datastream.h" -#include "classfactory.h" -#include "sm/CrossSections/latticecrosssection.h" -#include "engngm.h" - -#ifdef __OOFEG -#include "oofeggraphiccontext.h" -#include "../sm/Materials/structuralmaterial.h" -#endif - -namespace oofem { -REGISTER_Element(LatticeFrame3dg); - -LatticeFrame3dg::LatticeFrame3dg(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) -{ - numberOfDofMans = 2; -} - -LatticeFrame3dg::~LatticeFrame3dg() -{} - - -void -LatticeFrame3dg::computeBDmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) -// Returns the strain matrix of the receiver. -{ - //Assemble Bmatrix (used to compute strains and rotations) - answer.resize(6, 12); - answer.zero(); - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - this->length = computeLength(); - double tol=1.e-16; - FloatArray u; - // this->computeVectorOf(VM_Total, tStep, u); - this->computeVectorOf(VM_Incremental, tStep, u); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - //Normal displacement jump in x-direction - //First node - answer.at(1, 1) = -1.; - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - if ( fabs(u.at(5)) <= tol ) { - answer.at(1, 5) = 0.; - } else { - answer.at(1, 5) = l1*(1. - cos(u.at(5)))/u.at(5); - } - if ( fabs(u.at(6)) <= tol ) { - answer.at(1, 6) = 0.; - } else { - answer.at(1, 6) = l1*(1. - cos(u.at(6)))/u.at(6); - } - // - //Second node - answer.at(1, 7) = 1.; - answer.at(1, 8) = 0.; - answer.at(1, 9) = 0.; - answer.at(1, 10) = 0.; - if ( fabs(u.at(11)) <= tol ) { - answer.at(1, 11) = 0; - } else { - answer.at(1, 11) = l2*(1.-cos(u.at(11)))/u.at(11); - } - if ( fabs(u.at(12)) <= tol ) { - answer.at(1, 12) = 0.; - } else { - answer.at(1, 12) = l2*(1.-cos(u.at(12)))/u.at(12); - } - - //Shear displacement jump in y-plane - //first node - answer.at(2, 1) = 0.; - answer.at(2, 2) = -1.; - answer.at(2, 3) = 0.; - answer.at(2, 4) = 0.; - answer.at(2, 5) = 0; - if ( fabs(u.at(6)) <= tol ) { - answer.at( 2, 6 ) = l1; - } else { - answer.at( 2, 6 ) = -sin( u.at( 6 ) ) * l1/u.at(6); - } - //Second node - answer.at(2, 7) = 0.; - answer.at(2, 8) = 1.; - answer.at(2, 9) = 0.; - answer.at(2, 10) = 0.; - answer.at(2, 11) = 0; - if ( fabs(u.at(12)) <= tol ) { - answer.at(2, 12) = l2; - } else { - answer.at( 2, 12 ) = -sin( u.at( 12 ) ) * l2/u.at(12); - } - - //Shear displacement jump in z-plane - //first node - answer.at(3, 1) = 0.; - answer.at(3, 2) = 0.; - answer.at(3, 3) = -1.; - answer.at(3, 4) = 0.; - if ( fabs(u.at(5)) <= tol ) { - answer.at(3, 5) = l1; - } else { - answer.at( 3, 5 ) = sin( u.at( 5 ) ) * l1/u.at(5); - } - answer.at(3, 6) = 0.; - //Second node - answer.at(3, 7) = 0.; - answer.at(3, 8) = 0.; - answer.at(3, 9) = 1.; - answer.at(3, 10) = 0.; - if ( fabs(u.at(11)) <= tol ) { - answer.at(3, 11) = l2; - } else { - answer.at( 3, 11 ) = sin( u.at( 11 ) ) *l2/u.at(11); - } - answer.at(3, 12) = 0.; - - //Rotation around x-axis - //First node - answer.at(4, 1) = 0.; - answer.at(4, 2) = 0; - answer.at(4, 3) = 0.; - answer.at(4, 4) = -1.; - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; - //Second node - answer.at(4, 7) = 0.; - answer.at(4, 8) = 0.; - answer.at(4, 9) = 0.; - answer.at(4, 10) = 1.; - answer.at(4, 11) = 0.; - answer.at(4, 12) = 0.; - - //Rotation around y-axis - //First node - answer.at(5, 1) = 0.; - answer.at(5, 2) = 0.; - answer.at(5, 3) = 0.; - answer.at(5, 4) = 0.; - answer.at(5, 5) = -1.; - answer.at(5, 6) = 0.; - //Second node - answer.at(5, 7) = 0.; - answer.at(5, 8) = 0.; - answer.at(5, 9) = 0.; - answer.at(5, 10) = 0.; - answer.at(5, 11) = 1.; - answer.at(5, 12) = 0.; - - //Rotation around z-axis - //First node - answer.at(6, 1) = 0.; - answer.at(6, 2) = 0.; - answer.at(6, 3) = 0.; - answer.at(6, 4) = 0.; - answer.at(6, 5) = 0.; - answer.at(6, 6) = -1.; - //Second node - answer.at(6, 7) = 0.; - answer.at(6, 8) = 0.; - answer.at(6, 9) = 0.; - answer.at(6, 10) = 0.; - answer.at(6, 11) = 0.; - answer.at(6, 12) = 1.; - - return; -} - -void -LatticeFrame3dg::computeBFmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer) -{ - //Assemble BFmatrix (used to compute forces ) - answer.resize(12, 6); - answer.zero(); - - this->length = computeLength(); - - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - FloatArray u; - this->computeVectorOf(VM_Incremental, tStep, u); - // this->computeVectorOf(VM_Total, tStep, u); - double l1 = this->length*(1.-this->s)/2; - double l2 = this->length*(1.+this->s)/2; - - //Nx1 - answer.at(1, 1) = -1.; - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - answer.at(1, 5) = 0.; - answer.at(1, 6) = 0.; - - //Fy1 - answer.at(2, 1) = 0.; - answer.at(2, 2) = -1.; - answer.at(2, 3) = 0.; - answer.at(2, 4) = 0.; - answer.at(2, 5) = 0; - answer.at(2, 6) = 0.; - - //Fz1 - answer.at(3, 1) = 0.; - answer.at(3, 2) = 0.; - answer.at(3, 3) = -1.; - answer.at(3, 4) = 0.; - answer.at(3, 5) = 0.; - answer.at(3, 6) = 0.; - - //Mx1 - answer.at(4, 1) = 0.; - answer.at(4, 2) = -sin(u.at(5))*l1; - answer.at(4, 3) = -sin(u.at(6))*l1; - answer.at(4, 4) = -1.; - answer.at(4, 5) = 0.; - answer.at(4, 6) = 0.; - - //My1 - answer.at(5, 1) = sin(u.at(5))*l1; - answer.at(5, 2) = 0.; - answer.at(5, 3) = cos(u.at(5))*l1; - answer.at(5, 4) = 0.; - answer.at(5, 5) = -1.; - answer.at(5, 6) = 0.; - - //Mz1 - answer.at(6, 1) = sin(u.at(6))*l1; - answer.at(6, 2) = -cos(u.at(6))*l1; - answer.at(6, 3) = 0.; - answer.at(6, 4) = 0.; - answer.at(6, 5) = 0.; - answer.at(6, 6) = -1.; - - - //Nx2 - answer.at(7, 1) = 1.; - answer.at(7, 2) = 0.; - answer.at(7, 3) = 0.; - answer.at(7, 4) = 0.; - answer.at(7, 5) = 0.; - answer.at(7, 6) = 0.; - - //Fy2 - answer.at(8, 1) = 0.; - answer.at(8, 2) = 1.; - answer.at(8, 3) = 0.; - answer.at(8, 4) = 0.; - answer.at(8, 5) = 0; - answer.at(8, 6) = 0.; - - //Fz2 - answer.at(9, 1) = 0.; - answer.at(9, 2) = 0.; - answer.at(9, 3) = 1.; - answer.at(9, 4) = 0.; - answer.at(9, 5) = 0.; - answer.at(9, 6) = 0.; - - //Mx2 - answer.at(10, 1) = 0.; - answer.at(10, 2) = sin(u.at(11))*l2; - answer.at(10, 3) = sin(u.at(12))*l2; - answer.at(10, 4) = 1.; - answer.at(10, 5) = 0.; - answer.at(10, 6) = 0.; - - //My2 - answer.at(11, 1) = sin(u.at(11))*l2; - answer.at(11, 2) = 0.; - answer.at(11, 3) = cos(u.at(11))*l2; - answer.at(11, 4) = 0.; - answer.at(11, 5) = 1.; - answer.at(11, 6) = 0.; - - //Mz2 - answer.at(12, 1) = sin(u.at(12))*l2; - answer.at(12, 2) = -cos(u.at(12))*l2; - answer.at(12, 3) = 0.; - answer.at(12, 4) = 0.; - answer.at(12, 5) = 0.; - answer.at(12, 6) = 1.; - - return; -} -void -LatticeFrame3dg::computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) -{ - answer = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give3dFrameStiffnessMatrix(rMode, gp, tStep); -} -int -LatticeFrame3dg::computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) -{ - double ksi, n1, n2; - - ksi = lcoords.at(1); - n1 = ( 1. - ksi ) * 0.5; - n2 = ( 1. + ksi ) * 0.5; - - answer.resize(3); - answer.at(1) = n1 * this->giveNode(1)->giveCoordinate(1) + n2 * this->giveNode(2)->giveCoordinate(1); - answer.at(2) = n1 * this->giveNode(1)->giveCoordinate(2) + n2 * this->giveNode(2)->giveCoordinate(2); - answer.at(3) = n1 * this->giveNode(1)->giveCoordinate(3) + n2 * this->giveNode(2)->giveCoordinate(3); - - return 1; -} -void -LatticeFrame3dg::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) -// Computes numerically the stiffness matrix of the receiver. -{ - FloatMatrix d, bi, bj, bjt, dbj, dij, bf; - - this->length = computeLength(); - - answer.resize(12, 12); - answer.zero(); - this->computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); - //printf("Bmatrix/n"); - // bj.printYourself(); - this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - // printf("BFmatrix/n"); - // bf.printYourself(); - - dbj.beProductOf(d, bj); - dbj.times(1. / length); - bjt.beTranspositionOf(bj); - answer.beProductOf(bf, dbj); - //printf("answer/n"); - //answer.printYourself(); - return; -} - - -double LatticeFrame3dg::giveArea() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_Area, lc, this); -} - -double LatticeFrame3dg::giveIy() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentY, lc, this); -} - -double LatticeFrame3dg::giveIz() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_InertiaMomentZ, lc, this); -} - -double LatticeFrame3dg::giveIk() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_TorsionConstantX, lc, this); -} - -double LatticeFrame3dg::giveShearAreaY() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaY, lc, this); -} - -double LatticeFrame3dg::giveShearAreaZ() { - FloatArray lc(1); - return this->giveCrossSection()->give(CS_ShearAreaZ, lc, this); -} - -void -LatticeFrame3dg :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) -// Computes the vector containing the strains at the Gauss point gp of -// the receiver, at time step tStep. The nature of these strains depends -// on the element's type. -{ - FloatMatrix b; - FloatArray u; - FloatArray incrementalStrain; - - LatticeMaterialStatus *lmatStat = dynamic_cast< LatticeMaterialStatus * >( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto strain =lmatStat ->giveLatticeStrain(); - this->LatticeFrame3dg::computeBDmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); - this->computeVectorOf(VM_Incremental, tStep, u); - //this->computeVectorOf(VM_Total, tStep, u); - answer.beProductOf(b, u); - answer.times(1./this->length); - answer += strain; -} - -void -LatticeFrame3dg::giveInternalForcesVector(FloatArray &answer, - TimeStep *tStep, int useUpdatedGpRecord) -{ - FloatMatrix b, bt, bf; - FloatArray u, stress, strain; - - this->length = computeLength(); - GaussPoint *gp = this->integrationRulesArray[0]->getIntegrationPoint( 0 ); - this->LatticeFrame3dg::computeBFmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bf); - // bt.beTranspositionOf( b ); - // Total stress - this->LatticeFrame3dg::computeStrainVector( strain, gp, tStep ); - this->computeStressVector( stress, strain, integrationRulesArray[0]->getIntegrationPoint( 0 ), tStep ); - // totalInternalForces.beProductOf( bf, stress ); - // Old stresses - LatticeMaterialStatus *lmatStat = dynamic_cast( integrationRulesArray[0]->getIntegrationPoint( 0 )->giveMaterialStatus() ); - auto oldStress= lmatStat->giveLatticeStress(); - - auto oldInternalForces = lmatStat->giveInternalForces(); - - FloatArray incrementalStress; - incrementalStress.beDifferenceOf( stress, oldStress ); - - answer.beProductOf( bf, incrementalStress ); - //answer.beProductOf( bf, stress ); - answer += oldInternalForces; - - lmatStat->letTempInternalForcesBe(answer); -} - -bool -LatticeFrame3dg::computeGtoLRotationMatrix(FloatMatrix &answer) -{ - FloatMatrix lcs; - answer.resize(12, 12); - answer.zero(); - - this->LatticeFrame3dg::giveLocalCoordinateSystem(lcs); - for ( int i = 1; i <= 3; i++ ) { - for ( int j = 1; j <= 3; j++ ) { - answer.at(i, j) = lcs.at(i, j); - answer.at(i + 3, j + 3) = lcs.at(i, j); - answer.at(i + 6, j + 6) = lcs.at(i, j); - answer.at(i + 9, j + 9) = lcs.at(i, j); - } - } - - return 1; -} -int -LatticeFrame3dg::giveLocalCoordinateSystem(FloatMatrix &answer) -{ - FloatArray lx, ly, lz, help(3); - FloatArray coordA, coordB; - FloatArray uA(6),uAIncr(6), uB(6),uBIncr(6); - IntArray dofid = {1,2,3,4,5,6}; - - TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); - - Node *nodeA, *nodeB; - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - - - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); - nodeA->giveUnknownVector(uAIncr,dofid,VM_Incremental,tStep,false); - // nodeA->giveUnknownVectorOfType(uA, DisplacementVector, VM_Total, tStep); - // nodeA->giveUnknownVectorOfType(uAIncr, DisplacementVector, VM_Incremental, tStep); - for(int i=1;i<=3;i++){ - coordA.at(i) += uA.at(i)-uAIncr.at(i); - } - - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - nodeB->giveUnknownVector(uBIncr,dofid,VM_Incremental,tStep,false); - - // nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordB.at(i) += uB.at(i)-uBIncr.at(i); - } - - /* uA.at(1) = nodeA->giveUpdatedCoordinate(1,tStep,1.); */ - /* uA.at(2) = nodeA->giveUpdatedCoordinate(2,tStep,1.); */ - /* uA.at(3) = nodeA->giveUpdatedCoordinate(3,tStep,1.); */ - - /* uB.at(1) = nodeB->giveUpdatedCoordinate(1,tStep,1.); */ - /* uB.at(2) = nodeB->giveUpdatedCoordinate(2,tStep,1.); */ - /* uB.at(3) = nodeB->giveUpdatedCoordinate(3,tStep,1.); */ - - - lx.beDifferenceOf(coordB, coordA ); - lx.normalize(); - - if ( this->referenceNode ) { - Node *refNode = this->giveDomain()->giveNode(this->referenceNode); - help.beDifferenceOf(refNode->giveCoordinates(), nodeA->giveCoordinates() ); - - lz.beVectorProductOf(lx, help); - lz.normalize(); - } else if ( this->zaxis.giveSize() > 0 ) { - lz = this->zaxis; - lz.add(lz.dotProduct(lx), lx); - lz.normalize(); - } else { - FloatMatrix rot(3, 3); - double theta = referenceAngle * M_PI / 180.0; - - rot.at(1, 1) = cos(theta) + pow(lx.at(1), 2) * ( 1 - cos(theta) ); - rot.at(1, 2) = lx.at(1) * lx.at(2) * ( 1 - cos(theta) ) - lx.at(3) * sin(theta); - rot.at(1, 3) = lx.at(1) * lx.at(3) * ( 1 - cos(theta) ) + lx.at(2) * sin(theta); - - rot.at(2, 1) = lx.at(2) * lx.at(1) * ( 1 - cos(theta) ) + lx.at(3) * sin(theta); - rot.at(2, 2) = cos(theta) + pow(lx.at(2), 2) * ( 1 - cos(theta) ); - rot.at(2, 3) = lx.at(2) * lx.at(3) * ( 1 - cos(theta) ) - lx.at(1) * sin(theta); - - rot.at(3, 1) = lx.at(3) * lx.at(1) * ( 1 - cos(theta) ) - lx.at(2) * sin(theta); - rot.at(3, 2) = lx.at(3) * lx.at(2) * ( 1 - cos(theta) ) + lx.at(1) * sin(theta); - rot.at(3, 3) = cos(theta) + pow(lx.at(3), 2) * ( 1 - cos(theta) ); - - help.at(3) = 1.0; // up-vector - // here is ly is used as a temp var - if ( fabs(lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical - ly = { - 0., 1., 0. - }; - } else { - ly.beVectorProductOf(lx, help); - } - lz.beProductOf(rot, ly); - lz.normalize(); - } - - ly.beVectorProductOf(lz, lx); - ly.normalize(); - - answer.resize(3, 3); - answer.zero(); - for ( int i = 1; i <= 3; i++ ) { - answer.at(1, i) = lx.at(i); - answer.at(2, i) = ly.at(i); - answer.at(3, i) = lz.at(i); - } - - return 1; -} - - - - void -LatticeFrame3dg::giveDofManDofIDMask(int inode, IntArray &answer) const -{ - answer = { - D_u, D_v, D_w, R_u, R_v, R_w - }; -} - -void -LatticeFrame3dg::initializeFrom(InputRecord &ir) -{ - LatticeFrame3d::initializeFrom(ir); - - - -} -double -LatticeFrame3dg::computeLength() -{ - double dx, dy, dz; - Node *nodeA, *nodeB; - - if ( length == 0. ) { - nodeA = this->giveNode(1); - nodeB = this->giveNode(2); - dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); - dy = nodeB->giveCoordinate(2) - nodeA->giveCoordinate(2); - dz = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); - length = sqrt(dx * dx + dy * dy + dz * dz); - } - - return length; -} - -double -LatticeFrame3dg::computeCurrentLength() -{ - - TimeStep *tStep = this->domain->giveEngngModel()->givePreviousStep(); - if(tStep->isTheFirstStep()){ - tStep = this->domain->giveEngngModel()->giveCurrentStep(); - } - - - double dx, dy, dz; - Node *nodeA, *nodeB; - double currentLength; - FloatArray uA(6), uB(6), coordA(3), coordB(3); - IntArray dofid = {1,2,3,4,5,6}; - - nodeA = this->giveNode(1); - coordA = nodeA->giveCoordinates(); - nodeA->giveUnknownVector(uA,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordA.at(i) += uA.at(i); - } - - nodeB = this->giveNode(2); - coordB = nodeB->giveCoordinates(); - nodeB->giveUnknownVector(uB,dofid,VM_Total,tStep,false); - for(int i=1;i<=3;i++){ - coordB.at(i) += uB.at(i); - } - - dx = coordB.at(1) - coordA.at(1); - dy = coordB.at(2) - coordA.at(2); - dz = coordB.at(3) - coordA.at(3); - currentLength = sqrt(dx * dx + dy * dy + dz * dz); - - return currentLength; -} - -void -LatticeFrame3dg::computeLumpedMassMatrix(FloatMatrix &answer, TimeStep *tStep) -// Returns the lumped mass matrix of the receiver. This expression is -// valid in both local and global axes. -{ - GaussPoint *gp = integrationRulesArray [ 0 ]->getIntegrationPoint(0); - double density = static_cast< LatticeCrossSection * >( this->giveCrossSection() )->give('d', gp); - double halfMass = density * computeVolumeAround(gp) / 2.; - answer.resize(12, 12); - answer.zero(); - answer.at(1, 1) = answer.at(2, 2) = answer.at(3, 3) = halfMass; - answer.at(7, 7) = answer.at(8, 8) = answer.at(9, 9) = halfMass; -} - - -} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dg.h b/src/sm/Elements/LatticeElements/latticeframe3dg.h deleted file mode 100644 index f9b29d3cd..000000000 --- a/src/sm/Elements/LatticeElements/latticeframe3dg.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -* -* ##### ##### ###### ###### ### ### -* ## ## ## ## ## ## ## ### ## -* ## ## ## ## #### #### ## # ## -* ## ## ## ## ## ## ## ## -* ## ## ## ## ## ## ## ## -* ##### ##### ## ###### ## ## -* -* -* OOFEM : Object Oriented Finite Element Code -* -* Copyright (C) 1993 - 2019 Borek Patzak -* -* -* -* Czech Technical University, Faculty of Civil Engineering, -* Department of Structural Mechanics, 166 29 Prague, Czech Republic -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef latticeframe3dg_h -#define latticeframe3dg_h - -#include "latticeframe3d.h" - -///@name Input fields for LatticeFrame3dg -//@{ -#define _IFT_LatticeFrame3dg_Name "latticeframe3dg" - -//@} - -namespace oofem { -/** -* This class implements a 3-dimensional frame element based on rigid body spring theory presented in Toi 1991 and Toi 1993. It belongs to the group of lattice models in OOFEM. -* Authors: Gumaa Abdelrhim and Peter Grassl -*/ - -class LatticeFrame3dg : public LatticeFrame3d -{ -protected: - int referenceNode; - FloatArray zaxis; - double referenceAngle = 0; - double kappa; - double length = 0.; - double iy, iz, ik; - double area, shearareay, shearareaz; - double s; - FloatMatrix localCoordinateSystem; - - FloatArray midPoint, globalCentroid, normal; - -public: - LatticeFrame3dg(int n, Domain *); - virtual ~LatticeFrame3dg(); - int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; - - double giveArea() override; - - double giveIy() override; - - double giveIz() override; - - double giveIk() override; - - double giveShearAreaY() override; - - double giveShearAreaZ() override; - double computeLength() override; - double computeCurrentLength(); - void initializeFrom(InputRecord &ir) override; - void giveDofManDofIDMask(int inode, IntArray &) const override; - - int giveLocalCoordinateSystem(FloatMatrix &answer) override; - - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dg_Name; } - const char *giveClassName() const override { return "latticeframe3dg"; } - - void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; - - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - - - - protected: - void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - void computeBDmatrixAt(GaussPoint *, FloatMatrix &); - // virtual void computeBmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer) override; - virtual void computeStrainVector( FloatArray &answer, GaussPoint *gp, TimeStep *tStep ) override; - bool computeGtoLRotationMatrix(FloatMatrix &) override; - void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; - void computeBFmatrixAt( GaussPoint *aGaussPoint, FloatMatrix &answer); - - void computeLumpedMassMatrix( FloatMatrix &answer, TimeStep *tStep )override; -}; -} // end namespace oofem -#endif From f9eddd418aadc56c2e9e911b9727ac001ec4a5dc Mon Sep 17 00:00:00 2001 From: githubgrasp Date: Tue, 29 Aug 2023 11:25:09 +0100 Subject: [PATCH 51/60] added tests for frame elements --- .../LatticeElements/latticeframe3dnl.h | 6 +-- tests/sm/latticeframe3dnl.in | 42 +++++++++++++++++++ tests/sm/latticeframesteelplastic1.in | 22 +++------- tests/sm/latticeframesteelplastic2.in | 29 +++++++------ 4 files changed, 64 insertions(+), 35 deletions(-) create mode 100644 tests/sm/latticeframe3dnl.in diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.h b/src/sm/Elements/LatticeElements/latticeframe3dnl.h index bd03c275e..122893e07 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.h @@ -32,14 +32,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef latticeframe3d3g_h -#define latticeframe3d3g_h +#ifndef latticeframe3dnl_h +#define latticeframe3dnl_h #include "latticeframe3d.h" ///@name Input fields for LatticeFrame3dNL //@{ -#define _IFT_LatticeFrame3dNL_Name "latticeframe3d3g" +#define _IFT_LatticeFrame3dNL_Name "latticeframe3dnl" //@} diff --git a/tests/sm/latticeframe3dnl.in b/tests/sm/latticeframe3dnl.in new file mode 100644 index 000000000..085905c77 --- /dev/null +++ b/tests/sm/latticeframe3dnl.in @@ -0,0 +1,42 @@ +latticeframe3dnl.out +Buckling3D. Model +NonlinearStatic nmsteps 1 nsteps 1 nmodules 1 +nsteps 100 stiffmode 0 rtolv 1.e-3 maxiter 20000 initialguess 1 controlmode 1 +errorcheck +#vtkxml tstep_step 1 primvars 1 1 cellvars 8 138 139 140 47 46 45 141 52 domain_all element_all +domain 3dLattice +OutputManager +ndofman 9 nelem 8 ncrosssect 1 nmat 1 nbc 2 nic 0 nltf 2 nset 0 +node 1 coords 3 0.0 0.0 0.0 bc 6 1 1 1 1 1 1 +node 2 coords 3 1.1775 0.0 0.0 +node 3 coords 3 2.355 0.0 0.0 +node 4 coords 3 3.5325 0.0 0.0 +node 5 coords 3 4.71 0.0 0.0 +node 6 coords 3 5.8875 0.0 0.0 +node 7 coords 3 7.065 0.0 0.0 +node 8 coords 3 8.2425 0.0 0.0 +node 9 coords 3 9.42 0.0 0.0 bc 6 0 0 0 0 0 2 +# +latticeframe3dnl 1 nodes 2 1 2 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 2 nodes 2 2 3 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 3 nodes 2 3 4 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 4 nodes 2 4 5 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 5 nodes 2 5 6 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 6 nodes 2 6 7 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 7 nodes 2 7 8 zaxis 3 0 0 1 crossSect 1 mat 1 +latticeframe3dnl 8 nodes 2 8 9 zaxis 3 0 0 1 crossSect 1 mat 1 +# +latticecs 1 material 1 iy 7.857e-9 iz 7.857e-9 ik 1.6e-8 shearCoeff 0.83 area 3.1416e-4 +latticeframeelastic 1 d 1. E 2.1e11 n 0.3 talpha 0 +BoundaryCondition 1 loadTimeFunction 1 prescribedvalue 0.0 +BoundaryCondition 2 loadTimeFunction 2 prescribedvalue 1. +ConstantFunction 1 f(t) 1 +PiecewiseLinFunction 2 t 3 -1. 0. 100 f(t) 3 0. 0. .1 +#%BEGIN_CHECK% tolerance 1.e-6 +#NODE tStep 100 number 1 dof 1 unknown d value 0.0 +#NODE tStep 100 number 1 dof 2 unknown d value 0.0 +#NODE tStep 100 number 5 dof 1 unknown d value -1.89407969e-03 +#NODE tStep 100 number 5 dof 2 unknown d value 1.16549434e-01 +#NODE tStep 100 number 9 dof 1 unknown d value -1.53218429e-02 +#NODE tStep 100 number 9 dof 2 unknown d value 4.65912214e-01 +#%END_CHECK% diff --git a/tests/sm/latticeframesteelplastic1.in b/tests/sm/latticeframesteelplastic1.in index 10a2a8c5e..ad2600f99 100644 --- a/tests/sm/latticeframesteelplastic1.in +++ b/tests/sm/latticeframesteelplastic1.in @@ -1,9 +1,10 @@ latticeframesteelplastic1.out Cantilever test with latticeframesteelplastic material model -NonLinearStatic nmsteps 1 nsteps 20 contextOutputStep 100 nmodules 0 +NonLinearStatic nmsteps 1 nsteps 20 contextOutputStep 100 nmodules 1 nsteps 20 rtolv 1.e-0 maxiter 2000 stiffMode 1 controllmode 1 refloadmode 1 minsteplength 1.e-3 ddm 2 3 6 ddv 1 2 ddltf 2 +errorcheck domain 3dLattice -OutputManager tstep_all dofman_all element_all +OutputManager tstep_all ndofman 3 nelem 2 ncrosssect 1 nmat 1 nbc 1 nic 0 nltf 2 node 1 coords 3 0.000000e+00 0.000000e+00 0.000000e+00 bc 6 1 1 1 1 1 1 node 2 coords 3 0.500000e+00 0.000000e+00 0.000000e+00 @@ -15,20 +16,7 @@ latticeframesteelplastic 1 d 1. E 1. n 0.15 talpha 0 nx0 1 mx0 1 my0 1 mz0 1 tol BoundaryCondition 1 loadTimeFunction 1 prescribedvalue 0.0 ConstantFunction 1 f(t) 1. PiecewiseLinFunction 2 nPoints 2 t 2 0 20. f(t) 2 0. 2 -#PiecewiseLinFunction 3 nPoints 2 t 2 0 10. f(t) 2 0. 1 -#PiecewiseLinFunction 2 nPoints 5 t 5 0. 60 61 62 300. f(t) 5 0. 40. 18.8 40. 100 #%BEGIN_CHECK% -#REACTION number 1 dof 1 -#REACTION number 1 dof 2 -#REACTION number 1 dof 3 -#REACTION number 1 dof 4 -#REACTION number 1 dof 5 -#REACTION number 1 dof 6 -#DOFMAN number 3 dof 1 type d -#DOFMAN number 3 dof 2 type d -#DOFMAN number 3 dof 3 type d -#DOFMAN number 3 dof 4 type d -#DOFMAN number 3 dof 5 type d -#DOFMAN number 3 dof 6 type d -#TIME +#NODE tStep 20 number 3 dof 2 unknown d value 1.90000118e+01 tolerance 1.e-4 +#NODE tStep 20 number 3 dof 6 unknown d value 3.80000237e+01 tolerance 1.e-4 #%END_CHECK% diff --git a/tests/sm/latticeframesteelplastic2.in b/tests/sm/latticeframesteelplastic2.in index 763ed2d4c..4e82f2353 100644 --- a/tests/sm/latticeframesteelplastic2.in +++ b/tests/sm/latticeframesteelplastic2.in @@ -1,9 +1,11 @@ latticeframesteelplastic2.out Toi 1993 plastic frame -NonLinearStatic nmsteps 1 nsteps 1 contextOutputStep 100 nmodules 0 -nsteps 10 rtolv 1.e-6 maxiter 100 stiffMode 1 controllmode 1 refloadmode 1 minsteplength 1.e-3 ddm 2 5 1 ddv 1 2e-1 ddltf 2 +NonLinearStatic nmsteps 1 nsteps 1 contextOutputStep 100 nmodules 1 +nsteps 10 rtolv 1.e-6 maxiter 100 stiffMode 1 controllmode 1 refloadmode 1 minsteplength 1.e-3 ddm 2 5 1 ddv 1 2e-1 ddltf 2 +#vtkxml tstep_step 1 primvars 1 1 domain_all element_all +errorcheck domain 3dLattice -OutputManager tstep_all dofman_all element_all +OutputManager ndofman 13 nelem 12 ncrosssect 1 nmat 1 nbc 1 nic 0 nltf 2 node 1 coords 3 0.000000e+00 0.000000e+00 0.000000e+00 bc 6 1 1 1 1 1 1 node 2 coords 3 0.000000e+00 250.000000e+00 0.000000e+00 @@ -36,17 +38,14 @@ BoundaryCondition 1 loadTimeFunction 1 prescribedvalue 0.0 ConstantFunction 1 f(t) 1. PiecewiseLinFunction 2 nPoints 2 t 2 0 10. f(t) 2 0. 10 #%BEGIN_CHECK% -#REACTION number 1 dof 1 -#REACTION number 1 dof 2 -#REACTION number 1 dof 3 -#REACTION number 1 dof 4 -#REACTION number 1 dof 5 -#REACTION number 1 dof 6 -#DOFMAN number 5 dof 1 type d -#DOFMAN number 5 dof 2 type d -#DOFMAN number 5 dof 3 type d -#DOFMAN number 5 dof 4 type d -#DOFMAN number 5 dof 5 type d -#DOFMAN number 5 dof 6 type d +#REACTION tStep 10 number 1 dof 1 value -7.13485006e+04 tolerance 1.e-3 +#REACTION tStep 10 number 1 dof 2 value -6.49983931e+04 tolerance 1.e-3 +#REACTION tStep 10 number 1 dof 6 value 3.87420101e+07 tolerance 1. +#REACTION tStep 10 number 13 dof 1 value -7.11033739e+04 tolerance 1.e-3 +#REACTION tStep 10 number 13 dof 2 value 6.49983991e+04 tolerance 1.e-3 +#REACTION tStep 10 number 13 dof 6 value 3.87113692e+07 tolerance 1. +#NODE tStep 10 number 5 dof 1 unknown d value 9.00000895e+00 tolerance 1.e-5 +#NODE tStep 10 number 5 dof 2 unknown d value 1.36093742e-01 tolerance 1.e-5 +#NODE tStep 10 number 5 dof 6 unknown d value -5.26397500e-03 tolerance 1.e-6 #TIME #%END_CHECK% From 845b56e07db4a5f788a91a805e3d623658fdf849 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 9 Apr 2024 15:24:36 +0100 Subject: [PATCH 52/60] New Strain --- .../LatticeElements/latticeframe3dnl.C | 646 ++++++++++++++---- 1 file changed, 528 insertions(+), 118 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index e8331180d..bba2ac4b1 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -70,7 +70,7 @@ namespace oofem { void LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) + TimeStep *tStep) { FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; FloatArray u; @@ -85,201 +85,421 @@ namespace oofem { this->computeVectorOf(VM_Incremental, tStep, u); + + double sin4 = u.at(4); + double cos4 = 1.; + + double sin5 = u.at(5); + double cos5 = 1.; + + double sin6 = u.at(6); + double cos6 = 1.; + + double sin10 = u.at(10); + double cos10 = 1.; + + double sin11 = u.at(11); + double cos11 = 1.; + + double sin12 = u.at(12); + double cos12 = 1.; + + + /* double sin4 = sin( u.at(4) ); */ + /* double cos4 = cos( u.at(4) ); */ + + /* double sin5 = sin( u.at(5) ); */ + /* double cos5 = cos( u.at(5) ); */ + + /* double sin6 = sin( u.at(6) ); */ + /* double cos6 = cos( u.at(6) ); */ + + + /* double sin10 = sin( u.at(10) ); */ + /* double cos10 = cos( u.at(10) ); */ + + /* double sin11 = sin( u.at(11) ); */ + /* double cos11 = cos( u.at(11) ); */ + + /* double sin12 = sin( u.at(12) ); */ + /* double cos12 = cos( u.at(12) ); */ + + + //Debug + //Axial 1 answer.at(1, 1) = d.at(1, 1); answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - answer.at(1, 5) = -d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); - answer.at(1, 6) = -d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(1, 5) = -d.at(1, 1) * l1 * sin5 * cos6; + answer.at(1, 6) = -d.at(1, 1) * l1 * cos5 * sin6; answer.at(1, 7) = -d.at(1, 1); answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = -d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); - answer.at(1, 12) = -d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + answer.at(1, 11) = -d.at(1, 1) * l2 * sin11 * cos12; + answer.at(1, 12) = -d.at(1, 1) * l2 * cos11 * sin12; //Shear Y 1 answer.at(2, 1) = 0; answer.at(2, 2) = d.at(2, 2); answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(2, 5) = -d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(2, 6) = -d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(2, 4) = -d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; + answer.at(2, 5) = -d.at(2, 2) * ( -sin4 * cos5 * cos6 ) * l1; + answer.at(2, 6) = -d.at(2, 2) * ( -cos4 * cos6 + sin4 * sin5 * sin6 ) * l1; answer.at(2, 7) = 0.; answer.at(2, 8) = -d.at(2, 2); answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(2, 11) = -d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(2, 12) = -d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(2, 10) = -d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; + answer.at(2, 11) = -d.at(2, 2) * ( -sin10 * cos11 * cos12 ) * l2; + answer.at(2, 12) = -d.at(2, 2) * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2; //Shear Z 1 answer.at(3, 1) = 0; answer.at(3, 2) = 0.; answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(3, 5) = -d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(3, 6) = -d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(3, 4) = -d.at(3, 3) * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1; + answer.at(3, 5) = -d.at(3, 3) * ( cos4 * cos5 * cos6 ) * l1; + answer.at(3, 6) = -d.at(3, 3) * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1; answer.at(3, 7) = 0.; answer.at(3, 8) = 0; answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(3, 11) = -d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(3, 12) = -d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(3, 10) = -d.at(3, 3) * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2; + answer.at(3, 11) = -d.at(3, 3) * ( cos10 * cos11 * cos12 ) * l2; + answer.at(3, 12) = -d.at(3, 3) * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2; // Mx 1 answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(4, 3) = d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(4, 4) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(4, 4); - answer.at(4, 5) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(4, 6) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ); + answer.at(4, 2) = d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; + answer.at(4, 3) = d.at(3, 3) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; + answer.at(4, 4) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) + d.at(4, 4); + answer.at(4, 5) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( sin4 * cos5 * cos6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos4 * cos5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( -cos4 * cos5 * cos6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( sin4 * cos5 * cos6 ) * l1 ); + answer.at(4, 6) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( sin4 * sin6 + cos4 * sin5 * sin6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ); answer.at(4, 7) = 0.; - answer.at(4, 8) = -d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(4, 9) = -d.at(3, 3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(4, 10) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(4, 4); - answer.at(4, 11) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); - answer.at(4, 12) = -d.at(2, 2) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(3, 3) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ); + answer.at(4, 8) = -d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; + answer.at(4, 9) = -d.at(3, 3) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; + answer.at(4, 10) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) ) - d.at(4, 4); + answer.at(4, 11) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( sin10 * cos11 * cos12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( -cos10 * cos11 * cos12 ) * l2 ) ); + answer.at(4, 12) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( sin10 * cos12 + cos10 * sin11 * sin12 ) * l2 ) ); // My 1 - answer.at(5, 1) = -d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 1) = -d.at(1, 1) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; answer.at(5, 2) = 0.; - answer.at(5, 3) = -d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(5, 5) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(5, 5); - answer.at(5, 6) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ); - answer.at(5, 7) = d.at(1, 1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + answer.at(5, 3) = -d.at(3, 3) * cos5 * cos6 * l1; + answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1 ); + answer.at(5, 5) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( sin5 * cos6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -cos4 * cos5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( cos4 * cos5 * cos6 ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin5 * cos6 ) * l1 ) + d.at(5, 5); + answer.at(5, 6) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( cos5 * sin6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -cos5 * sin6 ) * l1 ); + answer.at(5, 7) = d.at(1, 1) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3, 3) * cos( u.at(5) ) * cos( u.at(6) ) * l1; - answer.at(5, 10) = d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(5, 11) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(5, 5); - answer.at(5, 12) = d.at(1, 1) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + answer.at(5, 9) = d.at(3, 3) * cos5 * cos6 * l1; + answer.at(5, 10) = d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2 ); + answer.at(5, 11) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( sin11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( cos10 * cos11 * cos12 ) * l2 ) - d.at(5, 5); + answer.at(5, 12) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( cos11 * sin12 ) * l2 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 ); // Mz 1 - answer.at(6, 1) = -d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(6, 2) = d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 1) = -d.at(1, 1) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; + answer.at(6, 2) = d.at(2, 2) * cos5 * cos6 * l1; answer.at(6, 3) = 0; - answer.at(6, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); - answer.at(6, 5) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(5) ) * cos( u.at(6) ) * l1 ) ); - answer.at(6, 6) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(5) ) * sin( u.at(6) ) * l1 ) ) + d.at(6, 6); - answer.at(6, 7) = d.at(1, 1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(6, 8) = -d.at(2, 2) * cos( u.at(5) ) * cos( u.at(6) ) * l1; + answer.at(6, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) ); + answer.at(6, 5) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( sin5 * cos6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin4 * cos5 * cos6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( sin4 * cos5 * cos6 ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -sin5 * cos6 * l1 ) ); + answer.at(6, 6) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( cos5 * sin6 ) * l1 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos5 * sin6 * l1 ) ) + d.at(6, 6); + answer.at(6, 7) = d.at(1, 1) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; + answer.at(6, 8) = -d.at(2, 2) * cos5 * cos6 * l1; answer.at(6, 9) = 0.; - answer.at(6, 10) = -d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); - answer.at(6, 11) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); - answer.at(6, 12) = d.at(1, 1) * ( ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 * ( ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(2, 2) * ( ( cos( u.at(5) ) * cos( u.at(6) ) * l1 ) * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) ) - d.at(6, 6); + answer.at(6, 10) = -d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ); + answer.at(6, 11) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( sin11 * cos12 ) * l2 ) ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( sin10 * cos11 * cos12 ) * l2 ) ); + answer.at(6, 12) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( cos11 * sin12 ) * l2 ) ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) ) - d.at(6, 6); //Axial 2 answer.at(7, 1) = -d.at(1, 1); answer.at(7, 2) = 0.; answer.at(7, 3) = 0.; answer.at(7, 4) = 0.; - answer.at(7, 5) = d.at(1, 1) * l1 * sin( u.at(5) ) * cos( u.at(6) ); - answer.at(7, 6) = d.at(1, 1) * l1 * cos( u.at(5) ) * sin( u.at(6) ); + answer.at(7, 5) = d.at(1, 1) * l1 * sin5 * cos6; + answer.at(7, 6) = d.at(1, 1) * l1 * cos5 * sin6; answer.at(7, 7) = d.at(1, 1); answer.at(7, 8) = 0.; answer.at(7, 9) = 0.; answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1, 1) * l2 * sin( u.at(11) ) * cos( u.at(12) ); - answer.at(7, 12) = d.at(1, 1) * l2 * cos( u.at(11) ) * sin( u.at(12) ); + answer.at(7, 11) = d.at(1, 1) * l2 * sin11 * cos12; + answer.at(7, 12) = d.at(1, 1) * l2 * cos11 * sin12; //Shear Y 2 answer.at(8, 1) = 0; answer.at(8, 2) = -d.at(2, 2); answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2, 2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(8, 5) = d.at(2, 2) * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(8, 6) = d.at(2, 2) * ( -cos( u.at(4) ) * cos( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(8, 4) = d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; + answer.at(8, 5) = d.at(2, 2) * ( -sin4 * cos5 * cos6 ) * l1; + answer.at(8, 6) = d.at(2, 2) * ( -cos4 * cos6 + sin4 * sin5 * sin6 ) * l1; answer.at(8, 7) = 0.; answer.at(8, 8) = d.at(2, 2); answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(8, 11) = d.at(2, 2) * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(8, 12) = d.at(2, 2) * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(8, 10) = d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; + answer.at(8, 11) = d.at(2, 2) * ( -sin10 * cos11 * cos12 ) * l2; + answer.at(8, 12) = d.at(2, 2) * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2; //Shear Z 2 answer.at(9, 1) = 0; answer.at(9, 2) = 0.; answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3, 3) * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(9, 5) = d.at(3, 3) * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1; - answer.at(9, 6) = d.at(3, 3) * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1; + answer.at(9, 4) = d.at(3, 3) * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1; + answer.at(9, 5) = d.at(3, 3) * ( cos4 * cos5 * cos6 ) * l1; + answer.at(9, 6) = d.at(3, 3) * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1; answer.at(9, 7) = 0.; answer.at(9, 8) = 0; answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3, 3) * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(9, 11) = d.at(3, 3) * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(9, 12) = d.at(3, 3) * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2; + answer.at(9, 10) = d.at(3, 3) * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2; + answer.at(9, 11) = d.at(3, 3) * ( cos10 * cos11 * cos12 ) * l2; + answer.at(9, 12) = d.at(3, 3) * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2; // Mx 2 answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2, 2) * ( -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(10, 3) = -d.at(3, 3) * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(10, 4) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(4, 4); - answer.at(10, 5) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(10, 6) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( sin( u.at(4) ) * cos( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ); + answer.at(10, 2) = -d.at(2, 2) * ( -( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 ); + answer.at(10, 3) = -d.at(3, 3) * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ); + answer.at(10, 4) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) ) - d.at(4, 4); + answer.at(10, 5) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -sin4 * cos5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( cos4 * cos5 * cos6 ) * l1 ); + answer.at(10, 6) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) ); answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2, 2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(10, 9) = -d.at(3, 3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(10, 10) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(4, 4); - answer.at(10, 11) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(10, 12) = -d.at(2, 2) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(10) ) * cos( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( u.at(8) - u.at(2) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(3, 3) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( u.at(9) - u.at(3) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + answer.at(10, 8) = -d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; + answer.at(10, 9) = -d.at(3, 3) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; + answer.at(10, 10) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) + d.at(4, 4); + answer.at(10, 11) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -sin10 * cos11 * cos12 ) * l2 + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos10 * cos11 * cos12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( cos10 * cos11 * cos12 ) * l2 + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( sin10 * cos11 * cos12 ) * l2 ); + answer.at(10, 12) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2 + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( sin10 * cos12 + cos10 * sin11 * sin12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ); // My 2 - answer.at(11, 1) = -d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 1) = -d.at(1, 1) * ( sin10 * sin12 - cos12 * sin11 * cos12 ) * l2; answer.at(11, 2) = 0.; - answer.at(11, 3) = -d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 4) = d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(4) ) * sin( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ); - answer.at(11, 5) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) - d.at(5, 5); - answer.at(11, 6) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(4) ) * cos( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ); - answer.at(11, 7) = d.at(1, 1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(12) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + answer.at(11, 3) = -d.at(3, 3) * cos11 * cos12 * l2; + answer.at(11, 4) = d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1 ); + answer.at(11, 5) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( sin5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( cos4 * cos5 * cos6 ) * l1 ) - d.at(5, 5); + answer.at(11, 6) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( cos5 * sin6 ) * l1 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1 ); + answer.at(11, 7) = d.at(1, 1) * ( sin10 * sin12 - cos12 * sin11 * cos12 ) * l2; answer.at(11, 8) = 0; - answer.at(11, 9) = d.at(3, 3) * cos( u.at(11) ) * cos( u.at(12) ) * l2; - answer.at(11, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -cos( u.at(10) ) * sin( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ); - answer.at(11, 11) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + d.at(5, 5); - answer.at(11, 12) = d.at(1, 1) * ( ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( cos( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(11) ) * cos( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + d.at(3, 3) * ( ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( -sin( u.at(10) ) * cos( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(11) ) * sin( u.at(12) ) ) * l2 ); + answer.at(11, 9) = d.at(3, 3) * cos11 * cos12 * l2; + answer.at(11, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2 ); + answer.at(11, 11) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( sin11 * cos12 ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -cos10 * cos11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( cos10 * cos11 * cos12 ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin11 * cos12 ) * l2 ) + d.at(5, 5); + answer.at(11, 12) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( cos11 * sin12 ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin11 * cos12 + cos10 * sin11 * sin12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -cos11 * sin12 ) * l2 ); // Mz 2 - answer.at(12, 1) = -d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(12, 2) = d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 1) = -d.at(1, 1) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; + answer.at(12, 2) = d.at(2, 2) * cos11 * cos12 * l2; answer.at(12, 3) = 0.; - answer.at(12, 4) = -d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( -sin( u.at(4) ) * sin( u.at(6) ) + cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); - answer.at(12, 5) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( sin( u.at(4) ) * cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) ); - answer.at(12, 6) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( cos( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( cos( u.at(4) ) * cos( u.at(6) ) - sin( u.at(4) ) * sin( u.at(5) ) * sin( u.at(6) ) ) * l1 ) ) - d.at(6, 6); - answer.at(12, 7) = d.at(1, 1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; - answer.at(12, 8) = -d.at(2, 2) * cos( u.at(11) ) * cos( u.at(12) ) * l2; + answer.at(12, 4) = -d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) ); + answer.at(12, 5) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin5 * cos6 ) * l1 ) ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( sin4 * cos5 * cos6 ) * l1 ) ); + answer.at(12, 6) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( cos5 * sin6 ) * l1 ) ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) ) - d.at(6, 6); + answer.at(12, 7) = d.at(1, 1) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; + answer.at(12, 8) = -d.at(2, 2) * cos11 * cos12 * l2; answer.at(12, 9) = 0.; - answer.at(12, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( -sin( u.at(10) ) * sin( u.at(12) ) + cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) ); - answer.at(12, 11) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( sin( u.at(10) ) * cos( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -sin( u.at(11) ) * cos( u.at(12) ) * l2 ) ); - answer.at(12, 12) = d.at(1, 1) * ( ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 * ( ( sin( u.at(11) ) * cos( u.at(12) ) ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) - d.at(2, 2) * ( ( cos( u.at(11) ) * cos( u.at(12) ) * l2 ) * ( -( cos( u.at(10) ) * cos( u.at(12) ) - sin( u.at(10) ) * sin( u.at(11) ) * sin( u.at(12) ) ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 ) * ( -cos( u.at(11) ) * sin( u.at(12) ) * l2 ) ) + d.at(6, 6); + answer.at(12, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ); + answer.at(12, 11) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin11 * cos12 ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin10 * cos11 * cos12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( sin10 * cos11 * cos12 ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -sin11 * cos12 * l2 ) ); + answer.at(12, 12) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin11 * cos12 ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos11 * sin12 * l2 ) ) + d.at(6, 6); answer.times(1. / length); return; } + void LatticeFrame3dNL::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of // the receiver, at time step tStep. The nature of these strains depends // on the element's type. { - FloatMatrix b; - FloatArray u; - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - this->computeVectorOf(VM_Incremental, tStep, u); - LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto strain = lmatStat->giveLatticeStrain(); - - answer.resize(6); - answer.at(1) = ( 1 - cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + ( 1 - cos( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(7) - u.at(1); - answer.at(2) = -( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(8) - u.at(2); - answer.at(3) = -( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + u.at(9) - u.at(3); - answer.at(4) = u.at(10) - u.at(4); - answer.at(5) = u.at(11) - u.at(5); - answer.at(6) = u.at(12) - u.at(6); - answer.times(1. / this->length); + + + FloatArray uIncr, un1; + FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; + FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; + FloatArray deltaPi, deltaPj, deltaP; + this->computeVectorOf(VM_Incremental, tStep, uIncr); + this->computeVectorOf(VM_Total, tStep, un1); + auto un = un1 - uIncr; + + this->length = computeLength(); + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain = lmatStat->giveLatticeStrain(); + + //Coordinates of point ni^0 + FloatArrayF< 3 >ni0; + ni0.at(1) = 0; + ni0.at(2) = 0; + ni0.at(3) = 0; + //Coordinates of point Pi^0 + FloatArrayF< 3 >pi0; + pi0.at(1) = l1; + pi0.at(2) = 0; + pi0.at(3) = 0; + //Coordinates of point pj^0 + FloatArrayF< 3 >pj0; + pj0.at(1) = l1; + pj0.at(2) = 0; + pj0.at(3) = 0; + //Coordinates of point nj^0 + FloatArrayF< 3 >nj0; + nj0.at(1) = l1+l2; + nj0.at(2) = 0; + nj0.at(3) = 0; + //Coordinates of point ni^n + FloatArrayF< 3 >nin; + nin.at(1) = ni0.at(1) + un.at(1); + nin.at(2) = ni0.at(2) + un.at(2); + nin.at(3) = ni0.at(3) + un.at(3); + //Coordinates of point nj^n + FloatArrayF< 3 >njn; + njn.at(1) = nj0.at(1) + un.at(7); + njn.at(2) = nj0.at(2) + un.at(8); + njn.at(3) = nj0.at(3) + un.at(9); + //Coordinates of point ni^n+1 + FloatArrayF< 3 >nin1; + nin1.at(1) = nin.at(1) + uIncr.at(1); + nin1.at(2) = nin.at(2) + uIncr.at(2); + nin1.at(3) = nin.at(3) + uIncr.at(3); + //Coordinates of point nj^n+1 + FloatArrayF< 3 >njn1; + njn1.at(1) = njn.at(1) + uIncr.at(7); + njn1.at(2) = njn.at(2) + uIncr.at(8); + njn1.at(3) = njn.at(3) + uIncr.at(9); + //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n + FloatMatrixF< 3, 3 >rin; + rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); + rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); + rin.at(1, 3) = sin(un.at(5)); + // + rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); + rin.at(2, 3) = -sin(un.at(4))*cos(un.at(6)); + // + rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); + rin.at(3, 3) = cos(un.at(4))*cos(un.at(6)); + //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n + FloatMatrixF< 3, 3 >rjn; + rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); + rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); + rjn.at(1, 3) = sin(un.at(11)); + // + // + rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); + rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(12)); + // + rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); + rjn.at(3, 3) = cos(un.at(10))*cos(un.at(12)); + // + //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). + //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n + pi0ni0.beDifferenceOf(pi0, ni0); + rinpi0ni0.beProductOf(rin, pi0ni0); + //We add the result with (Ni^0+ui^n) to get Pi^n + FloatArrayF< 3 >pin; + pin.at(1) = nin.at(1) + rinpi0ni0.at(1); + pin.at(2) = nin.at(2) + rinpi0ni0.at(2); + pin.at(3) = nin.at(3) + rinpi0ni0.at(3); + // + //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). + //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n + pj0nj0.beDifferenceOf(pj0, nj0); + rjnpj0nj0.beProductOf(rjn, pj0nj0); + //We add the result with (Nj^0+uj^n) to get Pj^n + FloatArrayF< 3 >pjn; + pjn.at(1) = nj0.at(1) +un.at(7)+ rjnpj0nj0.at(1); + pjn.at(2) = nj0.at(2) +un.at(8)+ rjnpj0nj0.at(2); + pjn.at(3) = nj0.at(3) +un.at(9)+ rjnpj0nj0.at(3); + // + //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rin1; + rin1.at(1, 1) = 1; + rin1.at(1, 2) = - uIncr.at(6); + rin1.at(1, 3) = uIncr.at(5); + // + rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); + rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; + rin1.at(2, 3) = -uIncr.at(4); + // + rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); + rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); + rin1.at(3, 3) = 1; + //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rjn1; + rjn1.at(1, 1) = 1; + rjn1.at(1, 2) = -uIncr.at(12); + rjn1.at(1, 3) = uIncr.at(11); + // + rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); + rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; + rjn1.at(2, 3) = -uIncr.at(10); + // + rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); + rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); + rjn1.at(3, 3) = 1; + // + //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). + //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 + pinnin.beDifferenceOf(pin, nin); + rin1pinnin.beProductOf(rin1, pinnin); + //We add the result with (Ni^n+uIncr) to get Pi^n+1 + FloatArrayF< 3 >pin1; + pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); + pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); + pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); + // + //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). + //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 + pjnnjn.beDifferenceOf(pjn, njn); + rjn1pjnnjn.beProductOf(rjn1, pjnnjn); + //We add the result with (Nj^n+uIncr) to get Pj^n+1 + FloatArrayF< 3 >pjn1; + pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); + pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); + pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); + // + //Calculate delta (Pi) and delta (Pj) + deltaPi.beDifferenceOf(pin1, pin); + deltaPj.beDifferenceOf(pjn1, pjn); + //Calculate delta (P) + deltaP.beDifferenceOf(deltaPj, deltaPi); + //Calculate delta (theta) + FloatArrayF< 3 >deltaT; + deltaT.at(1) = uIncr.at(10)-uIncr.at(4); + deltaT.at(2) = uIncr.at(11)-uIncr.at(5); + deltaT.at(3) = uIncr.at(12)-uIncr.at(6); + //Incremental displacement of point Ni which equal to UiN_n+1 - UiN_n + double ln = sqrt(pow(njn.at(1)-nin.at(1), 2) + pow(njn.at(2)-nin.at(2), 2) + pow(njn.at(3)-nin.at(3), 2) ); + // + // + answer.resize(6); + answer.at(1) = deltaP.at(1); + answer.at(2) = deltaP.at(2); + answer.at(3) = deltaP.at(3); + answer.at(4) = deltaT.at(1); + answer.at(5) = deltaT.at(2); + answer.at(6) = deltaT.at(3); + // answer.times(1. / this->length); + // printf("Strain/n"); + // answer.printYourself(); + // answer += strain; + // + // FloatMatrix b; + // FloatArray u; + // double l1 = this->length * ( 1. - this->s ) / 2; + // double l2 = this->length * ( 1. + this->s ) / 2; + // this->computeVectorOf(VM_Incremental, tStep, u); + // LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + // auto strain = lmatStat->giveLatticeStrain(); +// + // answer.resize(6); + // answer.at(1) = ( 1 - cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + ( 1 - cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(7) - uIncr.at(1); + // answer.at(2) = -( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(8) - uIncr.at(2); + // answer.at(3) = -( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(9) - uIncr.at(3); + // answer.at(4) = uIncr.at(10) - uIncr.at(4); + // answer.at(5) = uIncr.at(11) - uIncr.at(5); + // answer.at(6) = uIncr.at(12) - uIncr.at(6); + answer.times(1. / ln); // printf("Strain/n"); // answer.printYourself(); answer += strain; @@ -289,9 +509,19 @@ namespace oofem { LatticeFrame3dNL::giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) { - FloatMatrix b, bt, bf; + FloatMatrix b, bt, bf, d; FloatArray u, stress, strain; - this->computeVectorOf(VM_Incremental, tStep, u); + + FloatArray uIncr, un1; + FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; + FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; + FloatArray deltaPi, deltaPj, deltaP, pnsfi, pnsfj; + this->computeVectorOf(VM_Incremental, tStep, uIncr); + this->computeVectorOf(VM_Total, tStep, un1); + auto un = un1 - uIncr; + + + // this->computeVectorOf(VM_Incremental, tStep, u); this->length = computeLength(); GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); @@ -309,19 +539,199 @@ namespace oofem { FloatArray incrementalStress; incrementalStress.beDifferenceOf(stress, oldStress); + //Coordinates of point ni^0 + FloatArrayF< 3 >ni0; + ni0.at(1) = 0; + ni0.at(2) = 0; + ni0.at(3) = 0; + //Coordinates of point Pi^0 + FloatArrayF< 3 >pi0; + pi0.at(1) = l1; + pi0.at(2) = 0; + pi0.at(3) = 0; + //Coordinates of point pj^0 + FloatArrayF< 3 >pj0; + pj0.at(1) = l1; + pj0.at(2) = 0; + pj0.at(3) = 0; + //Coordinates of point nj^0 + FloatArrayF< 3 >nj0; + nj0.at(1) = l1+l2; + nj0.at(2) = 0; + nj0.at(3) = 0; + //Coordinates of point ni^n + FloatArrayF< 3 >nin; + nin.at(1) = ni0.at(1) + un.at(1); + nin.at(2) = ni0.at(2) + un.at(2); + nin.at(3) = ni0.at(3) + un.at(3); + //Coordinates of point nj^n + FloatArrayF< 3 >njn; + njn.at(1) = nj0.at(1) + un.at(7); + njn.at(2) = nj0.at(2) + un.at(8); + njn.at(3) = nj0.at(3) + un.at(9); + //Coordinates of point ni^n+1 + FloatArrayF< 3 >nin1; + nin1.at(1) = nin.at(1) + uIncr.at(1); + nin1.at(2) = nin.at(2) + uIncr.at(2); + nin1.at(3) = nin.at(3) + uIncr.at(3); + //Coordinates of point nj^n+1 + FloatArrayF< 3 >njn1; + njn1.at(1) = njn.at(1) + uIncr.at(7); + njn1.at(2) = njn.at(2) + uIncr.at(8); + njn1.at(3) = njn.at(3) + uIncr.at(9); + //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n + FloatMatrixF< 3, 3 >rin; + rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); + rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); + rin.at(1, 3) = sin(un.at(5)); + // + rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); + rin.at(2, 3) = -sin(un.at(4))*cos(un.at(6)); + // + rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); + rin.at(3, 3) = cos(un.at(4))*cos(un.at(6)); + //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n + FloatMatrixF< 3, 3 >rjn; + rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); + rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); + rjn.at(1, 3) = sin(un.at(11)); + // + rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); + rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(12)); + // + rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); + rjn.at(3, 3) = cos(un.at(10))*cos(un.at(12)); + // + //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). + //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n + pi0ni0.beDifferenceOf(pi0, ni0); + rinpi0ni0.beProductOf(rin, pi0ni0); + //We add the result with (Ni^0+ui^n) to get Pi^n + FloatArrayF< 3 >pin; + pin.at(1) = nin.at(1) + rinpi0ni0.at(1); + pin.at(2) = nin.at(2) + rinpi0ni0.at(2); + pin.at(3) = nin.at(3) + rinpi0ni0.at(3); + // + //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). + //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n + pj0nj0.beDifferenceOf(pj0, nj0); + rjnpj0nj0.beProductOf(rjn, pj0nj0); + //We add the result with (Nj^0+uj^n) to get Pj^n + FloatArrayF< 3 >pjn; + pjn.at(1) = nj0.at(1) +un.at(7)+ rjnpj0nj0.at(1); + pjn.at(2) = nj0.at(2) +un.at(8)+ rjnpj0nj0.at(2); + pjn.at(3) = nj0.at(3) +un.at(9)+ rjnpj0nj0.at(3); + // + //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rin1; + rin1.at(1, 1) = 1; + rin1.at(1, 2) = - uIncr.at(6); + rin1.at(1, 3) = uIncr.at(5); + // + rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); + rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; + rin1.at(2, 3) = -uIncr.at(4); + // + rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); + rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); + rin1.at(3, 3) = 1; + //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rjn1; + rjn1.at(1, 1) = 1; + rjn1.at(1, 2) = -uIncr.at(12); + rjn1.at(1, 3) = uIncr.at(11); + // + rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); + rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; + rjn1.at(2, 3) = -uIncr.at(10); + // + rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); + rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); + rjn1.at(3, 3) = 1; + // + //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). + //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 + pinnin.beDifferenceOf(pin, nin); + rin1pinnin.beProductOf(rin1, pinnin); + //We add the result with (Ni^n+uIncr) to get Pi^n+1 + FloatArrayF< 3 >pin1; + pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); + pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); + pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); + // + //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). + //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 + pjnnjn.beDifferenceOf(pjn, njn); + rjn1pjnnjn.beProductOf(rjn1, pjnnjn); + //We add the result with (Nj^n+uIncr) to get Pj^n+1 + FloatArrayF< 3 >pjn1; + pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); + pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); + pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); + // + //Calculate Delta(Mi)={mi1, mi2, mi3}= -(Pi^n+1 - Ni^n+1)xDelta(Sf)-Delta(Sm) + //Calculate (Pi^n+1-Ni^n+1) and multiply it with Delta(Sf) + FloatArrayF< 3 >pin1nin1; + pin1nin1.at(1)=pin1.at(1)-nin1.at(1); + pin1nin1.at(2)=pin1.at(2)-nin1.at(2); + pin1nin1.at(3)=pin1.at(3)-nin1.at(3); + // + FloatArrayF<3>DeltaSfi; + DeltaSfi.at(1)=incrementalStress.at(1); + DeltaSfi.at(2)=incrementalStress.at(2); + DeltaSfi.at(3)=incrementalStress.at(3); + // + pnsfi.beVectorProductOf(pin1nin1, DeltaSfi); + // + //Calculate Delta(Mj)={mj1, mj2, mj3}= -(Pj^n+1 - Nj^n+1)xDelta(Sf)+Delta(Sm) + //Calculate (Pj^n+1-Nj^n+1) and multiply it with Delta(Sf) + FloatArrayF< 3 >pjn1njn1; + pjn1njn1.at(1)=pjn1.at(1)-njn1.at(1); + pjn1njn1.at(2)=pjn1.at(2)-njn1.at(2); + pjn1njn1.at(3)=pjn1.at(3)-njn1.at(3); + // + FloatArrayF<3>DeltaSfj; + DeltaSfj.at(1)=incrementalStress.at(1); + DeltaSfj.at(2)=incrementalStress.at(2); + DeltaSfj.at(3)=incrementalStress.at(3); + // + pnsfj.beVectorProductOf(pjn1njn1, DeltaSfj); + // + // + answer.resize(12); + //answer.at(1) = -incrementalStress.at(1); + //answer.at(2) = -incrementalStress.at(2); + //answer.at(3) = -incrementalStress.at(3); + //answer.at(4) = -pnsfi.at(1)-incrementalStress.at(4); + //answer.at(5) = -pnsfi.at(2)-incrementalStress.at(5); + // answer.at(6) = -pnsfi.at(3)-incrementalStress.at(6); + //answer.at(7) = incrementalStress.at(1); + //answer.at(8) = incrementalStress.at(2); + //answer.at(9) = incrementalStress.at(3); + //answer.at(10) = -pnsfj.at(1)+incrementalStress.at(4); + //answer.at(11) = -pnsfj.at(2)+incrementalStress.at(5); + // answer.at(12) = -pnsfj.at(3)+incrementalStress.at(6); + // answer += oldInternalForces; + + // lmatStat->letTempInternalForcesBe(answer); + answer.resize(12); - answer.at(1) = -incrementalStress.at(1), + answer.at(1) = -incrementalStress.at(1); answer.at(2) = -incrementalStress.at(2); answer.at(3) = -incrementalStress.at(3); - answer.at(4) = +incrementalStress.at(2) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(4); - answer.at(5) = -incrementalStress.at(1) * ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(5); - answer.at(6) = incrementalStress.at(1) * ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1 - incrementalStress.at(6); + answer.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); + answer.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); + answer.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); answer.at(7) = incrementalStress.at(1); answer.at(8) = incrementalStress.at(2); answer.at(9) = incrementalStress.at(3); - answer.at(10) = incrementalStress.at(2) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(4); - answer.at(11) = -incrementalStress.at(1) * ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(5); - answer.at(12) = incrementalStress.at(1) * ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2 + incrementalStress.at(6); + answer.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); + answer.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); + answer.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); answer += oldInternalForces; lmatStat->letTempInternalForcesBe(answer); From c3c23ad6b92d100b8e41a272ae611a02dfc3f42d Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 23 Apr 2024 13:54:29 +0100 Subject: [PATCH 53/60] new stiffness matrix --- .../LatticeElements/latticeframe3dnl.C | 714 +++++++++--------- 1 file changed, 348 insertions(+), 366 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index bba2ac4b1..b64016992 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -70,10 +70,10 @@ namespace oofem { void LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) + TimeStep *tStep) { FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; - FloatArray u; + FloatArray u, uIncr, un1d; this->length = computeLength(); answer.resize(12, 12); answer.zero(); @@ -84,218 +84,189 @@ namespace oofem { double l2 = this->length * ( 1. + this->s ) / 2; this->computeVectorOf(VM_Incremental, tStep, u); + this->computeVectorOf(VM_Incremental, tStep, uIncr); + this->computeVectorOf(VM_Total, tStep, un1d); + auto un1 = un1d - uIncr; + double xin=(cos(un1d.at(5))*cos(un1d.at(6)))*l1; + double yin=(cos(un1d.at(4))*sin(un1d.at(6))+sin(un1d.at(4))*sin(un1d.at(5))*cos(un1d.at(6)))*l1; + double zin=(sin(un1d.at(4))*sin(un1d.at(6))-cos(un1d.at(4))*sin(un1d.at(5))*cos(un1d.at(6)))*l1; - double sin4 = u.at(4); - double cos4 = 1.; - - double sin5 = u.at(5); - double cos5 = 1.; - - double sin6 = u.at(6); - double cos6 = 1.; - - double sin10 = u.at(10); - double cos10 = 1.; - - double sin11 = u.at(11); - double cos11 = 1.; - - double sin12 = u.at(12); - double cos12 = 1.; - - - /* double sin4 = sin( u.at(4) ); */ - /* double cos4 = cos( u.at(4) ); */ - - /* double sin5 = sin( u.at(5) ); */ - /* double cos5 = cos( u.at(5) ); */ - - /* double sin6 = sin( u.at(6) ); */ - /* double cos6 = cos( u.at(6) ); */ - - - /* double sin10 = sin( u.at(10) ); */ - /* double cos10 = cos( u.at(10) ); */ - - /* double sin11 = sin( u.at(11) ); */ - /* double cos11 = cos( u.at(11) ); */ - /* double sin12 = sin( u.at(12) ); */ - /* double cos12 = cos( u.at(12) ); */ + double xjn=(cos(un1d.at(11))*cos(un1d.at(12)))*l2; + double yjn=(cos(un1d.at(10))*sin(un1d.at(12))+sin(un1d.at(10))*sin(un1d.at(11))*cos(un1d.at(12)))*l2; + double zjn=(sin(un1d.at(10))*sin(un1d.at(12))-cos(un1d.at(10))*sin(un1d.at(11))*cos(un1d.at(12)))*l2; - //Debug //Axial 1 answer.at(1, 1) = d.at(1, 1); answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - answer.at(1, 5) = -d.at(1, 1) * l1 * sin5 * cos6; - answer.at(1, 6) = -d.at(1, 1) * l1 * cos5 * sin6; + answer.at(1, 5) = d.at(1,1)*(-zin); + answer.at(1, 6) = -d.at(1,1)*(yin); answer.at(1, 7) = -d.at(1, 1); answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = -d.at(1, 1) * l2 * sin11 * cos12; - answer.at(1, 12) = -d.at(1, 1) * l2 * cos11 * sin12; + answer.at(1, 11) = d.at(1,1)*(-zjn); + answer.at(1, 12) = -d.at(1,1)*(yjn); //Shear Y 1 answer.at(2, 1) = 0; answer.at(2, 2) = d.at(2, 2); answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; - answer.at(2, 5) = -d.at(2, 2) * ( -sin4 * cos5 * cos6 ) * l1; - answer.at(2, 6) = -d.at(2, 2) * ( -cos4 * cos6 + sin4 * sin5 * sin6 ) * l1; + answer.at(2, 4) = -d.at(2,2)*(zin); + answer.at(2, 5) = 0; + answer.at(2, 6) = -d.at(2,2)*(-xin); answer.at(2, 7) = 0.; - answer.at(2, 8) = -d.at(2, 2); + answer.at(2, 8) = -d.at(2,2); answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; - answer.at(2, 11) = -d.at(2, 2) * ( -sin10 * cos11 * cos12 ) * l2; - answer.at(2, 12) = -d.at(2, 2) * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2; + answer.at(2, 10) = -d.at(2,2)*(zjn); + answer.at(2, 11) = 0; + answer.at(2, 12) = -d.at(2,2)*(-xjn); //Shear Z 1 answer.at(3, 1) = 0; answer.at(3, 2) = 0.; answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3, 3) * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1; - answer.at(3, 5) = -d.at(3, 3) * ( cos4 * cos5 * cos6 ) * l1; - answer.at(3, 6) = -d.at(3, 3) * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1; + answer.at(3, 4) = -d.at(3,3)*(-zin); + answer.at(3, 5) = -d.at(3,3)*(xin); + answer.at(3, 6) = 0; answer.at(3, 7) = 0.; answer.at(3, 8) = 0; answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3, 3) * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2; - answer.at(3, 11) = -d.at(3, 3) * ( cos10 * cos11 * cos12 ) * l2; - answer.at(3, 12) = -d.at(3, 3) * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2; + answer.at(3, 10) = -d.at(3,3)*(-zjn); + answer.at(3, 11) = -d.at(3,3)*(xjn); + answer.at(3, 12) = 0; // Mx 1 answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; - answer.at(4, 3) = d.at(3, 3) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; - answer.at(4, 4) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) + d.at(4, 4); - answer.at(4, 5) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( sin4 * cos5 * cos6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos4 * cos5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( -cos4 * cos5 * cos6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( sin4 * cos5 * cos6 ) * l1 ); - answer.at(4, 6) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( sin4 * sin6 + cos4 * sin5 * sin6 ) * l1 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ); + answer.at(4, 2) = d.at(2,2)*(-zin); + answer.at(4, 3) = -d.at(3,3)*(-yin); + answer.at(4, 4) = -d.at(3,3)*(-yin*yin)+d.at(2,2)*(zin*zin)+d.at(4,4); + answer.at(4, 5) = -d.at(3,3)*(yin*xin); + answer.at(4, 6) = d.at(2,2)*(-zin*xin); answer.at(4, 7) = 0.; - answer.at(4, 8) = -d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; - answer.at(4, 9) = -d.at(3, 3) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; - answer.at(4, 10) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) ) - d.at(4, 4); - answer.at(4, 11) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( sin10 * cos11 * cos12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( -cos10 * cos11 * cos12 ) * l2 ) ); - answer.at(4, 12) = -d.at(2, 2) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) ) - d.at(3, 3) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( -( sin10 * cos12 + cos10 * sin11 * sin12 ) * l2 ) ); + answer.at(4, 8) = d.at(2,2)*(zin); + answer.at(4, 9) = -d.at(3,3)*(yjn); + answer.at(4, 10) = -d.at(3,3)*(-yin*yjn)+d.at(2,2)*(+zin*zjn)-d.at(4,4); + answer.at(4, 11) = -d.at(3,3)*(yin*xjn); + answer.at(4, 12) = d.at(2,2)*(-zin*xjn); // My 1 - answer.at(5, 1) = -d.at(1, 1) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; - answer.at(5, 2) = 0.; - answer.at(5, 3) = -d.at(3, 3) * cos5 * cos6 * l1; - answer.at(5, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1 ); - answer.at(5, 5) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( sin5 * cos6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -cos4 * cos5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( cos4 * cos5 * cos6 ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin5 * cos6 ) * l1 ) + d.at(5, 5); - answer.at(5, 6) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( cos5 * sin6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -cos5 * sin6 ) * l1 ); - answer.at(5, 7) = d.at(1, 1) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; + answer.at(5, 1) = -d.at(1,1)*(-zin); + answer.at(5, 2) = 0; + answer.at(5, 3) = d.at(3,3)*(-xin); + answer.at(5, 4) = d.at(3,3)*(-xin*yin); + answer.at(5, 5) = -d.at(1,1)*(-zin*zin)+d.at(3,3)*(+xin*xin)+d.at(5,5); + answer.at(5, 6) = -d.at(1,1)*(+zin*yin); + answer.at(5, 7) = -d.at(1,1)*(zin); answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3, 3) * cos5 * cos6 * l1; - answer.at(5, 10) = d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2 ); - answer.at(5, 11) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( sin11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( cos10 * cos11 * cos12 ) * l2 ) - d.at(5, 5); - answer.at(5, 12) = d.at(1, 1) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 * ( cos11 * sin12 ) * l2 ) + d.at(3, 3) * ( ( cos5 * cos6 ) * l1 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 ); + answer.at(5, 9) = d.at(3,3)*(xin); + answer.at(5, 10) = d.at(3,3)*(-xin*yjn); + answer.at(5, 11) = -d.at(1,1)*(-zin*zjn)+d.at(3,3)*(xin*xjn)-d.at(5,5); + answer.at(5, 12) = -d.at(1,1)*(+zin*yjn); + // Mz 1 - answer.at(6, 1) = -d.at(1, 1) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; - answer.at(6, 2) = d.at(2, 2) * cos5 * cos6 * l1; + answer.at(6, 1) = d.at(1,1)*(-yin); + answer.at(6, 2) = -d.at(2,2)*(-xin); answer.at(6, 3) = 0; - answer.at(6, 4) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) ); - answer.at(6, 5) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( sin5 * cos6 ) * l1 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin4 * cos5 * cos6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( sin4 * cos5 * cos6 ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -sin5 * cos6 * l1 ) ); - answer.at(6, 6) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( cos5 * sin6 ) * l1 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos5 * sin6 * l1 ) ) + d.at(6, 6); - answer.at(6, 7) = d.at(1, 1) * ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1; - answer.at(6, 8) = -d.at(2, 2) * cos5 * cos6 * l1; - answer.at(6, 9) = 0.; - answer.at(6, 10) = -d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ); - answer.at(6, 11) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( sin11 * cos12 ) * l2 ) ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( sin10 * cos11 * cos12 ) * l2 ) ); - answer.at(6, 12) = d.at(1, 1) * ( ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 * ( ( cos11 * sin12 ) * l2 ) ) - d.at(2, 2) * ( ( cos5 * cos6 * l1 ) * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) ) - d.at(6, 6); + answer.at(6, 4) = -d.at(2,2)*(xin*zin); + answer.at(6, 5) = d.at(1,1)*(-yin*zin); + answer.at(6, 6) = d.at(1,1)*(yin*yin)-d.at(2,2)*(-xin*xin)+d.at(6,6); + answer.at(6, 7) = d.at(1,1)*(yin); + answer.at(6, 8) = -d.at(2,2)*(xin); + answer.at(6, 9) = 0; + answer.at(6, 10) = -d.at(2,2)*(xin*zjn); + answer.at(6, 11) = d.at(1,1)*(-yin*zjn); + answer.at(6, 12) = d.at(1,1)*(yin*yjn)-d.at(2,2)*(-xin*xjn)-d.at(6,6); + + //Axial 2 answer.at(7, 1) = -d.at(1, 1); answer.at(7, 2) = 0.; answer.at(7, 3) = 0.; answer.at(7, 4) = 0.; - answer.at(7, 5) = d.at(1, 1) * l1 * sin5 * cos6; - answer.at(7, 6) = d.at(1, 1) * l1 * cos5 * sin6; + answer.at(7, 5) = -d.at(1,1)*(-zin); + answer.at(7, 6) = d.at(1,1)*(yin); answer.at(7, 7) = d.at(1, 1); answer.at(7, 8) = 0.; answer.at(7, 9) = 0.; answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1, 1) * l2 * sin11 * cos12; - answer.at(7, 12) = d.at(1, 1) * l2 * cos11 * sin12; + answer.at(7, 11) = d.at(1,1)*(-zjn); + answer.at(7, 12) = d.at(1,1)*(yjn); //Shear Y 2 answer.at(8, 1) = 0; answer.at(8, 2) = -d.at(2, 2); answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2, 2) * ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1; - answer.at(8, 5) = d.at(2, 2) * ( -sin4 * cos5 * cos6 ) * l1; - answer.at(8, 6) = d.at(2, 2) * ( -cos4 * cos6 + sin4 * sin5 * sin6 ) * l1; + answer.at(8, 4) = d.at(2,2)*(zin); + answer.at(8, 5) = 0; + answer.at(8, 6) = d.at(2,2)*(-xin); answer.at(8, 7) = 0.; - answer.at(8, 8) = d.at(2, 2); + answer.at(8, 8) = d.at(2,2); answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; - answer.at(8, 11) = d.at(2, 2) * ( -sin10 * cos11 * cos12 ) * l2; - answer.at(8, 12) = d.at(2, 2) * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2; + answer.at(8, 10) = d.at(2,2)*(zjn); + answer.at(8, 11) = 0; + answer.at(8, 12) = d.at(2,2)*(-xjn); //Shear Z 2 answer.at(9, 1) = 0; answer.at(9, 2) = 0.; answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3, 3) * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1; - answer.at(9, 5) = d.at(3, 3) * ( cos4 * cos5 * cos6 ) * l1; - answer.at(9, 6) = d.at(3, 3) * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1; + answer.at(9, 4) = d.at(3,3)*(-zin); + answer.at(9, 5) = d.at(3,3)*(xin); + answer.at(9, 6) = 0; answer.at(9, 7) = 0.; answer.at(9, 8) = 0; answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3, 3) * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2; - answer.at(9, 11) = d.at(3, 3) * ( cos10 * cos11 * cos12 ) * l2; - answer.at(9, 12) = d.at(3, 3) * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2; + answer.at(9, 10) = d.at(3,3)*(-zjn); + answer.at(9, 11) = d.at(3,3)*(xjn); + answer.at(9, 12) = 0; // Mx 2 answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2, 2) * ( -( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 ); - answer.at(10, 3) = -d.at(3, 3) * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ); - answer.at(10, 4) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) ) - d.at(4, 4); - answer.at(10, 5) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -sin4 * cos5 * cos6 ) * l1 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( cos4 * cos5 * cos6 ) * l1 ); - answer.at(10, 6) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( sin4 * cos6 + cos4 * sin5 * sin6 ) * l1 ) ); + answer.at(10, 2) = -d.at(2,2)*(zjn); + answer.at(10, 3) = d.at(3,3)*(yin); + answer.at(10, 4) = d.at(3,3)*(yjn*yin)-d.at(2,2)*(-zjn*zin)-d.at(4,4); + answer.at(10, 5) = d.at(3,3)*(-yjn*xin); + answer.at(10, 6) = -d.at(2,2)*(zjn*xin); answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2, 2) * ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2; - answer.at(10, 9) = -d.at(3, 3) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; - answer.at(10, 10) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) + d.at(4, 4); - answer.at(10, 11) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -sin10 * cos11 * cos12 ) * l2 + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos10 * cos11 * cos12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( cos10 * cos11 * cos12 ) * l2 + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( sin10 * cos11 * cos12 ) * l2 ); - answer.at(10, 12) = -d.at(2, 2) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( -cos10 * cos12 + sin10 * sin11 * sin12 ) * l2 + ( u.at(8) - u.at(2) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( sin10 * cos12 + cos10 * sin11 * sin12 ) * l2 ) - d.at(3, 3) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 + ( u.at(9) - u.at(3) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ); - + answer.at(10, 8) = -d.at(2,2)*(-zjn); + answer.at(10, 9) = d.at(3,3)*(-yjn); + answer.at(10, 10) = d.at(3,3)*(yjn*yjn)-d.at(2,2)*(-zjn*zjn)+d.at(4,4); + answer.at(10, 11) = d.at(3,3)*(-yjn*xjn); + answer.at(10, 12) = -d.at(2,2)*(+zjn*xjn); // My 2 - answer.at(11, 1) = -d.at(1, 1) * ( sin10 * sin12 - cos12 * sin11 * cos12 ) * l2; - answer.at(11, 2) = 0.; - answer.at(11, 3) = -d.at(3, 3) * cos11 * cos12 * l2; - answer.at(11, 4) = d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -cos4 * sin6 - sin4 * sin5 * cos6 ) * l1 ); - answer.at(11, 5) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( sin5 * cos6 ) * l1 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( cos4 * cos5 * cos6 ) * l1 ) - d.at(5, 5); - answer.at(11, 6) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( cos5 * sin6 ) * l1 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -sin4 * cos6 - cos4 * sin5 * sin6 ) * l1 ); - answer.at(11, 7) = d.at(1, 1) * ( sin10 * sin12 - cos12 * sin11 * cos12 ) * l2; + answer.at(11, 1) = d.at(1,1)*(zjn); + answer.at(11, 2) = 0; + answer.at(11, 3) = -d.at(3,3)*(xjn); + answer.at(11, 4) = -d.at(3,3)*(xjn*yin); + answer.at(11, 5) = d.at(1,1)*(zjn*zin)-d.at(3,3)*(-xjn*xin)-d.at(5,5); + answer.at(11, 6) = d.at(1,1)*(-zjn*yin); + answer.at(11, 7) = d.at(1,1)*(-zjn); answer.at(11, 8) = 0; - answer.at(11, 9) = d.at(3, 3) * cos11 * cos12 * l2; - answer.at(11, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -cos10 * sin12 - sin10 * sin11 * cos12 ) * l2 ); - answer.at(11, 11) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( sin11 * cos12 ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -cos10 * cos11 * cos12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( cos10 * cos11 * cos12 ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -sin11 * cos12 ) * l2 ) + d.at(5, 5); - answer.at(11, 12) = d.at(1, 1) * ( ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 * ( cos11 * sin12 ) * l2 + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin11 * cos12 + cos10 * sin11 * sin12 ) * l2 ) + d.at(3, 3) * ( ( cos11 * cos12 ) * l2 * ( -sin10 * cos12 - cos10 * sin11 * sin12 ) * l2 + ( ( u.at(9) - u.at(3) ) - ( sin10 * sin12 - cos10 * sin11 * cos12 ) * l2 - ( sin4 * sin6 - cos4 * sin5 * cos6 ) * l1 ) * ( -cos11 * sin12 ) * l2 ); - + answer.at(11, 9) = -d.at(3,3)*(-xjn); + answer.at(11, 10) = -d.at(3,3)*(xjn*yjn); + answer.at(11, 11) = d.at(1,1)*(zjn*zjn)-d.at(3,3)*(-xjn*xjn)+d.at(5,5); + answer.at(11, 12) = d.at(1,1)*(-zjn*yjn); // Mz 2 - answer.at(12, 1) = -d.at(1, 1) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; - answer.at(12, 2) = d.at(2, 2) * cos11 * cos12 * l2; - answer.at(12, 3) = 0.; - answer.at(12, 4) = -d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( -sin4 * sin6 + cos4 * sin5 * cos6 ) * l1 ) ); - answer.at(12, 5) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin5 * cos6 ) * l1 ) ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( sin4 * cos5 * cos6 ) * l1 ) ); - answer.at(12, 6) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( cos5 * sin6 ) * l1 ) ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( cos4 * cos6 - sin4 * sin5 * sin6 ) * l1 ) ) - d.at(6, 6); - answer.at(12, 7) = d.at(1, 1) * ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2; - answer.at(12, 8) = -d.at(2, 2) * cos11 * cos12 * l2; - answer.at(12, 9) = 0.; - answer.at(12, 10) = d.at(1, 1) * ( ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( -sin10 * sin12 + cos10 * sin11 * cos12 ) * l2 ) ); - answer.at(12, 11) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin11 * cos12 ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( sin10 * cos11 * cos12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( sin10 * cos11 * cos12 ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -sin11 * cos12 * l2 ) ); - answer.at(12, 12) = d.at(1, 1) * ( ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 * ( ( sin11 * cos12 ) * l2 ) + ( ( u.at(7) - u.at(1) ) + ( 1 - cos11 * cos12 ) * l2 + ( 1 - cos5 * cos6 ) * l1 ) * ( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) - d.at(2, 2) * ( ( cos11 * cos12 * l2 ) * ( -( cos10 * cos12 - sin10 * sin11 * sin12 ) * l2 ) + ( ( u.at(8) - u.at(2) ) - ( cos10 * sin12 + sin10 * sin11 * cos12 ) * l2 - ( cos4 * sin6 + sin4 * sin5 * cos6 ) * l1 ) * ( -cos11 * sin12 * l2 ) ) + d.at(6, 6); - - answer.times(1. / length); + answer.at(12, 1) = d.at(1,1)*(zjn); + answer.at(12, 2) = 0; + answer.at(12, 3) = -d.at(3,3)*(xjn); + answer.at(12, 4) = -d.at(3,3)*(xjn*yin); + answer.at(12, 5) = d.at(1,1)*(zjn*zin)-d.at(3,3)*(-xjn*xin)-d.at(5,5); + answer.at(12, 6) = d.at(1,1)*(-zjn*yin); + answer.at(12, 7) = d.at(1,1)*(-zjn); + answer.at(12, 8) = 0; + answer.at(12, 9) = -d.at(3,3)*(-xjn); + answer.at(12, 10) = -d.at(3,3)*(xjn*yjn); + answer.at(12, 11) = d.at(1,1)*(zjn*zjn)-d.at(3,3)*(-xjn*xjn)+d.at(5,5); + answer.at(12, 12) = d.at(1,1)*(-zjn*yjn); return; } @@ -309,200 +280,206 @@ namespace oofem { { - FloatArray uIncr, un1; - FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; - FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; - FloatArray deltaPi, deltaPj, deltaP; - this->computeVectorOf(VM_Incremental, tStep, uIncr); - this->computeVectorOf(VM_Total, tStep, un1); - auto un = un1 - uIncr; - - this->length = computeLength(); - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - auto strain = lmatStat->giveLatticeStrain(); - - //Coordinates of point ni^0 - FloatArrayF< 3 >ni0; - ni0.at(1) = 0; - ni0.at(2) = 0; - ni0.at(3) = 0; - //Coordinates of point Pi^0 - FloatArrayF< 3 >pi0; - pi0.at(1) = l1; - pi0.at(2) = 0; - pi0.at(3) = 0; - //Coordinates of point pj^0 - FloatArrayF< 3 >pj0; - pj0.at(1) = l1; - pj0.at(2) = 0; - pj0.at(3) = 0; - //Coordinates of point nj^0 - FloatArrayF< 3 >nj0; - nj0.at(1) = l1+l2; - nj0.at(2) = 0; - nj0.at(3) = 0; - //Coordinates of point ni^n - FloatArrayF< 3 >nin; - nin.at(1) = ni0.at(1) + un.at(1); - nin.at(2) = ni0.at(2) + un.at(2); - nin.at(3) = ni0.at(3) + un.at(3); - //Coordinates of point nj^n - FloatArrayF< 3 >njn; - njn.at(1) = nj0.at(1) + un.at(7); - njn.at(2) = nj0.at(2) + un.at(8); - njn.at(3) = nj0.at(3) + un.at(9); - //Coordinates of point ni^n+1 - FloatArrayF< 3 >nin1; - nin1.at(1) = nin.at(1) + uIncr.at(1); - nin1.at(2) = nin.at(2) + uIncr.at(2); - nin1.at(3) = nin.at(3) + uIncr.at(3); - //Coordinates of point nj^n+1 - FloatArrayF< 3 >njn1; - njn1.at(1) = njn.at(1) + uIncr.at(7); - njn1.at(2) = njn.at(2) + uIncr.at(8); - njn1.at(3) = njn.at(3) + uIncr.at(9); - //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n - FloatMatrixF< 3, 3 >rin; - rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); - rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); - rin.at(1, 3) = sin(un.at(5)); - // - rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); - rin.at(2, 3) = -sin(un.at(4))*cos(un.at(6)); - // - rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); - rin.at(3, 3) = cos(un.at(4))*cos(un.at(6)); - //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n - FloatMatrixF< 3, 3 >rjn; - rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); - rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); - rjn.at(1, 3) = sin(un.at(11)); - // - // - rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); - rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(12)); - // - rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); - rjn.at(3, 3) = cos(un.at(10))*cos(un.at(12)); - // - //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). - //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n - pi0ni0.beDifferenceOf(pi0, ni0); - rinpi0ni0.beProductOf(rin, pi0ni0); - //We add the result with (Ni^0+ui^n) to get Pi^n - FloatArrayF< 3 >pin; - pin.at(1) = nin.at(1) + rinpi0ni0.at(1); - pin.at(2) = nin.at(2) + rinpi0ni0.at(2); - pin.at(3) = nin.at(3) + rinpi0ni0.at(3); - // - //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). - //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n - pj0nj0.beDifferenceOf(pj0, nj0); - rjnpj0nj0.beProductOf(rjn, pj0nj0); - //We add the result with (Nj^0+uj^n) to get Pj^n - FloatArrayF< 3 >pjn; - pjn.at(1) = nj0.at(1) +un.at(7)+ rjnpj0nj0.at(1); - pjn.at(2) = nj0.at(2) +un.at(8)+ rjnpj0nj0.at(2); - pjn.at(3) = nj0.at(3) +un.at(9)+ rjnpj0nj0.at(3); - // - //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rin1; - rin1.at(1, 1) = 1; - rin1.at(1, 2) = - uIncr.at(6); - rin1.at(1, 3) = uIncr.at(5); - // - rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); - rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; - rin1.at(2, 3) = -uIncr.at(4); - // - rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); - rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); - rin1.at(3, 3) = 1; - //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rjn1; - rjn1.at(1, 1) = 1; - rjn1.at(1, 2) = -uIncr.at(12); - rjn1.at(1, 3) = uIncr.at(11); - // - rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); - rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; - rjn1.at(2, 3) = -uIncr.at(10); - // - rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); - rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); - rjn1.at(3, 3) = 1; - // - //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). - //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 - pinnin.beDifferenceOf(pin, nin); - rin1pinnin.beProductOf(rin1, pinnin); - //We add the result with (Ni^n+uIncr) to get Pi^n+1 - FloatArrayF< 3 >pin1; - pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); - pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); - pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); - // - //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). - //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 - pjnnjn.beDifferenceOf(pjn, njn); - rjn1pjnnjn.beProductOf(rjn1, pjnnjn); - //We add the result with (Nj^n+uIncr) to get Pj^n+1 - FloatArrayF< 3 >pjn1; - pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); - pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); - pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); - // - //Calculate delta (Pi) and delta (Pj) - deltaPi.beDifferenceOf(pin1, pin); - deltaPj.beDifferenceOf(pjn1, pjn); - //Calculate delta (P) - deltaP.beDifferenceOf(deltaPj, deltaPi); - //Calculate delta (theta) - FloatArrayF< 3 >deltaT; - deltaT.at(1) = uIncr.at(10)-uIncr.at(4); - deltaT.at(2) = uIncr.at(11)-uIncr.at(5); - deltaT.at(3) = uIncr.at(12)-uIncr.at(6); - //Incremental displacement of point Ni which equal to UiN_n+1 - UiN_n - double ln = sqrt(pow(njn.at(1)-nin.at(1), 2) + pow(njn.at(2)-nin.at(2), 2) + pow(njn.at(3)-nin.at(3), 2) ); - // - // - answer.resize(6); - answer.at(1) = deltaP.at(1); - answer.at(2) = deltaP.at(2); - answer.at(3) = deltaP.at(3); - answer.at(4) = deltaT.at(1); - answer.at(5) = deltaT.at(2); - answer.at(6) = deltaT.at(3); - // answer.times(1. / this->length); - // printf("Strain/n"); - // answer.printYourself(); - // answer += strain; - // - // FloatMatrix b; - // FloatArray u; - // double l1 = this->length * ( 1. - this->s ) / 2; - // double l2 = this->length * ( 1. + this->s ) / 2; - // this->computeVectorOf(VM_Incremental, tStep, u); - // LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - // auto strain = lmatStat->giveLatticeStrain(); + FloatArray uIncr, un1, un; + FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; + FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; + FloatArray deltaPi, deltaPj, deltaP, answerold; + this->computeVectorOf(VM_Incremental, tStep, uIncr); + this->computeVectorOf(VM_Total, tStep, un1); + un = un1 - uIncr; + + this->length = computeLength(); + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain = lmatStat->giveLatticeStrain(); + + //Coordinates of point ni^0 + FloatArrayF< 3 >ni0; + ni0.at(1) = 0; + ni0.at(2) = 0; + ni0.at(3) = 0; + //Coordinates of point Pi^0 + FloatArrayF< 3 >pi0; + pi0.at(1) = l1; + pi0.at(2) = 0; + pi0.at(3) = 0; + //Coordinates of point pj^0 + FloatArrayF< 3 >pj0; + pj0.at(1) = l1; + pj0.at(2) = 0; + pj0.at(3) = 0; + //Coordinates of point nj^0 + FloatArrayF< 3 >nj0; + nj0.at(1) = l1+l2; + nj0.at(2) = 0; + nj0.at(3) = 0; + //Coordinates of point ni^n + FloatArrayF< 3 >nin; + nin.at(1) = ni0.at(1) + un.at(1); + nin.at(2) = ni0.at(2) + un.at(2); + nin.at(3) = ni0.at(3) + un.at(3); + //Coordinates of point nj^n + FloatArrayF< 3 >njn; + njn.at(1) = nj0.at(1) + un.at(7); + njn.at(2) = nj0.at(2) + un.at(8); + njn.at(3) = nj0.at(3) + un.at(9); + //Coordinates of point ni^n+1 + FloatArrayF< 3 >nin1; + nin1.at(1) = nin.at(1) + uIncr.at(1); + nin1.at(2) = nin.at(2) + uIncr.at(2); + nin1.at(3) = nin.at(3) + uIncr.at(3); + //Coordinates of point nj^n+1 + FloatArrayF< 3 >njn1; + njn1.at(1) = njn.at(1) + uIncr.at(7); + njn1.at(2) = njn.at(2) + uIncr.at(8); + njn1.at(3) = njn.at(3) + uIncr.at(9); + //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n + FloatMatrixF< 3, 3 >rin; + rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); + rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); + rin.at(1, 3) = sin(un.at(5)); + // + rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); + rin.at(2, 3) = -sin(un.at(4))*cos(un.at(5)); + // + rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); + rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); + rin.at(3, 3) = cos(un.at(4))*cos(un.at(5)); + //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n + FloatMatrixF< 3, 3 >rjn; + rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); + rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); + rjn.at(1, 3) = sin(un.at(11)); + // + rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); + rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(11)); + // + rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); + rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); + rjn.at(3, 3) = cos(un.at(10))*cos(un.at(11)); + // + //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). + //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n + pi0ni0.beDifferenceOf(pi0, ni0); + rinpi0ni0.beProductOf(rin, pi0ni0); + //We add the result with (Ni^0+ui^n) to get Pi^n + FloatArrayF< 3 >pin; + pin.at(1) = nin.at(1) + rinpi0ni0.at(1); + pin.at(2) = nin.at(2) + rinpi0ni0.at(2); + pin.at(3) = nin.at(3) + rinpi0ni0.at(3); + // + // + //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). + //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n + pj0nj0.beDifferenceOf(pj0, nj0); + rjnpj0nj0.beProductOf(rjn, pj0nj0); + //We add the result with (Nj^0+uj^n) to get Pj^n + FloatArrayF< 3 >pjn; + pjn.at(1) = njn.at(1) + rjnpj0nj0.at(1); + pjn.at(2) = njn.at(2) + rjnpj0nj0.at(2); + pjn.at(3) = njn.at(3) + rjnpj0nj0.at(3); + // + //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rin1; + rin1.at(1, 1) = 1; + rin1.at(1, 2) = - uIncr.at(6); + rin1.at(1, 3) = uIncr.at(5); + // + rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); + rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; + rin1.at(2, 3) = -uIncr.at(4); + // + rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); + rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); + rin1.at(3, 3) = 1; + //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) + FloatMatrixF< 3, 3 >rjn1; + rjn1.at(1, 1) = 1; + rjn1.at(1, 2) = -uIncr.at(12); + rjn1.at(1, 3) = uIncr.at(11); + // + rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); + rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; + rjn1.at(2, 3) = -uIncr.at(10); + // + rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); + rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); + rjn1.at(3, 3) = 1; + // + + //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). + //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 + pinnin.beDifferenceOf(pin, nin); + rin1pinnin.beProductOf(rin1, pinnin); + //We add the result with (Ni^n+uIncr) to get Pi^n+1 + FloatArrayF< 3 >pin1; + pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); + pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); + pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); + // + //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). + //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 + pjnnjn.beDifferenceOf(pjn, njn); + rjn1pjnnjn.beProductOf(rjn1, pjnnjn); + //We add the result with (Nj^n+uIncr) to get Pj^n+1 + FloatArrayF< 3 >pjn1; + pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); + pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); + pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); + // + //Calculate delta (Pi) and delta (Pj) + deltaPi.beDifferenceOf(pin1, pin); + deltaPj.beDifferenceOf(pjn1, pjn); + //Calculate delta (P) + // + // FloatArray deltaP, + deltaP.beDifferenceOf(deltaPj, deltaPi); + + // + //Calculate delta (theta) + FloatArrayF< 3 >deltaT; + deltaT.at(1) = uIncr.at(10)-uIncr.at(4); + deltaT.at(2) = uIncr.at(11)-uIncr.at(5); + deltaT.at(3) = uIncr.at(12)-uIncr.at(6); + //Incremental displacement of point Ni which equal to UiN_n+1 - UiN_n + // double ln = sqrt(pow(njn.at(1)-nin.at(1), 2) + pow(njn.at(2)-nin.at(2), 2) + pow(njn.at(3)-nin.at(3), 2) ); + // + // + answer.resize(6); + answer.at(1) = deltaP.at(1); + answer.at(2) = deltaP.at(2); + answer.at(3) = deltaP.at(3); + answer.at(4) = deltaT.at(1); + answer.at(5) = deltaT.at(2); + answer.at(6) = deltaT.at(3); + answer.times(1. / this->length); + printf("Strain/n"); + answer.printYourself(); + answer += strain; + // + // FloatMatrix b; + // FloatArray u; + // double l1 = this->length * ( 1. - this->s ) / 2; + // double l2 = this->length * ( 1. + this->s ) / 2; + // this->computeVectorOf(VM_Incremental, tStep, u); + // LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + // auto strain = lmatStat->giveLatticeStrain(); // - // answer.resize(6); - // answer.at(1) = ( 1 - cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + ( 1 - cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(7) - uIncr.at(1); - // answer.at(2) = -( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(8) - uIncr.at(2); - // answer.at(3) = -( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(9) - uIncr.at(3); - // answer.at(4) = uIncr.at(10) - uIncr.at(4); - // answer.at(5) = uIncr.at(11) - uIncr.at(5); - // answer.at(6) = uIncr.at(12) - uIncr.at(6); - answer.times(1. / ln); - // printf("Strain/n"); - // answer.printYourself(); - answer += strain; + answerold.resize(6); + answerold.at(1) = ( 1 - cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + ( 1 - cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(7) - uIncr.at(1); + answerold.at(2) = -( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(8) - uIncr.at(2); + answerold.at(3) = -( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(9) - uIncr.at(3); + answerold.at(4) = uIncr.at(10) - uIncr.at(4); + answerold.at(5) = uIncr.at(11) - uIncr.at(5); + answerold.at(6) = uIncr.at(12) - uIncr.at(6); + answerold.times(1. / this->length); + // answerold.times(1. / ln); +// printf("StrainOld/n"); +// answer.printYourself(); + answerold += strain; } // void @@ -515,7 +492,7 @@ namespace oofem { FloatArray uIncr, un1; FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; - FloatArray deltaPi, deltaPj, deltaP, pnsfi, pnsfj; + FloatArray deltaPi, deltaPj, deltaP, pnsfi, pnsfj, answerold; this->computeVectorOf(VM_Incremental, tStep, uIncr); this->computeVectorOf(VM_Total, tStep, un1); auto un = un1 - uIncr; @@ -587,24 +564,25 @@ namespace oofem { // rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); - rin.at(2, 3) = -sin(un.at(4))*cos(un.at(6)); + rin.at(2, 3) = -sin(un.at(4))*cos(un.at(5)); // rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); - rin.at(3, 3) = cos(un.at(4))*cos(un.at(6)); + rin.at(3, 3) = cos(un.at(4))*cos(un.at(5)); //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n FloatMatrixF< 3, 3 >rjn; rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); rjn.at(1, 3) = sin(un.at(11)); // + // rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); - rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(12)); + rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(11)); // rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); - rjn.at(3, 3) = cos(un.at(10))*cos(un.at(12)); + rjn.at(3, 3) = cos(un.at(10))*cos(un.at(11)); // //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n @@ -616,6 +594,7 @@ namespace oofem { pin.at(2) = nin.at(2) + rinpi0ni0.at(2); pin.at(3) = nin.at(3) + rinpi0ni0.at(3); // + // //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n pj0nj0.beDifferenceOf(pj0, nj0); @@ -685,7 +664,7 @@ namespace oofem { DeltaSfi.at(2)=incrementalStress.at(2); DeltaSfi.at(3)=incrementalStress.at(3); // - pnsfi.beVectorProductOf(pin1nin1, DeltaSfi); + pnsfi.beVectorProductOf( pin1nin1, DeltaSfi); // //Calculate Delta(Mj)={mj1, mj2, mj3}= -(Pj^n+1 - Nj^n+1)xDelta(Sf)+Delta(Sm) //Calculate (Pj^n+1-Nj^n+1) and multiply it with Delta(Sf) @@ -699,41 +678,44 @@ namespace oofem { DeltaSfj.at(2)=incrementalStress.at(2); DeltaSfj.at(3)=incrementalStress.at(3); // - pnsfj.beVectorProductOf(pjn1njn1, DeltaSfj); + pnsfj.beVectorProductOf( pjn1njn1, -DeltaSfj); // // - answer.resize(12); - //answer.at(1) = -incrementalStress.at(1); - //answer.at(2) = -incrementalStress.at(2); - //answer.at(3) = -incrementalStress.at(3); - //answer.at(4) = -pnsfi.at(1)-incrementalStress.at(4); - //answer.at(5) = -pnsfi.at(2)-incrementalStress.at(5); - // answer.at(6) = -pnsfi.at(3)-incrementalStress.at(6); - //answer.at(7) = incrementalStress.at(1); - //answer.at(8) = incrementalStress.at(2); - //answer.at(9) = incrementalStress.at(3); - //answer.at(10) = -pnsfj.at(1)+incrementalStress.at(4); - //answer.at(11) = -pnsfj.at(2)+incrementalStress.at(5); - // answer.at(12) = -pnsfj.at(3)+incrementalStress.at(6); - // answer += oldInternalForces; - - // lmatStat->letTempInternalForcesBe(answer); - answer.resize(12); answer.at(1) = -incrementalStress.at(1); answer.at(2) = -incrementalStress.at(2); answer.at(3) = -incrementalStress.at(3); - answer.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); - answer.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); - answer.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); + answer.at(4) = -pnsfi.at(1)-incrementalStress.at(4); + answer.at(5) = -pnsfi.at(2)-incrementalStress.at(5); + answer.at(6) = -pnsfi.at(3)-incrementalStress.at(6); answer.at(7) = incrementalStress.at(1); answer.at(8) = incrementalStress.at(2); answer.at(9) = incrementalStress.at(3); - answer.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); - answer.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); - answer.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); + answer.at(10) = -pnsfj.at(1)+incrementalStress.at(4); + answer.at(11) = -pnsfj.at(2)+incrementalStress.at(5); + answer.at(12) = -pnsfj.at(3)+incrementalStress.at(6); answer += oldInternalForces; - + printf("Force/n"); + answer.printYourself(); + + // lmatStat->letTempInternalForcesBe(answer); + + answerold.resize(12); + answerold.at(1) = -incrementalStress.at(1); + answerold.at(2) = -incrementalStress.at(2); + answerold.at(3) = -incrementalStress.at(3); + answerold.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); + answerold.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); + answerold.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); + answerold.at(7) = incrementalStress.at(1); + answerold.at(8) = incrementalStress.at(2); + answerold.at(9) = incrementalStress.at(3); + answerold.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); + answerold.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); + answerold.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); + answerold += oldInternalForces; + printf("OldForce/n"); + answerold.printYourself(); lmatStat->letTempInternalForcesBe(answer); } From c664b0dfdf7e9945f35713a4b7e7f3eb3a634261 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Wed, 24 Apr 2024 12:22:04 +0100 Subject: [PATCH 54/60] new stiffness matrix1 --- .../LatticeElements/latticeframe3dnl.C | 236 +++++++++--------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index b64016992..e1af021b2 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -88,14 +88,14 @@ namespace oofem { this->computeVectorOf(VM_Total, tStep, un1d); auto un1 = un1d - uIncr; - double xin=(cos(un1d.at(5))*cos(un1d.at(6)))*l1; - double yin=(cos(un1d.at(4))*sin(un1d.at(6))+sin(un1d.at(4))*sin(un1d.at(5))*cos(un1d.at(6)))*l1; - double zin=(sin(un1d.at(4))*sin(un1d.at(6))-cos(un1d.at(4))*sin(un1d.at(5))*cos(un1d.at(6)))*l1; + double xin1=(cos(un1.at(5))*cos(un1.at(6)))*l1; + double yin1=(cos(un1.at(4))*sin(un1.at(6))+sin(un1.at(4))*sin(un1.at(5))*cos(un1.at(6)))*l1; + double zin1=(sin(un1.at(4))*sin(un1.at(6))-cos(un1.at(4))*sin(un1.at(5))*cos(un1.at(6)))*l1; - double xjn=(cos(un1d.at(11))*cos(un1d.at(12)))*l2; - double yjn=(cos(un1d.at(10))*sin(un1d.at(12))+sin(un1d.at(10))*sin(un1d.at(11))*cos(un1d.at(12)))*l2; - double zjn=(sin(un1d.at(10))*sin(un1d.at(12))-cos(un1d.at(10))*sin(un1d.at(11))*cos(un1d.at(12)))*l2; + double xjn1=(cos(un1.at(11))*cos(un1.at(12)))*l2; + double yjn1=(cos(un1.at(10))*sin(un1.at(12))+sin(un1.at(10))*sin(un1.at(11))*cos(un1.at(12)))*l2; + double zjn1=(sin(un1.at(10))*sin(un1.at(12))-cos(un1.at(10))*sin(un1.at(11))*cos(un1.at(12)))*l2; @@ -104,85 +104,85 @@ namespace oofem { answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - answer.at(1, 5) = d.at(1,1)*(-zin); - answer.at(1, 6) = -d.at(1,1)*(yin); + answer.at(1, 5) = d.at(1,1)*(-zin1); + answer.at(1, 6) = -d.at(1,1)*(yin1); answer.at(1, 7) = -d.at(1, 1); answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = d.at(1,1)*(-zjn); - answer.at(1, 12) = -d.at(1,1)*(yjn); + answer.at(1, 11) = d.at(1,1)*(-zjn1); + answer.at(1, 12) = -d.at(1,1)*(yjn1); //Shear Y 1 answer.at(2, 1) = 0; answer.at(2, 2) = d.at(2, 2); answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2,2)*(zin); + answer.at(2, 4) = -d.at(2,2)*(zin1); answer.at(2, 5) = 0; - answer.at(2, 6) = -d.at(2,2)*(-xin); + answer.at(2, 6) = -d.at(2,2)*(-xin1); answer.at(2, 7) = 0.; answer.at(2, 8) = -d.at(2,2); answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2,2)*(zjn); + answer.at(2, 10) = -d.at(2,2)*(zjn1); answer.at(2, 11) = 0; - answer.at(2, 12) = -d.at(2,2)*(-xjn); + answer.at(2, 12) = -d.at(2,2)*(-xjn1); //Shear Z 1 answer.at(3, 1) = 0; answer.at(3, 2) = 0.; answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3,3)*(-zin); - answer.at(3, 5) = -d.at(3,3)*(xin); + answer.at(3, 4) = -d.at(3,3)*(-zin1); + answer.at(3, 5) = -d.at(3,3)*(xin1); answer.at(3, 6) = 0; answer.at(3, 7) = 0.; answer.at(3, 8) = 0; answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3,3)*(-zjn); - answer.at(3, 11) = -d.at(3,3)*(xjn); + answer.at(3, 10) = -d.at(3,3)*(-zjn1); + answer.at(3, 11) = -d.at(3,3)*(xjn1); answer.at(3, 12) = 0; // Mx 1 answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2,2)*(-zin); - answer.at(4, 3) = -d.at(3,3)*(-yin); - answer.at(4, 4) = -d.at(3,3)*(-yin*yin)+d.at(2,2)*(zin*zin)+d.at(4,4); - answer.at(4, 5) = -d.at(3,3)*(yin*xin); - answer.at(4, 6) = d.at(2,2)*(-zin*xin); + answer.at(4, 2) = d.at(2,2)*(-zin1); + answer.at(4, 3) = -d.at(3,3)*(-yin1); + answer.at(4, 4) = -d.at(3,3)*(-yin1*yin1)+d.at(2,2)*(zin1*zin1)+d.at(4,4); + answer.at(4, 5) = -d.at(3,3)*(yin1*xin1); + answer.at(4, 6) = d.at(2,2)*(-zin1*xin1); answer.at(4, 7) = 0.; - answer.at(4, 8) = d.at(2,2)*(zin); - answer.at(4, 9) = -d.at(3,3)*(yjn); - answer.at(4, 10) = -d.at(3,3)*(-yin*yjn)+d.at(2,2)*(+zin*zjn)-d.at(4,4); - answer.at(4, 11) = -d.at(3,3)*(yin*xjn); - answer.at(4, 12) = d.at(2,2)*(-zin*xjn); + answer.at(4, 8) = d.at(2,2)*(zin1); + answer.at(4, 9) = -d.at(3,3)*(yjn1); + answer.at(4, 10) = -d.at(3,3)*(-yin1*yjn1)+d.at(2,2)*(+zin1*zjn1)-d.at(4,4); + answer.at(4, 11) = -d.at(3,3)*(yin1*xjn1); + answer.at(4, 12) = d.at(2,2)*(-zin1*xjn1); // My 1 - answer.at(5, 1) = -d.at(1,1)*(-zin); + answer.at(5, 1) = -d.at(1,1)*(-zin1); answer.at(5, 2) = 0; - answer.at(5, 3) = d.at(3,3)*(-xin); - answer.at(5, 4) = d.at(3,3)*(-xin*yin); - answer.at(5, 5) = -d.at(1,1)*(-zin*zin)+d.at(3,3)*(+xin*xin)+d.at(5,5); - answer.at(5, 6) = -d.at(1,1)*(+zin*yin); - answer.at(5, 7) = -d.at(1,1)*(zin); + answer.at(5, 3) = d.at(3,3)*(-xin1); + answer.at(5, 4) = d.at(3,3)*(-xin1*yin1); + answer.at(5, 5) = -d.at(1,1)*(-zin1*zin1)+d.at(3,3)*(xin1*xin1)+d.at(5,5); + answer.at(5, 6) = -d.at(1,1)*(+zin1*yin1); + answer.at(5, 7) = -d.at(1,1)*(zin1); answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3,3)*(xin); - answer.at(5, 10) = d.at(3,3)*(-xin*yjn); - answer.at(5, 11) = -d.at(1,1)*(-zin*zjn)+d.at(3,3)*(xin*xjn)-d.at(5,5); - answer.at(5, 12) = -d.at(1,1)*(+zin*yjn); + answer.at(5, 9) = d.at(3,3)*(xin1); + answer.at(5, 10) = d.at(3,3)*(-xin1*yjn1); + answer.at(5, 11) = -d.at(1,1)*(-zin1*zjn1)+d.at(3,3)*(xin1*xjn1)-d.at(5,5); + answer.at(5, 12) = -d.at(1,1)*(+zin1*yjn1); // Mz 1 - answer.at(6, 1) = d.at(1,1)*(-yin); - answer.at(6, 2) = -d.at(2,2)*(-xin); + answer.at(6, 1) = d.at(1,1)*(-yin1); + answer.at(6, 2) = -d.at(2,2)*(-xin1); answer.at(6, 3) = 0; - answer.at(6, 4) = -d.at(2,2)*(xin*zin); - answer.at(6, 5) = d.at(1,1)*(-yin*zin); - answer.at(6, 6) = d.at(1,1)*(yin*yin)-d.at(2,2)*(-xin*xin)+d.at(6,6); - answer.at(6, 7) = d.at(1,1)*(yin); - answer.at(6, 8) = -d.at(2,2)*(xin); + answer.at(6, 4) = -d.at(2,2)*(xin1*zin1); + answer.at(6, 5) = d.at(1,1)*(-yin1*zin1); + answer.at(6, 6) = d.at(1,1)*(yin1*yin1)-d.at(2,2)*(-xin1*xin1)+d.at(6,6); + answer.at(6, 7) = d.at(1,1)*(yin1); + answer.at(6, 8) = -d.at(2,2)*(xin1); answer.at(6, 9) = 0; - answer.at(6, 10) = -d.at(2,2)*(xin*zjn); - answer.at(6, 11) = d.at(1,1)*(-yin*zjn); - answer.at(6, 12) = d.at(1,1)*(yin*yjn)-d.at(2,2)*(-xin*xjn)-d.at(6,6); + answer.at(6, 10) = -d.at(2,2)*(xin1*zjn1); + answer.at(6, 11) = d.at(1,1)*(-yin1*zjn1); + answer.at(6, 12) = d.at(1,1)*(yin1*yjn1)-d.at(2,2)*(-xin1*xjn1)-d.at(6,6); @@ -191,83 +191,83 @@ namespace oofem { answer.at(7, 2) = 0.; answer.at(7, 3) = 0.; answer.at(7, 4) = 0.; - answer.at(7, 5) = -d.at(1,1)*(-zin); - answer.at(7, 6) = d.at(1,1)*(yin); + answer.at(7, 5) = -d.at(1,1)*(-zin1); + answer.at(7, 6) = d.at(1,1)*(yin1); answer.at(7, 7) = d.at(1, 1); answer.at(7, 8) = 0.; answer.at(7, 9) = 0.; answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1,1)*(-zjn); - answer.at(7, 12) = d.at(1,1)*(yjn); + answer.at(7, 11) = d.at(1,1)*(-zjn1); + answer.at(7, 12) = d.at(1,1)*(yjn1); //Shear Y 2 answer.at(8, 1) = 0; answer.at(8, 2) = -d.at(2, 2); answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2,2)*(zin); + answer.at(8, 4) = d.at(2,2)*(zin1); answer.at(8, 5) = 0; - answer.at(8, 6) = d.at(2,2)*(-xin); + answer.at(8, 6) = d.at(2,2)*(-xin1); answer.at(8, 7) = 0.; answer.at(8, 8) = d.at(2,2); answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2,2)*(zjn); + answer.at(8, 10) = d.at(2,2)*(zjn1); answer.at(8, 11) = 0; - answer.at(8, 12) = d.at(2,2)*(-xjn); + answer.at(8, 12) = d.at(2,2)*(-xjn1); //Shear Z 2 answer.at(9, 1) = 0; answer.at(9, 2) = 0.; answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3,3)*(-zin); - answer.at(9, 5) = d.at(3,3)*(xin); + answer.at(9, 4) = d.at(3,3)*(-zin1); + answer.at(9, 5) = d.at(3,3)*(xin1); answer.at(9, 6) = 0; answer.at(9, 7) = 0.; answer.at(9, 8) = 0; answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3,3)*(-zjn); - answer.at(9, 11) = d.at(3,3)*(xjn); + answer.at(9, 10) = d.at(3,3)*(-zjn1); + answer.at(9, 11) = d.at(3,3)*(xjn1); answer.at(9, 12) = 0; // Mx 2 answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2,2)*(zjn); - answer.at(10, 3) = d.at(3,3)*(yin); - answer.at(10, 4) = d.at(3,3)*(yjn*yin)-d.at(2,2)*(-zjn*zin)-d.at(4,4); - answer.at(10, 5) = d.at(3,3)*(-yjn*xin); - answer.at(10, 6) = -d.at(2,2)*(zjn*xin); + answer.at(10, 2) = -d.at(2,2)*(zjn1); + answer.at(10, 3) = d.at(3,3)*(yin1); + answer.at(10, 4) = d.at(3,3)*(yjn1*yin1)-d.at(2,2)*(-zjn1*zin1)-d.at(4,4); + answer.at(10, 5) = d.at(3,3)*(-yjn1*xin1); + answer.at(10, 6) = -d.at(2,2)*(zjn1*xin1); answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2,2)*(-zjn); - answer.at(10, 9) = d.at(3,3)*(-yjn); - answer.at(10, 10) = d.at(3,3)*(yjn*yjn)-d.at(2,2)*(-zjn*zjn)+d.at(4,4); - answer.at(10, 11) = d.at(3,3)*(-yjn*xjn); - answer.at(10, 12) = -d.at(2,2)*(+zjn*xjn); + answer.at(10, 8) = -d.at(2,2)*(-zjn1); + answer.at(10, 9) = d.at(3,3)*(-yjn1); + answer.at(10, 10) = d.at(3,3)*(yjn1*yjn1)-d.at(2,2)*(-zjn1*zjn1)+d.at(4,4); + answer.at(10, 11) = d.at(3,3)*(-yjn1*xjn1); + answer.at(10, 12) = -d.at(2,2)*(+zjn1*xjn1); // My 2 - answer.at(11, 1) = d.at(1,1)*(zjn); + answer.at(11, 1) = d.at(1,1)*(zjn1); answer.at(11, 2) = 0; - answer.at(11, 3) = -d.at(3,3)*(xjn); - answer.at(11, 4) = -d.at(3,3)*(xjn*yin); - answer.at(11, 5) = d.at(1,1)*(zjn*zin)-d.at(3,3)*(-xjn*xin)-d.at(5,5); - answer.at(11, 6) = d.at(1,1)*(-zjn*yin); - answer.at(11, 7) = d.at(1,1)*(-zjn); + answer.at(11, 3) = -d.at(3,3)*(xjn1); + answer.at(11, 4) = -d.at(3,3)*(xjn1*yin1); + answer.at(11, 5) = d.at(1,1)*(zjn1*zin1)-d.at(3,3)*(-xjn1*xin1)-d.at(5,5); + answer.at(11, 6) = d.at(1,1)*(-zjn1*yin1); + answer.at(11, 7) = d.at(1,1)*(-zjn1); answer.at(11, 8) = 0; - answer.at(11, 9) = -d.at(3,3)*(-xjn); - answer.at(11, 10) = -d.at(3,3)*(xjn*yjn); - answer.at(11, 11) = d.at(1,1)*(zjn*zjn)-d.at(3,3)*(-xjn*xjn)+d.at(5,5); - answer.at(11, 12) = d.at(1,1)*(-zjn*yjn); + answer.at(11, 9) = -d.at(3,3)*(-xjn1); + answer.at(11, 10) = -d.at(3,3)*(xjn1*yjn1); + answer.at(11, 11) = d.at(1,1)*(zjn1*zjn1)-d.at(3,3)*(-xjn1*xjn1)+d.at(5,5); + answer.at(11, 12) = d.at(1,1)*(-zjn1*yjn1); // Mz 2 - answer.at(12, 1) = d.at(1,1)*(zjn); - answer.at(12, 2) = 0; - answer.at(12, 3) = -d.at(3,3)*(xjn); - answer.at(12, 4) = -d.at(3,3)*(xjn*yin); - answer.at(12, 5) = d.at(1,1)*(zjn*zin)-d.at(3,3)*(-xjn*xin)-d.at(5,5); - answer.at(12, 6) = d.at(1,1)*(-zjn*yin); - answer.at(12, 7) = d.at(1,1)*(-zjn); - answer.at(12, 8) = 0; - answer.at(12, 9) = -d.at(3,3)*(-xjn); - answer.at(12, 10) = -d.at(3,3)*(xjn*yjn); - answer.at(12, 11) = d.at(1,1)*(zjn*zjn)-d.at(3,3)*(-xjn*xjn)+d.at(5,5); - answer.at(12, 12) = d.at(1,1)*(-zjn*yjn); - + answer.at(12, 1) = -yjn1*d.at(1,1); + answer.at(12, 2) = xjn1*d.at(2,2); + answer.at(12, 3) = 0; + answer.at(12, 4) = -xjn1*d.at(2,2)*(zin1); + answer.at(12, 5) = yjn1*d.at(1,1)*(-zin1); + answer.at(12, 6) = yjn1*d.at(1,1)*(yin1)-xjn1*d.at(2,2)*(-xin1)-d.at(6,6); + answer.at(12, 7) = yjn1*d.at(1,1); + answer.at(12, 8) = -xjn1*d.at(2,2); + answer.at(12, 9) = 0; + answer.at(12, 10) = -xjn1*d.at(2,2)*(zjn1); + answer.at(12, 11) = yjn1*d.at(1,1)*(-zjn1); + answer.at(12, 12) = yjn1*d.at(1,1)*(yjn1)-xjn1*d.at(2,2)*(-xjn1)+d.at(6,6); + answer.times(1. / this->length); return; } @@ -456,8 +456,8 @@ namespace oofem { answer.at(5) = deltaT.at(2); answer.at(6) = deltaT.at(3); answer.times(1. / this->length); - printf("Strain/n"); - answer.printYourself(); +// printf("Strain/n"); +// answer.printYourself(); answer += strain; // // FloatMatrix b; @@ -476,10 +476,10 @@ namespace oofem { answerold.at(5) = uIncr.at(11) - uIncr.at(5); answerold.at(6) = uIncr.at(12) - uIncr.at(6); answerold.times(1. / this->length); - // answerold.times(1. / ln); + // answerold.times(1. / ln); // printf("StrainOld/n"); -// answer.printYourself(); - answerold += strain; +// answerold.printYourself(); +// answer += strain; } // void @@ -503,7 +503,7 @@ namespace oofem { GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); // Total stress - this->LatticeFrame3dNL::computeStrainVector(strain, gp, tStep); + this->computeStrainVector(strain, gp, tStep); this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); // Old stresses @@ -698,25 +698,25 @@ namespace oofem { printf("Force/n"); answer.printYourself(); - // lmatStat->letTempInternalForcesBe(answer); - - answerold.resize(12); - answerold.at(1) = -incrementalStress.at(1); - answerold.at(2) = -incrementalStress.at(2); - answerold.at(3) = -incrementalStress.at(3); - answerold.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); - answerold.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); - answerold.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); - answerold.at(7) = incrementalStress.at(1); - answerold.at(8) = incrementalStress.at(2); - answerold.at(9) = incrementalStress.at(3); - answerold.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); - answerold.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); - answerold.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); - answerold += oldInternalForces; - printf("OldForce/n"); - answerold.printYourself(); - lmatStat->letTempInternalForcesBe(answer); + lmatStat->letTempInternalForcesBe(answer); + +// answer.resize(12); +// answer.at(1) = -incrementalStress.at(1); +// answer.at(2) = -incrementalStress.at(2); +// answer.at(3) = -incrementalStress.at(3); +// answer.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); +// answer.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); +// answer.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); +// answer.at(7) = incrementalStress.at(1); +// answer.at(8) = incrementalStress.at(2); +// answer.at(9) = incrementalStress.at(3); +// answer.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); +// answer.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); +// answer.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); +// answer += oldInternalForces; +// printf("OldForce/n"); +// answer.printYourself(); +// lmatStat->letTempInternalForcesBe(answer); } int From 1a7c37cd88079a562a8e5460cb5da38e3b2016ff Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Wed, 24 Apr 2024 12:22:41 +0100 Subject: [PATCH 55/60] new stiffness matrix1 --- src/sm/Elements/LatticeElements/latticeframe3dnl.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index e1af021b2..6562e67a1 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -271,7 +271,7 @@ namespace oofem { return; } - +// void LatticeFrame3dNL::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of From 4baca8e882a18d40b23714c383965a678550fed4 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Sat, 4 May 2024 12:54:46 +0100 Subject: [PATCH 56/60] new stiffness matrix1 --- .../LatticeElements/latticeframe3dnl.C | 799 +++++++----------- .../LatticeElements/latticeframe3dnl.h | 33 +- 2 files changed, 305 insertions(+), 527 deletions(-) mode change 100644 => 100755 src/sm/Elements/LatticeElements/latticeframe3dnl.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C old mode 100644 new mode 100755 index 6562e67a1..7cb8c6408 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -53,7 +53,7 @@ #include "engngm.h" #ifdef __OOFEG - #include "oofeggraphiccontext.h" +#include "oofeggraphiccontext.h" #include "../sm/Materials/structuralmaterial.h" #endif @@ -67,13 +67,154 @@ namespace oofem { LatticeFrame3dNL::~LatticeFrame3dNL() {} - +// void +// LatticeFrame3dNL::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep, int li, int ui) +//// Returns the strain matrix of the receiver. +// { +// FloatArray u; +// this->computeVectorOf(VM_Total, tStep, u); +// +// this->length = computeLength(); +// double l1 = this->length * ( 1. - this->s ) / 2; +// double l2 = this->length * ( 1. + this->s ) / 2; +// answer.resize(6, 12); +// answer.zero(); +// double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; +// double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// +// +// double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; +// double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; +// double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; +// +// +// //Normal displacement jump in x-direction +// //First node +// answer.at(1, 1) = -1.; +// answer.at(1, 2) = 0.; +// answer.at(1, 3) = 0.; +// answer.at(1, 4) = 0.; +// answer.at(1, 5) = -cz1; +// answer.at(1, 6) = cy1; +// //Second node +// answer.at(1, 7) = 1.; +// answer.at(1, 8) = 0.; +// answer.at(1, 9) = 0.; +// answer.at(1, 10) = 0.; +// answer.at(1, 11) = -cz2; +// answer.at(1, 12) = cy2; +// +// //Shear displacement jump in y-plane +// //first node +// answer.at(2, 1) = 0.; +// answer.at(2, 2) = -1.; +// answer.at(2, 3) = 0.; +// answer.at(2, 4) = cz1; +// answer.at(2, 5) = 0; +// answer.at(2, 6) = -cx1; +// //Second node +// answer.at(2, 7) = 0.; +// answer.at(2, 8) = 1.; +// answer.at(2, 9) = 0.; +// answer.at(2, 10) = cz2; +// answer.at(2, 11) = 0; +// answer.at(2, 12) = -cx2; +// +// //Shear displacement jump in z-plane +// //first node +// answer.at(3, 1) = 0.; +// answer.at(3, 2) = 0.; +// answer.at(3, 3) = -1.; +// answer.at(3, 4) = -cy1; +// answer.at(3, 5) = cx1; +// answer.at(3, 6) = 0.; +// //Second node +// answer.at(3, 7) = 0.; +// answer.at(3, 8) = 0.; +// answer.at(3, 9) = 1.; +// answer.at(3, 10) = -cy2; +// answer.at(3, 11) = cx2; +// answer.at(3, 12) = 0.; +// +// //Rotation around x-axis +// //First node +// answer.at(4, 1) = 0.; +// answer.at(4, 2) = 0; +// answer.at(4, 3) = 0.; +// answer.at(4, 4) = -1.; +// answer.at(4, 5) = 0.; +// answer.at(4, 6) = 0.; +// //Second node +// answer.at(4, 7) = 0.; +// answer.at(4, 8) = 0.; +// answer.at(4, 9) = 0.; +// answer.at(4, 10) = 1.; +// answer.at(4, 11) = 0.; +// answer.at(4, 12) = 0.; +// +// //Rotation around y-axis +// //First node +// answer.at(5, 1) = 0.; +// answer.at(5, 2) = 0.; +// answer.at(5, 3) = 0.; +// answer.at(5, 4) = 0.; +// answer.at(5, 5) = -1.; +// answer.at(5, 6) = 0.; +// //Second node +// answer.at(5, 7) = 0.; +// answer.at(5, 8) = 0.; +// answer.at(5, 9) = 0.; +// answer.at(5, 10) = 0.; +// answer.at(5, 11) = 1.; +// answer.at(5, 12) = 0.; +// +// //Rotation around z-axis +// //First node +// answer.at(6, 1) = 0.; +// answer.at(6, 2) = 0.; +// answer.at(6, 3) = 0.; +// answer.at(6, 4) = 0.; +// answer.at(6, 5) = 0.; +// answer.at(6, 6) = -1.; +// //Second node +// answer.at(6, 7) = 0.; +// answer.at(6, 8) = 0.; +// answer.at(6, 9) = 0.; +// answer.at(6, 10) = 0.; +// answer.at(6, 11) = 0.; +// answer.at(6, 12) = 1.; +// +// return; +// } +// void +// LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, +// TimeStep *tStep) +//// Computes numerically the stiffness matrix of the receiver. +// { +// FloatMatrix d, bi, bj, bjt, dbj, dij; +// +// this->length = computeLength(); +// +// answer.resize(12, 12); +// answer.zero(); +// this-> computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); +// this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); +// +// dbj.beProductOf(d, bj); +// dbj.times(1. / length); +// bjt.beTranspositionOf(bj); +// answer.beProductOf(bjt, dbj); +// //printf("answer/n"); +// //answer.printYourself(); +// return; +// } void LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) { - FloatMatrix d, bi, bj, bjt, dbj, dij, bf, g, b, bt; - FloatArray u, uIncr, un1d; + FloatMatrix d; + FloatArray u; this->length = computeLength(); answer.resize(12, 12); answer.zero(); @@ -83,19 +224,16 @@ namespace oofem { double l1 = this->length * ( 1. - this->s ) / 2; double l2 = this->length * ( 1. + this->s ) / 2; - this->computeVectorOf(VM_Incremental, tStep, u); - this->computeVectorOf(VM_Incremental, tStep, uIncr); - this->computeVectorOf(VM_Total, tStep, un1d); - auto un1 = un1d - uIncr; + this->computeVectorOf(VM_Total, tStep, u); - double xin1=(cos(un1.at(5))*cos(un1.at(6)))*l1; - double yin1=(cos(un1.at(4))*sin(un1.at(6))+sin(un1.at(4))*sin(un1.at(5))*cos(un1.at(6)))*l1; - double zin1=(sin(un1.at(4))*sin(un1.at(6))-cos(un1.at(4))*sin(un1.at(5))*cos(un1.at(6)))*l1; + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - double xjn1=(cos(un1.at(11))*cos(un1.at(12)))*l2; - double yjn1=(cos(un1.at(10))*sin(un1.at(12))+sin(un1.at(10))*sin(un1.at(11))*cos(un1.at(12)))*l2; - double zjn1=(sin(un1.at(10))*sin(un1.at(12))-cos(un1.at(10))*sin(un1.at(11))*cos(un1.at(12)))*l2; + double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; @@ -104,85 +242,85 @@ namespace oofem { answer.at(1, 2) = 0.; answer.at(1, 3) = 0.; answer.at(1, 4) = 0.; - answer.at(1, 5) = d.at(1,1)*(-zin1); - answer.at(1, 6) = -d.at(1,1)*(yin1); + answer.at(1, 5) = -d.at(1,1)*(-cz1); + answer.at(1, 6) = -d.at(1,1)*(cy1); answer.at(1, 7) = -d.at(1, 1); answer.at(1, 8) = 0.; answer.at(1, 9) = 0.; answer.at(1, 10) = 0.; - answer.at(1, 11) = d.at(1,1)*(-zjn1); - answer.at(1, 12) = -d.at(1,1)*(yjn1); + answer.at(1, 11) = -d.at(1,1)*(-cz2); + answer.at(1, 12) = -d.at(1,1)*(cy2); //Shear Y 1 answer.at(2, 1) = 0; answer.at(2, 2) = d.at(2, 2); answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2,2)*(zin1); + answer.at(2, 4) = -d.at(2,2)*(cz1); answer.at(2, 5) = 0; - answer.at(2, 6) = -d.at(2,2)*(-xin1); + answer.at(2, 6) = -d.at(2,2)*(-cx1); answer.at(2, 7) = 0.; answer.at(2, 8) = -d.at(2,2); answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2,2)*(zjn1); + answer.at(2, 10) = -d.at(2,2)*(cz2); answer.at(2, 11) = 0; - answer.at(2, 12) = -d.at(2,2)*(-xjn1); + answer.at(2, 12) = -d.at(2,2)*(-cx2); //Shear Z 1 answer.at(3, 1) = 0; answer.at(3, 2) = 0.; answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3,3)*(-zin1); - answer.at(3, 5) = -d.at(3,3)*(xin1); + answer.at(3, 4) = -d.at(3,3)*(-cy1); + answer.at(3, 5) = -d.at(3,3)*(cx1); answer.at(3, 6) = 0; answer.at(3, 7) = 0.; answer.at(3, 8) = 0; answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3,3)*(-zjn1); - answer.at(3, 11) = -d.at(3,3)*(xjn1); + answer.at(3, 10) = -d.at(3,3)*(-cy2); + answer.at(3, 11) = -d.at(3,3)*(cx2); answer.at(3, 12) = 0; // Mx 1 answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2,2)*(-zin1); - answer.at(4, 3) = -d.at(3,3)*(-yin1); - answer.at(4, 4) = -d.at(3,3)*(-yin1*yin1)+d.at(2,2)*(zin1*zin1)+d.at(4,4); - answer.at(4, 5) = -d.at(3,3)*(yin1*xin1); - answer.at(4, 6) = d.at(2,2)*(-zin1*xin1); + answer.at(4, 2) = d.at(2,2)*(-cz1); + answer.at(4, 3) = -d.at(3,3)*(-cy1); + answer.at(4, 4) = -d.at(3,3)*(-cy1*cy1)+d.at(2,2)*(cz1*cz1)+d.at(4,4); + answer.at(4, 5) = -d.at(3,3)*(cy1*cx1); + answer.at(4, 6) = d.at(2,2)*(-cz1*cx1); answer.at(4, 7) = 0.; - answer.at(4, 8) = d.at(2,2)*(zin1); - answer.at(4, 9) = -d.at(3,3)*(yjn1); - answer.at(4, 10) = -d.at(3,3)*(-yin1*yjn1)+d.at(2,2)*(+zin1*zjn1)-d.at(4,4); - answer.at(4, 11) = -d.at(3,3)*(yin1*xjn1); - answer.at(4, 12) = d.at(2,2)*(-zin1*xjn1); + answer.at(4, 8) = d.at(2,2)*(cz1); + answer.at(4, 9) = -d.at(3,3)*(cy1); + answer.at(4, 10) = -d.at(3,3)*(-cy1*cy2)+d.at(2,2)*(+cz1*cz2)-d.at(4,4); + answer.at(4, 11) = -d.at(3,3)*(cy1*cx2); + answer.at(4, 12) = d.at(2,2)*(-cz1*cx2); // My 1 - answer.at(5, 1) = -d.at(1,1)*(-zin1); + answer.at(5, 1) = -d.at(1,1)*(-cz1); answer.at(5, 2) = 0; - answer.at(5, 3) = d.at(3,3)*(-xin1); - answer.at(5, 4) = d.at(3,3)*(-xin1*yin1); - answer.at(5, 5) = -d.at(1,1)*(-zin1*zin1)+d.at(3,3)*(xin1*xin1)+d.at(5,5); - answer.at(5, 6) = -d.at(1,1)*(+zin1*yin1); - answer.at(5, 7) = -d.at(1,1)*(zin1); + answer.at(5, 3) = d.at(3,3)*(-cx1); + answer.at(5, 4) = d.at(3,3)*(-cx1*cy1); + answer.at(5, 5) = -d.at(1,1)*(-cz1*cz1)+d.at(3,3)*(cx1*cx1)+d.at(5,5); + answer.at(5, 6) = -d.at(1,1)*(+cz1*cy1); + answer.at(5, 7) = -d.at(1,1)*(cz1); answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3,3)*(xin1); - answer.at(5, 10) = d.at(3,3)*(-xin1*yjn1); - answer.at(5, 11) = -d.at(1,1)*(-zin1*zjn1)+d.at(3,3)*(xin1*xjn1)-d.at(5,5); - answer.at(5, 12) = -d.at(1,1)*(+zin1*yjn1); + answer.at(5, 9) = d.at(3,3)*(cx1); + answer.at(5, 10) = d.at(3,3)*(-cx1*cy2); + answer.at(5, 11) = -d.at(1,1)*(-cz1*cz2)+d.at(3,3)*(cx1*cx2)-d.at(5,5); + answer.at(5, 12) = -d.at(1,1)*(+cz1*cy2); // Mz 1 - answer.at(6, 1) = d.at(1,1)*(-yin1); - answer.at(6, 2) = -d.at(2,2)*(-xin1); + answer.at(6, 1) = d.at(1,1)*(-cy1); + answer.at(6, 2) = -d.at(2,2)*(-cx1); answer.at(6, 3) = 0; - answer.at(6, 4) = -d.at(2,2)*(xin1*zin1); - answer.at(6, 5) = d.at(1,1)*(-yin1*zin1); - answer.at(6, 6) = d.at(1,1)*(yin1*yin1)-d.at(2,2)*(-xin1*xin1)+d.at(6,6); - answer.at(6, 7) = d.at(1,1)*(yin1); - answer.at(6, 8) = -d.at(2,2)*(xin1); + answer.at(6, 4) = -d.at(2,2)*(cx1*cz1); + answer.at(6, 5) = d.at(1,1)*(-cy1*cz1); + answer.at(6, 6) = d.at(1,1)*(cy1*cy1)-d.at(2,2)*(-cx1*cx1)+d.at(6,6); + answer.at(6, 7) = d.at(1,1)*(cy1); + answer.at(6, 8) = -d.at(2,2)*(cx1); answer.at(6, 9) = 0; - answer.at(6, 10) = -d.at(2,2)*(xin1*zjn1); - answer.at(6, 11) = d.at(1,1)*(-yin1*zjn1); - answer.at(6, 12) = d.at(1,1)*(yin1*yjn1)-d.at(2,2)*(-xin1*xjn1)-d.at(6,6); + answer.at(6, 10) = -d.at(2,2)*(cx1*cz2); + answer.at(6, 11) = d.at(1,1)*(-cy1*cz2); + answer.at(6, 12) = d.at(1,1)*(cy1*cy2)-d.at(2,2)*(-cx1*cx2)-d.at(6,6); @@ -191,86 +329,85 @@ namespace oofem { answer.at(7, 2) = 0.; answer.at(7, 3) = 0.; answer.at(7, 4) = 0.; - answer.at(7, 5) = -d.at(1,1)*(-zin1); - answer.at(7, 6) = d.at(1,1)*(yin1); + answer.at(7, 5) = d.at(1,1)*(-cz1); + answer.at(7, 6) = d.at(1,1)*(cy1); answer.at(7, 7) = d.at(1, 1); answer.at(7, 8) = 0.; answer.at(7, 9) = 0.; answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1,1)*(-zjn1); - answer.at(7, 12) = d.at(1,1)*(yjn1); + answer.at(7, 11) = d.at(1,1)*(-cz2); + answer.at(7, 12) = d.at(1,1)*(cy2); //Shear Y 2 answer.at(8, 1) = 0; answer.at(8, 2) = -d.at(2, 2); answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2,2)*(zin1); + answer.at(8, 4) = d.at(2,2)*(cz1); answer.at(8, 5) = 0; - answer.at(8, 6) = d.at(2,2)*(-xin1); + answer.at(8, 6) = d.at(2,2)*(-cx1); answer.at(8, 7) = 0.; answer.at(8, 8) = d.at(2,2); answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2,2)*(zjn1); + answer.at(8, 10) = d.at(2,2)*(cz2); answer.at(8, 11) = 0; - answer.at(8, 12) = d.at(2,2)*(-xjn1); + answer.at(8, 12) = d.at(2,2)*(-cx2); //Shear Z 2 answer.at(9, 1) = 0; answer.at(9, 2) = 0.; answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3,3)*(-zin1); - answer.at(9, 5) = d.at(3,3)*(xin1); + answer.at(9, 4) = d.at(3,3)*(-cy1); + answer.at(9, 5) = d.at(3,3)*(cx1); answer.at(9, 6) = 0; answer.at(9, 7) = 0.; answer.at(9, 8) = 0; answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3,3)*(-zjn1); - answer.at(9, 11) = d.at(3,3)*(xjn1); + answer.at(9, 10) = d.at(3,3)*(-cy2); + answer.at(9, 11) = d.at(3,3)*(cx2); answer.at(9, 12) = 0; // Mx 2 answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2,2)*(zjn1); - answer.at(10, 3) = d.at(3,3)*(yin1); - answer.at(10, 4) = d.at(3,3)*(yjn1*yin1)-d.at(2,2)*(-zjn1*zin1)-d.at(4,4); - answer.at(10, 5) = d.at(3,3)*(-yjn1*xin1); - answer.at(10, 6) = -d.at(2,2)*(zjn1*xin1); + answer.at(10, 2) = -d.at(2,2)*(cz2); + answer.at(10, 3) = d.at(3,3)*(cy2); + answer.at(10, 4) = d.at(3,3)*(cy2*cy1)-d.at(2,2)*(-cz2*cz1)-d.at(4,4); + answer.at(10, 5) = d.at(3,3)*(-cy2*cx1); + answer.at(10, 6) = -d.at(2,2)*(cz2*cx1); answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2,2)*(-zjn1); - answer.at(10, 9) = d.at(3,3)*(-yjn1); - answer.at(10, 10) = d.at(3,3)*(yjn1*yjn1)-d.at(2,2)*(-zjn1*zjn1)+d.at(4,4); - answer.at(10, 11) = d.at(3,3)*(-yjn1*xjn1); - answer.at(10, 12) = -d.at(2,2)*(+zjn1*xjn1); + answer.at(10, 8) = -d.at(2,2)*(-cz2); + answer.at(10, 9) = d.at(3,3)*(-cy2); + answer.at(10, 10) = d.at(3,3)*(cy2*cy2)-d.at(2,2)*(-cz2*cz2)+d.at(4,4); + answer.at(10, 11) = d.at(3,3)*(-cy2*cx2); + answer.at(10, 12) = -d.at(2,2)*(+cz2*cx2); // My 2 - answer.at(11, 1) = d.at(1,1)*(zjn1); + answer.at(11, 1) = d.at(1,1)*(cz2); answer.at(11, 2) = 0; - answer.at(11, 3) = -d.at(3,3)*(xjn1); - answer.at(11, 4) = -d.at(3,3)*(xjn1*yin1); - answer.at(11, 5) = d.at(1,1)*(zjn1*zin1)-d.at(3,3)*(-xjn1*xin1)-d.at(5,5); - answer.at(11, 6) = d.at(1,1)*(-zjn1*yin1); - answer.at(11, 7) = d.at(1,1)*(-zjn1); + answer.at(11, 3) = -d.at(3,3)*(cx2); + answer.at(11, 4) = -d.at(3,3)*(cx2*cy1); + answer.at(11, 5) = d.at(1,1)*(cz2*cz1)-d.at(3,3)*(-cx2*cx1)-d.at(5,5); + answer.at(11, 6) = d.at(1,1)*(-cz2*cy1); + answer.at(11, 7) = d.at(1,1)*(-cz2); answer.at(11, 8) = 0; - answer.at(11, 9) = -d.at(3,3)*(-xjn1); - answer.at(11, 10) = -d.at(3,3)*(xjn1*yjn1); - answer.at(11, 11) = d.at(1,1)*(zjn1*zjn1)-d.at(3,3)*(-xjn1*xjn1)+d.at(5,5); - answer.at(11, 12) = d.at(1,1)*(-zjn1*yjn1); + answer.at(11, 9) = -d.at(3,3)*(-cx2); + answer.at(11, 10) = -d.at(3,3)*(cx2*cy2); + answer.at(11, 11) = d.at(1,1)*(cz2*cz2)-d.at(3,3)*(-cx2*cx2)+d.at(5,5); + answer.at(11, 12) = d.at(1,1)*(-cz2*cy2); // Mz 2 - answer.at(12, 1) = -yjn1*d.at(1,1); - answer.at(12, 2) = xjn1*d.at(2,2); + answer.at(12, 1) = -cy2*d.at(1,1); + answer.at(12, 2) = cx2*d.at(2,2); answer.at(12, 3) = 0; - answer.at(12, 4) = -xjn1*d.at(2,2)*(zin1); - answer.at(12, 5) = yjn1*d.at(1,1)*(-zin1); - answer.at(12, 6) = yjn1*d.at(1,1)*(yin1)-xjn1*d.at(2,2)*(-xin1)-d.at(6,6); - answer.at(12, 7) = yjn1*d.at(1,1); - answer.at(12, 8) = -xjn1*d.at(2,2); + answer.at(12, 4) = -cx2*d.at(2,2)*(cz1); + answer.at(12, 5) = cy2*d.at(1,1)*(-cz1); + answer.at(12, 6) = cy2*d.at(1,1)*(cy1)-cx2*d.at(2,2)*(-cx1)-d.at(6,6); + answer.at(12, 7) = cy2*d.at(1,1); + answer.at(12, 8) = -cx2*d.at(2,2); answer.at(12, 9) = 0; - answer.at(12, 10) = -xjn1*d.at(2,2)*(zjn1); - answer.at(12, 11) = yjn1*d.at(1,1)*(-zjn1); - answer.at(12, 12) = yjn1*d.at(1,1)*(yjn1)-xjn1*d.at(2,2)*(-xjn1)+d.at(6,6); + answer.at(12, 10) = -cx2*d.at(2,2)*(cz2); + answer.at(12, 11) = cy2*d.at(1,1)*(-cz2); + answer.at(12, 12) = cy2*d.at(1,1)*(cy2)-cx2*d.at(2,2)*(-cx2)+d.at(6,6); answer.times(1. / this->length); return; } - // void LatticeFrame3dNL::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) @@ -278,15 +415,11 @@ namespace oofem { // the receiver, at time step tStep. The nature of these strains depends // on the element's type. { + FloatArray u; + this->computeVectorOf(VM_Total, tStep, u); - - FloatArray uIncr, un1, un; - FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; - FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; - FloatArray deltaPi, deltaPj, deltaP, answerold; - this->computeVectorOf(VM_Incremental, tStep, uIncr); - this->computeVectorOf(VM_Total, tStep, un1); - un = un1 - uIncr; +// printf("displacement n:"); +// un.printYourself(); this->length = computeLength(); double l1 = this->length * ( 1. - this->s ) / 2; @@ -294,192 +427,24 @@ namespace oofem { LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); auto strain = lmatStat->giveLatticeStrain(); - //Coordinates of point ni^0 - FloatArrayF< 3 >ni0; - ni0.at(1) = 0; - ni0.at(2) = 0; - ni0.at(3) = 0; - //Coordinates of point Pi^0 - FloatArrayF< 3 >pi0; - pi0.at(1) = l1; - pi0.at(2) = 0; - pi0.at(3) = 0; - //Coordinates of point pj^0 - FloatArrayF< 3 >pj0; - pj0.at(1) = l1; - pj0.at(2) = 0; - pj0.at(3) = 0; - //Coordinates of point nj^0 - FloatArrayF< 3 >nj0; - nj0.at(1) = l1+l2; - nj0.at(2) = 0; - nj0.at(3) = 0; - //Coordinates of point ni^n - FloatArrayF< 3 >nin; - nin.at(1) = ni0.at(1) + un.at(1); - nin.at(2) = ni0.at(2) + un.at(2); - nin.at(3) = ni0.at(3) + un.at(3); - //Coordinates of point nj^n - FloatArrayF< 3 >njn; - njn.at(1) = nj0.at(1) + un.at(7); - njn.at(2) = nj0.at(2) + un.at(8); - njn.at(3) = nj0.at(3) + un.at(9); - //Coordinates of point ni^n+1 - FloatArrayF< 3 >nin1; - nin1.at(1) = nin.at(1) + uIncr.at(1); - nin1.at(2) = nin.at(2) + uIncr.at(2); - nin1.at(3) = nin.at(3) + uIncr.at(3); - //Coordinates of point nj^n+1 - FloatArrayF< 3 >njn1; - njn1.at(1) = njn.at(1) + uIncr.at(7); - njn1.at(2) = njn.at(2) + uIncr.at(8); - njn1.at(3) = njn.at(3) + uIncr.at(9); - //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n - FloatMatrixF< 3, 3 >rin; - rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); - rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); - rin.at(1, 3) = sin(un.at(5)); - // - rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); - rin.at(2, 3) = -sin(un.at(4))*cos(un.at(5)); - // - rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); - rin.at(3, 3) = cos(un.at(4))*cos(un.at(5)); - //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n - FloatMatrixF< 3, 3 >rjn; - rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); - rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); - rjn.at(1, 3) = sin(un.at(11)); - // - rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); - rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(11)); - // - rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); - rjn.at(3, 3) = cos(un.at(10))*cos(un.at(11)); - // - //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). - //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n - pi0ni0.beDifferenceOf(pi0, ni0); - rinpi0ni0.beProductOf(rin, pi0ni0); - //We add the result with (Ni^0+ui^n) to get Pi^n - FloatArrayF< 3 >pin; - pin.at(1) = nin.at(1) + rinpi0ni0.at(1); - pin.at(2) = nin.at(2) + rinpi0ni0.at(2); - pin.at(3) = nin.at(3) + rinpi0ni0.at(3); - // - // - //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). - //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n - pj0nj0.beDifferenceOf(pj0, nj0); - rjnpj0nj0.beProductOf(rjn, pj0nj0); - //We add the result with (Nj^0+uj^n) to get Pj^n - FloatArrayF< 3 >pjn; - pjn.at(1) = njn.at(1) + rjnpj0nj0.at(1); - pjn.at(2) = njn.at(2) + rjnpj0nj0.at(2); - pjn.at(3) = njn.at(3) + rjnpj0nj0.at(3); - // - //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rin1; - rin1.at(1, 1) = 1; - rin1.at(1, 2) = - uIncr.at(6); - rin1.at(1, 3) = uIncr.at(5); - // - rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); - rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; - rin1.at(2, 3) = -uIncr.at(4); - // - rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); - rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); - rin1.at(3, 3) = 1; - //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rjn1; - rjn1.at(1, 1) = 1; - rjn1.at(1, 2) = -uIncr.at(12); - rjn1.at(1, 3) = uIncr.at(11); - // - rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); - rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; - rjn1.at(2, 3) = -uIncr.at(10); - // - rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); - rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); - rjn1.at(3, 3) = 1; - // + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). - //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 - pinnin.beDifferenceOf(pin, nin); - rin1pinnin.beProductOf(rin1, pinnin); - //We add the result with (Ni^n+uIncr) to get Pi^n+1 - FloatArrayF< 3 >pin1; - pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); - pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); - pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); - // - //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). - //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 - pjnnjn.beDifferenceOf(pjn, njn); - rjn1pjnnjn.beProductOf(rjn1, pjnnjn); - //We add the result with (Nj^n+uIncr) to get Pj^n+1 - FloatArrayF< 3 >pjn1; - pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); - pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); - pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); - // - //Calculate delta (Pi) and delta (Pj) - deltaPi.beDifferenceOf(pin1, pin); - deltaPj.beDifferenceOf(pjn1, pjn); - //Calculate delta (P) - // - // FloatArray deltaP, - deltaP.beDifferenceOf(deltaPj, deltaPi); - // - //Calculate delta (theta) - FloatArrayF< 3 >deltaT; - deltaT.at(1) = uIncr.at(10)-uIncr.at(4); - deltaT.at(2) = uIncr.at(11)-uIncr.at(5); - deltaT.at(3) = uIncr.at(12)-uIncr.at(6); - //Incremental displacement of point Ni which equal to UiN_n+1 - UiN_n - // double ln = sqrt(pow(njn.at(1)-nin.at(1), 2) + pow(njn.at(2)-nin.at(2), 2) + pow(njn.at(3)-nin.at(3), 2) ); - // + double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; // answer.resize(6); - answer.at(1) = deltaP.at(1); - answer.at(2) = deltaP.at(2); - answer.at(3) = deltaP.at(3); - answer.at(4) = deltaT.at(1); - answer.at(5) = deltaT.at(2); - answer.at(6) = deltaT.at(3); + answer.at(1) = u.at(7)-u.at(1)+cx2 +cx1 -l1-l2; + answer.at(2) = u.at(8)-u.at(2)-cy2 -cy1; + answer.at(3) = u.at(9)-u.at(3)-cz2 -cz1; + answer.at(4) = u.at(10)-u.at(4); + answer.at(5) = u.at(11)-u.at(5); + answer.at(6) = u.at(12)-u.at(6); answer.times(1. / this->length); -// printf("Strain/n"); -// answer.printYourself(); - answer += strain; - // - // FloatMatrix b; - // FloatArray u; - // double l1 = this->length * ( 1. - this->s ) / 2; - // double l2 = this->length * ( 1. + this->s ) / 2; - // this->computeVectorOf(VM_Incremental, tStep, u); - // LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); - // auto strain = lmatStat->giveLatticeStrain(); -// - answerold.resize(6); - answerold.at(1) = ( 1 - cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + ( 1 - cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(7) - uIncr.at(1); - answerold.at(2) = -( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(8) - uIncr.at(2); - answerold.at(3) = -( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + uIncr.at(9) - uIncr.at(3); - answerold.at(4) = uIncr.at(10) - uIncr.at(4); - answerold.at(5) = uIncr.at(11) - uIncr.at(5); - answerold.at(6) = uIncr.at(12) - uIncr.at(6); - answerold.times(1. / this->length); - // answerold.times(1. / ln); -// printf("StrainOld/n"); -// answerold.printYourself(); -// answer += strain; + } // void @@ -488,235 +453,47 @@ namespace oofem { { FloatMatrix b, bt, bf, d; FloatArray u, stress, strain; - - FloatArray uIncr, un1; - FloatArray pi0ni0, pj0nj0, rinpi0ni0, rjnpj0nj0; - FloatArray pinnin, pjnnjn, rin1pinnin, rjn1pjnnjn; - FloatArray deltaPi, deltaPj, deltaP, pnsfi, pnsfj, answerold; - this->computeVectorOf(VM_Incremental, tStep, uIncr); - this->computeVectorOf(VM_Total, tStep, un1); - auto un = un1 - uIncr; - - - // this->computeVectorOf(VM_Incremental, tStep, u); + this->computeVectorOf(VM_Total, tStep, u); + // this->computeVectorOf(VM_Incremental, tStep, u); this->length = computeLength(); GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); - // Total stress this->computeStrainVector(strain, gp, tStep); this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - // Old stresses LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); auto oldStress = lmatStat->giveLatticeStress(); - + // auto oldInternalForces = lmatStat->giveInternalForces(); double l1 = this->length * ( 1. - this->s ) / 2; double l2 = this->length * ( 1. + this->s ) / 2; - FloatArray incrementalStress; - incrementalStress.beDifferenceOf(stress, oldStress); - - //Coordinates of point ni^0 - FloatArrayF< 3 >ni0; - ni0.at(1) = 0; - ni0.at(2) = 0; - ni0.at(3) = 0; - //Coordinates of point Pi^0 - FloatArrayF< 3 >pi0; - pi0.at(1) = l1; - pi0.at(2) = 0; - pi0.at(3) = 0; - //Coordinates of point pj^0 - FloatArrayF< 3 >pj0; - pj0.at(1) = l1; - pj0.at(2) = 0; - pj0.at(3) = 0; - //Coordinates of point nj^0 - FloatArrayF< 3 >nj0; - nj0.at(1) = l1+l2; - nj0.at(2) = 0; - nj0.at(3) = 0; - //Coordinates of point ni^n - FloatArrayF< 3 >nin; - nin.at(1) = ni0.at(1) + un.at(1); - nin.at(2) = ni0.at(2) + un.at(2); - nin.at(3) = ni0.at(3) + un.at(3); - //Coordinates of point nj^n - FloatArrayF< 3 >njn; - njn.at(1) = nj0.at(1) + un.at(7); - njn.at(2) = nj0.at(2) + un.at(8); - njn.at(3) = nj0.at(3) + un.at(9); - //Coordinates of point ni^n+1 - FloatArrayF< 3 >nin1; - nin1.at(1) = nin.at(1) + uIncr.at(1); - nin1.at(2) = nin.at(2) + uIncr.at(2); - nin1.at(3) = nin.at(3) + uIncr.at(3); - //Coordinates of point nj^n+1 - FloatArrayF< 3 >njn1; - njn1.at(1) = njn.at(1) + uIncr.at(7); - njn1.at(2) = njn.at(2) + uIncr.at(8); - njn1.at(3) = njn.at(3) + uIncr.at(9); - //Rotation matrix (Rj^n) of the first element (Ni0-Pi0) using total displacement at step n - FloatMatrixF< 3, 3 >rin; - rin.at(1, 1) = cos( un.at(5) )*cos(un.at(6)); - rin.at(1, 2) = -cos( un.at(5) )*sin(un.at(6)); - rin.at(1, 3) = sin(un.at(5)); - // - rin.at(2, 1) = cos(un.at(4))*sin(un.at(6))+sin(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(2, 2) = -sin(un.at(4))*sin(un.at(5))*sin(un.at(6))+cos(un.at(4))*cos(un.at(6)); - rin.at(2, 3) = -sin(un.at(4))*cos(un.at(5)); - // - rin.at(3, 1) = sin(un.at(4))*sin(un.at(6))-cos(un.at(4))*sin(un.at(5))*cos(un.at(6)); - rin.at(3, 2) = cos(un.at(4))*sin(un.at(5))*sin(un.at(6))+sin(un.at(4))*cos(un.at(6)); - rin.at(3, 3) = cos(un.at(4))*cos(un.at(5)); - //Rotation matrix (Rj^n) of the second element (Nj0-Pj0) using total displacement at step n - FloatMatrixF< 3, 3 >rjn; - rjn.at(1, 1) = cos( un.at(11) )*cos(un.at(12)); - rjn.at(1, 2) = -cos( un.at(11) )*sin(un.at(12)); - rjn.at(1, 3) = sin(un.at(11)); - // - // - rjn.at(2, 1) = cos(un.at(10))*sin(un.at(12))+sin(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(2, 2) = -sin(un.at(10))*sin(un.at(11))*sin(un.at(12))+cos(un.at(10))*cos(un.at(12)); - rjn.at(2, 3) = -sin(un.at(10))*cos(un.at(11)); - // - rjn.at(3, 1) = sin(un.at(10))*sin(un.at(12))-cos(un.at(10))*sin(un.at(11))*cos(un.at(12)); - rjn.at(3, 2) = cos(un.at(10))*sin(un.at(11))*sin(un.at(12))+sin(un.at(10))*cos(un.at(12)); - rjn.at(3, 3) = cos(un.at(10))*cos(un.at(11)); - // - //Calculate the coordinates of point Pi^n using equation Pi^n=Ni^0+Ui^n+Ri^n(Pi^0-Ni^0). - //First we calculate (Pi^0-Ni^0) and multiply it with Ri^n - pi0ni0.beDifferenceOf(pi0, ni0); - rinpi0ni0.beProductOf(rin, pi0ni0); - //We add the result with (Ni^0+ui^n) to get Pi^n - FloatArrayF< 3 >pin; - pin.at(1) = nin.at(1) + rinpi0ni0.at(1); - pin.at(2) = nin.at(2) + rinpi0ni0.at(2); - pin.at(3) = nin.at(3) + rinpi0ni0.at(3); - // - // - //Calculate the coordinates of point Pj^n using equation Pj^n=Nj^0+uj^n+Rj^n(Pj^0-Nj^0). - //First we calculate (Pj^0-Nj^0) and multiply it with Rj^n - pj0nj0.beDifferenceOf(pj0, nj0); - rjnpj0nj0.beProductOf(rjn, pj0nj0); - //We add the result with (Nj^0+uj^n) to get Pj^n - FloatArrayF< 3 >pjn; - pjn.at(1) = nj0.at(1) +un.at(7)+ rjnpj0nj0.at(1); - pjn.at(2) = nj0.at(2) +un.at(8)+ rjnpj0nj0.at(2); - pjn.at(3) = nj0.at(3) +un.at(9)+ rjnpj0nj0.at(3); // - //Rotation matrix (Ri^n+1) of the first element (Nin-Pin) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rin1; - rin1.at(1, 1) = 1; - rin1.at(1, 2) = - uIncr.at(6); - rin1.at(1, 3) = uIncr.at(5); - // - rin1.at(2, 1) = uIncr.at(6)+uIncr.at(4)*uIncr.at(5); - rin1.at(2, 2) = -uIncr.at(4)*uIncr.at(5)*uIncr.at(6)+1; - rin1.at(2, 3) = -uIncr.at(4); - // - rin1.at(3, 1) = uIncr.at(4)*uIncr.at(6)-uIncr.at(5); - rin1.at(3, 2) = uIncr.at(5)*uIncr.at(6)+uIncr.at(4); - rin1.at(3, 3) = 1; - //Rotation matrix (Rj^n+1) of the first element (Njn-Pjn) using uIncr. displacement at step n+1 (cos(theta)=1, cos(theta)= theta) - FloatMatrixF< 3, 3 >rjn1; - rjn1.at(1, 1) = 1; - rjn1.at(1, 2) = -uIncr.at(12); - rjn1.at(1, 3) = uIncr.at(11); - // - rjn1.at(2, 1) = uIncr.at(12)+uIncr.at(10)*uIncr.at(11); - rjn1.at(2, 2) = -uIncr.at(10)*uIncr.at(11)*uIncr.at(12)+1; - rjn1.at(2, 3) = -uIncr.at(10); - // - rjn1.at(3, 1) = uIncr.at(10)*uIncr.at(12)-uIncr.at(11); - rjn1.at(3, 2) = uIncr.at(11)*uIncr.at(12)+uIncr.at(10); - rjn1.at(3, 3) = 1; - // - //Calculate the coordinates of point Pi^n+1 using equation Pi^n=Ni^n+uIncr+Ri^n+1(Pi^n-Ni^n). - //First we calculate (Pi^n-Ni^n) and multiply it with Ri^n+1 - pinnin.beDifferenceOf(pin, nin); - rin1pinnin.beProductOf(rin1, pinnin); - //We add the result with (Ni^n+uIncr) to get Pi^n+1 - FloatArrayF< 3 >pin1; - pin1.at(1) = nin1.at(1) + rin1pinnin.at(1); - pin1.at(2) = nin1.at(2) + rin1pinnin.at(2); - pin1.at(3) = nin1.at(3) + rin1pinnin.at(3); - // - //Calculate the coordinates of point Pj^n+1 using equation Pj^n=Nj^n+uIncr+Rj^n+1(Pj^n-Nj^n). - //First we calculate (Pj^n-Nj^n) and multiply it with Rj^n+1 - pjnnjn.beDifferenceOf(pjn, njn); - rjn1pjnnjn.beProductOf(rjn1, pjnnjn); - //We add the result with (Nj^n+uIncr) to get Pj^n+1 - FloatArrayF< 3 >pjn1; - pjn1.at(1) = njn1.at(1) + rjn1pjnnjn.at(1); - pjn1.at(2) = njn1.at(2) + rjn1pjnnjn.at(2); - pjn1.at(3) = njn1.at(3) + rjn1pjnnjn.at(3); - // - //Calculate Delta(Mi)={mi1, mi2, mi3}= -(Pi^n+1 - Ni^n+1)xDelta(Sf)-Delta(Sm) - //Calculate (Pi^n+1-Ni^n+1) and multiply it with Delta(Sf) - FloatArrayF< 3 >pin1nin1; - pin1nin1.at(1)=pin1.at(1)-nin1.at(1); - pin1nin1.at(2)=pin1.at(2)-nin1.at(2); - pin1nin1.at(3)=pin1.at(3)-nin1.at(3); - // - FloatArrayF<3>DeltaSfi; - DeltaSfi.at(1)=incrementalStress.at(1); - DeltaSfi.at(2)=incrementalStress.at(2); - DeltaSfi.at(3)=incrementalStress.at(3); - // - pnsfi.beVectorProductOf( pin1nin1, DeltaSfi); - // - //Calculate Delta(Mj)={mj1, mj2, mj3}= -(Pj^n+1 - Nj^n+1)xDelta(Sf)+Delta(Sm) - //Calculate (Pj^n+1-Nj^n+1) and multiply it with Delta(Sf) - FloatArrayF< 3 >pjn1njn1; - pjn1njn1.at(1)=pjn1.at(1)-njn1.at(1); - pjn1njn1.at(2)=pjn1.at(2)-njn1.at(2); - pjn1njn1.at(3)=pjn1.at(3)-njn1.at(3); - // - FloatArrayF<3>DeltaSfj; - DeltaSfj.at(1)=incrementalStress.at(1); - DeltaSfj.at(2)=incrementalStress.at(2); - DeltaSfj.at(3)=incrementalStress.at(3); - // - pnsfj.beVectorProductOf( pjn1njn1, -DeltaSfj); + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + + + double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; // // answer.resize(12); - answer.at(1) = -incrementalStress.at(1); - answer.at(2) = -incrementalStress.at(2); - answer.at(3) = -incrementalStress.at(3); - answer.at(4) = -pnsfi.at(1)-incrementalStress.at(4); - answer.at(5) = -pnsfi.at(2)-incrementalStress.at(5); - answer.at(6) = -pnsfi.at(3)-incrementalStress.at(6); - answer.at(7) = incrementalStress.at(1); - answer.at(8) = incrementalStress.at(2); - answer.at(9) = incrementalStress.at(3); - answer.at(10) = -pnsfj.at(1)+incrementalStress.at(4); - answer.at(11) = -pnsfj.at(2)+incrementalStress.at(5); - answer.at(12) = -pnsfj.at(3)+incrementalStress.at(6); - answer += oldInternalForces; - printf("Force/n"); - answer.printYourself(); - - lmatStat->letTempInternalForcesBe(answer); - -// answer.resize(12); -// answer.at(1) = -incrementalStress.at(1); -// answer.at(2) = -incrementalStress.at(2); -// answer.at(3) = -incrementalStress.at(3); -// answer.at(4) = +incrementalStress.at(2) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(3) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(4); -// answer.at(5) = -incrementalStress.at(1) * ( sin( uIncr.at(4) ) * sin( uIncr.at(6) ) - cos( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 + incrementalStress.at(3) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(5); -// answer.at(6) = incrementalStress.at(1) * ( cos( uIncr.at(4) ) * sin( uIncr.at(6) ) + sin( uIncr.at(4) ) * sin( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(2) * ( cos( uIncr.at(5) ) * cos( uIncr.at(6) ) ) * l1 - incrementalStress.at(6); -// answer.at(7) = incrementalStress.at(1); -// answer.at(8) = incrementalStress.at(2); -// answer.at(9) = incrementalStress.at(3); -// answer.at(10) = incrementalStress.at(2) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(3) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(4); -// answer.at(11) = -incrementalStress.at(1) * ( sin( uIncr.at(10) ) * sin( uIncr.at(12) ) - cos( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(3) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(5); -// answer.at(12) = incrementalStress.at(1) * ( cos( uIncr.at(10) ) * sin( uIncr.at(12) ) + sin( uIncr.at(10) ) * sin( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 - incrementalStress.at(2) * ( cos( uIncr.at(11) ) * cos( uIncr.at(12) ) ) * l2 + incrementalStress.at(6); -// answer += oldInternalForces; -// printf("OldForce/n"); -// answer.printYourself(); -// lmatStat->letTempInternalForcesBe(answer); + answer.at(1) = -stress.at(1); + answer.at(2) = -stress.at(2); + answer.at(3) = -stress.at(3); + answer.at(4) = stress.at(2)*cz1- stress.at(3)*cy1- stress.at(4); + answer.at(5) = -stress.at(1)*cz1+ stress.at(3)*cx1- stress.at(5); + answer.at(6) = stress.at(1)*cy1- stress.at(2)*cx1- stress.at(6); + answer.at(7) = stress.at(1); + answer.at(8) = stress.at(2); + answer.at(9) = stress.at(3); + answer.at(10) = stress.at(2)*cz2- stress.at(3)*cy2+ stress.at(4); + answer.at(11) = -stress.at(1)*cz2+ stress.at(3)*cx2+ stress.at(5); + answer.at(12) = stress.at(1)*cy2- stress.at(2)*cx2+ stress.at(6); + // + lmatStat->letTempInternalForcesBe(answer); + } int @@ -726,7 +503,7 @@ namespace oofem { FloatArray coordA, coordB; FloatArray uA(6), uAIncr(6), uB(6), uBIncr(6); IntArray dofid = { - 1, 2, 3, 4, 5, 6 + 1, 2, 3, 4, 5, 6 }; TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); @@ -740,17 +517,17 @@ namespace oofem { coordA = nodeA->giveCoordinates(); nodeA->giveUnknownVector(uA, dofid, VM_Total, tStep, false); nodeA->giveUnknownVector(uAIncr, dofid, VM_Incremental, tStep, false); - for (int i = 1; i <= 3; i++) { - coordA.at(i) += uA.at(i) - uAIncr.at(i); - } +// for (int i = 1; i <= 3; i++) { +// coordA.at(i) += uA.at(i) - uAIncr.at(i); +// } coordB = nodeB->giveCoordinates(); nodeB->giveUnknownVector(uB, dofid, VM_Total, tStep, false); nodeB->giveUnknownVector(uBIncr, dofid, VM_Incremental, tStep, false); - for (int i = 1; i <= 3; i++) { - coordB.at(i) += uB.at(i) - uBIncr.at(i); - } +// for (int i = 1; i <= 3; i++) { +// coordB.at(i) += uB.at(i) - uBIncr.at(i); +// } lx.beDifferenceOf(coordB, coordA); lx.normalize(); @@ -787,7 +564,7 @@ namespace oofem { // here is ly is used as a temp var if ( fabs( lx.dotProduct(help) ) > 0.999 ) { // Check if it is vertical ly = { - 0., 1., 0. + 0., 1., 0. }; } else { ly.beVectorProductOf(lx, help); @@ -809,4 +586,4 @@ namespace oofem { return 1; } -} // end namespace oofem +} // end namespace oofem \ No newline at end of file diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.h b/src/sm/Elements/LatticeElements/latticeframe3dnl.h index 122893e07..d563a4e99 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.h @@ -52,24 +52,25 @@ Toi, Y., & Isobe, D. (1993). Adaptively shifted integration technique for finite Authors: Gumaa Abdelrhim and Peter Grassl, 2023 */ -class LatticeFrame3dNL : public LatticeFrame3d -{ -protected: + class LatticeFrame3dNL : public LatticeFrame3d + { + protected: -public: - LatticeFrame3dNL(int n, Domain *); - virtual ~LatticeFrame3dNL(); - - int giveLocalCoordinateSystem(FloatMatrix &answer) override; + public: + LatticeFrame3dNL(int n, Domain *); + virtual ~LatticeFrame3dNL(); - const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dNL_Name; } - const char *giveClassName() const override { return "latticeframe3dnl"; } + int giveLocalCoordinateSystem(FloatMatrix &answer) override; - void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; + const char *giveInputRecordName() const override { return _IFT_LatticeFrame3dNL_Name; } + const char *giveClassName() const override { return "latticeframe3dnl"; } -protected: - void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; - virtual void computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) override; -}; + void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; + + protected: + // virtual void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; + virtual void computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) override; + }; } // end namespace oofem -#endif +#endif \ No newline at end of file From b4be4b83a813da1145be150e1740f02d6d369e08 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 7 May 2024 11:45:38 +0100 Subject: [PATCH 57/60] Improve code --- .../LatticeElements/latticeframe3dnl.C | 610 +++++++++--------- .../LatticeElements/latticeframe3dnl.h | 2 +- 2 files changed, 308 insertions(+), 304 deletions(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index 7cb8c6408..c974ee1ef 100755 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -67,18 +67,168 @@ namespace oofem { LatticeFrame3dNL::~LatticeFrame3dNL() {} + void + LatticeFrame3dNL::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) + //Returns the strain matrix of the receiver. + { + FloatArray u; + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + this->computeVectorOf(VM_Total, tStep, u); + + this->length = computeLength(); + double l1 = this->length * ( 1. - this->s ) / 2; + double l2 = this->length * ( 1. + this->s ) / 2; + answer.resize(6, 12); + answer.zero(); + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + + + double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + + + //Normal displacement jump in x-direction + //First node + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = -cz1; + answer.at(1, 6) = cy1; + //Second node + answer.at(1, 7) = 1.; + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = -cz2; + answer.at(1, 12) = cy2; + + //Shear displacement jump in y-plane + //first node + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = cz1; + answer.at(2, 5) = 0; + answer.at(2, 6) = -cx1; + //Second node + answer.at(2, 7) = 0.; + answer.at(2, 8) = 1.; + answer.at(2, 9) = 0.; + answer.at(2, 10) = cz2; + answer.at(2, 11) = 0; + answer.at(2, 12) = -cx2; + + //Shear displacement jump in z-plane + //first node + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = -cy1; + answer.at(3, 5) = cx1; + answer.at(3, 6) = 0.; + //Second node + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0.; + answer.at(3, 9) = 1.; + answer.at(3, 10) = -cy2; + answer.at(3, 11) = cx2; + answer.at(3, 12) = 0.; + + //Rotation around x-axis + //First node + answer.at(4, 1) = 0.; + answer.at(4, 2) = 0; + answer.at(4, 3) = 0.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0.; + answer.at(4, 9) = 0.; + answer.at(4, 10) = 1.; + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + //Rotation around y-axis + //First node + answer.at(5, 1) = 0.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = 0.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node + answer.at(5, 7) = 0.; + answer.at(5, 8) = 0.; + answer.at(5, 9) = 0.; + answer.at(5, 10) = 0.; + answer.at(5, 11) = 1.; + answer.at(5, 12) = 0.; + + //Rotation around z-axis + //First node + answer.at(6, 1) = 0.; + answer.at(6, 2) = 0.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node + answer.at(6, 7) = 0.; + answer.at(6, 8) = 0.; + answer.at(6, 9) = 0.; + answer.at(6, 10) = 0.; + answer.at(6, 11) = 0.; + answer.at(6, 12) = 1.; + + return; + } + void + LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) + { + FloatMatrix d, bt, db, b; + FloatArray u; + + this->computeVectorOf(VM_Total, tStep, u); + this->length = computeLength(); + + answer.resize(12, 12); + answer.zero(); + this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + db.beProductOf(d, b); + db.times(1. / length); + bt.beTranspositionOf(b); + answer.beProductOf(bt, db); + + printf("answer/n"); + answer.printYourself(); + return; + } // void -// LatticeFrame3dNL::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, TimeStep *tStep, int li, int ui) -//// Returns the strain matrix of the receiver. +// LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, +// TimeStep *tStep) // { +// FloatMatrix d; // FloatArray u; -// this->computeVectorOf(VM_Total, tStep, u); -// // this->length = computeLength(); +// answer.resize(12, 12); +// answer.zero(); +// +// this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); +// // double l1 = this->length * ( 1. - this->s ) / 2; // double l2 = this->length * ( 1. + this->s ) / 2; -// answer.resize(6, 12); -// answer.zero(); +// +// this->computeVectorOf(VM_Total, tStep, u); +// // double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; // double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; // double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; @@ -89,326 +239,179 @@ namespace oofem { // double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; // // -// //Normal displacement jump in x-direction -// //First node -// answer.at(1, 1) = -1.; +// +// //Axial 1 +// answer.at(1, 1) = d.at(1, 1); // answer.at(1, 2) = 0.; // answer.at(1, 3) = 0.; // answer.at(1, 4) = 0.; -// answer.at(1, 5) = -cz1; -// answer.at(1, 6) = cy1; -// //Second node -// answer.at(1, 7) = 1.; +// answer.at(1, 5) = -d.at(1,1)*(-cz1); +// answer.at(1, 6) = -d.at(1,1)*(cy1); +// answer.at(1, 7) = -d.at(1, 1); // answer.at(1, 8) = 0.; // answer.at(1, 9) = 0.; // answer.at(1, 10) = 0.; -// answer.at(1, 11) = -cz2; -// answer.at(1, 12) = cy2; +// answer.at(1, 11) = -d.at(1,1)*(-cz2); +// answer.at(1, 12) = -d.at(1,1)*(cy2); // -// //Shear displacement jump in y-plane -// //first node -// answer.at(2, 1) = 0.; -// answer.at(2, 2) = -1.; -// answer.at(2, 3) = 0.; -// answer.at(2, 4) = cz1; +// //Shear Y 1 +// answer.at(2, 1) = 0; +// answer.at(2, 2) = d.at(2, 2); +// answer.at(2, 3) = 0.; +// answer.at(2, 4) = -d.at(2,2)*(cz1); // answer.at(2, 5) = 0; -// answer.at(2, 6) = -cx1; -// //Second node +// answer.at(2, 6) = -d.at(2,2)*(-cx1); // answer.at(2, 7) = 0.; -// answer.at(2, 8) = 1.; -// answer.at(2, 9) = 0.; -// answer.at(2, 10) = cz2; +// answer.at(2, 8) = -d.at(2,2); +// answer.at(2, 9) = 0.; +// answer.at(2, 10) = -d.at(2,2)*(cz2); // answer.at(2, 11) = 0; -// answer.at(2, 12) = -cx2; +// answer.at(2, 12) = -d.at(2,2)*(-cx2); // -// //Shear displacement jump in z-plane -// //first node -// answer.at(3, 1) = 0.; +// //Shear Z 1 +// answer.at(3, 1) = 0; // answer.at(3, 2) = 0.; -// answer.at(3, 3) = -1.; -// answer.at(3, 4) = -cy1; -// answer.at(3, 5) = cx1; -// answer.at(3, 6) = 0.; -// //Second node +// answer.at(3, 3) = d.at(3, 3); +// answer.at(3, 4) = -d.at(3,3)*(-cy1); +// answer.at(3, 5) = -d.at(3,3)*(cx1); +// answer.at(3, 6) = 0; // answer.at(3, 7) = 0.; -// answer.at(3, 8) = 0.; -// answer.at(3, 9) = 1.; -// answer.at(3, 10) = -cy2; -// answer.at(3, 11) = cx2; -// answer.at(3, 12) = 0.; +// answer.at(3, 8) = 0; +// answer.at(3, 9) = -d.at(3, 3); +// answer.at(3, 10) = -d.at(3,3)*(-cy2); +// answer.at(3, 11) = -d.at(3,3)*(cx2); +// answer.at(3, 12) = 0; // -// //Rotation around x-axis -// //First node -// answer.at(4, 1) = 0.; -// answer.at(4, 2) = 0; -// answer.at(4, 3) = 0.; -// answer.at(4, 4) = -1.; -// answer.at(4, 5) = 0.; -// answer.at(4, 6) = 0.; -// //Second node +// // Mx 1 +// answer.at(4, 1) = 0; +// answer.at(4, 2) = d.at(2,2)*(-cz1); +// answer.at(4, 3) = -d.at(3,3)*(-cy1); +// answer.at(4, 4) = -d.at(3,3)*(-cy1*cy1)+d.at(2,2)*(cz1*cz1)+d.at(4,4); +// answer.at(4, 5) = -d.at(3,3)*(cy1*cx1); +// answer.at(4, 6) = d.at(2,2)*(-cz1*cx1); // answer.at(4, 7) = 0.; -// answer.at(4, 8) = 0.; -// answer.at(4, 9) = 0.; -// answer.at(4, 10) = 1.; -// answer.at(4, 11) = 0.; -// answer.at(4, 12) = 0.; +// answer.at(4, 8) = d.at(2,2)*(cz1); +// answer.at(4, 9) = -d.at(3,3)*(cy1); +// answer.at(4, 10) = -d.at(3,3)*(-cy1*cy2)+d.at(2,2)*(+cz1*cz2)-d.at(4,4); +// answer.at(4, 11) = -d.at(3,3)*(cy1*cx2); +// answer.at(4, 12) = d.at(2,2)*(-cz1*cx2); // -// //Rotation around y-axis -// //First node -// answer.at(5, 1) = 0.; -// answer.at(5, 2) = 0.; -// answer.at(5, 3) = 0.; -// answer.at(5, 4) = 0.; -// answer.at(5, 5) = -1.; -// answer.at(5, 6) = 0.; -// //Second node -// answer.at(5, 7) = 0.; -// answer.at(5, 8) = 0.; -// answer.at(5, 9) = 0.; -// answer.at(5, 10) = 0.; -// answer.at(5, 11) = 1.; -// answer.at(5, 12) = 0.; +// // My 1 +// answer.at(5, 1) = -d.at(1,1)*(-cz1); +// answer.at(5, 2) = 0; +// answer.at(5, 3) = d.at(3,3)*(-cx1); +// answer.at(5, 4) = d.at(3,3)*(-cx1*cy1); +// answer.at(5, 5) = -d.at(1,1)*(-cz1*cz1)+d.at(3,3)*(cx1*cx1)+d.at(5,5); +// answer.at(5, 6) = -d.at(1,1)*(+cz1*cy1); +// answer.at(5, 7) = -d.at(1,1)*(cz1); +// answer.at(5, 8) = 0; +// answer.at(5, 9) = d.at(3,3)*(cx1); +// answer.at(5, 10) = d.at(3,3)*(-cx1*cy2); +// answer.at(5, 11) = -d.at(1,1)*(-cz1*cz2)+d.at(3,3)*(cx1*cx2)-d.at(5,5); +// answer.at(5, 12) = -d.at(1,1)*(+cz1*cy2); // -// //Rotation around z-axis -// //First node -// answer.at(6, 1) = 0.; -// answer.at(6, 2) = 0.; -// answer.at(6, 3) = 0.; -// answer.at(6, 4) = 0.; -// answer.at(6, 5) = 0.; -// answer.at(6, 6) = -1.; -// //Second node -// answer.at(6, 7) = 0.; -// answer.at(6, 8) = 0.; -// answer.at(6, 9) = 0.; -// answer.at(6, 10) = 0.; -// answer.at(6, 11) = 0.; -// answer.at(6, 12) = 1.; // -// return; -// } -// void -// LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, -// TimeStep *tStep) -//// Computes numerically the stiffness matrix of the receiver. -// { -// FloatMatrix d, bi, bj, bjt, dbj, dij; +// // Mz 1 +// answer.at(6, 1) = d.at(1,1)*(-cy1); +// answer.at(6, 2) = -d.at(2,2)*(-cx1); +// answer.at(6, 3) = 0; +// answer.at(6, 4) = -d.at(2,2)*(cx1*cz1); +// answer.at(6, 5) = d.at(1,1)*(-cy1*cz1); +// answer.at(6, 6) = d.at(1,1)*(cy1*cy1)-d.at(2,2)*(-cx1*cx1)+d.at(6,6); +// answer.at(6, 7) = d.at(1,1)*(cy1); +// answer.at(6, 8) = -d.at(2,2)*(cx1); +// answer.at(6, 9) = 0; +// answer.at(6, 10) = -d.at(2,2)*(cx1*cz2); +// answer.at(6, 11) = d.at(1,1)*(-cy1*cz2); +// answer.at(6, 12) = d.at(1,1)*(cy1*cy2)-d.at(2,2)*(-cx1*cx2)-d.at(6,6); // -// this->length = computeLength(); // -// answer.resize(12, 12); -// answer.zero(); -// this-> computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), bj); -// this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); // -// dbj.beProductOf(d, bj); -// dbj.times(1. / length); -// bjt.beTranspositionOf(bj); -// answer.beProductOf(bjt, dbj); -// //printf("answer/n"); -// //answer.printYourself(); +// //Axial 2 +// answer.at(7, 1) = -d.at(1, 1); +// answer.at(7, 2) = 0.; +// answer.at(7, 3) = 0.; +// answer.at(7, 4) = 0.; +// answer.at(7, 5) = d.at(1,1)*(-cz1); +// answer.at(7, 6) = d.at(1,1)*(cy1); +// answer.at(7, 7) = d.at(1, 1); +// answer.at(7, 8) = 0.; +// answer.at(7, 9) = 0.; +// answer.at(7, 10) = 0.; +// answer.at(7, 11) = d.at(1,1)*(-cz2); +// answer.at(7, 12) = d.at(1,1)*(cy2); +// +// //Shear Y 2 +// answer.at(8, 1) = 0; +// answer.at(8, 2) = -d.at(2, 2); +// answer.at(8, 3) = 0.; +// answer.at(8, 4) = d.at(2,2)*(cz1); +// answer.at(8, 5) = 0; +// answer.at(8, 6) = d.at(2,2)*(-cx1); +// answer.at(8, 7) = 0.; +// answer.at(8, 8) = d.at(2,2); +// answer.at(8, 9) = 0.; +// answer.at(8, 10) = d.at(2,2)*(cz2); +// answer.at(8, 11) = 0; +// answer.at(8, 12) = d.at(2,2)*(-cx2); +// +// //Shear Z 2 +// answer.at(9, 1) = 0; +// answer.at(9, 2) = 0.; +// answer.at(9, 3) = -d.at(3, 3); +// answer.at(9, 4) = d.at(3,3)*(-cy1); +// answer.at(9, 5) = d.at(3,3)*(cx1); +// answer.at(9, 6) = 0; +// answer.at(9, 7) = 0.; +// answer.at(9, 8) = 0; +// answer.at(9, 9) = d.at(3, 3); +// answer.at(9, 10) = d.at(3,3)*(-cy2); +// answer.at(9, 11) = d.at(3,3)*(cx2); +// answer.at(9, 12) = 0; +// +// // Mx 2 +// answer.at(10, 1) = 0; +// answer.at(10, 2) = -d.at(2,2)*(cz2); +// answer.at(10, 3) = d.at(3,3)*(cy2); +// answer.at(10, 4) = d.at(3,3)*(cy2*cy1)-d.at(2,2)*(-cz2*cz1)-d.at(4,4); +// answer.at(10, 5) = d.at(3,3)*(-cy2*cx1); +// answer.at(10, 6) = -d.at(2,2)*(cz2*cx1); +// answer.at(10, 7) = 0.; +// answer.at(10, 8) = -d.at(2,2)*(-cz2); +// answer.at(10, 9) = d.at(3,3)*(-cy2); +// answer.at(10, 10) = d.at(3,3)*(cy2*cy2)-d.at(2,2)*(-cz2*cz2)+d.at(4,4); +// answer.at(10, 11) = d.at(3,3)*(-cy2*cx2); +// answer.at(10, 12) = -d.at(2,2)*(+cz2*cx2); +// // My 2 +// answer.at(11, 1) = d.at(1,1)*(cz2); +// answer.at(11, 2) = 0; +// answer.at(11, 3) = -d.at(3,3)*(cx2); +// answer.at(11, 4) = -d.at(3,3)*(cx2*cy1); +// answer.at(11, 5) = d.at(1,1)*(cz2*cz1)-d.at(3,3)*(-cx2*cx1)-d.at(5,5); +// answer.at(11, 6) = d.at(1,1)*(-cz2*cy1); +// answer.at(11, 7) = d.at(1,1)*(-cz2); +// answer.at(11, 8) = 0; +// answer.at(11, 9) = -d.at(3,3)*(-cx2); +// answer.at(11, 10) = -d.at(3,3)*(cx2*cy2); +// answer.at(11, 11) = d.at(1,1)*(cz2*cz2)-d.at(3,3)*(-cx2*cx2)+d.at(5,5); +// answer.at(11, 12) = d.at(1,1)*(-cz2*cy2); +// // Mz 2 +// answer.at(12, 1) = -cy2*d.at(1,1); +// answer.at(12, 2) = cx2*d.at(2,2); +// answer.at(12, 3) = 0; +// answer.at(12, 4) = -cx2*d.at(2,2)*(cz1); +// answer.at(12, 5) = cy2*d.at(1,1)*(-cz1); +// answer.at(12, 6) = cy2*d.at(1,1)*(cy1)-cx2*d.at(2,2)*(-cx1)-d.at(6,6); +// answer.at(12, 7) = cy2*d.at(1,1); +// answer.at(12, 8) = -cx2*d.at(2,2); +// answer.at(12, 9) = 0; +// answer.at(12, 10) = -cx2*d.at(2,2)*(cz2); +// answer.at(12, 11) = cy2*d.at(1,1)*(-cz2); +// answer.at(12, 12) = cy2*d.at(1,1)*(cy2)-cx2*d.at(2,2)*(-cx2)+d.at(6,6); +// answer.times(1. / this->length); // return; // } - void - LatticeFrame3dNL::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - TimeStep *tStep) - { - FloatMatrix d; - FloatArray u; - this->length = computeLength(); - answer.resize(12, 12); - answer.zero(); - - this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); - - double l1 = this->length * ( 1. - this->s ) / 2; - double l2 = this->length * ( 1. + this->s ) / 2; - this->computeVectorOf(VM_Total, tStep, u); - - double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; - double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - - - double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; - double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - - - - //Axial 1 - answer.at(1, 1) = d.at(1, 1); - answer.at(1, 2) = 0.; - answer.at(1, 3) = 0.; - answer.at(1, 4) = 0.; - answer.at(1, 5) = -d.at(1,1)*(-cz1); - answer.at(1, 6) = -d.at(1,1)*(cy1); - answer.at(1, 7) = -d.at(1, 1); - answer.at(1, 8) = 0.; - answer.at(1, 9) = 0.; - answer.at(1, 10) = 0.; - answer.at(1, 11) = -d.at(1,1)*(-cz2); - answer.at(1, 12) = -d.at(1,1)*(cy2); - - //Shear Y 1 - answer.at(2, 1) = 0; - answer.at(2, 2) = d.at(2, 2); - answer.at(2, 3) = 0.; - answer.at(2, 4) = -d.at(2,2)*(cz1); - answer.at(2, 5) = 0; - answer.at(2, 6) = -d.at(2,2)*(-cx1); - answer.at(2, 7) = 0.; - answer.at(2, 8) = -d.at(2,2); - answer.at(2, 9) = 0.; - answer.at(2, 10) = -d.at(2,2)*(cz2); - answer.at(2, 11) = 0; - answer.at(2, 12) = -d.at(2,2)*(-cx2); - - //Shear Z 1 - answer.at(3, 1) = 0; - answer.at(3, 2) = 0.; - answer.at(3, 3) = d.at(3, 3); - answer.at(3, 4) = -d.at(3,3)*(-cy1); - answer.at(3, 5) = -d.at(3,3)*(cx1); - answer.at(3, 6) = 0; - answer.at(3, 7) = 0.; - answer.at(3, 8) = 0; - answer.at(3, 9) = -d.at(3, 3); - answer.at(3, 10) = -d.at(3,3)*(-cy2); - answer.at(3, 11) = -d.at(3,3)*(cx2); - answer.at(3, 12) = 0; - - // Mx 1 - answer.at(4, 1) = 0; - answer.at(4, 2) = d.at(2,2)*(-cz1); - answer.at(4, 3) = -d.at(3,3)*(-cy1); - answer.at(4, 4) = -d.at(3,3)*(-cy1*cy1)+d.at(2,2)*(cz1*cz1)+d.at(4,4); - answer.at(4, 5) = -d.at(3,3)*(cy1*cx1); - answer.at(4, 6) = d.at(2,2)*(-cz1*cx1); - answer.at(4, 7) = 0.; - answer.at(4, 8) = d.at(2,2)*(cz1); - answer.at(4, 9) = -d.at(3,3)*(cy1); - answer.at(4, 10) = -d.at(3,3)*(-cy1*cy2)+d.at(2,2)*(+cz1*cz2)-d.at(4,4); - answer.at(4, 11) = -d.at(3,3)*(cy1*cx2); - answer.at(4, 12) = d.at(2,2)*(-cz1*cx2); - - // My 1 - answer.at(5, 1) = -d.at(1,1)*(-cz1); - answer.at(5, 2) = 0; - answer.at(5, 3) = d.at(3,3)*(-cx1); - answer.at(5, 4) = d.at(3,3)*(-cx1*cy1); - answer.at(5, 5) = -d.at(1,1)*(-cz1*cz1)+d.at(3,3)*(cx1*cx1)+d.at(5,5); - answer.at(5, 6) = -d.at(1,1)*(+cz1*cy1); - answer.at(5, 7) = -d.at(1,1)*(cz1); - answer.at(5, 8) = 0; - answer.at(5, 9) = d.at(3,3)*(cx1); - answer.at(5, 10) = d.at(3,3)*(-cx1*cy2); - answer.at(5, 11) = -d.at(1,1)*(-cz1*cz2)+d.at(3,3)*(cx1*cx2)-d.at(5,5); - answer.at(5, 12) = -d.at(1,1)*(+cz1*cy2); - - - // Mz 1 - answer.at(6, 1) = d.at(1,1)*(-cy1); - answer.at(6, 2) = -d.at(2,2)*(-cx1); - answer.at(6, 3) = 0; - answer.at(6, 4) = -d.at(2,2)*(cx1*cz1); - answer.at(6, 5) = d.at(1,1)*(-cy1*cz1); - answer.at(6, 6) = d.at(1,1)*(cy1*cy1)-d.at(2,2)*(-cx1*cx1)+d.at(6,6); - answer.at(6, 7) = d.at(1,1)*(cy1); - answer.at(6, 8) = -d.at(2,2)*(cx1); - answer.at(6, 9) = 0; - answer.at(6, 10) = -d.at(2,2)*(cx1*cz2); - answer.at(6, 11) = d.at(1,1)*(-cy1*cz2); - answer.at(6, 12) = d.at(1,1)*(cy1*cy2)-d.at(2,2)*(-cx1*cx2)-d.at(6,6); - - - - //Axial 2 - answer.at(7, 1) = -d.at(1, 1); - answer.at(7, 2) = 0.; - answer.at(7, 3) = 0.; - answer.at(7, 4) = 0.; - answer.at(7, 5) = d.at(1,1)*(-cz1); - answer.at(7, 6) = d.at(1,1)*(cy1); - answer.at(7, 7) = d.at(1, 1); - answer.at(7, 8) = 0.; - answer.at(7, 9) = 0.; - answer.at(7, 10) = 0.; - answer.at(7, 11) = d.at(1,1)*(-cz2); - answer.at(7, 12) = d.at(1,1)*(cy2); - - //Shear Y 2 - answer.at(8, 1) = 0; - answer.at(8, 2) = -d.at(2, 2); - answer.at(8, 3) = 0.; - answer.at(8, 4) = d.at(2,2)*(cz1); - answer.at(8, 5) = 0; - answer.at(8, 6) = d.at(2,2)*(-cx1); - answer.at(8, 7) = 0.; - answer.at(8, 8) = d.at(2,2); - answer.at(8, 9) = 0.; - answer.at(8, 10) = d.at(2,2)*(cz2); - answer.at(8, 11) = 0; - answer.at(8, 12) = d.at(2,2)*(-cx2); - - //Shear Z 2 - answer.at(9, 1) = 0; - answer.at(9, 2) = 0.; - answer.at(9, 3) = -d.at(3, 3); - answer.at(9, 4) = d.at(3,3)*(-cy1); - answer.at(9, 5) = d.at(3,3)*(cx1); - answer.at(9, 6) = 0; - answer.at(9, 7) = 0.; - answer.at(9, 8) = 0; - answer.at(9, 9) = d.at(3, 3); - answer.at(9, 10) = d.at(3,3)*(-cy2); - answer.at(9, 11) = d.at(3,3)*(cx2); - answer.at(9, 12) = 0; - - // Mx 2 - answer.at(10, 1) = 0; - answer.at(10, 2) = -d.at(2,2)*(cz2); - answer.at(10, 3) = d.at(3,3)*(cy2); - answer.at(10, 4) = d.at(3,3)*(cy2*cy1)-d.at(2,2)*(-cz2*cz1)-d.at(4,4); - answer.at(10, 5) = d.at(3,3)*(-cy2*cx1); - answer.at(10, 6) = -d.at(2,2)*(cz2*cx1); - answer.at(10, 7) = 0.; - answer.at(10, 8) = -d.at(2,2)*(-cz2); - answer.at(10, 9) = d.at(3,3)*(-cy2); - answer.at(10, 10) = d.at(3,3)*(cy2*cy2)-d.at(2,2)*(-cz2*cz2)+d.at(4,4); - answer.at(10, 11) = d.at(3,3)*(-cy2*cx2); - answer.at(10, 12) = -d.at(2,2)*(+cz2*cx2); - // My 2 - answer.at(11, 1) = d.at(1,1)*(cz2); - answer.at(11, 2) = 0; - answer.at(11, 3) = -d.at(3,3)*(cx2); - answer.at(11, 4) = -d.at(3,3)*(cx2*cy1); - answer.at(11, 5) = d.at(1,1)*(cz2*cz1)-d.at(3,3)*(-cx2*cx1)-d.at(5,5); - answer.at(11, 6) = d.at(1,1)*(-cz2*cy1); - answer.at(11, 7) = d.at(1,1)*(-cz2); - answer.at(11, 8) = 0; - answer.at(11, 9) = -d.at(3,3)*(-cx2); - answer.at(11, 10) = -d.at(3,3)*(cx2*cy2); - answer.at(11, 11) = d.at(1,1)*(cz2*cz2)-d.at(3,3)*(-cx2*cx2)+d.at(5,5); - answer.at(11, 12) = d.at(1,1)*(-cz2*cy2); - // Mz 2 - answer.at(12, 1) = -cy2*d.at(1,1); - answer.at(12, 2) = cx2*d.at(2,2); - answer.at(12, 3) = 0; - answer.at(12, 4) = -cx2*d.at(2,2)*(cz1); - answer.at(12, 5) = cy2*d.at(1,1)*(-cz1); - answer.at(12, 6) = cy2*d.at(1,1)*(cy1)-cx2*d.at(2,2)*(-cx1)-d.at(6,6); - answer.at(12, 7) = cy2*d.at(1,1); - answer.at(12, 8) = -cx2*d.at(2,2); - answer.at(12, 9) = 0; - answer.at(12, 10) = -cx2*d.at(2,2)*(cz2); - answer.at(12, 11) = cy2*d.at(1,1)*(-cz2); - answer.at(12, 12) = cy2*d.at(1,1)*(cy2)-cx2*d.at(2,2)*(-cx2)+d.at(6,6); - answer.times(1. / this->length); - return; - } -// void LatticeFrame3dNL::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) // Computes the vector containing the strains at the Gauss point gp of @@ -424,6 +427,7 @@ namespace oofem { this->length = computeLength(); double l1 = this->length * ( 1. - this->s ) / 2; double l2 = this->length * ( 1. + this->s ) / 2; + // double ln = sqrt(pow(njn.at(1)-nin.at(1), 2) + pow(njn.at(2)-nin.at(2), 2) + pow(njn.at(3)-nin.at(3), 2) ); LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); auto strain = lmatStat->giveLatticeStrain(); @@ -437,7 +441,7 @@ namespace oofem { double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; // answer.resize(6); - answer.at(1) = u.at(7)-u.at(1)+cx2 +cx1 -l1-l2; + answer.at(1) = u.at(7)-u.at(1)-cx2 -cx1 +l1+l2; answer.at(2) = u.at(8)-u.at(2)-cy2 -cy1; answer.at(3) = u.at(9)-u.at(3)-cz2 -cz1; answer.at(4) = u.at(10)-u.at(4); diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.h b/src/sm/Elements/LatticeElements/latticeframe3dnl.h index d563a4e99..dcc9e692f 100644 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.h +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.h @@ -68,7 +68,7 @@ Authors: Gumaa Abdelrhim and Peter Grassl, 2023 void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord) override; protected: - // virtual void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS) override; + virtual void computeBmatrixAt(GaussPoint *, FloatMatrix &, int = 1, int = ALL_STRAINS); void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override; virtual void computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) override; }; From 65ad4065c3b452afc17e1fe3552cd02ebe66511d Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Tue, 29 Oct 2024 12:43:56 +0000 Subject: [PATCH 58/60] src/sm/CMakeLists.txt --- src/sm/CMakeLists.txt | 3 +- .../LatticeElements/latticeframe3dnl.C | 64 +++++++++++++------ .../Materials/LatticeMaterials/CMakeLists.txt | 0 .../latticeframesteelplastic.C | 2 +- 4 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 src/sm/Materials/LatticeMaterials/CMakeLists.txt diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index 334e030d2..bfa78524b 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -431,7 +431,8 @@ set (sm ${sm_new} ${sm_boundary_conditions} ${sm_quasicontinuum} - ) + Elements/LatticeElements/latticebeam3dboundary.h +) if (USE_PARALLEL) list (APPEND sm ${sm_parallel}) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index c974ee1ef..48219128a 100755 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -80,14 +80,23 @@ namespace oofem { double l2 = this->length * ( 1. + this->s ) / 2; answer.resize(6, 12); answer.zero(); +// double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; +// double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// +// +// double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; +// double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; +// double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; - double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(5))*sin(u.at(6)))*l1; + double cz1=(-sin(u.at(5)))*l1; double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; - double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(11))*sin(u.at(12)))*l2; + double cz2=(-sin(u.at(11)))*l2; //Normal displacement jump in x-direction @@ -208,8 +217,8 @@ namespace oofem { bt.beTranspositionOf(b); answer.beProductOf(bt, db); - printf("answer/n"); - answer.printYourself(); +// printf("answer/n"); +// answer.printYourself(); return; } // void @@ -292,7 +301,7 @@ namespace oofem { // answer.at(4, 7) = 0.; // answer.at(4, 8) = d.at(2,2)*(cz1); // answer.at(4, 9) = -d.at(3,3)*(cy1); -// answer.at(4, 10) = -d.at(3,3)*(-cy1*cy2)+d.at(2,2)*(+cz1*cz2)-d.at(4,4); +// answer.at(4, 10) = d.at(3,3)*(cy1*cy2)+d.at(2,2)*(+cz1*cz2)-d.at(4,4); // answer.at(4, 11) = -d.at(3,3)*(cy1*cx2); // answer.at(4, 12) = d.at(2,2)*(-cz1*cx2); // @@ -308,8 +317,7 @@ namespace oofem { // answer.at(5, 9) = d.at(3,3)*(cx1); // answer.at(5, 10) = d.at(3,3)*(-cx1*cy2); // answer.at(5, 11) = -d.at(1,1)*(-cz1*cz2)+d.at(3,3)*(cx1*cx2)-d.at(5,5); -// answer.at(5, 12) = -d.at(1,1)*(+cz1*cy2); -// +// answer.at(5, 12) = -d.at(1,1)*(cz1*cy2); // // // Mz 1 // answer.at(6, 1) = d.at(1,1)*(-cy1); @@ -325,8 +333,6 @@ namespace oofem { // answer.at(6, 11) = d.at(1,1)*(-cy1*cz2); // answer.at(6, 12) = d.at(1,1)*(cy1*cy2)-d.at(2,2)*(-cx1*cx2)-d.at(6,6); // -// -// // //Axial 2 // answer.at(7, 1) = -d.at(1, 1); // answer.at(7, 2) = 0.; @@ -382,6 +388,7 @@ namespace oofem { // answer.at(10, 10) = d.at(3,3)*(cy2*cy2)-d.at(2,2)*(-cz2*cz2)+d.at(4,4); // answer.at(10, 11) = d.at(3,3)*(-cy2*cx2); // answer.at(10, 12) = -d.at(2,2)*(+cz2*cx2); +// // // My 2 // answer.at(11, 1) = d.at(1,1)*(cz2); // answer.at(11, 2) = 0; @@ -395,6 +402,7 @@ namespace oofem { // answer.at(11, 10) = -d.at(3,3)*(cx2*cy2); // answer.at(11, 11) = d.at(1,1)*(cz2*cz2)-d.at(3,3)*(-cx2*cx2)+d.at(5,5); // answer.at(11, 12) = d.at(1,1)*(-cz2*cy2); +// // // Mz 2 // answer.at(12, 1) = -cy2*d.at(1,1); // answer.at(12, 2) = cx2*d.at(2,2); @@ -408,6 +416,7 @@ namespace oofem { // answer.at(12, 10) = -cx2*d.at(2,2)*(cz2); // answer.at(12, 11) = cy2*d.at(1,1)*(-cz2); // answer.at(12, 12) = cy2*d.at(1,1)*(cy2)-cx2*d.at(2,2)*(-cx2)+d.at(6,6); +// // answer.times(1. / this->length); // return; // } @@ -431,14 +440,22 @@ namespace oofem { LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); auto strain = lmatStat->giveLatticeStrain(); +// double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; +// double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// +// +// double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; +// double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; +// double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; - double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(5))*sin(u.at(6)))*l1; + double cz1=(-sin(u.at(5)))*l1; double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; - double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(11))*sin(u.at(12)))*l2; + double cz2=(-sin(u.at(11)))*l2; // answer.resize(6); answer.at(1) = u.at(7)-u.at(1)-cx2 -cx1 +l1+l2; @@ -472,14 +489,23 @@ namespace oofem { double l1 = this->length * ( 1. - this->s ) / 2; double l2 = this->length * ( 1. + this->s ) / 2; // +// double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; +// double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; +// +// +// double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; +// double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; +// double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cx1=(cos(u.at(5))*cos(u.at(6)))*l1; - double cy1=(cos(u.at(4))*sin(u.at(6))+sin(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; - double cz1=(sin(u.at(4))*sin(u.at(6))-cos(u.at(4))*sin(u.at(5))*cos(u.at(6)))*l1; + double cy1=(cos(u.at(5))*sin(u.at(6)))*l1; + double cz1=(-sin(u.at(5)))*l1; double cx2=(cos(u.at(11))*cos(u.at(12)))*l2; - double cy2=(cos(u.at(10))*sin(u.at(12))+sin(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; - double cz2=(sin(u.at(10))*sin(u.at(12))-cos(u.at(10))*sin(u.at(11))*cos(u.at(12)))*l2; + double cy2=(cos(u.at(11))*sin(u.at(12)))*l2; + double cz2=(-sin(u.at(11)))*l2; // // answer.resize(12); diff --git a/src/sm/Materials/LatticeMaterials/CMakeLists.txt b/src/sm/Materials/LatticeMaterials/CMakeLists.txt new file mode 100644 index 000000000..e69de29bb diff --git a/src/sm/Materials/LatticeMaterials/latticeframesteelplastic.C b/src/sm/Materials/LatticeMaterials/latticeframesteelplastic.C index 62a74616b..02f6315a4 100644 --- a/src/sm/Materials/LatticeMaterials/latticeframesteelplastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeframesteelplastic.C @@ -206,7 +206,7 @@ LatticeFrameSteelPlastic::computeDMMatrix(const FloatArrayF< 4 > &stress, GaussP dm.at(4, 1) = 0; dm.at(4, 2) = 0; dm.at(4, 3) = 0; - dm.at(4, 3) = 2. / pow(this->mz0, 2.); + dm.at(4, 4) = 2. / pow(this->mz0, 2.); return dm; } From 124988c86f2be7e2267c4cf446d816fc5b3d8952 Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 14 Nov 2024 14:03:22 +0000 Subject: [PATCH 59/60] new 2 and 3 --- .../LatticeElements/latticeframe3dnl2.C | 493 ++++++++++++++++++ .../LatticeElements/latticeframe3dnl3.C | 412 +++++++++++++++ 2 files changed, 905 insertions(+) create mode 100644 src/sm/Elements/LatticeElements/latticeframe3dnl2.C create mode 100644 src/sm/Elements/LatticeElements/latticeframe3dnl3.C diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl2.C b/src/sm/Elements/LatticeElements/latticeframe3dnl2.C new file mode 100644 index 000000000..be93ea846 --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl2.C @@ -0,0 +1,493 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2023 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "domain.h" +#include "latticeframe3dnl2.h" +#include "../sm/Materials/LatticeMaterials/latticematstatus.h" +#include "node.h" +#include "material.h" +#include "gausspoint.h" +#include "gaussintegrationrule.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "intarray.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "mathfem.h" +#include "latticeframe3d.h" +#include "contextioerr.h" +#include "datastream.h" +#include "classfactory.h" +#include "sm/CrossSections/latticecrosssection.h" +#include "engngm.h" + +#ifdef __OOFEG + #include "oofeggraphiccontext.h" + #include "../sm/Materials/structuralmaterial.h" +#endif + +namespace oofem { + REGISTER_Element(LatticeFrame3dNL2); + + LatticeFrame3dNL2::LatticeFrame3dNL2(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) + { + numberOfDofMans = 2; + } + + LatticeFrame3dNL2::~LatticeFrame3dNL2() + {} + void + LatticeFrame3dNL2::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) + //Returns the strain matrix of the receiver. + { + FloatArray u; + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + this->computeVectorOf(VM_Total, tStep, u); + + FloatArray coordA(3), coordB(3); + coordA = giveNode(1)->giveCoordinates(); + coordB = giveNode(2)->giveCoordinates(); + + this->length = computeLength(); + double l1 = this->length * ( 1. + this->s ) / 2.; + double l2 = this->length * ( 1. - this->s ) / 2.; + + double lx1 = ( coordB.at(1) - coordA.at(1) ) * ( 1. + this->s ) / 2.; + double ly1 = ( coordB.at(2) - coordA.at(2) ) * ( 1. + this->s ) / 2.; + double lz1 = ( coordB.at(3) - coordA.at(3) ) * ( 1. + this->s ) / 2.; + + double lx2 = ( coordB.at(1) - coordA.at(1) ) * ( 1. - this->s ) / 2.; + double ly2 = ( coordB.at(2) - coordA.at(2) ) * ( 1. - this->s ) / 2.; + double lz2 = ( coordB.at(3) - coordA.at(3) ) * ( 1. - this->s ) / 2.; + + answer.resize(6, 12); + answer.zero(); + + + double cx1Old = ( cos( u.at(5) ) * cos( u.at(6) ) ) * l1; + double cy1Old = ( cos( u.at(4) ) * sin( u.at(6) ) + sin( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + double cz1Old = ( sin( u.at(4) ) * sin( u.at(6) ) - cos( u.at(4) ) * sin( u.at(5) ) * cos( u.at(6) ) ) * l1; + + + double cx2Old = ( cos( u.at(11) ) * cos( u.at(12) ) ) * l2; + double cy2Old = ( cos( u.at(10) ) * sin( u.at(12) ) + sin( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + double cz2Old = ( sin( u.at(10) ) * sin( u.at(12) ) - cos( u.at(10) ) * sin( u.at(11) ) * cos( u.at(12) ) ) * l2; + + + //First node rotations + double thetaX1 = u.at(4); + double thetaY1 = u.at(5); + double thetaZ1 = u.at(6); + + //Second node rotations + double thetaX2 = u.at(10); + double thetaY2 = u.at(11); + double thetaZ2 = u.at(12); + + +// double cx1 = lz1 * sin(thetaY1) + lx1 * cos(thetaY1) * cos(thetaZ1) - ly1 * cos(thetaY1) * sin(thetaZ1); +// double cx2 = lz2 * sin(thetaY2) + lx2 * cos(thetaY2) * cos(thetaZ2) - ly2 * cos(thetaY2) * sin(thetaZ2); +// double cy1 = lx1 * ( cos(thetaX1) * sin(thetaZ1) + cos(thetaZ1) * sin(thetaX1) * sin(thetaY1) ) + ly1 * ( cos(thetaX1) * cos(thetaZ1) - sin(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) - lz1 * cos(thetaY1) * sin(thetaX1); +// double cy2 = lx2 * ( cos(thetaX2) * sin(thetaZ2) + cos(thetaZ2) * sin(thetaX2) * sin(thetaY2) ) + ly2 * ( cos(thetaX2) * cos(thetaZ2) - sin(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) - lz2 * cos(thetaY2) * sin(thetaX2); +// double cz1 = lx1 * ( sin(thetaX1) * sin(thetaZ1) - cos(thetaX1) * cos(thetaZ1) * sin(thetaY1) ) + ly1 * ( cos(thetaZ1) * sin(thetaX1) + cos(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) + lz1 * cos(thetaX1) * cos(thetaY1); +// double cz2 = lx2 * ( sin(thetaX2) * sin(thetaZ2) - cos(thetaX2) * cos(thetaZ2) * sin(thetaY2) ) + ly2 * ( cos(thetaZ2) * sin(thetaX2) + cos(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) + lz2 * cos(thetaX2) * cos(thetaY2); + + double cx1 = (cos(thetaZ1) * cos(thetaY1)) * lx1 + + (-sin(thetaZ1) * cos(thetaX1) + cos(thetaZ1) * sin(thetaY1) * sin(thetaX1)) * ly1 + + (sin(thetaZ1) * sin(thetaX1) + cos(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cy1 = (sin(thetaZ1) * cos(thetaY1)) * lx1 + + (cos(thetaZ1) * cos(thetaX1) + sin(thetaZ1) * sin(thetaY1) * sin(thetaX1)) * ly1 + + (-cos(thetaZ1) * sin(thetaX1) + sin(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cz1 = (-sin(thetaY1)) * lx1 + + (cos(thetaY1) * sin(thetaX1)) * ly1 + + (cos(thetaY1) * cos(thetaX1)) * lz1; + + double cx2 = (cos(thetaZ2) * cos(thetaY2)) * lx2 + + (-sin(thetaZ2) * cos(thetaX2) + cos(thetaZ2) * sin(thetaY2) * sin(thetaX2)) * ly2 + + (sin(thetaZ2) * sin(thetaX2) + cos(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cy2 = (sin(thetaZ2) * cos(thetaY2)) * lx2 + + (cos(thetaZ2) * cos(thetaX2) + sin(thetaX2) * sin(thetaY2) * sin(thetaZ2)) * ly2 + + (-cos(thetaZ2) * sin(thetaX2) + sin(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cz2 = (-sin(thetaY2)) * lx2 + + (cos(thetaY2) * sin(thetaX2)) * ly2 + + (cos(thetaY2) * cos(thetaX2)) * lz2; + //Normal displacement jump in x-direction + //First node + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = -cz1; + answer.at(1, 6) = cy1; + //Second node + answer.at(1, 7) = 1.; + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = -cz2; + answer.at(1, 12) = cy2; + + //Shear displacement jump in y-plane + //first node + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = cz1; + answer.at(2, 5) = 0; + answer.at(2, 6) = -cx1; + //Second node + answer.at(2, 7) = 0.; + answer.at(2, 8) = 1.; + answer.at(2, 9) = 0.; + answer.at(2, 10) = cz2; + answer.at(2, 11) = 0; + answer.at(2, 12) = -cx2; + + //Shear displacement jump in z-plane + //first node + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = -cy1; + answer.at(3, 5) = cx1; + answer.at(3, 6) = 0.; + //Second node + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0.; + answer.at(3, 9) = 1.; + answer.at(3, 10) = -cy2; + answer.at(3, 11) = cx2; + answer.at(3, 12) = 0.; + + //Rotation around x-axis + //First node + answer.at(4, 1) = 0.; + answer.at(4, 2) = 0; + answer.at(4, 3) = 0.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0.; + answer.at(4, 9) = 0.; + answer.at(4, 10) = 1.; + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + //Rotation around y-axis + //First node + answer.at(5, 1) = 0.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = 0.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node + answer.at(5, 7) = 0.; + answer.at(5, 8) = 0.; + answer.at(5, 9) = 0.; + answer.at(5, 10) = 0.; + answer.at(5, 11) = 1.; + answer.at(5, 12) = 0.; + + //Rotation around z-axis + //First node + answer.at(6, 1) = 0.; + answer.at(6, 2) = 0.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node + answer.at(6, 7) = 0.; + answer.at(6, 8) = 0.; + answer.at(6, 9) = 0.; + answer.at(6, 10) = 0.; + answer.at(6, 11) = 0.; + answer.at(6, 12) = 1.; + + return; + } + void + LatticeFrame3dNL2::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) + { + FloatMatrix d, bt, db, b; + FloatArray u; + + this->computeVectorOf(VM_Total, tStep, u); + this->length = computeLength(); + + answer.resize(12, 12); + answer.zero(); + this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + //Rotate constitutive stiffness matrix + FloatMatrix r(6, 6), rT(6, 6), dR(6, 6), rTDR(6, 6); + computeGtoLStrainRotationMatrix(r); + rT.beTranspositionOf(r); + + dR.beProductOf(d, r); + rTDR.beProductOf(rT, dR); + + db.beProductOf(rTDR, b); + db.times(1. / length); + bt.beTranspositionOf(b); + answer.beProductOf(bt, db); + + return; + } + + void + LatticeFrame3dNL2::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) + { + //Compute normalised displacement jumps in global coordinate system first and then rotate it to the local coordiante system. + + FloatArray u; + this->computeVectorOf(VM_Total, tStep, u); + + FloatArray coordA(3), coordB(3); + coordA = giveNode(1)->giveCoordinates(); + coordB = giveNode(2)->giveCoordinates(); + + this->length = computeLength(); + + double l1 = this->length * ( 1. + this->s ) / 2.; + double l2 = this->length * ( 1. - this->s ) / 2.; + + double lx1 = ( coordB.at(1) - coordA.at(1) ) * ( 1. + this->s ) / 2.; + double ly1 = ( coordB.at(2) - coordA.at(2) ) * ( 1. + this->s ) / 2.; + double lz1 = ( coordB.at(3) - coordA.at(3) ) * ( 1. + this->s ) / 2.; + + double lx2 = ( coordB.at(1) - coordA.at(1) ) * ( 1. - this->s ) / 2.; + double ly2 = ( coordB.at(2) - coordA.at(2) ) * ( 1. - this->s ) / 2.; + double lz2 = ( coordB.at(3) - coordA.at(3) ) * ( 1. - this->s ) / 2.; + + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + auto strain = lmatStat->giveLatticeStrain(); + + //First node rotations + double uX1 = u.at(1); + double uY1 = u.at(2); + double uZ1 = u.at(3); + + double thetaX1 = u.at(4); + double thetaY1 = u.at(5); + double thetaZ1 = u.at(6); + + double thetaX2 = u.at(10); + double thetaY2 = u.at(11); + double thetaZ2 = u.at(12); + +// double cx1 = lz1 * sin(thetaY1) + lx1 * cos(thetaY1) * cos(thetaZ1) - ly1 * cos(thetaY1) * sin(thetaZ1); +// double cx2 = lz2 * sin(thetaY2) + lx2 * cos(thetaY2) * cos(thetaZ2) - ly2 * cos(thetaY2) * sin(thetaZ2); +// double cy1 = lx1 * ( cos(thetaX1) * sin(thetaZ1) + cos(thetaZ1) * sin(thetaX1) * sin(thetaY1) ) + ly1 * ( cos(thetaX1) * cos(thetaZ1) - sin(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) - lz1 * cos(thetaY1) * sin(thetaX1); +// double cy2 = lx2 * ( cos(thetaX2) * sin(thetaZ2) + cos(thetaZ2) * sin(thetaX2) * sin(thetaY2) ) + ly2 * ( cos(thetaX2) * cos(thetaZ2) - sin(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) - lz2 * cos(thetaY2) * sin(thetaX2); +// double cz1 = lx1 * ( sin(thetaX1) * sin(thetaZ1) - cos(thetaX1) * cos(thetaZ1) * sin(thetaY1) ) + ly1 * ( cos(thetaZ1) * sin(thetaX1) + cos(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) + lz1 * cos(thetaX1) * cos(thetaY1); +// double cz2 = lx2 * ( sin(thetaX2) * sin(thetaZ2) - cos(thetaX2) * cos(thetaZ2) * sin(thetaY2) ) + ly2 * ( cos(thetaZ2) * sin(thetaX2) + cos(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) + lz2 * cos(thetaX2) * cos(thetaY2); + + double cx1 = (cos(thetaZ1) * cos(thetaY1)) * lx1 + + (-sin(thetaZ1) * cos(thetaX1) + cos(thetaZ1) * sin(thetaY1) * sin(thetaX1)) * ly1 + + (sin(thetaZ1) * sin(thetaX1) + cos(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cy1 = (sin(thetaZ1) * cos(thetaY1)) * lx1 + + (cos(thetaZ1) * cos(thetaX1) + sin(thetaX1) * sin(thetaY1) * sin(thetaZ1)) * ly1 + + (-cos(thetaZ1) * sin(thetaX1) + sin(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cz1 = (-sin(thetaY1)) * lx1 + + (cos(thetaY1) * sin(thetaX1)) * ly1 + + (cos(thetaY1) * cos(thetaX1)) * lz1; + + double cx2 = (cos(thetaZ2) * cos(thetaY2)) * lx2 + + (-sin(thetaZ2) * cos(thetaX2) + cos(thetaZ2) * sin(thetaY2) * sin(thetaX2)) * ly2 + + (sin(thetaZ2) * sin(thetaX2) + cos(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cy2 = (sin(thetaZ2) * cos(thetaY2)) * lx2 + + (cos(thetaZ2) * cos(thetaX2) + sin(thetaX2) * sin(thetaY2) * sin(thetaZ2)) * ly2 + + (-cos(thetaZ2) * sin(thetaX2) + sin(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cz2 = (-sin(thetaY2)) * lx2 + + (cos(thetaY2) * sin(thetaX2)) * ly2 + + (cos(thetaY2) * cos(thetaX2)) * lz2; + + answer.resize(6); + answer.at(1) = u.at(7) - u.at(1) - cx1 - cx2 + lx1 + lx2; + answer.at(2) = u.at(8) - u.at(2) - cy1 - cy2 + ly1 + ly2; + answer.at(3) = u.at(9) - u.at(3) - cz1 - cz2 + lz1 + lz2; + answer.at(4) = u.at(10) - u.at(4); + answer.at(5) = u.at(11) - u.at(5); + answer.at(6) = u.at(12) - u.at(6); + + answer.times(1. / this->length); + + //Rotate strain vector to local coordinate system + FloatMatrix rotationMatrix(6, 6); + computeGtoLStrainRotationMatrix(rotationMatrix); + answer.rotatedWith(rotationMatrix, 'n'); + } + + + bool + LatticeFrame3dNL2::computeGtoLStrainRotationMatrix(FloatMatrix &answer) + { + FloatMatrix lcs; + answer.resize(6, 6); + answer.zero(); + + this->giveLocalCoordinateSystem(lcs); + for ( int i = 1; i <= 3; i++ ) { + for ( int j = 1; j <= 3; j++ ) { + answer.at(i, j) = lcs.at(i, j); + answer.at(i + 3, j + 3) = lcs.at(i, j); + } + } + + return 1; + } + + + bool + LatticeFrame3dNL2::computeGtoLRotationMatrix(FloatMatrix &answer) + { + return false; + } + + + + // + void + LatticeFrame3dNL2::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) + { + FloatMatrix b, bt, bf, d; + FloatArray u, stress, strain; + this->computeVectorOf(VM_Total, tStep, u); + this->length = computeLength(); + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); + + FloatArray coordA(3), coordB(3); + coordA = giveNode(1)->giveCoordinates(); + coordB = giveNode(2)->giveCoordinates(); + + this->computeStrainVector(strain, gp, tStep); + this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + /* // Rotate strain vector to local coordinate system */ + FloatMatrix rotationMatrix(6, 6); + computeGtoLStrainRotationMatrix(rotationMatrix); +// bt.beTranspositionOf(rotationMatrix); + stress.rotatedWith(rotationMatrix, 't'); + + //First node rotations + double thetaX1 = u.at(4); + double thetaY1 = u.at(5); + double thetaZ1 = u.at(6); + + //Second node rotations + double thetaX2 = u.at(10); + double thetaY2 = u.at(11); + double thetaZ2 = u.at(12); + + + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + + double l1 = this->length * ( 1. + this->s ) / 2.; + double l2 = this->length * ( 1. - this->s ) / 2.; + +// + double lx1 = ( coordB.at(1) - coordA.at(1) ) * ( 1. + this->s ) / 2.; + double ly1 = ( coordB.at(2) - coordA.at(2) ) * ( 1. + this->s ) / 2.; + double lz1 = ( coordB.at(3) - coordA.at(3) ) * ( 1. + this->s ) / 2.; + + double lx2 = ( coordB.at(1) - coordA.at(1) ) * ( 1. - this->s ) / 2.; + double ly2 = ( coordB.at(2) - coordA.at(2) ) * ( 1. - this->s ) / 2.; + double lz2 = ( coordB.at(3) - coordA.at(3) ) * ( 1. - this->s ) / 2.; + + +// double cx1 = lz1 * sin(thetaY1) + lx1 * cos(thetaY1) * cos(thetaZ1) - ly1 * cos(thetaY1) * sin(thetaZ1); +// double cx2 = lz2 * sin(thetaY2) + lx2 * cos(thetaY2) * cos(thetaZ2) - ly2 * cos(thetaY2) * sin(thetaZ2); +// double cy1 = lx1 * ( cos(thetaX1) * sin(thetaZ1) + cos(thetaZ1) * sin(thetaX1) * sin(thetaY1) ) + ly1 * ( cos(thetaX1) * cos(thetaZ1) - sin(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) - lz1 * cos(thetaY1) * sin(thetaX1); +// double cy2 = lx2 * ( cos(thetaX2) * sin(thetaZ2) + cos(thetaZ2) * sin(thetaX2) * sin(thetaY2) ) + ly2 * ( cos(thetaX2) * cos(thetaZ2) - sin(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) - lz2 * cos(thetaY2) * sin(thetaX2); +// double cz1 = lx1 * ( sin(thetaX1) * sin(thetaZ1) - cos(thetaX1) * cos(thetaZ1) * sin(thetaY1) ) + ly1 * ( cos(thetaZ1) * sin(thetaX1) + cos(thetaX1) * sin(thetaY1) * sin(thetaZ1) ) + lz1 * cos(thetaX1) * cos(thetaY1); +// double cz2 = lx2 * ( sin(thetaX2) * sin(thetaZ2) - cos(thetaX2) * cos(thetaZ2) * sin(thetaY2) ) + ly2 * ( cos(thetaZ2) * sin(thetaX2) + cos(thetaX2) * sin(thetaY2) * sin(thetaZ2) ) + lz2 * cos(thetaX2) * cos(thetaY2); + + double cx1 = (cos(thetaZ1) * cos(thetaY1)) * lx1 + + (-sin(thetaZ1) * cos(thetaX1) + cos(thetaZ1) * sin(thetaY1) * sin(thetaX1)) * ly1 + + (sin(thetaZ1) * sin(thetaX1) + cos(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cy1 = (sin(thetaZ1) * cos(thetaY1)) * lx1 + + (cos(thetaZ1) * cos(thetaX1) + sin(thetaX1) * sin(thetaY1) * sin(thetaZ1)) * ly1 + + (-cos(thetaZ1) * sin(thetaX1) + sin(thetaZ1) * sin(thetaY1) * cos(thetaX1)) * lz1; + + double cz1 = (-sin(thetaY1)) * lx1 + + (cos(thetaY1) * sin(thetaX1)) * ly1 + + (cos(thetaY1) * cos(thetaX1)) * lz1; + + double cx2 = (cos(thetaZ2) * cos(thetaY2)) * lx2 + + (-sin(thetaZ2) * cos(thetaX2) + cos(thetaZ2) * sin(thetaY2) * sin(thetaX2)) * ly2 + + (sin(thetaZ2) * sin(thetaX2) + cos(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cy2 = (sin(thetaZ2) * cos(thetaY2)) * lx2 + + (cos(thetaZ2) * cos(thetaX2) + sin(thetaX2) * sin(thetaY2) * sin(thetaZ2)) * ly2 + + (-cos(thetaZ2) * sin(thetaX2) + sin(thetaZ2) * sin(thetaY2) * cos(thetaX2)) * lz2; + + double cz2 = (-sin(thetaY2)) * lx2 + + (cos(thetaY2) * sin(thetaX2)) * ly2 + + (cos(thetaY2) * cos(thetaX2)) * lz2; + + answer.resize(12); + answer.at(1) = -stress.at(1); + answer.at(2) = -stress.at(2); + answer.at(3) = -stress.at(3); + answer.at(4) = stress.at(2) * cz1 - stress.at(3) * cy1 - stress.at(4); + answer.at(5) = -stress.at(1) * cz1 + stress.at(3) * cx1 - stress.at(5); + answer.at(6) = stress.at(1) * cy1 - stress.at(2) * cx1 - stress.at(6); + answer.at(7) = stress.at(1); + answer.at(8) = stress.at(2); + answer.at(9) = stress.at(3); + answer.at(10) = stress.at(2) * cz2 - stress.at(3) * cy2 + stress.at(4); + answer.at(11) = -stress.at(1) * cz2 + stress.at(3) * cx2 + stress.at(5); + answer.at(12) = stress.at(1) * cy2 - stress.at(2) * cx2 + stress.at(6); + + + lmatStat->letTempInternalForcesBe(answer); + } +} // end namespace oofem diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl3.C b/src/sm/Elements/LatticeElements/latticeframe3dnl3.C new file mode 100644 index 000000000..d66212e9a --- /dev/null +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl3.C @@ -0,0 +1,412 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2023 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "domain.h" +#include "latticeframe3dnl3.h" +#include "../sm/Materials/LatticeMaterials/latticematstatus.h" +#include "node.h" +#include "material.h" +#include "gausspoint.h" +#include "gaussintegrationrule.h" +#include "floatmatrix.h" +#include "floatmatrixf.h" +#include "intarray.h" +#include "floatarray.h" +#include "floatarrayf.h" +#include "mathfem.h" +#include "latticeframe3d.h" +#include "contextioerr.h" +#include "datastream.h" +#include "classfactory.h" +#include "sm/CrossSections/latticecrosssection.h" +#include "engngm.h" + +#ifdef __OOFEG + #include "oofeggraphiccontext.h" + #include "../sm/Materials/structuralmaterial.h" +#endif + +namespace oofem { + REGISTER_Element(LatticeFrame3dNL3); + + LatticeFrame3dNL3::LatticeFrame3dNL3(int n, Domain *aDomain) : LatticeFrame3d(n, aDomain) + { + numberOfDofMans = 2; + } + + LatticeFrame3dNL3::~LatticeFrame3dNL3() + {} + void + LatticeFrame3dNL3::computeBmatrixAt(GaussPoint *aGaussPoint, FloatMatrix &answer, int li, int ui) + //Returns the strain matrix of the receiver. + { + FloatArray u; + TimeStep *tStep = this->domain->giveEngngModel()->giveCurrentStep(); + this->computeVectorOf(VM_Total, tStep, u); + + FloatArray uGlobal(12); + FloatMatrix r(12, 12), rT(12, 12); + computeGtoLRotationMatrix(r); + rT.beTranspositionOf(r); + uGlobal.beProductOf(rT, u); + + FloatArray uROneGlobal(3); + uROneGlobal.at(1) = uGlobal.at(4); + uROneGlobal.at(2) = uGlobal.at(5); + uROneGlobal.at(3) = uGlobal.at(6); + + FloatArray uRTwoGlobal(3); + uRTwoGlobal.at(1) = uGlobal.at(10); + uRTwoGlobal.at(2) = uGlobal.at(11); + uRTwoGlobal.at(3) = uGlobal.at(12); + + //Compute the two rotation matrices in the local coordinate system + FloatMatrix rotationMatrixOne(3, 3), rotationMatrixTwo(3, 3); + ; + computeLocalRotationMatrix(rotationMatrixOne, uROneGlobal); + computeLocalRotationMatrix(rotationMatrixTwo, uRTwoGlobal); + + this->length = computeLength(); + double l1 = this->length * ( 1. + this->s ) / 2; + double l2 = this->length * ( 1. - this->s ) / 2; + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + + double cx1 = rotationMatrixOne.at(1, 1) * l1; + double cy1 = rotationMatrixOne.at(2, 1) * l1; + double cz1 = rotationMatrixOne.at(3, 1) * l1; + + double cx2 = rotationMatrixTwo.at(1, 1) * l2; + double cy2 = rotationMatrixTwo.at(2, 1) * l2; + double cz2 = rotationMatrixTwo.at(3, 1) * l2; + + answer.resize(6, 12); + //Normal displacement jump in x-direction + //First node + answer.at(1, 1) = -1.; + answer.at(1, 2) = 0.; + answer.at(1, 3) = 0.; + answer.at(1, 4) = 0.; + answer.at(1, 5) = -cz1; + answer.at(1, 6) = cy1; + //Second node + answer.at(1, 7) = 1.; + answer.at(1, 8) = 0.; + answer.at(1, 9) = 0.; + answer.at(1, 10) = 0.; + answer.at(1, 11) = -cz2; + answer.at(1, 12) = cy2; + + //Shear displacement jump in y-plane + //first node + answer.at(2, 1) = 0.; + answer.at(2, 2) = -1.; + answer.at(2, 3) = 0.; + answer.at(2, 4) = cz1; + answer.at(2, 5) = 0; + answer.at(2, 6) = -cx1; + //Second node + answer.at(2, 7) = 0.; + answer.at(2, 8) = 1.; + answer.at(2, 9) = 0.; + answer.at(2, 10) = cz2; + answer.at(2, 11) = 0; + answer.at(2, 12) = -cx2; + + //Shear displacement jump in z-plane + //first node + answer.at(3, 1) = 0.; + answer.at(3, 2) = 0.; + answer.at(3, 3) = -1.; + answer.at(3, 4) = -cy1; + answer.at(3, 5) = cx1; + answer.at(3, 6) = 0.; + //Second node + answer.at(3, 7) = 0.; + answer.at(3, 8) = 0.; + answer.at(3, 9) = 1.; + answer.at(3, 10) = -cy2; + answer.at(3, 11) = cx2; + answer.at(3, 12) = 0.; + + //Rotation around x-axis + //First node + answer.at(4, 1) = 0.; + answer.at(4, 2) = 0; + answer.at(4, 3) = 0.; + answer.at(4, 4) = -1.; + answer.at(4, 5) = 0.; + answer.at(4, 6) = 0.; + //Second node + answer.at(4, 7) = 0.; + answer.at(4, 8) = 0.; + answer.at(4, 9) = 0.; + answer.at(4, 10) = 1.; + answer.at(4, 11) = 0.; + answer.at(4, 12) = 0.; + + //Rotation around y-axis + //First node + answer.at(5, 1) = 0.; + answer.at(5, 2) = 0.; + answer.at(5, 3) = 0.; + answer.at(5, 4) = 0.; + answer.at(5, 5) = -1.; + answer.at(5, 6) = 0.; + //Second node + answer.at(5, 7) = 0.; + answer.at(5, 8) = 0.; + answer.at(5, 9) = 0.; + answer.at(5, 10) = 0.; + answer.at(5, 11) = 1.; + answer.at(5, 12) = 0.; + + //Rotation around z-axis + //First node + answer.at(6, 1) = 0.; + answer.at(6, 2) = 0.; + answer.at(6, 3) = 0.; + answer.at(6, 4) = 0.; + answer.at(6, 5) = 0.; + answer.at(6, 6) = -1.; + //Second node + answer.at(6, 7) = 0.; + answer.at(6, 8) = 0.; + answer.at(6, 9) = 0.; + answer.at(6, 10) = 0.; + answer.at(6, 11) = 0.; + answer.at(6, 12) = 1.; + + return; + } + void + LatticeFrame3dNL3::computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, + TimeStep *tStep) + { + FloatMatrix d, bt, db, b; + FloatArray u; + + this->computeVectorOf(VM_Total, tStep, u); + this->length = computeLength(); + + answer.resize(12, 12); + answer.zero(); + this->computeBmatrixAt(integrationRulesArray [ 0 ]->getIntegrationPoint(0), b); + this->computeConstitutiveMatrixAt(d, rMode, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + db.beProductOf(d, b); + db.times(1. / length); + bt.beTranspositionOf(b); + answer.beProductOf(bt, db); + + return; + } + + void LatticeFrame3dNL3::computeLocalRotationMatrix(FloatMatrix &answer, FloatArray &rotation) { + //Use global rotational DOFs to compute rotation matrix. + //The order for the global rotations is first z, then y and finally x. + double thetaX = rotation.at(1); + double thetaY = rotation.at(2); + double thetaZ = rotation.at(3);; + +// +// FloatMatrix globalR(3, 3); +// globalR.at(1, 1) = cos(thetaY) * cos(thetaZ); +// globalR.at(1, 2) = -cos(thetaY) * sin(thetaZ); +// globalR.at(1, 3) = sin(thetaY); +// globalR.at(2, 1) = cos(thetaX) * sin(thetaZ) + sin(thetaX) * sin(thetaY) * cos(thetaZ); +// globalR.at(2, 2) = -sin(thetaX) * sin(thetaY) * sin(thetaZ) + cos(thetaX) * cos(thetaZ); +// globalR.at(2, 3) = -sin(thetaX) * cos(thetaY); +// globalR.at(3, 1) = sin(thetaX) * sin(thetaZ) - cos(thetaX) * sin(thetaY) * cos(thetaZ); +// globalR.at(3, 2) = cos(thetaX) * sin(thetaY) * sin(thetaZ) + sin(thetaX) * cos(thetaZ); +// globalR.at(3, 3) = cos(thetaX) * cos(thetaY); + + FloatMatrix globalR(3, 3); + globalR.at(1, 1) = cos(thetaZ) * cos(thetaY); + globalR.at(1, 2) = - sin(thetaZ)*cos(thetaX) + cos(thetaZ)*sin(thetaY)*sin(thetaX); + globalR.at(1, 3) = sin(thetaZ) * sin(thetaX) + cos(thetaZ) * sin(thetaY) * cos(thetaX); + globalR.at(2, 1) = sin(thetaZ) * cos(thetaY); + globalR.at(2, 2) = cos(thetaZ) * cos(thetaX) + sin(thetaX) * sin(thetaY) * sin(thetaZ); + globalR.at(2, 3) = - cos(thetaZ) * sin(thetaX)+ sin(thetaZ) * sin(thetaY) * cos(thetaX) ; + globalR.at(3, 1) = -sin(thetaY); + globalR.at(3, 2) = cos(thetaY) * sin(thetaX); + globalR.at(3, 3) = cos(thetaY) * cos(thetaX); + + FloatMatrix transform(3, 3), transformT(3, 3), localR(3, 3), help(3, 3); + this->giveLocalCoordinateSystem(transform); + transformT.beTranspositionOf(transform); + + help.beProductOf(globalR, transformT); + answer.beProductOf(transform, help); + + return; + } + + void + LatticeFrame3dNL3::computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) + { + FloatArray u; + this->computeVectorOf(VM_Total, tStep, u); + + FloatArray uGlobal(12); + FloatMatrix r(12, 12), rT(12, 12); + computeGtoLRotationMatrix(r); + rT.beTranspositionOf(r); + uGlobal.beProductOf(rT, u); + + FloatArray uROneGlobal(3); + uROneGlobal.at(1) = uGlobal.at(4); + uROneGlobal.at(2) = uGlobal.at(5); + uROneGlobal.at(3) = uGlobal.at(6); + + FloatArray uRTwoGlobal(3); + uRTwoGlobal.at(1) = uGlobal.at(10); + uRTwoGlobal.at(2) = uGlobal.at(11); + uRTwoGlobal.at(3) = uGlobal.at(12); + + //Compute the two rotation matrices in the local coordinate system + FloatMatrix rotationMatrixOne(3, 3), rotationMatrixTwo(3, 3); + + computeLocalRotationMatrix(rotationMatrixOne, uROneGlobal); + computeLocalRotationMatrix(rotationMatrixTwo, uRTwoGlobal); + + this->length = computeLength(); + double l1 = this->length * ( 1. + this->s ) / 2; + double l2 = this->length * ( 1. - this->s ) / 2; + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + + double cx1 = rotationMatrixOne.at(1, 1) * l1; + double cy1 = rotationMatrixOne.at(2, 1) * l1; + double cz1 = rotationMatrixOne.at(3, 1) * l1; + + double cx2 = rotationMatrixTwo.at(1, 1) * l2; + double cy2 = rotationMatrixTwo.at(2, 1) * l2; + double cz2 = rotationMatrixTwo.at(3, 1) * l2; + + // + answer.resize(6); + answer.at(1) = u.at(7) - u.at(1) - cx2 - cx1 + l1 + l2; + answer.at(2) = u.at(8) - u.at(2) - cy2 - cy1; + answer.at(3) = u.at(9) - u.at(3) - cz2 - cz1; + answer.at(4) = u.at(10) - u.at(4); + answer.at(5) = u.at(11) - u.at(5); + answer.at(6) = u.at(12) - u.at(6); + answer.times(1. / this->length); + } + + + bool + LatticeFrame3dNL3::computeGtoLComponentTransformationMatrix(FloatMatrix &answer) + { + FloatMatrix lcs; + answer.resize(3, 3); + answer.zero(); + + this->giveLocalCoordinateSystem(lcs); + for ( int i = 1; i <= 3; i++ ) { + for ( int j = 1; j <= 3; j++ ) { + answer.at(i, j) = lcs.at(i, j); + } + } + + return 1; + } + + + void + LatticeFrame3dNL3::giveInternalForcesVector(FloatArray &answer, + TimeStep *tStep, int useUpdatedGpRecord) + { + FloatMatrix b, bt, bf, d; + FloatArray u, stress, strain; + this->computeVectorOf(VM_Total, tStep, u); + + GaussPoint *gp = this->integrationRulesArray [ 0 ]->getIntegrationPoint(0); + + this->computeStrainVector(strain, gp, tStep); + this->computeStressVector(stress, strain, integrationRulesArray [ 0 ]->getIntegrationPoint(0), tStep); + + LatticeMaterialStatus *lmatStat = dynamic_cast < LatticeMaterialStatus * > ( integrationRulesArray [ 0 ]->getIntegrationPoint(0)->giveMaterialStatus() ); + + + FloatArray uGlobal(12); + FloatMatrix r(12, 12), rT(12, 12); + computeGtoLRotationMatrix(r); + rT.beTranspositionOf(r); + uGlobal.beProductOf(rT, u); + + FloatArray uROneGlobal(3); + uROneGlobal.at(1) = uGlobal.at(4); + uROneGlobal.at(2) = uGlobal.at(5); + uROneGlobal.at(3) = uGlobal.at(6); + + FloatArray uRTwoGlobal(3); + uRTwoGlobal.at(1) = uGlobal.at(10); + uRTwoGlobal.at(2) = uGlobal.at(11); + uRTwoGlobal.at(3) = uGlobal.at(12); + + //Compute the two rotation matrices in the local coordinate system + FloatMatrix rotationMatrixOne(3, 3), rotationMatrixTwo(3, 3); + ; + computeLocalRotationMatrix(rotationMatrixOne, uROneGlobal); + computeLocalRotationMatrix(rotationMatrixTwo, uRTwoGlobal); + + this->length = computeLength(); + double l1 = this->length * ( 1. + this->s ) / 2; + double l2 = this->length * ( 1. - this->s ) / 2; + + double cx1 = rotationMatrixOne.at(1, 1) * l1; + double cy1 = rotationMatrixOne.at(2, 1) * l1; + double cz1 = rotationMatrixOne.at(3, 1) * l1; + + double cx2 = rotationMatrixTwo.at(1, 1) * l2; + double cy2 = rotationMatrixTwo.at(2, 1) * l2; + double cz2 = rotationMatrixTwo.at(3, 1) * l2; + + answer.resize(12); + answer.at(1) = -stress.at(1); + answer.at(2) = -stress.at(2); + answer.at(3) = -stress.at(3); + answer.at(4) = stress.at(2) * cz1 - stress.at(3) * cy1 - stress.at(4); + answer.at(5) = -stress.at(1) * cz1 + stress.at(3) * cx1 - stress.at(5); + answer.at(6) = stress.at(1) * cy1 - stress.at(2) * cx1 - stress.at(6); + answer.at(7) = stress.at(1); + answer.at(8) = stress.at(2); + answer.at(9) = stress.at(3); + answer.at(10) = stress.at(2) * cz2 - stress.at(3) * cy2 + stress.at(4); + answer.at(11) = -stress.at(1) * cz2 + stress.at(3) * cx2 + stress.at(5); + answer.at(12) = stress.at(1) * cy2 - stress.at(2) * cx2 + stress.at(6); + + lmatStat->letTempInternalForcesBe(answer); + } +} // end namespace oofem From b94771c4a3e06b5d1dbace60b40beeee0bf8340d Mon Sep 17 00:00:00 2001 From: gumaa-eng Date: Thu, 14 Nov 2024 14:40:52 +0000 Subject: [PATCH 60/60] new 1 --- src/sm/Elements/LatticeElements/latticeframe3dnl.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sm/Elements/LatticeElements/latticeframe3dnl.C b/src/sm/Elements/LatticeElements/latticeframe3dnl.C index 48219128a..63a5bf950 100755 --- a/src/sm/Elements/LatticeElements/latticeframe3dnl.C +++ b/src/sm/Elements/LatticeElements/latticeframe3dnl.C @@ -194,7 +194,7 @@ namespace oofem { answer.at(6, 10) = 0.; answer.at(6, 11) = 0.; answer.at(6, 12) = 1.; - +// return; } void