shear

Module

Description

$Id$

This modules deals with all aspects of shear; if no shear is invoked, a corresponding replacement dummy routine is used instead which absorbs all the calls to the shear relevant subroutines listed in here.

When this module is used, Pencil Code works in terms of the fluctuating fluid velocity, i.e. in terms of the difference between the total fluid velocity and the uniform shear flow. Therefore, an explicit magnetic stretching term appears in the induction equation (switched on by ‘lmagnetic_stretching’).

Shear can either be given relative to Omega (using qshear), or in absolute fashion via the parameters Sshear.

** AUTOMATIC CPARAM.INC GENERATION ************************ Declare (for generation of cparam.inc) the number of f array variables and auxiliary variables added by this module

CPARAM logical, parameter :: lshear = .true.

PENCILS PROVIDED advec_shear

Quick access

Variables:

bcx_periodic, bspline_ay, bspline_iy, bspline_k, diff_hyper3x_mesh, fourier_shift_ghostzones, idiag_deltay, idiag_dtshear, lhyper3x_mesh, lmagnetic_stretching, lmagnetic_tilt, lposdef, lposdef_advection, lrandomx0, lshear_acceleration, lshearadvection_as_shift, ltvd_advection, norder_poly, qshear0, shear_method, sheared_advection_nonfft, shift_ghostzones_nonfft, shift_ghostzones_nonfft_subtask, sini, sshear1, sshear_sini, u0_advec, x0_shear

Routines:

advance_shear(), boundcond_shear(), calc_diagnostics_shear(), calc_pencils_shear(), get_hyper3x_mesh(), get_uy0_shear(), initialize_shear(), pencil_criteria_shear(), pencil_interdep_shear(), read_shear_init_pars(), read_shear_run_pars(), register_shear(), rprint_shear(), shear_before_boundary(), shear_frame_transform(), shear_variables(), sheared_advection_fft(), shearing(), write_shear_init_pars(), write_shear_run_pars()

Needed modules

Variables

  • shear/bcx_periodic [private]
  • shear/bspline_ay (nygrid,nygrid) [real,private/optional/default=0.0]
  • shear/bspline_iy (nygrid) [integer,private/optional/default=0]
  • shear/bspline_k [integer,private/parameter/optional/default=7]
  • shear/diff_hyper3x_mesh [real,private/optional/default=0.03]
  • shear/fourier_shift_ghostzones [private]
  • shear/idiag_deltay [integer,private/optional/default=0]

    DIAG_DOC: deltay

  • shear/idiag_dtshear [integer,private/optional/default=0]

    DIAG_DOC: advec_shear/cdt

  • shear/lhyper3x_mesh [logical,private/optional/default=.false.]
  • shear/lmagnetic_stretching [logical,private/optional/default=.true.]
  • shear/lmagnetic_tilt [logical,private/optional/default=.false.]
  • shear/lposdef (mcom) [logical,private/optional/default=.false.]
  • shear/lposdef_advection [logical,private/optional/default=.false.]
  • shear/lrandomx0 [logical,private/optional/default=.false.]
  • shear/lshear_acceleration [logical,private/optional/default=.true.]
  • shear/lshearadvection_as_shift [logical,private/target/optional/default=.false.]
  • shear/ltvd_advection [logical,private/optional/default=.false.]
  • shear/norder_poly [integer,private/optional/default=3]
  • shear/qshear0 [real,private/optional/default=0.0]
  • shear/shear_method [character,private/optional/default='fft']
  • shear/sheared_advection_nonfft [private]
  • shear/shift_ghostzones_nonfft [private]
  • shear/shift_ghostzones_nonfft_subtask [private]
  • shear/sini [real,private/optional/default=0.0]
  • shear/sshear1 [real,private/optional/default=0.0]
  • shear/sshear_sini [real,private/optional/default=0.0]
  • shear/u0_advec (3) [real,private/optional/default=0.0]
  • shear/uy0 (nx) [real,private/optional/default=0.]
  • shear/x0_shear [real,private/optional/default=0.0]

Subroutines and functions

subroutine  shear/register_shear()

Initialise variables.

2-july-02/nils: coded

Use :

sharedvariables (put_shared_variable())

Called from:

register_modules()

Call to:

svn_id(), not_implemented(), warning(), bspline_precondition(), ludcmp(), information(), fatal_error(), der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), save_name(), fourier_shift_y(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/initialize_shear()

21-nov-02/tony: coded 08-jul-04/anders: Sshear calculated whenever qshear /= 0

Calculate shear flow velocity; if qshear is given, then

Sshear=-(qshear-qshear0)*Omega (shear in advection and magnetic stretching) Sshear1=-qshear*Omega (Lagrangian shear)

are calculated. Otherwise Sshear and Sshear1 keep their values from the input list.

Definitions:

qshear = -(R / Omega) d Omega / dR, qshear0 = 1 - Omega_p / Omega,

where Omega_p is the angular speed at which the shearing box revolves about the central host. If Omega_p = Omega, the usual shearing approximation is recovered.

Use :

sub (bspline_precondition(), ludcmp())

Called from:

register_modules(), initialize_modules()

Call to:

not_implemented(), warning(), bspline_precondition(), ludcmp(), information(), fatal_error(), der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), save_name(), fourier_shift_y(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/read_shear_init_pars(iomsg)
Parameters:

iomsg [character,out]

Use :

file_io (parallel_unit())

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/write_shear_init_pars(unit)
Parameters:

unit [integer,in]

Called from:

get_datadir(), get_snapdir(), read_all_init_pars(), read_all_run_pars(), get_downpars()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/read_shear_run_pars(iomsg)
Parameters:

iomsg [character,out]

Use :

file_io (parallel_unit())

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/write_shear_run_pars(unit)
Parameters:

unit [integer,in]

Called from:

get_datadir(), get_snapdir(), read_all_init_pars(), read_all_run_pars(), get_downpars()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/shear_before_boundary(f)

Actions to take before boundary conditions are set.

1-may-08/anders: coded

Parameters:

f (,,*,*) [real,contiguous]

Use :

general (random_number_wrapper()), mpicomm (mpibcast_real())

Called from:

pde(), write_diagnostics(), calc_all_module_diagnostic_auxiliaries(), perform_diagnostics(), finalize_diagnostics()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/pencil_criteria_shear()

All pencils that the Shear module depends on are specified here.

01-may-09/wlad: coded

Called from:

register_modules(), initialize_modules(), finalize_modules(), choose_pencils()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/pencil_interdep_shear(lpencil_in)

Interdependency among pencils from the Shear module is specified here.

01-may-09/wlad: coded

Parameters:

lpencil_in (npencils) [logical]

Called from:

register_modules(), initialize_modules(), finalize_modules(), choose_pencils()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/calc_pencils_shear(f, p)

Calculate Shear pencils. Most basic pencils should come first, as others may depend on them.

01-may-09/wlad: coded

Parameters:
  • f (,,*,*) [real,in,contiguous]

  • p [pencil_case,out]

Called from:

pde(), write_diagnostics(), calc_all_module_diagnostic_auxiliaries(), perform_diagnostics(), finalize_diagnostics()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/shearing(f, df, p)

Calculates the shear terms -uy0*df/dy (shearing sheat approximation).

2-jul-02/nils: coded 6-jul-02/axel: runs through all nvar variables; added timestep check

16-aug-02/axel: use now Sshear which is calculated in param_io.f90 20-aug-02/axel: added magnetic stretching term 25-feb-11/MR: restored shearing of testflow solutions, when demanded 20-Mar-11/MR: testflow variables now completely processed in testflow module

Parameters:
  • f (,,*,*) [real,in,contiguous]

  • df (mx,my,mz,mvar) [real]

  • p [pencil_case]

Use :

deriv (der(), der6())

Called from:

pde(), write_diagnostics(), calc_all_module_diagnostic_auxiliaries(), perform_diagnostics(), finalize_diagnostics()

Call to:

der6(), calc_diagnostics_shear(), max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/calc_diagnostics_shear(p)

Calculate shearing related diagnostics.

Parameters:

p [pencil_case]

Use :

diagnostics (max_mn_name())

Called from:

pde(), write_diagnostics(), calc_all_module_diagnostic_auxiliaries(), register_shear(), initialize_shear(), read_shear_init_pars(), write_shear_init_pars(), read_shear_run_pars(), write_shear_run_pars(), shear_before_boundary(), pencil_criteria_shear(), pencil_interdep_shear(), calc_pencils_shear(), shearing()

Call to:

max_mn_name(), update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/shear_variables(f, df, nvars, jstart[, jstep[, shear1]])

Allow shear treatment of variables in other modules

Parameters:
  • jstart [integer,in] :: corresponds to u_x; default value: 3 to which advection term is added

  • jstep [integer,in,] :: stepsize in df for selecting slots to which Langrangian shear is added; only relevant for velocity variables,

  • jstart ::

    corresponds to u_x; default value: 3

    = 0 : Langrangian shear is not added

    20-Mar-11/MR: coded

  • f (,,*,*) [real,in,contiguous]

  • df (mx,my,mz,mvar) [real,inout]

  • nvars [integer,in]

  • shear1 [logical,in,]

Use :

deriv (der())

Called from:

register_testflow(), initialize_testflow(), init_uutest(), pencil_criteria_testflow(), pencil_interdep_testflow(), read_testflow_init_pars(), write_testflow_init_pars(), read_testflow_run_pars(), write_testflow_run_pars(), duutest_dt()

Call to:

update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/advance_shear(f, df, dt_shear)

Advance shear distance, deltay, using dt. Using t instead introduces significant errors when nt = t/dt exceeds ~100,000 steps. This formulation works also when Sshear is changed during the run.

18-aug-02/axel: incorporated from nompicomm.f90 05-jun-12/ccyang: move SAFI to subroutine sheared_advection_fft

Parameters:
  • f (,,*,*) [real,contiguous]

  • df (mx,my,mz,mvar) [real]

  • dt_shear [real]

Use :

diagnostics (save_name()), mpicomm (update_neighbors(), isendrcv_bdry_x())

Call to:

update_neighbors(), sheared_advection_fft(), isendrcv_bdry_x(), fatal_error(), save_name(), not_implemented(), fourier_shift_y(), warning(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/sheared_advection_fft(a, comp_start, comp_end, dt_shear)

Uses Fourier interpolation to integrate the shearing terms.

05-jun-12/ccyang: modularized from advance_shear and advect_shear_xparallel

Input/Ouput Argument

Parameters:
  • a (,,*,*) [real,inout] ::

    field to be sheared Input Argument

    ic1, ic2: start and end indices in a

  • dt_shear [real,in] :: time increment

  • comp_start [integer,in]

  • comp_end [integer,in]

Use :

fourier (fourier_shift_y(), fft_y_parallel())

Called from:

register_shear(), initialize_shear(), read_shear_init_pars(), write_shear_init_pars(), read_shear_run_pars(), write_shear_run_pars(), shear_before_boundary(), pencil_criteria_shear(), pencil_interdep_shear(), calc_pencils_shear(), shearing(), calc_diagnostics_shear(), advance_shear(), shear_variables()

Call to:

not_implemented(), fourier_shift_y(), warning(), fatal_error(), bspline_interpolation(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), mpibarrier()

subroutine  shear/boundcond_shear(f, ivar1, ivar2)

Shearing boundary conditions, called from the Boundconds module.

02-oct-07/anders: coded

Parameters:
  • f (,,*,*) [real,inout,contiguous]

  • ivar1 [integer,in]

  • ivar2 [integer,in]

Use :

mpicomm (initiate_shearing(), finalize_shearing())

Called from:

initialize_boundcond(), boundconds_x_c()

Call to:

warning(), fatal_error(), initiate_shearing(), finalize_shearing(), fourier_shift_yz_y(), not_implemented(), bspline_interpolation(), mpibarrier()

subroutine  shear/rprint_shear(lreset[, lwrite])

Reads and registers print parameters relevant to shearing.

2-jul-04/tobi: adapted from entropy

Parameters:
  • lreset [logical]

  • lwrite [logical]

Use :

diagnostics (parse_name())

Called from:

register_modules(), initialize_modules(), finalize_modules(), choose_pencils(), rprint_list()

Call to:

fatal_error(), mpibarrier(), fourier_shift_yz_y()

subroutine  shear/get_uy0_shear(uy0_shear[, x])

Gets the shear velocity.

08-oct-13/ccyang: coded

Parameters:
  • uy0_shear (*) [real,out]

  • x (*) [real,in,]

Call to:

fatal_error(), mpibarrier(), fourier_shift_yz_y()

subroutine  shear/get_hyper3x_mesh(lhyper3x_mesh_out, diff_hyper3x_mesh_out)

Gets module variables lhyper3x_mesh and diff_hyper3x_mesh.

03-jun-14/ccyang: coded

Parameters:
  • lhyper3x_mesh_out [logical,out]

  • diff_hyper3x_mesh_out [real,out]

Call to:

fatal_error(), mpibarrier(), fourier_shift_yz_y()

subroutine  shear/shear_frame_transform(a[, tshift])

Transforms a variable a from lab frame to shear frame in the x space

Parameters:
  • a (nx,ny,nz) [real,inout] ::

    must be defined on (l1:l2,m1:m2,n1:n2)

    31-jun-21/hongzhe: coded 10-dec-21/hongzhe: using fft to shift, allowing for nprocy>1

  • tshift [real,in,]

Use :

fourier (fourier_shift_yz_y()), general (roptest())

Called from:

initialize_power_spectrum(), read_power_spectrum_run_pars(), write_power_spectrum_run_pars(), power(), crossspec(), power_2d(), power_xy(), powerhel(), powerlor(), poweromu(), poweremf(), powertra(), powergws(), powerscl(), power_1d(), pdf(), pdf_2d(), pdf1d_ang(), power_phi(), powerhel_phi(), power_vec(), polar_spectrum(), power1d_plane(), power_cor(), power_cor_scl(), quadratic_invariants(), power_fft3d_vec()

Call to:

fourier_shift_yz_y()