Message Boards Message Boards

0
|
927 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Integrate doesn't give a result for non-linear functions

I use Acegen for Finitie Element formulation that gives out residuals and tangents by taking in the field values as inputs. For this in my residual formulation I need to integrate a nonlinear term over the element Area(2D Element). For some reason, this doesn't give a result. I isolated the problem in a smaller version of the code as shown below:

SetOptions[EvaluationNotebook[]]
ClearAll["Global`*"]
<< AceGen`; NAME = "QIntegrate";
SMSInitialize[NAME, "Language" -> "Matlab", "Mode" -> "Debug"];
(*Initialization*)
SMSModule[NAME, Real[ y$$[2], ue$$[4], a$$, b$$, f$$, intf$$],
  "Input" -> {y$$, ue$$, a$$},
  "Output" -> {f$$, intf$$}];
(*copy Acegen variables to Mathematica variables*)
{y1, 
   y2} \[RightTee] SMSReal[Table[y$$[i], {i, 2}]];
ue \[DoubleRightTee] SMSReal[Table[ue$$[i], {i, 4}]];
ue1 \[DoubleRightTee] SMSReal[ue$$[1]];
ue2 \[DoubleRightTee] SMSReal[ue$$[2]];
ue3 \[DoubleRightTee] SMSReal[ue$$[3]];
ue4 \[DoubleRightTee] SMSReal[ue$$[4]];
a \[DoubleRightTee] SMSReal[a$$];
(*Shape Functions*)
sf \[DoubleRightTee] ConstantArray[1, 4];
sf[[1]] \[DoubleRightTee] 0.25*(1 - y1)*(1 - y2);
sf[[2]] \[DoubleRightTee] 0.25*(1 + y1)*(1 - y2);
sf[[3]] \[DoubleRightTee] 0.25*(1 + y1)*(1 + y2);
sf[[4]] \[DoubleRightTee] 0.25*(1 - y1)*(1 + y2);
(*Field value interpolated at gauss point*)
uGP \[DoubleRightTee] sf . ue;
(*Non-linear function definition*)
f \[DoubleRightTee] Exp[uGP];
(*Integrate the function over the area of the element after restoring y1 and y2 dependencies*)
intf = Integrate[
   SMSSmartRestore[f, y1 | y2], {y1, -1, 1}, {y2, -1, 1}];
(*export the output variables/copy mathematica variables to AceGen \
variables*)
SMSExport[f, f$$];
SMSExport[intf, intf$$];
SMSWrite[NAME, "LocalAuxiliaryVariables" -> True];
FilePrint[StringJoin[NAME, ".m"]]

This should technically run since the function is integrable. But the code doesnt give any result. Just says:

Expression contains part/parts that can not be numerically evaluated.
User subroutine: QIntegrate
Error in user input parameters for function:  SMSExport  
Input parameter:  {LARGE EXPRESSION}  
Parts that can not be evaluated:  {Undefined}
Events: 0
Version: 7.505 Linux (16 Aug 22) (MMA 13.) Module: SMSExport
See also: Symbolic-Numeric Interface  AceGen Troubleshooting  Continue

I tried many things such as: defining the exponent as a polynomial function instead of a vector multiplication

uGP \[DoubleRightTee] 
 0.25*(1 - y1)*(1 - y2)*ue1 + 0.25*(1 + y1)*(1 - y2)*ue2 + 
  0.25*(1 + y1)*(1 + y2)*ue3 + 0.25*(1 - y1)*(1 + y2)*ue4;

using SMSPower instead

f \[DoubleRightTee] SMSPower[E, uGP];

It only gives a result for:

intf = Integrate[f, {y1, -1, 1}, {y2, -1, 1}];

but here it considers the exponent as independent of y1 and y2 and gives out wrong result. or

f \[DoubleRightTee] Exp[a];

where a is an independent variable. and surprisingly f=sf works with array output

f \[DoubleRightTee] Exp[sf];

I'm not able to understand the issue. Please suggest a resolution to this. I'm not sure where the problem is occuring and my entire work depends on this. Any help is extremely appreciated. I've also attached the notebook file for referance. Thank You!!

Attachments:
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract