dataRANS_aij[:,:,j,k] = tau_RANS[:,:,j,k]/(2.*dataRANS_k[j,k]) - np.diag([1/3.,1/3.,1/3.])

            aneigVal_DNS = foam.calcEigenvalues(ReStress_DNS, dataDNS_i['k'])
            baryMap_DNS = foam.barycentricMap(aneigVal_DNS)

            aneigVal_RANS = foam.calcEigenvalues(tau_RANS, dataRANS_k)
            baryMap_RANS = foam.barycentricMap(aneigVal_RANS)

            
            eigVal_RANS, eigVec_RANS = foam.eigenDecomposition(dataRANS_aij)
            eigVal_DNS, eigVec_DNS = foam.eigenDecomposition(aij_DNS)
            
            phi_RANS =  np.reshape(( np.reshape((foam.eigenvectorToEuler(eigVec_RANS)).swapaxes(1,2), (nx*ny, 3), "F")).swapaxes(1,0), (nx*ny, 3))
            phi_DNS =  np.reshape(( np.reshape((foam.eigenvectorToEuler(eigVec_DNS)).swapaxes(1,2), (nx*ny, 3), "F")).swapaxes(1,0), (nx*ny, 3))
            
            baryMap_discr = np.reshape(( np.reshape((foam.baryMap_discr(baryMap_RANS, baryMap_DNS)).swapaxes(1,2), (nx*ny, 2), "F")).swapaxes(1,0), (nx*ny, 2))

            phi_discr = phi_DNS - phi_RANS
            k_discr = np.reshape(( np.reshape((dataDNS_i['k'] - k_RANS).swapaxes(1,2), (nx*ny, 1), "F")).swapaxes(1,0), (nx*ny, 1))
        
            Y[i*nx*ny:(i+1)*nx*ny, 0:2] = baryMap_discr
            Y[i*nx*ny:(i+1)*nx*ny, 2:5] = phi_discr
            Y[i*nx*ny:(i+1)*nx*ny, 5] = k_discr[:,0]
            

        print('return Y')
        return Y
    
    else:
        print('train = false')
        for i in range(len(Re)):
            aneigVal_RANS = foam.calcEigenvalues(tau_RANS, dataRANS_k)
            baryMap_RANS = foam.barycentricMap(aneigVal_RANS)

            eigVal_RANS, eigVec_RANS = foam.eigenDecomposition(dataRANS_aij)
            eigVal_DNS, eigVec_DNS = foam.eigenDecomposition(aij_DNS)

            phi_RANS = np.reshape((np.reshape(
                (foam.eigenvectorToEuler(eigVec_RANS)).swapaxes(1, 2),
                (nx * ny, 3), "F")).swapaxes(1, 0), (nx * ny, 3))
            phi_DNS = np.reshape((np.reshape(
                (foam.eigenvectorToEuler(eigVec_DNS)).swapaxes(1, 2),
                (nx * ny, 3), "F")).swapaxes(1, 0), (nx * ny, 3))

            baryMap_discr = np.reshape((np.reshape(
                (foam.baryMap_discr(baryMap_RANS, baryMap_DNS)).swapaxes(1, 2),
                (nx * ny, 2), "F")).swapaxes(1, 0), (nx * ny, 2))

            phi_discr = phi_DNS - phi_RANS
            k_discr = np.reshape(
                (np.reshape((dataDNS_i['k'] - k_RANS).swapaxes(1, 2),
                            (nx * ny, 1), "F")).swapaxes(1, 0), (nx * ny, 1))

            Y[i * nx * ny:(i + 1) * nx * ny, 0:2] = baryMap_discr
            Y[i * nx * ny:(i + 1) * nx * ny, 2:5] = phi_discr
            Y[i * nx * ny:(i + 1) * nx * ny, 5] = k_discr[:, 0]

        print('return Y')
        return Y

    else: