Simulation of CBRAM devices with the level set method