Commit 5b34b233 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

adds Gauss field par control for `kraichnan_field`

parent 481916bc
......@@ -671,7 +671,20 @@ class DNS(_code):
eval('self.parameters_to_parser_arguments('
'parser_{0},'
'self.NSVEp_extra_parameters)'.format(parser))
eval('self.parameters_to_parser_arguments('
'parser_{0},'
'self.generate_extra_parameters(\'{0}\'))'.format(parser))
return None
def generate_extra_parameters(
self,
dns_type):
pars = {}
if dns_type == 'kraichnan_field':
pars['field_random_seed'] = int(1)
pars['spectrum_slope'] = float(-5./3)
pars['spectrum_k_cutoff'] = float(16)
pars['spectrum_coefficient'] = float(1)
return pars
def prepare_launch(
self,
args = [],
......@@ -713,6 +726,9 @@ class DNS(_code):
if self.dns_type in extra_parameters.keys():
for k in extra_parameters[self.dns_type].keys():
self.parameters[k] = extra_parameters[self.dns_type][k]
additional_parameters = self.generate_extra_parameters(self.dns_type)
for k in additional_parameters.keys():
self.parameters[k] = additional_parameters[k]
if ((self.parameters['niter_todo'] % self.parameters['niter_out']) != 0):
self.parameters['niter_out'] = self.parameters['niter_todo']
if len(opt.src_work_dir) == 0:
......@@ -1050,7 +1066,13 @@ class DNS(_code):
f['vorticity/complex/{0}'.format(0)] = data
f.close()
# now take care of particles' initial condition
if self.dns_type in ['kraichnan_field', 'static_field', 'NSVEparticles', 'NSVEcomplex_particles', 'NSVEparticles_no_output', 'NSVEp_extra_sampling']:
if self.dns_type in [
'kraichnan_field',
'static_field',
'NSVEparticles',
'NSVEcomplex_particles',
'NSVEparticles_no_output',
'NSVEp_extra_sampling']:
self.generate_particle_data(opt = opt)
return None
def launch_jobs(
......
......@@ -2,20 +2,20 @@
* *
* Copyright 2019 Max Planck Institute for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* This file is part of TurTLE. *
* *
* bfps is free software: you can redistribute it and/or modify *
* TurTLE is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* bfps is distributed in the hope that it will be useful, *
* TurTLE is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with bfps. If not, see <http://www.gnu.org/licenses/> *
* along with TurTLE. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
......@@ -101,14 +101,8 @@ int kraichnan_field<rnumber>::initialize(void)
"position/0");
this->particles_sample_writer_mpi->setParticleFileLayout(this->ps->getParticleFileLayout());
this->spectrum_slope = -5./3.;
this->spectrum_k_cutoff = 20.; //k_max is approximately N/2 in a N^3 simulation
// Projection factor
this->spectrum_coeff = 3./2.;
DEBUG_MSG("Coefficient: %g\n",
this->spectrum_coeff);
DEBUG_MSG("Coefficient: %g\n",
this->spectrum_coefficient);
return EXIT_SUCCESS;
}
......@@ -124,7 +118,7 @@ int kraichnan_field<rnumber>::step(void)
this->iteration,
this->spectrum_slope,
this->spectrum_k_cutoff,
this->spectrum_coeff * 3./2.); // incompressibility projection factor
this->spectrum_coefficient * 3./2.); // incompressibility projection factor
this->velocity->ift();
// PUT THE INCOMPRESSIBILITY PROJECTION FACTOR sqrt(2/3)
......@@ -189,7 +183,7 @@ int kraichnan_field<rnumber>::do_stats()
std::unique_ptr<double[]> pdata(new double[3*this->ps->getLocalNbParticles()]);
/// copy position data
/// sample position
std::copy(this->ps->getParticlesState(),
this->ps->getParticlesState()+3*this->ps->getLocalNbParticles(),
......@@ -236,6 +230,10 @@ int kraichnan_field<rnumber>::read_parameters(void)
this->tracers0_integration_steps = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_integration_steps");
this->tracers0_neighbours = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_neighbours");
this->tracers0_smoothness = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_smoothness");
this->spectrum_slope = hdf5_tools::read_value<double>(parameter_file, "parameters/spectrum_slope");
this->spectrum_k_cutoff = hdf5_tools::read_value<double>(parameter_file, "parameters/spectrum_k_cutoff");
this->spectrum_coefficient = hdf5_tools::read_value<double>(parameter_file, "parameters/spectrum_coefficient");
this->field_random_seed = hdf5_tools::read_value<int>(parameter_file, "parameters/field_random_seed");
H5Fclose(parameter_file);
return EXIT_SUCCESS;
}
......
......@@ -3,20 +3,20 @@
* Copyright 2017 Max Planck Institute *
* for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* This file is part of TurTLE. *
* *
* bfps is free software: you can redistribute it and/or modify *
* TurTLE is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* bfps is distributed in the hope that it will be useful, *
* TurTLE is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with bfps. If not, see <http://www.gnu.org/licenses/> *
* along with TurTLE. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
......@@ -61,7 +61,8 @@ class kraichnan_field: public direct_numerical_simulation
field<rnumber, FFTW, THREE> *velocity;
double spectrum_slope;
double spectrum_k_cutoff;
double spectrum_coeff;
double spectrum_coefficient;
int field_random_seed;
/* other stuff */
std::unique_ptr<abstract_particles_system<long long int, double>> ps;
......
Supports Markdown
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