Skip to content

Files not moved to a subdirectory after simulation is over

Created originally on Bitbucket by avmo (Ashwin Vishnu)

It can be fixed as follows:

#!python

diff -r ae8383eb95a7 fluidsim/base/output/base.py
--- a/fluidsim/base/output/base.py	Fri Nov 20 16:58:44 2015 +0100
+++ b/fluidsim/base/output/base.py	Tue Dec 08 17:28:16 2015 +0100
@@ -301,9 +301,17 @@
                         self.__dict__[k].close_file()
 
         if (not self.path_run.startswith(FLUIDSIM_PATH) and mpi.rank == 0):
-            new_path_run = os.path.join(FLUIDSIM_PATH, self.sim.name_run)
+            path_base = FLUIDSIM_PATH
+            if len(self.params.sub_directory) > 0:
+                path_base = os.path.join(path_base, self.params.sub_directory)
+            
+            if mpi.rank == 0:
+                if not os.path.exists(path_base):
+                    os.makedirs(path_base)
+            
+            new_path_run = os.path.join(path_base, self.sim.name_run)
+            shutil.move(self.path_run, path_base)
             print('move result directory in directory:\n' + new_path_run)
-            shutil.move(self.path_run, FLUIDSIM_PATH)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information