Commit bf509869 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'bugfix/environment' into develop

parents 82cf5e36 7b5555e8
......@@ -133,13 +133,12 @@ class FluidResize(_fluid_particle_base):
self,
args = [],
**kwargs):
parser = argparse.ArgumentParser('bfps ' + type(self).__name__)
self.add_parser_arguments(parser)
opt = parser.parse_args(args)
opt = self.prepare_launch(args)
cmd_line_pars = vars(opt)
for k in ['dst_nx', 'dst_ny', 'dst_nz']:
if type(cmd_line_pars[k]) == type(None):
cmd_line_pars[k] = opt.m
self.parameters['niter_todo'] = 0
self.pars_from_namespace(opt)
src_file = os.path.join(
os.path.realpath(opt.src_work_dir),
......
......@@ -30,6 +30,7 @@ import h5py
import argparse
import bfps
from ._code import _code
from ._fluid_base import _fluid_particle_base
class NavierStokes(_fluid_particle_base):
......@@ -976,12 +977,10 @@ class NavierStokes(_fluid_particle_base):
self,
args = [],
**kwargs):
opt = self.prepare_launch(args)
# with the default Lundgren forcing, I can estimate the dissipation
# with nondefault forcing, figure out the amplitude for this viscosity
# yourself
parser = argparse.ArgumentParser('bfps ' + type(self).__name__)
self.add_parser_arguments(parser)
opt = parser.parse_args(args)
self.QR_stats_on = opt.QR_stats
self.parameters['nu'] = (opt.kMeta * 2 / opt.n)**(4./3)
self.parameters['dt'] = (opt.dtfactor / opt.n)
......@@ -1001,7 +1000,6 @@ class NavierStokes(_fluid_particle_base):
self.fill_up_fluid_code()
self.finalize_code()
self.write_src()
self.set_host_info(bfps.host_info)
if not os.path.exists(os.path.join(self.work_dir, self.simname + '.h5')):
self.write_par()
if self.parameters['nparticles'] > 0:
......
......@@ -29,7 +29,6 @@ import argparse
import bfps
from .NavierStokes import NavierStokes
from .FluidConvert import FluidConvert
from .FluidResize import FluidResize
def main():
......
......@@ -166,7 +166,7 @@ class _base(object):
'--environment',
type = str,
dest = 'environment',
default = '')
default = None)
parser.add_argument(
'--wd',
type = str, dest = 'work_dir',
......
......@@ -28,6 +28,7 @@ import os
import sys
import shutil
import subprocess
import argparse
import h5py
from datetime import datetime
import math
......@@ -263,4 +264,15 @@ class _code(_base):
script_file.write('exit 0\n')
script_file.close()
return None
def prepare_launch(
self,
args = [],
**kwargs):
parser = argparse.ArgumentParser('bfps ' + type(self).__name__)
self.add_parser_arguments(parser)
opt = parser.parse_args(args)
self.set_host_info(bfps.host_info)
if type(opt.environment) != type(None):
self.host_info['environment'] = opt.environment
return opt
......@@ -395,9 +395,4 @@ class _fluid_particle_base(_code):
nshells = kspace['nshell'].shape[0]
ofile.close()
return None
def launch(
self,
args = [],
**kwargs):
return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment