self.parameter_description['fftw_plan_rigor']='FFTW plan rigor to use. One of `FFTW_ESTIMATE`, `FFTW_MEASURE`, `FFTW_PATIENT`. Please see FFTW documentation.'
self.parameter_description['fftw_plan_rigor']='FFTW plan rigor to use. One of `FFTW_ESTIMATE`, `FFTW_MEASURE`, `FFTW_PATIENT`. Please see FFTW documentation.'
self.parameters['dealias_type']=int(1)
self.parameters['dealias_type']=int(1)
self.parameter_description['dealias_type']='Dealiasing mehtod to use, integer. Options are: two-thirds (0) or smooth (1).'
self.parameter_description['dealias_type']='Dealiasing mehtod to use, integer. Options are: two-thirds (0) or smooth (1).'
...
@@ -125,7 +125,7 @@ class DNS(_code):
...
@@ -125,7 +125,7 @@ class DNS(_code):
self.parameter_description['fk0']='Forcing parameter: if forcing acts on wavenumber band, this is the smallest wavenumber where it acts (in code units).'
self.parameter_description['fk0']='Forcing parameter: if forcing acts on wavenumber band, this is the smallest wavenumber where it acts (in code units).'
self.parameters['fk1']=float(4.0)
self.parameters['fk1']=float(4.0)
self.parameter_description['fk1']='Forcing parameter: if forcing acts on wavenumber band, this is the largest wavenumber where it acts (in code units).'
self.parameter_description['fk1']='Forcing parameter: if forcing acts on wavenumber band, this is the largest wavenumber where it acts (in code units).'
self.parameter_description['forcing_type']='Forcing parameter: what type of force to use.'
self.parameter_description['forcing_type']='Forcing parameter: what type of force to use.'
self.parameters['histogram_bins']=int(256)
self.parameters['histogram_bins']=int(256)
self.parameter_description['histogram_bins']='During statistics, histograms of real-valued fields are computed using a number of `HISTOGRAM_BINS` bins.'
self.parameter_description['histogram_bins']='During statistics, histograms of real-valued fields are computed using a number of `HISTOGRAM_BINS` bins.'
...
@@ -324,22 +324,39 @@ class DNS(_code):
...
@@ -324,22 +324,39 @@ class DNS(_code):
'--src-wd',
'--src-wd',
type=str,
type=str,
dest='src_work_dir',
dest='src_work_dir',
help=('Empty by default.'
+' Location of simulation from which to source initial conditions.'
+' See also `--src-simname`.'),
default='')
default='')
parser.add_argument(
parser.add_argument(
'--src-simname',
'--src-simname',
type=str,
type=str,
dest='src_simname',
dest='src_simname',
help=('Empty by default.'
+' Name of simulation from which to source initial conditions.'
+' If the parameter file of the source simulation is present, '
+'the new DNS will use the same physical parameters '
+'(forcing parameters and viscosity) and the same dealiasing option.'
+' Any other parameters (e.g. "nx") have to be specified separately.'
+' See also `--overwrite-src-parameters`.'),
default='')
default='')
parser.add_argument(
parser.add_argument(
'--src-iteration',
'--src-iteration',
type=int,
type=int,
dest='src_iteration',
dest='src_iteration',
help=('0 by default.'
+' Iteration of source simulation to be used as initial condition.'
+' See also `--src-simname`.'),
default=0)
default=0)
parser.add_argument(
parser.add_argument(
'--overwrite-src-parameters',
'--overwrite-src-parameters',
action='store_true',
action='store_true',
dest='overwrite_src_parameters',
dest='overwrite_src_parameters',
help='False by default. If using a source simulation, do we keep its physical parameters? Note: if this option is switched on, default values are used for parameters that are not set explicitly by the command --- NOT the values of the source simulation.')
help=('False by default.'
+' If using a source simulation, do we keep its physical parameters?'
+' Note: if this option is switched on, default values are used for '
+'parameters that are not set explicitly by the command --- '
+'NOT the values of the source simulation.'))
parser.add_argument(
parser.add_argument(
'--kMeta',
'--kMeta',
type=float,
type=float,
...
@@ -472,7 +489,23 @@ class DNS(_code):
...
@@ -472,7 +489,23 @@ class DNS(_code):
self,
self,
args=[],
args=[],
extra_parameters=None):
extra_parameters=None):
"""Set up reasonable parameters.
"""Assign DNS parameters.
There are three ways to specify parameters:
* Directly via the command line.
* If the simulation takes its initial condition from another simulation
(via the :code:`--src-dir` and :code:`--src-simname` parameters) and
some physical parameter is not provided on the command line, then this
method will attempt to read that parameter from the parameter file of
the source simulation.
* If a parameter is not specified via the command line, and a source
simulation is not provided, or the source parameter file is missing, or
the :code:`--overwrite-src-parameters` option is turned on, this method
will generate a "reasonable" value for that parameter.
"Reasonable" refers to either some fixed values for the forcing
parameters, or an empirical extrapolation of the viscosity to satisfy a
given value of the :code:`--kMeta` command line parameter.
With the default Lundgren forcing applied in the band [2, 4],
With the default Lundgren forcing applied in the band [2, 4],
we can estimate the dissipation, therefore we can estimate
we can estimate the dissipation, therefore we can estimate
print('TurTLE WARNING: unable to copy parameters of source simulation.'
+'File {0} is missing.\n'.format(src_file)
+'DNS will use default values for physical parameters.\n')
else:
print('TurTLE WARNING: DNS will use default values for physical parameters.\n'
'This means `dealias_type`, `energy`, `famplitude`, `fk0`, `fk1`, `fmode`, `friction_coefficient`, `injection_rate`, `nu` and `forcing_type` may differ from values used by the source DNS.')