From 4ed852f4b9a74fa43eba3ac504e40f07e62cd5d7 Mon Sep 17 00:00:00 2001
From: Chichi Lalescu <chichilalescu@gmail.com>
Date: Mon, 8 May 2017 08:44:50 +0200
Subject: [PATCH] add parameters for controlling size of box

---
 bfps/DNS.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/bfps/DNS.py b/bfps/DNS.py
index eb8aff2b..7b960195 100644
--- a/bfps/DNS.py
+++ b/bfps/DNS.py
@@ -489,12 +489,20 @@ class DNS(_code):
                 type = str, dest = 'simname',
                 default = 'test')
         parser.add_argument(
-               '-n', '--cube-size',
+               '-n', '--grid-size',
                type = int,
                dest = 'n',
                default = 32,
                metavar = 'N',
                help = 'code is run by default in a grid of NxNxN')
+        for coord in ['x', 'y', 'z']:
+            parser.add_argument(
+                   '--L{0}'.format(coord), '--box-length-{0}'.format(coord),
+                   type = float,
+                   dest = 'L{0}'.format(coord),
+                   default = 2.0,
+                   metavar = 'length{0}'.format(coord),
+                   help = 'length of the box in the {0} direction will be `length{0} x pi`'.format(coord))
         parser.add_argument(
                 '--wd',
                 type = str, dest = 'work_dir',
@@ -641,6 +649,12 @@ class DNS(_code):
             self.parameters['niter_out'] = self.parameters['niter_todo']
         if len(opt.src_work_dir) == 0:
             opt.src_work_dir = os.path.realpath(opt.work_dir)
+        if type(opt.dkx) == type(None):
+            opt.dkx = 2. / opt.Lx
+        if type(opt.dky) == type(None):
+            opt.dky = 2. / opt.Ly
+        if type(opt.dkx) == type(None):
+            opt.dkz = 2. / opt.Lz
         self.pars_from_namespace(opt)
         return opt
     def launch(
-- 
GitLab