From 10e85df0a928eda40304dd6cadcf03745be6fed8 Mon Sep 17 00:00:00 2001
From: JM Etancelin <jean-matthieu.etancelin@univ-pau.fr>
Date: Tue, 15 Jun 2021 12:00:35 +0200
Subject: [PATCH] fix simulation parameters writting on restart

---
 hysop/simulation.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hysop/simulation.py b/hysop/simulation.py
index 115507a53..60055c883 100644
--- a/hysop/simulation.py
+++ b/hysop/simulation.py
@@ -380,13 +380,14 @@ class Simulation(object):
             if ('file' in kwds) and (kwds['file'] is not None):
                 kwds['file'].close()
             if self.mpi_params.rank == io_params.io_leader:
-                if os.path.isfile(filename):
+                if os.path.isfile(filename) and self._restart == 0:
                     os.remove(filename)
                 if (fileformat is IO.ASCII):
                     f = open(filename, 'a')
                     header = '{}\n'.format('\t'.join('{}({})'.format(
                         p.name, p.pretty_name) for p in params))
-                    f.write(header)
+                    if self._restart == 0:
+                        f.write(header)
                     kwds['file'] = f
 
                     formatter = {'float_kind': lambda x: '{:.8g}'.format(x)}
-- 
GitLab