229 lines
4 KiB
Markdown
229 lines
4 KiB
Markdown
# m_calculate.f90
|
|
|
|

|
|
|
|
## Overview
|
|
|
|
*Author: Google DeepMind Team & Ignis*
|
|
@brief DNS post-processing mathematical operations and derivatives.
|
|
|
|
This module calculates spatial derivatives (first and second derivatives in X, Y, Z directions)
|
|
using high-order compact finite difference schemes. It also calculates chemical reaction rates,
|
|
positive/negative component extraction, and threshold operations.
|
|
|
|
## API Index
|
|
|
|
- [Module: `m_calculate`](#m_calculate)
|
|
- [Subroutine: `m_calculate_init`](#m_calculate_init)
|
|
- [Subroutine: `m_calculate_finalize`](#m_calculate_finalize)
|
|
- [Subroutine: `ddx1d`](#ddx1d)
|
|
- [Subroutine: `ddx`](#ddx)
|
|
- [Subroutine: `ddy`](#ddy)
|
|
- [Subroutine: `ddz`](#ddz)
|
|
- [Subroutine: `d2dx1d`](#d2dx1d)
|
|
- [Subroutine: `d2dx`](#d2dx)
|
|
- [Subroutine: `d2dy`](#d2dy)
|
|
- [Subroutine: `d2dz`](#d2dz)
|
|
- [Subroutine: `tp`](#tp)
|
|
- [Subroutine: `tp2`](#tp2)
|
|
- [Function: `rxn_rate`](#rxn_rate)
|
|
- [Function: `threshold_min_max`](#threshold_min_max)
|
|
- [Function: `positive`](#positive)
|
|
- [Function: `negative`](#negative)
|
|
|
|
---
|
|
|
|
## API Reference
|
|
|
|
### [Module] `m_calculate`
|
|
|
|
*Author: Google DeepMind Team & Ignis*
|
|
@brief DNS post-processing mathematical operations and derivatives.
|
|
|
|
This module calculates spatial derivatives (first and second derivatives in X, Y, Z directions)
|
|
using high-order compact finite difference schemes. It also calculates chemical reaction rates,
|
|
positive/negative component extraction, and threshold operations.
|
|
|
|
---
|
|
|
|
### [Subroutine] `m_calculate_init`
|
|
|
|
```fortran
|
|
subroutine m_calculate_init()
|
|
```
|
|
|
|
Initializes the workspace arrays and matrices.
|
|
|
|
Pre-allocates transposed workspace buffers (`xsrc`, `xdst`, `rsrc`, `rdst`)
|
|
and performs the LU decomposition setup via `ludcmp` for the tridiagonal compact schemes.
|
|
|
|
---
|
|
|
|
### [Subroutine] `m_calculate_finalize`
|
|
|
|
```fortran
|
|
subroutine m_calculate_finalize()
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `ddx1d`
|
|
|
|
```fortran
|
|
subroutine ddx1d(dst, src)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `ddx`
|
|
|
|
```fortran
|
|
subroutine ddx(dst, src)
|
|
```
|
|
|
|
Computes the first-order derivative in the X-direction.
|
|
|
|
- ` src `: 3D input scalar field (nxp, nyp, nzp).
|
|
- ` dst `: 3D output derivative field (nxp, nyp, nzp).
|
|
|
|
---
|
|
|
|
### [Subroutine] `ddy`
|
|
|
|
```fortran
|
|
subroutine ddy(dst, src)
|
|
```
|
|
|
|
Computes the first-order derivative in the Y-direction.
|
|
|
|
- ` src `: 3D input scalar field (nxp, nyp, nzp).
|
|
- ` dst `: 3D output derivative field (nxp, nyp, nzp).
|
|
|
|
---
|
|
|
|
### [Subroutine] `ddz`
|
|
|
|
```fortran
|
|
subroutine ddz(dst, src)
|
|
```
|
|
|
|
Computes the first-order derivative in the Z-direction.
|
|
|
|
- ` src `: 3D input scalar field (nxp, nyp, nzp).
|
|
- ` dst `: 3D output derivative field (nxp, nyp, nzp).
|
|
|
|
---
|
|
|
|
### [Subroutine] `d2dx1d`
|
|
|
|
```fortran
|
|
subroutine d2dx1d(dst, src)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `d2dx`
|
|
|
|
```fortran
|
|
subroutine d2dx(dst, src)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `d2dy`
|
|
|
|
```fortran
|
|
subroutine d2dy(dst, src)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `d2dz`
|
|
|
|
```fortran
|
|
subroutine d2dz(dst, src)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `tp`
|
|
|
|
```fortran
|
|
subroutine tp(a, b, nx)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Subroutine] `tp2`
|
|
|
|
```fortran
|
|
subroutine tp2(a, b, n1, n2)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Function] `rxn_rate`
|
|
|
|
```fortran
|
|
function rxn_rate(c)
|
|
```
|
|
|
|
Computes the chemical reaction rate based on the progress variable c.
|
|
|
|
This uses a piecewise exponential/Arrhenius model depending on whether the progress variable
|
|
is below c_cut, above c_ref, or intermediate.
|
|
|
|
- ` c `: The progress variable (0.0 to 1.0).
|
|
|
|
**Returns:**
|
|
|
|
The computed reaction rate.
|
|
|
|
---
|
|
|
|
### [Function] `threshold_min_max`
|
|
|
|
```fortran
|
|
function threshold_min_max(c, minc, maxc)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Function] `positive`
|
|
|
|
```fortran
|
|
function positive(c)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|
|
### [Function] `negative`
|
|
|
|
```fortran
|
|
function negative(c)
|
|
```
|
|
|
|
*No description provided.*
|
|
|
|
---
|
|
|