2
$\begingroup$

I have an issue which I know is definitely solvable but I don't know how to implement this in AceGen.

Basically, I want to assemble a matrix $\mathbf{L} \in \mathbb{R}^{n_{dof} \times 6}$ for a global system of equations with $n_{dof}$ degrees of freedom (without applying essential boundary conditions). This can be calculated by assembling the element contributions $\mathbf{l} \in \mathbb{R}^{n_{st} \times 6}$, where $n_{st}$ is the number of nodes per element $n_{nodes}$ times the dimensionality of the problem $n_{dim}$ (e.g. 2D or 3D), therefore $n_{st} = n_{nodes} * n_{dim}$.

The assembly of $\mathbf{L}$ is done exactly how we would to it for the "Residual" $\mathbf{R}$ using the element contributions $\mathbf{r}$, only with multiple columns. Luckily, applying SMSD on the energy function and exporting it using SMSIO does the job for the residual.

Now, I have implemented the element contribution $\mathbf{l}$ and just want to assemble it to the global array $\mathbf{L}$ of the mentioned size....

  • Do I have to work with SMSIO right at the place where I assemble the stiffness and the residual? If yes, how do I tell AceGen that I want a custom array (which keyword?) and how would the command look like?

  • Can a user defined SMSStandardModule["Task"] be used for this? In the documentation, it is suggested to work with task type =4 for a vector (or task type =5 for a matrix). Again, using SMSIO there is an option for exporting the Task local vector for the task type =4. I tried to use the example from the documentation and included the first column of my element vector le:

SMSIf[task == -4, SMSIO[{4, 0, 0, 0, 0}, "Export to", "Task data"]; 
  SMSReturn[];];
SMSIf[task == 4
  , SMSIO[le[[All, 1]], "Export to", 
    "Task local vector"];
  ];

Unfortunately, all I get is a Syntax error for the initialization (task == -4). What exactly do I have to pass as information?

Hope that I could explain my request sufficiently. Any advice is appreciated!

Thanks in advance, Frida

EDIT: I think the Syntax error is not related to the initialization but to the actual export (second SMSIO):

"Export to" syntax error.
User subroutine: Tasks Description: Value:   {$V[1121,1] $V[1222,1],$V[1122,1] $V[1223,1],0,$V[1124,1] $V[1222,1],$V[1125,1] $V[1223,1],0,$V[1129,1] $V[1222,1],$V[1130,1] $V[1223,1],0,$V[1131,1] $V[1222,1],...}  
Key:   Task local vector
Events: 6 BP2-4+28 SMSDB-0
Version: 7.102 MacOSX (28 Mar 20) (MMA 11.2) Module: SMSIO
See also: SMSIO  AceGen Troubleshooting  Continue
$\endgroup$

1 Answer 1

2
$\begingroup$

Tasks subroutines can only be used to assemble vectors and square matrices. Your L matrix can be assembled by calling Tasks 6 times, for each column separately.

About the syntax error. It is an AceGen bug. You did everything right. Here is a quick solution.

SMSIf[task == -4, SMSIO[{4, 0, 0, 0, 0}, "Export to", "Task data"];SMSReturn[];];
SMSIf[task == 4, SMSIO[le[[All, 1]], "Export to", "Task local vector"[Range[SMSNoDOFGlobal]]];
];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.