TURTLE
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
NSE< rnumber > Class Template Reference

Navier-Stokes solver. More...

#include <NSE.hpp>

Inheritance diagram for NSE< rnumber >:
Inheritance graph
[legend]
Collaboration diagram for NSE< rnumber >:
Collaboration graph
[legend]

Public Member Functions

 NSE (const MPI_Comm COMMUNICATOR, const std::string &simulation_name)
 
 ~NSE ()
 
int initialize (void)
 Initialize DNS.
 
int step (void)
 
int finalize (void)
 
int Euler_step (void)
 
int Heun_step (void)
 
int ShuOsher (void)
 Time step with Shu Osher method.
 
int add_field_band (field< rnumber, FFTW, THREE > *dst, field< rnumber, FFTW, THREE > *src, const double k0, const double k1, const double prefactor)
 
virtual int add_nonlinear_term (const field< rnumber, FFTW, THREE > *vel, field< rnumber, FFTW, THREE > *dst)
 
int add_forcing_term (field< rnumber, FFTW, THREE > *vel, field< rnumber, FFTW, THREE > *dst)
 
int impose_forcing (field< rnumber, FFTW, THREE > *vel)
 
virtual int read_parameters (void)
 
int write_checkpoint (void)
 
int do_stats (void)
 Compute standard statistics for velocity and vorticity fields.
 
- Public Member Functions inherited from direct_numerical_simulation
 direct_numerical_simulation (const MPI_Comm COMMUNICATOR, const std::string &simulation_name)
 
virtual ~direct_numerical_simulation () noexcept(false)
 
int main_loop (void)
 
int read_iteration (void)
 
int write_iteration (void)
 
int grow_file_datasets (void)
 
int update_checkpoint (void)
 Basic computation of current checkpoint.
 
const std::string get_current_fname ()
 
- Public Member Functions inherited from code_base
 code_base (const MPI_Comm COMMUNICATOR, const std::string &simulation_name)
 
virtual ~code_base () noexcept(false)
 
int check_stopping_condition (void)
 
int start_simple_timer (void)
 
int print_simple_timer (const std::string operation_name)
 
MPI_Comm get_communicator () const
 
int get_nx () const
 
int get_ny () const
 
int get_nz () const
 

Data Fields

std::string name
 
double dt
 
double famplitude
 
double friction_coefficient
 
double fk0
 
double fk1
 
double energy
 
double injection_rate
 
int fmode
 
int field_random_seed
 
std::string forcing_type
 
int histogram_bins
 
double max_velocity_estimate
 
double max_vorticity_estimate
 
double nu
 
std::string fftw_plan_rigor
 
kspace< FFTW, SMOOTH > * kk
 
field< rnumber, FFTW, THREE > * velocity
 
field< rnumber, FFTW, THREE > * tmp_velocity1
 
field< rnumber, FFTW, THREE > * tmp_velocity2
 
field< rnumber, FFTW, THREE > * tmp_vec_field0
 
field< rnumber, FFTW, THREE > * tmp_vec_field1
 
- Data Fields inherited from direct_numerical_simulation
std::string name
 
int checkpoint
 
int checkpoints_per_file
 
int niter_out
 
int niter_stat
 
int niter_todo
 
hid_t stat_file
 
- Data Fields inherited from code_base
int myrank
 
int nprocs
 
MPI_Comm comm
 
std::string simname
 
int iteration
 
bool stop_code_now
 
int nx
 
int ny
 
int nz
 
int dealias_type
 
double dkx
 
double dky
 
double dkz
 

Detailed Description

template<typename rnumber>
class NSE< rnumber >

Navier-Stokes solver.

Solves the Navier Stokes equation.

Allocates fields and a kspace object.

Constructor & Destructor Documentation

◆ NSE()

template<typename rnumber >
NSE< rnumber >::NSE ( const MPI_Comm COMMUNICATOR,
const std::string & simulation_name )
inline

◆ ~NSE()

template<typename rnumber >
NSE< rnumber >::~NSE ( )
inline

Member Function Documentation

◆ add_field_band()

template<typename rnumber >
int NSE< rnumber >::add_field_band ( field< rnumber, FFTW, THREE > * dst,
field< rnumber, FFTW, THREE > * src,
const double k0,
const double k1,
const double prefactor )

◆ add_forcing_term()

template<typename rnumber >
int NSE< rnumber >::add_forcing_term ( field< rnumber, FFTW, THREE > * vel,
field< rnumber, FFTW, THREE > * dst )

◆ add_nonlinear_term()

template<typename rnumber >
int NSE< rnumber >::add_nonlinear_term ( const field< rnumber, FFTW, THREE > * vel,
field< rnumber, FFTW, THREE > * dst )
virtual

◆ do_stats()

template<typename rnumber >
int NSE< rnumber >::do_stats ( void )
virtual

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 NSEparticles class, so please don't break it.

Implements direct_numerical_simulation.

◆ Euler_step()

template<typename rnumber >
int NSE< rnumber >::Euler_step ( void )

◆ finalize()

template<typename rnumber >
int NSE< rnumber >::finalize ( void )
virtual

◆ Heun_step()

template<typename rnumber >
int NSE< rnumber >::Heun_step ( void )

◆ impose_forcing()

template<typename rnumber >
int NSE< rnumber >::impose_forcing ( field< rnumber, FFTW, THREE > * vel)

◆ initialize()

template<typename rnumber >
int NSE< rnumber >::initialize ( void )
virtual

Initialize DNS.

Must assign :code:this->stat_file.

Implements direct_numerical_simulation.

◆ read_parameters()

template<typename rnumber >
int NSE< rnumber >::read_parameters ( void )
virtual

Reads parameters

Warning
This method should ensure the parameter file is closed by all MPI processes when finished. One solution is to open the file in sequential mode, read-only, and then call MPI_Barrier.

Reimplemented from direct_numerical_simulation.

◆ ShuOsher()

template<typename rnumber >
int NSE< rnumber >::ShuOsher ( void )

Time step with Shu Osher method.

The Navier Stokes equations are integrated with a third-order Runge-Kutta method [shu1988jcp]_, which is an explicit Runge-Kutta method with the Butcher tableau

0
1 1
1/2 1/4 1/4
1/6 1/6 2/3

In addition to the stability properties described in [shu1988jcp]_, this method has the advantage that it is memory-efficient, requiring only two additional field allocations, as can be seen from

\begin{eqnarray*} \hat{\boldsymbol w}_1(\boldsymbol k) &= {\hat{\boldsymbol u}}(\boldsymbol k, t)e^{-\nu k^2 h} + h \textrm{NL}[\hat{\boldsymbol u}(\boldsymbol k, t)]e^{-\nu k^2 h}, \\ \hat{\boldsymbol w}_2(\boldsymbol k) &= \frac{3}{4}\hat{\boldsymbol u}( \boldsymbol k, t)e^{-\nu k^2 h/2} + \frac{1}{4}(\hat{\boldsymbol w}_1(\boldsymbol k) + h \textrm{NL}[\hat{\boldsymbol w}_1(\boldsymbol k)])e^{\nu k^2 h/2}, \\ \hat{\boldsymbol u}(\boldsymbol k, t+h) &= \frac{1}{3}\hat{\boldsymbol u}(\boldsymbol k, t)e^{-\nu k^2 h} + \frac{2}{3}(\hat{\boldsymbol w}_2(\boldsymbol k) + h \textrm{NL}[\hat{\boldsymbol w}_2(\boldsymbol k)])e^{-\nu k^2 h/2}, \end{eqnarray*}

◆ step()

template<typename rnumber >
int NSE< rnumber >::step ( void )
virtual

◆ write_checkpoint()

template<typename rnumber >
int NSE< rnumber >::write_checkpoint ( void )
virtual

Field Documentation

◆ dt

template<typename rnumber >
double NSE< rnumber >::dt

◆ energy

template<typename rnumber >
double NSE< rnumber >::energy

◆ famplitude

template<typename rnumber >
double NSE< rnumber >::famplitude

◆ fftw_plan_rigor

template<typename rnumber >
std::string NSE< rnumber >::fftw_plan_rigor

◆ field_random_seed

template<typename rnumber >
int NSE< rnumber >::field_random_seed

◆ fk0

template<typename rnumber >
double NSE< rnumber >::fk0

◆ fk1

template<typename rnumber >
double NSE< rnumber >::fk1

◆ fmode

template<typename rnumber >
int NSE< rnumber >::fmode

◆ forcing_type

template<typename rnumber >
std::string NSE< rnumber >::forcing_type

◆ friction_coefficient

template<typename rnumber >
double NSE< rnumber >::friction_coefficient

◆ histogram_bins

template<typename rnumber >
int NSE< rnumber >::histogram_bins

◆ injection_rate

template<typename rnumber >
double NSE< rnumber >::injection_rate

◆ kk

template<typename rnumber >
kspace<FFTW, SMOOTH>* NSE< rnumber >::kk

◆ max_velocity_estimate

template<typename rnumber >
double NSE< rnumber >::max_velocity_estimate

◆ max_vorticity_estimate

template<typename rnumber >
double NSE< rnumber >::max_vorticity_estimate

◆ name

template<typename rnumber >
std::string NSE< rnumber >::name

◆ nu

template<typename rnumber >
double NSE< rnumber >::nu

◆ tmp_vec_field0

template<typename rnumber >
field<rnumber, FFTW, THREE>* NSE< rnumber >::tmp_vec_field0

◆ tmp_vec_field1

template<typename rnumber >
field<rnumber, FFTW, THREE>* NSE< rnumber >::tmp_vec_field1

◆ tmp_velocity1

template<typename rnumber >
field<rnumber, FFTW, THREE>* NSE< rnumber >::tmp_velocity1

◆ tmp_velocity2

template<typename rnumber >
field<rnumber, FFTW, THREE>* NSE< rnumber >::tmp_velocity2

◆ velocity

template<typename rnumber >
field<rnumber, FFTW, THREE>* NSE< rnumber >::velocity

The documentation for this class was generated from the following files: