Change Temporary Directory

How to change the value of $TemporaryDirectory ? I need to change it because there is not enough space on the C drive and the calculation seems to stop after a while !

Why do you think that $TemporaryDirectory is relevant to your problem?

However, if you wish to change the value of $TemporaryDirectory for a particular Mathematica session then you can simply execute

$TemporaryDirectory="path to a new directory" 

since $TemporaryDirectory is not Protected

I only guessed ! Because when the C drive becomes full, the simulation somehow stops.

The question then is, of course, why is your drive and filling up? Is this a consequence of the simulation that you are running…? That is, are you saving files to your disk purposefully in your simulation? Of course, as a general statement, it is never a good idea on one’s computer to have a disc that is so filled.

I’m not really sure ! I’m not saving files purposefully, but it seems to be part of the simulation process. I don’t know if I can modify that or not !

Did you write the code, or is it code that somebody else has written and that you are making use of?
Typically no files would be saved unless they were explicit Mathematica commands to do that.

It is, of course, possible in some circumstances that some temporary files may be saved to the contemporary directory, but you should be able to look at that directory to see if such files are being generated.

No, I didn’t write the code. So which function writes a temporary simulation files ? I guess they are back-up files ! .. I will give you the extension when I run the simulation again.

There are a variety of ways to save files from within Mathematica. Save, Export, NotebookSave, and others. Since it sounds like this code which was written by somebody else is filling up your disk I would be very cautious about making use of it. Any code that someone writes that causes such large amounts of data to be written to disc without warning is probably to be avoided.