#!/usr/bin/python

import numpy as np


def solveur2D_df(mesh,dt,alpha,Nptsx,Lx,residu):
    """Solves the 2D temperture equation using finite difference method """
    t=dt
    temp=np.copy(mesh)
    temp_tmp=np.copy(mesh)
    residu_i=1
    
    while (residu < residu_i):
        #print(residu_i)
        for i in range(1,Nptsx-1):
            #print(i)
            temp_tmp[:,i]=temp[:,i]-alpha*dt*(2*temp[:,i]-temp[:,i-1]-temp[:,i+1])/((Lx*Lx)/(Nptsx*Nptsx))
        
        residu_i=max(abs(temp_tmp[1,:]-temp[1,:]))
        temp=np.copy(temp_tmp)
        t=t+dt
        #print(residu_i)
    return temp


def solveur2D_md()
    """Solves the 2D temperture equation using the nodal approach """




    return
