0
$\begingroup$

Does anyone know what does the error:

SMSCorrect internal: Incorrect structure-2.

refer to? I mean, in general. Specifically, I get it from the following code.

Here's the MWE - this is the entire element code, I don't know, how to reproduce the error in another way. I didn't wanted to post it before, because I think it is quite long and complicated. And my question refers just to the meaning of the message - I don't expect anyone here to find the bug in my code.

<< AceGen`;

SMSInitialize["COR3SXALCoulombRigidConeRound", "Language" -> "C", 
  "Mode" -> "Debug", "VectorLength" -> 2000];
nstate = 0; iswitch = 1;
nhistory = nstate + 2 + 3;
SMSTemplate["CDriver",
  "SMSTopology" -> "S1",
  "SMSNoNodes" -> 8,
  "SMSDOFGlobal" -> {3, 3, 3, 3, 3, 3, 3, 3},
  "SMSDefaultIntegrationCode" -> 5,
  "SMSAdditionalNodes" -> "{#1,#2,#3,#4}&",
  "SMSNodeID" -> {"D", "D", "D", "D", "LB -AL -F", "LB -AL -F", "LB -AL -F", 
    "LB -AL -F"},
  "SMSNoTimeStorage" -> nhistory es$$["id", "NoIntPoints"],
  "SMSGroupDataNames" -> {
    "\[Mu] -friction coefficient",
    "r -ball radius",
    "\[Alpha] -half the cone's angle", "\[Delta] -rounding parameter",
    "\[Rho] -regularization parameter"},
  "SMSDefaultData" -> {0.16, 100., ArcTan[(1486 Sqrt[3]/4)/200] // N, 5., 1.},
  "SMSSymmetricTangent" -> False
  ];

SMSStandardModule["Tangent and residual"];

SMSDo[IpIndex, 1, SMSInteger[es$$["id", "NoIntPoints"]]];

initialization[] := (
   (* Element data *)
   {\[Mu], R, \[Alpha], \[Delta], \[Rho]} \[DoubleRightTee] 
    Array[SMSReal[es$$["Data", #]] &, SMSGroupDataNames // Length];
   Xi \[DoubleRightTee] Table[SMSReal[nd$$[i, "X", 1]], {i, 1, 4}];
   Yi \[DoubleRightTee] Table[SMSReal[nd$$[i, "X", 2]], {i, 1, 4}];
   Zi \[DoubleRightTee] Table[SMSReal[nd$$[i, "X", 3]], {i, 1, 4}];
   ui \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 1]], {i, 1, 4}];
   vi \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 2]], {i, 1, 4}];
   wi \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 3]], {i, 1, 4}];
   uPi \[DoubleRightTee] Table[SMSReal[nd$$[i, "ap", 1]], {i, 1, 4}];
   vPi \[DoubleRightTee] Table[SMSReal[nd$$[i, "ap", 2]], {i, 1, 4}];
   wPi \[DoubleRightTee] Table[SMSReal[nd$$[i, "ap", 3]], {i, 1, 4}];
   \[Lambda]ui \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 1]], {i, 5, 8}];
   \[Lambda]vi \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 2]], {i, 5, 8}];
   \[Lambda]wi \[DoubleRightTee] Table[SMSReal[nd$$[i, "at", 3]], {i, 5, 8}];
   at = Join[ Transpose[{ui, vi, wi}], 
      Transpose[{\[Lambda]ui, \[Lambda]vi, \[Lambda]wi}] ] // Flatten;

   hindex \[DoubleRightTee] SMSInteger[(IpIndex - 1) nhistory];
   {stateN, stateT} \[DoubleRightTee] 
    SMSInteger[{ed$$["hp", hindex + iswitch], 
  ed$$["hp", hindex + iswitch + 1]}];
   {stateNt, stateTt} \[DoubleRightTee] 
    SMSInteger[{ed$$["ht", hindex + iswitch], 
  ed$$["ht", hindex + iswitch + 1]}];
   iter \[DoubleRightTee] SMSInteger[idata$$["Iteration"]];

   (* Numerical integration *)
   {\[Xi], \[Eta], \[Zeta], wGauss} \[RightTee] 
    Table[SMSReal[es$$["IntPoints", i, IpIndex]], {i, 1, 4}];

   (* Shape functions *)
   {\[Xi]i, \[Eta]i} = {{-1, 1, 1, -1}, {-1, -1, 1, 1}};
   Ni \[DoubleRightTee] 
    MapThread[ 1/4 (1 + \[Xi] #1) (1 + \[Eta] #2) &, {\[Xi]i, \[Eta]i}];
   {X, Y, Z, u, v, w, uP, vP, 
     wP, \[Lambda]u, \[Lambda]v, \[Lambda]w} \[DoubleRightTee] {Xi, Yi, Zi, 
      ui, vi, wi, uPi, vPi, wPi, \[Lambda]ui, \[Lambda]vi, \[Lambda]wi}.Ni;
   {\[Tau]\[Xi], \[Tau]\[Eta]} \[DoubleRightTee] 
    Transpose[ SMSD[{X, Y, Z}, {\[Xi], \[Eta]}] ];
   dA \[DoubleRightTee] Cross[\[Tau]\[Xi], \[Tau]\[Eta]];
   Jd \[DoubleRightTee] SMSSqrt[dA.dA];

   {\[Tau]c\[Xi], \[Tau]c\[Eta]} \[DoubleRightTee] 
    Transpose[ SMSD[{X, Y, Z} + {u, v, w}, {\[Xi], \[Eta]}] ];
   da \[DoubleRightTee] Cross[\[Tau]c\[Xi], \[Tau]c\[Eta]];
   Jdc \[DoubleRightTee] SMSSqrt[da.da];
   Jdcn \[DoubleRightTee] SMSAbs[da.{0, 0, 1}];

   (*Point on slave: *)
   xS \[DoubleRightTee] {X + u, Y + v, Z + w};

   (*Parameters describing the shape: *)
   Hso \[DoubleRightTee] R/Sin[\[Alpha]];
   ht \[DoubleRightTee] R Cos[\[Alpha]];
   hx \[DoubleRightTee] ht/Tan[\[Alpha]];
   ar \[DoubleRightTee] ht/hx;
   );

initialization[];

contactSearch :=
  (xP \[DoubleRightTee] {xM1, xM2, 
     SMSSqrt[xM1^2/ar^2 + xM2^2/ar^2 + \[Delta]^2] - (Hso - R)};
   (* Tangential directions: *)
   t1 \[DoubleRightTee] SMSD[xP, xM1];
   t2 \[DoubleRightTee] SMSD[xP, xM2];
   (* Normal direction: *)
   tn \[DoubleRightTee] Cross[t1, t2];
   n \[DoubleRightTee] tn/SMSSqrt[tn.tn];
   (* Should be zero: *)
   H \[DoubleRightTee] xP + gN n - xS;
   dHdb \[DoubleRightTee] SMSD[H, {xM1, xM2, gN}];
   dHdbInv \[DoubleRightTee] SMSInverse[dHdb]);

(*Contact with the regularized cone *)
b \[DoubleLeftTee] {0, 0, 0};
SMSDo[ iter, 1, 30, 1, b ];
     {xM1, xM2, gN} \[DoubleRightTee] b;
     contactSearch;
     \[CapitalDelta]b \[DoubleRightTee] -dHdbInv.H;
     b \[LeftTee] b + \[CapitalDelta]b;
     SMSIf[SMSSqrt[\[CapitalDelta]b.\[CapitalDelta]b] < 1/10^9  || iter == "29"];
        SMSBreak[];
    SMSEndIf[];
SMSEndDo[b];
b \[RightTee] SMSReal[b];
{xM1, xM2, gN} \[DoubleRightTee] b;
contactSearch;
dHda \[DoubleRightTee] SMSD[H, at];
dbda \[DoubleRightTee] -dHdbInv.dHda;
SMSDefineDerivative[b, at, dbda];

hindex \[DoubleRightTee] SMSInteger[(IpIndex - 1) nhistory];
SMSExport[xM1, ed$$["ht", hindex + iswitch + 2]];
SMSExport[xM2, ed$$["ht", hindex + iswitch + 3]];
SMSExport[gN, ed$$["ht", hindex + iswitch + 4]];

(* 3x3 matrix *)
PT \[DoubleRightTee] IdentityMatrix[3] - Outer[Times, n, n];
(* scalar *)
\[Lambda]N \[DoubleRightTee] {\[Lambda]u, \[Lambda]v, \[Lambda]w}.n;
(* vector 3 *)
\[Lambda]T \[DoubleRightTee] PT.{\[Lambda]u, \[Lambda]v, \[Lambda]w};
(* vector 3 *)
\[CapitalDelta]gT \[DoubleRightTee] PT.({u, v, w} - {uP, vP, wP});
(* Augmented multiplier *)
\[Lambda]Naug \[DoubleRightTee] \[Lambda]N + \[Rho] gN;
\[Lambda]Taug \[DoubleRightTee] \[Lambda]T + \[Rho] \[CapitalDelta]gT;

(* Augmented Lagrangian of contact *)
SMSIf[(\[Lambda]Naug <= -10^-13 && iter > 1) || (stateN == 1 && iter == 1)];
    (*scalars*) 
    \[Lambda]Neff \[DoubleLeftTee] \[Lambda]Naug;
    CN \[DoubleLeftTee] gN;
    SMSExport[1, ed$$["ht", hindex + iswitch]];
	kaug \[DoubleRightTee] -\[Mu] \[Lambda]Naug;
	SMSIf[(SMSSqrt[\[Lambda]Taug.\[Lambda]Taug] - kaug >= 10^-13 && 
 iter > 1) || (stateT == 1 && iter == 1)];
		(*vectors 3*)
		\[Lambda]Teff2 \[DoubleLeftTee] 
  kaug \[Lambda]Taug/SMSSqrt[\[Lambda]Taug.\[Lambda]Taug];		
		CT2 \[DoubleLeftTee] -(\[Lambda]T - 
  kaug \[Lambda]Taug/SMSSqrt[\[Lambda]Taug.\[Lambda]Taug])/\[Rho];
		SMSExport[1, ed$$["ht", hindex + iswitch + 1]];
    SMSElse[];
        \[Lambda]Teff2 \[LeftTee] \[Lambda]Taug;
        CT2 \[LeftTee] \[CapitalDelta]gT;
        SMSExport[0, 
 ed$$["ht", hindex + iswitch + 1]]; SMSEndIf[\[Lambda]Teff2, CT2];
	\[Lambda]Teff \[DoubleLeftTee] \[Lambda]Teff2;
	CT \[DoubleLeftTee] CT2;
SMSElse[];
	\[Lambda]Neff \[LeftTee] 0;
	CN \[LeftTee] -\[Lambda]N/\[Rho];
	SMSExport[0, ed$$["ht", hindex + iswitch]];
    \[Lambda]Teff \[LeftTee] {0, 0, 0};
    CT \[LeftTee] -\[Lambda]T/\[Rho];
    SMSExport[0, ed$$["ht", hindex + iswitch + 1]];
SMSEndIf[\[Lambda]Neff, \[Lambda]Teff, CN, CT];

SMSDo[i, 1, SMSNoDOFGlobal];
    \[Delta]gN \[DoubleRightTee] SMSD[gN, at, i];
    \[Delta]gT \[DoubleRightTee] SMSD[\[CapitalDelta]gT, at, i, "Constant" -> n];
    \[Delta]\[Lambda] \[DoubleRightTee] 
  SMSD[{\[Lambda]u, \[Lambda]v, \[Lambda]w}, at, i, "Constant" -> n];
    Ri \[DoubleRightTee] 
  Jd wGauss (\[Lambda]Neff \[Delta]gN + \[Lambda]Teff.\[Delta]gT + (CN n + 
        CT).\[Delta]\[Lambda]);
    SMSExport[Ri, p$$[i], "AddIn" -> True];
    SMSDo[j, 1, SMSNoDOFGlobal];
        Kij \[DoubleRightTee] SMSD[Ri, at, j]

This is the place, where the error shows. So the problem is in the SMSD appplied to Ri, and more specifically to the two second terms.

SMSExport[Kij, s$$[i, j], "AddIn" -> True];
    SMSEndDo[];
SMSEndDo[];

SMSEndDo[];

(* Postprocessing *)
SMSStandardModule["Postprocessing"];

SMSGPostNames = {"Contact tN",(*"Contact tT",*)"Contact gN",(*"Contact DgT",*)
   "dA", "dAn"};
SMSDo[IpIndex, 1, SMSInteger[es$$["id", "NoIntPoints"]]];
	initialization[];
	\[CapitalDelta]a \[DoubleRightTee] SMSIf[stateNt == 1, Jdc, 0];
	\[CapitalDelta]an \[DoubleRightTee] SMSIf[stateNt == 1, Jdcn, 0];
	xM1 \[DoubleRightTee] SMSReal[ed$$["hp", hindex + iswitch + 2]];
    xM2 \[DoubleRightTee] SMSReal[ed$$["hp", hindex + iswitch + 3]];
	gN \[DoubleRightTee] SMSReal[ed$$["hp", hindex + iswitch + 4]];
    contactSearch;
    \[Lambda]N \[DoubleRightTee] {\[Lambda]u, \[Lambda]v, \[Lambda]w}.n;
    SMSExport[{\[Lambda]N,(*SMSSqrt[\[Lambda]T.\[Lambda]T],*)
   gN,(*SMSSqrt[\[CapitalDelta]gT.\[CapitalDelta]gT],*)\[CapitalDelta]a, \
\[CapitalDelta]an}, gpost$$[IpIndex, #1] &];
SMSEndDo[];

SMSNPostNames = {"DeformedMeshX", "DeformedMeshY", "DeformedMeshZ"};
SMSExport[ Join[ {ui, vi, wi} // Transpose, {ui, vi, wi} // Transpose ], 
  npost$$];

SMSWrite[];

SMTMakeDll[]
```
$\endgroup$
  • 2
    $\begingroup$ Could you please provide a minimal code example which produces this bug/error? It is impossible to tell without an actual case. $\endgroup$ – Pinti Aug 2 '19 at 8:20
  • $\begingroup$ Please do not make us guess, give context and code that can reproduce the issue. $\endgroup$ – rhermans Aug 2 '19 at 8:48
  • $\begingroup$ Could you please check again if you copied whole code correctly, because I am getting some other error than the one you mention. Also, what version of AceGen are you using? SMSGroupDataNames is an obsolete symbol and has been replaced by SMSDomainDataNames a long time ago, I think. $\endgroup$ – Pinti Aug 2 '19 at 10:55
  • 1
    $\begingroup$ I have found the solution to the problem - the variable iter was used twice in the code. Changing iter to some other name in the Do loop leads to removal of the error. $\endgroup$ – Karol Frydrych Aug 2 '19 at 11:37
  • 1
    $\begingroup$ @KarolFrydrych Great news! I general I suggest that you use modern syntax (e.g. SMSDomainDataNames) if possible. $\endgroup$ – Pinti Aug 2 '19 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.