def genbcs(self, forcing_freq=1, dt=None, nspoolgs=1, h0=None, L=False): """ Generate the ``fort.019`` which is the boundary conditions file needed for a subdomain run of :program:`ADCIRC`. This requires the presence of the output files from a fulldomain run, ``fort.06*``. :param int forcing_freq: number of timesteps at which infomration is written to a boudnary conditions file (``fort.019``) THIS MUST BE A MULTIPLE OF NSPOOLGS :param float dt: One timestep in seconds :param int nspoolgs: the number of timesteps at which information is written to the new output files ``fort.06*`` :param float h0: minimum water depth for a node to be wet :param bool L: flag whether or not :program:`PADCIRC` was run with ``-L`` flag and if local files need to be post-processed into global files :rtype: string :returns: command line for invoking genbcs.py """ if L: # create post-processing input file post.write_sub(self.fulldomain.path) # run ADCPOST subprocess.call('./adcpost < in.postsub > post_o.txt', shell=True, cwd=self.fulldomain.path) self.create_fort15() self.link_fort22() self.read_recording_data() if self.check_fulldomain(): if h0 is None: h0 = self.h0 if dt is None: dt = self.fulldomain.time.dt command = "python " + self.script_dir + "/genbcs.py -p " command += self.fulldomain.path + '/ ' + self.path + '/ ' command += str(forcing_freq) + ' ' + str(dt) + ' ' + str(nspoolgs) command += ' ' + str(h0) print command subprocess.call(command, shell=True, cwd=self.path) return command else: print "Output files from the fulldomain run do not exist" return "Output files from the fulldomain run do not exist"
def genbcs(self, forcing_freq=1, dt=None, nspoolgs=1, h0=None, L=False): """ Generate the ``fort.019`` which is the boundary conditions file needed for a subdomain run of :program:`ADCIRC`. This requires the presence of the output files from a fulldomain run, ``fort.06*``. :param int forcing_freq: number of timesteps at which infomration is written to a boudnary conditions file (``fort.019``) THIS MUST BE A MULTIPLE OF NSPOOLGS :param float dt: One timestep in seconds :param int nspoolgs: the number of timesteps at which information is written to the new output files ``fort.06*`` :param float h0: minimum water depth for a node to be wet :param bool L: flag whether or not :program:`PADCIRC` was run with ``-L`` flag and if local files need to be post-processed into global files :rtype: string :returns: command line for invoking genbcs.py """ if L: # create post-processing input file post.write_sub(self.fulldomain.path) # run ADCPOST subprocess.call('./adcpost < in.postsub > post_o.txt', shell=True, cwd=self.fulldomain.path) self.create_fort15() self.link_fort22() self.read_recording_data() if self.check_fulldomain(): if h0 is None: h0 = self.h0 if dt is None: dt = self.fulldomain.time.dt command = "python "+self.script_dir+"/genbcs.py -p " command += self.fulldomain.path+'/ '+self.path+'/ ' command += str(forcing_freq)+' '+str(dt)+' '+str(nspoolgs) command += ' '+str(h0) print command subprocess.call(command, shell=True, cwd=self.path) return command else: print "Output files from the fulldomain run do not exist" return "Output files from the fulldomain run do not exist"
def genbcss(self, forcing_freq=None, dt=None, nspoolgs=None, h0=None, L=False): """ Generate the ``fort.019`` files for the subdomains. This requires the presence of the output files from a fulldomain run, ``fort.06*``. :param list forcing_freq: number of timesteps at which infomration is written to a boudnary conditions file (``fort.019``) :param list dt: One timestep in seconds :param list nspoolgs: the number of timesteps at which information is written to the new output files ``fort.06*`` :param list h0: minimum water depth for a node to be wet :param bool L: flag whether or not :program:`PADCIRC` was run with ``-L`` flag and if local files need to be post-processed into global files :rtype: list :return: command lines for invoking genbcs.py """ commands = [] if L: # create post-processing input file post.write_sub(self.path) # run ADCPOST subprocess.call('./adcpost < in.postsub > post_o.txt', shell=True, cwd=self.path) if self.check_fulldomain(): if forcing_freq is None: forcing_freq = [1 for i in self.subdomains] if dt is None: dt = [self.time.dt for i in self.subdomains] if nspoolgs is None: nspoolgs = [1 for i in self.subdomains] if h0 is None: h0 = [None for s in self.subdomains] for f, d, ns, h, subdomain in zip(forcing_freq, dt, nspoolgs, h0, self.subdomains): commands.append(subdomain.genbcs(f, d, ns, h)) else: print "Output files from the fulldomain run do not exist" return commands