There is a program written in the pros. Solves the heat equation using the finite element method. And displays the result in gnuplot - as a picture. Tn is random. In the code below, the function responsible for the derivation of boundary conditions is given.
double BoundaryFunc(double x, double y){ double T1 = 1.5; double T2 = 0.5; double T3 = 2.5; double T4 = 1.0; if(x == 1) return T1 * cos(x*y); if(x == -1) return T2 * cos(x*y); if(y == 1) return T3 * cos(x+y); if(y == -1) return T4 * cos(xy);} It is necessary to change the function so that the output is influenced by the unit vector of the external normal to the surface. If you need I can throw off all the code.