deriv
Module
Description
$Id$
** AUTOMATIC CPARAM.INC GENERATION ************************ Declare (for generation of cparam.inc) the number of f array variables and auxiliary variables added by this module
CPARAM integer, parameter :: nghost = 3
Quick access
- Variables:
bval_from_3rd,bval_from_3rd_arr,bval_from_3rd_scl,bval_from_4th,bval_from_4th_arr,bval_from_4th_scl,bval_from_neumann,bval_from_neumann_arr,bval_from_neumann_scl,der,der2,der2_coef0,der2_coef1,der2_coef2,der2_coef3,der2_coef4,der2_coef5,der2_main,der2_other,der6,der6_main,der6_other,der_main,der_onesided_4_slice,der_onesided_4_slice_main,der_onesided_4_slice_main_pt,der_onesided_4_slice_other_pt,der_other,deri,deri_2d,deri_3d,derij,derij_main,derij_other,derivative_1,set_ghosts_for_onesided_ders_1d,test- Routines:
calc_coeffs_1(),der2_minmod(),der2_pencil(),der2_x(),der2_z(),der2i2j2k(),der3(),der3i2j1k(),der3i3j(),der4(),der4i1j1k(),der4i2j(),der5(),der5_single(),der5i1j(),der6(),der6_pencil(),der_onesided_4_slice_other(),der_pencil(),der_upwind1st(),der_x(),der_z(),deri_3d_inds(),distr_der(),finalize_deriv(),heatflux_deriv_x(),initialize_deriv(),set_ghosts_for_onesided_ders()
Needed modules
messages(fatal_error(),warning(),not_implemented()): $Id$cdata: $Id$
Variables
- deriv/bval_from_3rd [public]
- deriv/bval_from_3rd_arr [private]
- deriv/bval_from_3rd_scl [private]
- deriv/bval_from_4th [public]
- deriv/bval_from_4th_arr [private]
- deriv/bval_from_4th_scl [private]
- deriv/bval_from_neumann [public]
- deriv/bval_from_neumann_arr [private]
- deriv/bval_from_neumann_scl [private]
- deriv/der [public]
- deriv/der2 [public]
- deriv/der2_coef0 [real,private]
- deriv/der2_coef1 [real,private]
- deriv/der2_coef2 [real,private]
- deriv/der2_coef3 [real,private]
- deriv/der2_main [private]
- deriv/der2_other [private]
- deriv/der6 [public]
- deriv/der6_main [private]
- deriv/der6_other [private]
- deriv/der_main [private]
- deriv/der_onesided_4_slice [public]
- deriv/der_onesided_4_slice_main [private]
- deriv/der_onesided_4_slice_main_pt [private]
- deriv/der_onesided_4_slice_other_pt [private]
- deriv/der_other [private]
- deriv/derij [public]
- deriv/derij_main [private]
- deriv/derij_other [private]
- deriv/minmod [private]
- deriv/set_ghosts_for_onesided_ders_1d [private]
Subroutines and functions
- subroutine deriv/initialize_deriv()
Initialize stencil coefficients
- 23-sep-16/MR: added initialization and manipulation of l-offsets for complete
one-sided calculation of 2nd derivatives
5-jan-17/MR: removed offset manipulation as not needed; see set_ghosts_for_onesided_ders
- Use :
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/calc_coeffs_1(grid, coeffs)
Calculates the coefficients of the 6th order difference formula for the first derivative on a 7-point stencil. The grid is provided in form of the stepsizes in grid.
26-mar-15/MR: extracted from deriv_alt.
- Parameters:
grid (6) [real,in]
coeffs (7) [real,out]
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der_x(f, df)
x derivative operating on an x-dependent 1-D array
23-jun-15/pete: adapted from der_z; note that f is not the f array!
- Parameters:
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der2_x(f, df2)
Second x derivative operating on an x-dependent 1-D array
23-jun-15/pete: adapted from der2_z
- Parameters:
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der_z(f, df)
z derivative operating on a z-dependent 1-D array
9-feb-07/axel: adapted from der_main; note that f is not the f array!
- Parameters:
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der2_z(f, df2)
z derivative operating on a z-dependent 1-D array
2-jan-10/axel: adapted from der_z and der_main
- Parameters:
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der_pencil(j, pencil, df)
Calculate first derivative of any x, y or z pencil.
01-nov-07/anders: adapted from der
- Parameters:
j [integer,in]
pencil (*) [real,in]
df (*) [real,out]
- Use :
- Call to:
fatal_error(),not_implemented(),der2_z(),der_z(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/distr_der(arr, idir, der[, order])
Calculates 1st or 2nd derivative of a 1D array (of vectors, so 2nd dim for components), which is distributed across the procs of its dimension. At the moment only for z-direction (idir=IZBEAM=3).
20-oct-21/MR: coded
- Parameters:
arr (,) [real,inout]
idir [integer,in]
der (,) [real,out]
order [integer,in,]
- Use :
mpicomm(mpisendrecv_real(),ixbeam(),iybeam(),izbeam()),general(ioptest())- Call to:
not_implemented(),der2_z(),der_z(),fatal_error(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der2_pencil(j, pencil, df2)
Calculate 2nd derivative of any x, y or z pencil.
01-nov-07/anders: adapted from der2
- Parameters:
j [integer,in]
pencil (*) [real,in]
df2 (*) [real,out]
- Call to:
fatal_error(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der3(f, k, df, j[, ignoredx])
Calculate 3rd derivative of a scalar, get scalar
10-feb-06/anders: adapted from der5
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
j [integer,in]
ignoredx [logical,in,]
- Call to:
fatal_error(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der4(f, k, df, j[, ignoredx[, upwind]])
- Calculate 4th derivative of a scalar, get scalar
Used for hyperdiffusion that affects small wave numbers as little as
- possible (useful for density).
The optional flag IGNOREDX is useful for numerical purposes, where
you want to affect the Nyquist scale in each direction, independent of the ratios dx:dy:dz.
8-jul-02/wolf: coded 9-dec-03/nils: adapted from der6
10-feb-06/anders: corrected sign and factor
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
j [integer,in]
ignoredx [logical,in,]
upwind [logical,in,]
- Call to:
fatal_error(),warning(),der5_single(),der6(),heatflux_deriv_x()
- subroutine deriv/der5(f, k, df, j[, ignoredx])
- Calculate 5th derivative of a scalar, get scalar
Used for hyperdiffusion that affects small wave numbers as little as
- possible (useful for density).
The optional flag IGNOREDX is useful for numerical purposes, where
you want to affect the Nyquist scale in each direction, independent of the ratios dx:dy:dz.
29-oct-04/anders: adapted from der6
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
j [integer,in]
ignoredx [logical,in,]
- Call to:
fatal_error(),der5_single(),warning(),der6(),heatflux_deriv_x()
- subroutine deriv/der2_minmod(f, j, delfk, delfkp1, delfkm1, k)
Calculates gradient of a scalar along the direction j but get the derivatives at the point i-1,i,i+1
- Parameters:
- Call to:
fatal_error(),der5_single(),warning(),der6(),heatflux_deriv_x()
- subroutine deriv/der6_pencil(j, pencil, df6[, ignoredx[, upwind]])
Calculate 6th derivative of any x, y or z pencil.
20-jul-20/wlyra: adapted from der2_pencil
- Parameters:
j [integer,in]
pencil (*) [real,in]
df6 (*) [real,out]
ignoredx [logical,in,]
upwind [logical,in,]
- Call to:
fatal_error(),der5_single(),warning(),der6(),heatflux_deriv_x()
- function deriv/der5_single(f, j, dc1)
computes 5th order derivative of function given by f at position j
3-oct-12/MR: coded
- Parameters:
f (*) [real,in]
j [integer,in]
dc1 (*) [real,in]
- Return:
der5_single [real]
- Call to:
- subroutine deriv/der5i1j(f, k, df, i, j)
Calculate 6th derivative with respect to two different directions.
05-dec-06/anders: adapted from derij
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
i [integer,in]
j [integer,in]
- Call to:
- subroutine deriv/der4i2j(f, k, df, i, j)
Calculate 6th derivative with respect to two different directions.
02-apr-17/wlyra: adapted from der5i1j
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
i [integer,in]
j [integer,in]
- Call to:
- subroutine deriv/der2i2j2k(f, k, df)
Mixed 6th derivative of der2x(der2y(der2z(f))). Worked out symbolically in python. Result as spit from the python routine.
02-apr-17/wlyra: coded
- Parameters:
f (,,*,*) [real,in,contiguous]
k [integer,in]
df (nx) [real,out]
- Call to:
- subroutine deriv/der3i3j(f, k, df, i, j)
- Parameters:
f (,,*,*) [real,contiguous]
k [integer,in]
df (nx) [real,out]
i [integer,in]
j [integer,in]
- Call to:
- subroutine deriv/der3i2j1k(f, ik, df, i, j, k)
- Parameters:
f (,,*,*) [real,contiguous]
ik [integer,in]
df (nx) [real,out]
i [integer,in]
j [integer,in]
k [integer,in]
- Call to:
- subroutine deriv/der4i1j1k(f, ik, df, i, j, k)
- Parameters:
f (,,*,*) [real,contiguous]
ik [integer,in]
df (nx) [real,out]
i [integer,in]
j [integer,in]
k [integer,in]
- Call to:
- subroutine deriv/der_upwind1st(f, uu, k, df, j)
First order upwind derivative of variable
Useful for advecting non-logarithmic variables
- Parameters:
- Call to:
- subroutine deriv/der_onesided_4_slice_other(f, sgn, df, pos, j)
Calculate x/y/z-derivative on a yz/xz/xy-slice at gridpoint pos. Uses a one-sided 4th order stencil. sgn = +1 for forward difference, sgn = -1 for backwards difference.
Because of its original intended use in relation to solving characteristic equations on boundaries (NSCBC), this sub should return only PARTIAL derivatives, NOT COVARIANT. Applying the right scaling factors and connection terms should instead be done when solving the characteristic equations.
7-jul-08/arne: coded.
- Parameters:
- Call to:
- subroutine deriv/finalize_deriv()
Dummy
- Call to:
- subroutine deriv/deri_3d_inds(f, df, inds, j[, lignored[, lnometric]])
dummy routine for compatibility
26-mar-12/MR: coded
- Parameters:
- Call to:
- function deriv/heatflux_deriv_x(f, inh, fac, topbot)
dummy routine
17-apr-12/MR: coded
- Parameters:
- Return:
heatflux_deriv_x [logical]
- Use :
- subroutine deriv/set_ghosts_for_onesided_ders(f, topbot, j, idir[, l2nd])
Sets ghost zones in f-array for one-sided derivatives of 1st and 2nd order.
- 20-sep-16/MR: added optional parameter bval for boundary value.
added ghost value setting for having the second derivative correct in one-sided formulation for first inner point.
- 5-jan-17/MR: simplified, as ghost zone values for 1st and 2nd derivative
also in 2nd ghost zone point equal, as Fred spotted.