4 Changed the boundary definition to now properly unconstrain edited Apr 5 '17 at 9:29 BHudobivnik 72122 silver badges66 bronze badges By using the SMSIf[Cons\[Lambda] == 0, SMSExport[-1, nd$$[3, "DOF", 1]], SMSExport[0, nd$$[3, "DOF", 1]]] line inside element you will get the correct values in the "DOF" field: SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Or you can run the SMTData["TangentMatrix"] command which will cal each element and set the "DOF" values: SMTDomainData["\[CapitalOmega]", "Data", "Cons*" -> 1] SMTData["TangentMatrix"] // MatrixForm SMTNodeData["DOF"] SMTIData["SetSolver", 1]; SMTData["TangentMatrix"] // MatrixForm SMTNewtonIteration[];  If you change the "Cons*" -> 1 to 2 you should see the change of matrix size from 3x3 to 4x4 or vice versa each time you change the value. But I would recomend using the SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0], since it is not a good practice to change global variables from within the local element. Since the lambda parameter is specific only to each element it could be safe, but if multiple elements tried to write on the same position at the same time, there could be some problems. I would use AceFEM boundary commands when you want to make it constrained: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  And to unconstrain: SMTData["TangentMatrix"] // MatrixForm SMTAddNaturalBoundary["ID"SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0]Null] SMTData["TangentMatrix"] // MatrixForm  By using the SMSIf[Cons\[Lambda] == 0, SMSExport[-1, nd$$[3, "DOF", 1]], SMSExport[0, nd$$[3, "DOF", 1]]] line inside element you will get the correct values in the "DOF" field: SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Or you can run the SMTData["TangentMatrix"] command which will cal each element and set the "DOF" values: SMTDomainData["\[CapitalOmega]", "Data", "Cons*" -> 1] SMTData["TangentMatrix"] // MatrixForm SMTNodeData["DOF"] SMTIData["SetSolver", 1]; SMTData["TangentMatrix"] // MatrixForm SMTNewtonIteration[];  If you change the "Cons*" -> 1 to 2 you should see the change of matrix size from 3x3 to 4x4 or vice versa each time you change the value. But I would recomend using the SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0], since it is not a good practice to change global variables from within the local element. Since the lambda parameter is specific only to each element it could be safe, but if multiple elements tried to write on the same position at the same time, there could be some problems. I would use AceFEM boundary commands when you want to make it constrained: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  And to unconstrain: SMTData["TangentMatrix"] // MatrixForm SMTAddNaturalBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  By using the SMSIf[Cons\[Lambda] == 0, SMSExport[-1, nd$$[3, "DOF", 1]], SMSExport[0, nd$$[3, "DOF", 1]]] line inside element you will get the correct values in the "DOF" field: SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Or you can run the SMTData["TangentMatrix"] command which will cal each element and set the "DOF" values: SMTDomainData["\[CapitalOmega]", "Data", "Cons*" -> 1] SMTData["TangentMatrix"] // MatrixForm SMTNodeData["DOF"] SMTIData["SetSolver", 1]; SMTData["TangentMatrix"] // MatrixForm SMTNewtonIteration[];  If you change the "Cons*" -> 1 to 2 you should see the change of matrix size from 3x3 to 4x4 or vice versa each time you change the value. But I would recomend using the SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0], since it is not a good practice to change global variables from within the local element. Since the lambda parameter is specific only to each element it could be safe, but if multiple elements tried to write on the same position at the same time, there could be some problems. I would use AceFEM boundary commands when you want to make it constrained: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  And to unconstrain: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> Null] SMTData["TangentMatrix"] // MatrixForm  Post Undeleted by BHudobivnik occurred Apr 5 '17 at 9:00 3 added 1171 characters in body; added 106 characters in body edited Apr 5 '17 at 9:00 BHudobivnik 72122 silver badges66 bronze badges By using the SMSIf[Cons\[Lambda] == 10, SMSExport[-1, nd$$[3, "DOF", 1]]];1]], SMSExport[0, nd$$[3, "DOF", 1]]] line inside element you will get the correct values in the "DOF" field: SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Or you can run the SMTData["TangentMatrix"] command which will cal each element and set the "DOF" values: SMTDomainData["\[CapitalOmega]", "Data", "Cons*" -> 1] SMTData["TangentMatrix"] // MatrixForm SMTNodeData["DOF"] SMTIData["SetSolver", 1]; SMTData["TangentMatrix"] // MatrixForm SMTNewtonIteration[];  If you change the "Cons*" -> 1 to 2 you should see the change of matrix size from 3x3 to 4x4 or vice versa each time you change the value. But I would recomend using the SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0], since it is not a good practice to change global variables from within the local element. Since the lambda parameter is specific only to each element it could be safe, but if multiple elements tried to write on the same position at the same time, there could be some problems. I would use AceFEM boundary commands when you want to make it constrained: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  And to unconstrain: SMTData["TangentMatrix"] // MatrixForm SMTAddNaturalBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  By using the SMSIf[Cons\[Lambda] == 1, SMSExport[-1, nd$$[3, "DOF", 1]]]; line inside element you will get the correct values in the "DOF" field SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. By using the SMSIf[Cons\[Lambda] == 0, SMSExport[-1, nd$$[3, "DOF", 1]], SMSExport[0, nd$$[3, "DOF", 1]]] line inside element you will get the correct values in the "DOF" field: SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Or you can run the SMTData["TangentMatrix"] command which will cal each element and set the "DOF" values: SMTDomainData["\[CapitalOmega]", "Data", "Cons*" -> 1] SMTData["TangentMatrix"] // MatrixForm SMTNodeData["DOF"] SMTIData["SetSolver", 1]; SMTData["TangentMatrix"] // MatrixForm SMTNewtonIteration[];  If you change the "Cons*" -> 1 to 2 you should see the change of matrix size from 3x3 to 4x4 or vice versa each time you change the value. But I would recomend using the SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0], since it is not a good practice to change global variables from within the local element. Since the lambda parameter is specific only to each element it could be safe, but if multiple elements tried to write on the same position at the same time, there could be some problems. I would use AceFEM boundary commands when you want to make it constrained: SMTData["TangentMatrix"] // MatrixForm SMTAddEssentialBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  And to unconstrain: SMTData["TangentMatrix"] // MatrixForm SMTAddNaturalBoundary["ID" == "Lagrange" &, 1 -> 0] SMTData["TangentMatrix"] // MatrixForm  2 added 472 characters in body edited Apr 5 '17 at 8:43 BHudobivnik 72122 silver badges66 bronze badges By using the SMSIf[Cons\[Lambda] == 01, SMSExport[-1, nd$$[3, "DOF", 1]]]; line inside element you will get the correct values in the In[105]:= SMTNodeData["DOF"]"DOF" field SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  Out[105]= {{-1,But you have to use the command -1SMTIData["SetSolver", 1], -1}which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run {0SMTNewtonIteration[], 1the global matrix used in the iteration will stil be 4x4, 2}even though "DOF"=-1, then you can call {3}}SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. By using the SMSIf[Cons\[Lambda] == 0, SMSExport[-1, nd$$[3, "DOF", 1]]]; line inside element you will get the the In[105]:= SMTNodeData["DOF"] Out[105]= {{-1, -1, -1}, {0, 1, 2}, {3}} By using the SMSIf[Cons\[Lambda] == 1, SMSExport[-1, nd$$[3, "DOF", 1]]]; line inside element you will get the correct values in the "DOF" field SMTNodeData["DOF"]=={{-1, -1, -1}, {0, 1, 2}, {-1}}  But you have to use the command SMTIData["SetSolver", 1], which rebulds the tangent matrix from the current "DOF" values. But this can only be called after the call to the "Tangent and residual" module. So if you change the constrained to True from False, and run SMTNewtonIteration[], the global matrix used in the iteration will stil be 4x4, even though "DOF"=-1, then you can call SMTIData["SetSolver", 1] the next iteration will use 3x3 matrix. Post Deleted by BHudobivnik occurred Apr 5 '17 at 8:34 1 answered Apr 5 '17 at 8:34 BHudobivnik 72122 silver badges66 bronze badges