Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
ebe9a19c
Commit
ebe9a19c
authored
5 years ago
by
Tobias Baetge
Browse files
Options
Downloads
Patches
Plain Diff
WIP implement static velocity field
parent
992e96b6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cpp/full_code/static.cpp
+148
-0
148 additions, 0 deletions
cpp/full_code/static.cpp
cpp/full_code/static.hpp
+68
-0
68 additions, 0 deletions
cpp/full_code/static.hpp
with
216 additions
and
0 deletions
cpp/full_code/static.cpp
0 → 100644
+
148
−
0
View file @
ebe9a19c
/******************************************************************************
* *
* Copyright 2019 Max Planck Institute for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* *
* bfps 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, *
* 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/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
******************************************************************************/
#define NDEBUG
#include
<string>
#include
<cmath>
#include
"static_field.hpp"
#include
"scope_timer.hpp"
#include
"fftw_tools.hpp"
template
<
typename
rnumber
>
int
static_field
<
rnumber
>::
initialize
(
void
)
{
TIMEZONE
(
"static_file::initialize"
);
this
->
read_iteration
();
this
->
read_parameters
();
if
(
this
->
myrank
==
0
)
{
// set caching parameters
hid_t
fapl
=
H5Pcreate
(
H5P_FILE_ACCESS
);
herr_t
cache_err
=
H5Pset_cache
(
fapl
,
0
,
521
,
134217728
,
1.0
);
variable_used_only_in_assert
(
cache_err
);
DEBUG_MSG
(
"when setting stat_file cache I got %d
\n
"
,
cache_err
);
this
->
stat_file
=
H5Fopen
(
(
this
->
simname
+
".h5"
).
c_str
(),
H5F_ACC_RDWR
,
fapl
);
}
int
data_file_problem
;
if
(
this
->
myrank
==
0
)
data_file_problem
=
this
->
grow_file_datasets
();
MPI_Bcast
(
&
data_file_problem
,
1
,
MPI_INT
,
0
,
this
->
comm
);
if
(
data_file_problem
>
0
)
{
std
::
cerr
<<
data_file_problem
<<
" problems growing file datasets.
\n
trying to exit now."
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
this
->
vorticity
=
new
field
<
rnumber
,
FFTW
,
THREE
>
(
nx
,
ny
,
nz
,
this
->
comm
,
fftw_planner_string_to_flag
[
this
->
fftw_plan_rigor
]);
this
->
stat_vel
=
new
field
<
rnumber
,
FFTW
,
THREE
>
(
nx
,
ny
,
nz
,
this
->
comm
,
fftw_planner_string_to_flag
[
this
->
fftw_plan_rigor
]);
//reading initial field which is either default or a specified source field
this
->
vorticity
->
io
(
this
->
simname
+
std
::
string
(
".h5"
),
"vorticity"
,
this
->
iteration
,
true
);
this
->
kk
=
new
kspace
<
FFTW
,
SMOOTH
>
(
this
->
vorticity
->
clayout
,
this
->
dkx
,
this
->
dky
,
this
->
dkz
);
// compute the velocity field and store
invert_curl
(
this
->
kk
,
this
->
vorticity
,
stat_vel_field
);
// transform velocity field to real space
this
->
stat_vel
->
ift
();
return
EXIT_SUCCESS
;
}
template
<
typename
rnumber
>
int
NSVE
<
rnumber
>::
step
(
void
)
{
return
EXIT_SUCCESS
;
}
template
<
typename
rnumber
>
int
NSVE
<
rnumber
>::
write_checkpoint
(
void
)
{
return
EXIT_SUCCESS
;
}
template
<
typename
rnumber
>
int
NSVE
<
rnumber
>::
finalize
(
void
)
{
TIMEZONE
(
"NSVE::finalize"
);
if
(
this
->
myrank
==
0
)
H5Fclose
(
this
->
stat_file
);
delete
this
->
vorticity
;
delete
this
->
stat_vel
;
delete
this
->
kk
;
return
EXIT_SUCCESS
;
}
/** \brief Compute standard statistics for velocity and vorticity fields.
*
* IMPORTANT: at the end of this subroutine, `this->fs->cvelocity` contains
* the Fourier space representation of the velocity field, and
* `this->tmp_vec_field` contains the real space representation of the
* velocity field.
* This behavior is relied upon in the `NSVEparticles` class, so please
* don't break it.
*/
template
<
typename
rnumber
>
int
NSVE
<
rnumber
>::
do_stats
()
{
return
EXIT_SUCCESS
;
}
template
<
typename
rnumber
>
int
NSVE
<
rnumber
>::
read_parameters
(
void
)
{
TIMEZONE
(
"NSVE::read_parameters"
);
this
->
direct_numerical_simulation
::
read_parameters
();
hid_t
parameter_file
=
H5Fopen
((
this
->
simname
+
".h5"
).
c_str
(),
H5F_ACC_RDONLY
,
H5P_DEFAULT
);
this
->
fftw_plan_rigor
=
hdf5_tools
::
read_string
(
parameter_file
,
"parameters/fftw_plan_rigor"
);
H5Fclose
(
parameter_file
);
return
EXIT_SUCCESS
;
}
template
class
NSVE
<
float
>;
template
class
NSVE
<
double
>;
This diff is collapsed.
Click to expand it.
cpp/full_code/static.hpp
0 → 100644
+
68
−
0
View file @
ebe9a19c
/**********************************************************************
* *
* Copyright 2017 Max Planck Institute *
* for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* *
* bfps 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, *
* 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/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
**********************************************************************/
#ifndef STATIC_FIELD_HPP
#define STATIC_FIELD_HPP
#include
<cstdlib>
#include
"base.hpp"
#include
"full_code/direct_numerical_simulation.hpp"
template
<
typename
rnumber
>
class
static_field
:
public
direct_numerical_simulation
{
public:
/* parameters that are read in read_parameters */
std
::
string
fftw_plan_rigor
;
/* other stuff */
kspace
<
FFTW
,
SMOOTH
>
*
kk
;
field
<
rnumber
,
FFTW
,
THREE
>
*
velocity
;
field
<
rnumber
,
FFTW
,
THREE
>
*
stat_vel
;
static_field
(
const
MPI_Comm
COMMUNICATOR
,
const
std
::
string
&
simulation_name
)
:
direct_numerical_simulation
(
COMMUNICATOR
,
simulation_name
){}
~
static_field
(){}
int
initialize
(
void
);
int
step
(
void
);
int
finalize
(
void
);
virtual
int
read_parameters
(
void
);
int
write_checkpoint
(
void
);
int
do_stats
(
void
);
};
#endif//STATIC_FIELD_HPP
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment