Creating single AceGen element using the same constitutive model defined for 2 fibre families

I'm currently working with a single constitutive model that describes 2 collagen fibre families that have different element properties. The strain energy density function is W, where there would be 2 values of W for the two fibre families :

    Wi = 1/2*c*(I1 - 3) + (k1/(2*k2) (Exp[k2*Ei]) -
1), (* i = 1, 2, these are the two fibre families*)
Ei = Tr[hi]] - 1 (* i = 1, 2, a structure strain invariant for the two families*)
hi1=k*bmod +(1 - (3*k))*(TensorProduct[a1, a1]);
hi2 =k*bmod + (1 - (3*k))*(TensorProduct[a2,  a2]);
(*a1 and a2 are vectors that describe the mean orientations of the fibre families with respect to the reference direction*)


I have not outlined all the variables but I think this is sufficient to describe the general idea of what the constitutive model outlines. Using the above, I need to generate a single AceGen element that describes both fibre families for later analysis in AceFem. Since I need to create an element that includes 2 strain energy density functions instead of one, I was wondering if it is possible to create more than 1 tangent and residual matrix within a tangent and residual subroutine. My current subroutine for one fibre family looks like this (I haven't put the full code in, but I think the relevant parts are only the assembly of tangent and residual:

    SMSStandardModule["Tangent and residual"];

skipR = SMSLogical[SMSInteger[idata$$["SkipResidual"]] == 1]; skipK = SMSLogical[SMSInteger[idata$$["SkipTangent"]] == 1];

NoIp = SMSInteger[es$$["id", "NoIntPoints"]]; SMSDo[Ig, 1, NoIp]; ElementDefinitions["Tangent"]; Export velocity and acceleration; SMSExport[{v[1], v[2], v[3], v[4], v[5], v[6]}, Table[ed$$["ht", Ihg + i], {i, 6}]];

wgp = SMSReal[es$$["IntPoints", 4, Ig]]; SMSDo[i, 1, Length[pe]; Residual; Rg1 = fGauss wgp SMSD[ W + T - (\[Rho]*u.bforces), pe, i, "Constant" -> a]; (*This process would have to be repeated twice for the fibre families W1 and W2*) SMSIf[! skipR]; (*assembly of residual vector*) SMSExport[Rg, p$$[i], "AddIn" -> True];
SMSEndIf[];
SMSIf[skipK];
SMSContinue[];
SMSEndIf[];

Tangent stiffness;
SMSDo[j, If[SMSSymmetricTangent, i, 1], Length[pe];
Kg = SMSD[Rg1, pe, j];

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

SMSEndDo[];


But as I mentioned earlier I need to add the second equation for the second fibre family and I'm not sure if it is possible to create more than 1 tangent and residual matrix within a tangent and residual subroutine. I was brainstorming the following possibilities:

1) create a loop that loops through the material characteristics of the two fibre families but I was told by a project supervisor that doing that was not necessary since I could just write out the two equations, but I'm wondering how that would work.

2) I was also thinking that I could create two separate AceGen elements but that would require some sort of superposition which I do not think is possible when entered into AceFem for the finite element analysis.

Absolutely any ideas are welcome, thank you in advance.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Nov 29 '19 at 14:11
• I recommend that you take a look at different examples of various element types and constitutive models in this book about AceGen. Nov 29 '19 at 14:13