# AceGen: Transfer the code for H1 element to a code for H2S

I have recently generated a code based on 8-node Hexahedral (tri-linear) element that gives the response of a hyperelastic material. However, now I have found out that with 20-node serendipity (bi-quadratic) element, maybe I can achieve better responses. My question is how to transfer the code that is written for "SMSTopology" -> "H1" to a code with "SMSTopology" -> "H2S".

As an example, the shape functions should be changed. But since for Serendipity elements, there is no unique equation for all the shape functions (corner and median nodes have different equations for shape functions), how can I program different shape function equation for different nodes? The equation of the shape functions for the corner nodes ($j = 1,...,8$) is written as,

$N_j = \frac{1}{8} (1 + \xi_j \xi)(1 + \eta_j \eta)(1 + \zeta \zeta_i)(\xi_j \xi + \eta_j \eta + \zeta_j \zeta -2).$

For mide-side nodes $j = 10,12,14,16$, the equation of the shape functions is written as,

$N_j = \frac{1}{4} (1 - \xi^2) (1 + \eta_j \eta)(1 + \zeta_j \zeta).$

For mide-side nodes $j = 9,11,13,15$, the equation of the shape functions is written as, $N_j = \frac{1}{4} (1 - \eta^2) (1 + \xi_j \xi)(1 + \zeta_j \zeta).$

For mide-side nodes $j = 17,18,19,20$, the equation of the shape functions is written as,

$N_j = \frac{1}{4} (1 - \zeta^2) (1 + \xi_j \xi)(1 + \eta_j \eta).$