MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_body_forces Module Reference

Computes gravitational and body force source terms for the momentum equations. More...

Functions/Subroutines

pure logical function f_is_fluid_cell (marks, j, k, l)
 True for a cell outside every immersed boundary.
pure real(wp) function f_fluid_volume (marks, j, k, l)
 Volume of the fluid in cell (j, k, l): zero inside an immersed boundary.
impure subroutine, public s_initialize_body_forces_module
 Initialize the body forces module. When synthetic_turbulence is enabled, generates random wave vectors for each energy shell on rank 0, then broadcasts to all MPI ranks and copies to GPU.
impure subroutine s_initialize_body_force_with_spatial_support
 Initialize a body force with spatial support presented in Wei & Freund (JFM, 2005).
subroutine s_compute_acceleration (t)
 Compute the acceleration at time t.
subroutine s_compute_body_force_with_spatial_support (t, bounds)
 Apply the body force of Wei & Freund (JFM, 2005).
subroutine s_compute_mixture_density (q_cons_vf, bounds)
 Compute the mixture density at each cell center.
subroutine, public s_compute_body_forces_rhs (q_prim_vf, q_cons_vf, rhs_vf, bounds, q_t_sf)
 Compute the body force source terms for momentum and energy equations.
subroutine s_compute_mts_terms (q_cons_vf, q_t_sf)
 Source terms of the thermally developed state, psi = T - T_s, central in x: g1 = rho cp u psi - d(lam psi)/dx - lam dpsi/dx, g2 = lam psi, for every cell. The applied source S = beta (g1 + beta g2) and the controller's A1 = sum(g1 dV), A2 = sum(g2 dV) share them.
subroutine, public s_apply_bodyforces (q_cons_vf, q_prim_vf_in, rhs_vf_in, ldt, q_t_sf)
 Apply the body forces source term at each Runge-Kutta stage.
subroutine, public s_apply_synthetic_turbulence_force (q_cons_vf, q_prim_vf_in, rhs_vf_in, ldt)
 Adds the synthetic turbulence forcing to the momentum and energy over the stage's local dt.
impure subroutine s_open_history (unit, fname)
 Rank 0 opens a per-step history file in case_dir, appending on restart.
subroutine s_mean_controller (src, y, y_old, y_target, gain, c)
 Integral (deadbeat for G = 1 and a constant load) update of a mean source s holding a fluid-mean quantity y at y_target: s += (G/dt) c (y_target - 2y^n + y^(n-1)), c the source-to-y capacity. y_old carries y^(n-1) between steps.
impure subroutine, public s_update_mean_sources (q_cons_vf, q_t_sf, t_step)
 Once per step, fluid-cell averages driving the mean sources (sums over fluid cells). Mean pressure gradient: bulk mass flux Q_i = sum(rho u_i dV)/sum(dV), controlled to mean_mflux(i) by -dP/dx; logged to mean_dpdx.dat. Thermostat: mass-averaged temperature T_b = sum(rho T dV)/sum(rho dV), controlled to mean_temp by the heat source with capacity rho c_v (fluid mean); logged to mean_temp.dat with the mixing-cup T_m = sum(rho u_1 T dV)/sum(rho u_1 dV) and the fluid volume. With mean_temp_wall, the controller holds T_m instead and beta solves source total = beta (A1 + beta A2), A1 = sum(rho cp u_1 psi dV), A2 = sum(lam psi dV), psi = T - T_s, with A1 including the discrete conduction terms of the applied source; beta, A1, A2 are logged too.
subroutine, public s_compute_synthetic_forces_rhs (q_prim_vf, q_cons_vf, rhs_vf)
 Compute the synthetic turbulence RHS contribution.
impure subroutine, public s_finalize_body_forces_module
 Finalize the body forces module.

Variables

logical, dimension(3) mpg_dir
 Mean pressure gradient active in this direction.
real(wp), dimension(3) mflux_old
 Previous-step bulk mass flux, for the controller.
integer mpg_unit
 mean_dpdx.dat history file unit
logical mts_on
 Mean gas heat source (thermostat) active.
real(wp) temp_old
 Previous-step bulk temperature, for the controller.
logical mts_sim
 Self-similar thermostat (mean_temp_wall set).
real(wp) mts_beta
 Its streamwise decay rate beta [1/m].
integer mts_unit
 mean_temp.dat history file unit
logical mts_warned = .false.
 The beta quadratic had no real root (reported once).
integer, parameter spbf_num_freq = 8
real(wp) spbf_amp
real(wp) spbf_xc
real(wp) spbf_yc
real(wp) spbf_conv_vel
real(wp) spbf_sigma
real(wp), dimension(:), allocatable freq
real(wp), dimension(:), allocatable phase
real(wp), dimension(:,:,:), allocatable rhom
real(wp), dimension(:,:,:), allocatable mts_g1
 Self-similar source terms of each cell (s_compute_mts_terms).
real(wp), dimension(:,:,:), allocatable mts_g2
integer num_synthetic_wave_numbers
real(wp), dimension(:), allocatable synthetic_k_x
real(wp), dimension(:), allocatable synthetic_k_y
real(wp), dimension(:), allocatable synthetic_k_z
real(wp), dimension(:), allocatable synthetic_phase
real(wp), dimension(:), allocatable synthetic_amp
real(wp), dimension(:), allocatable synthetic_ex
real(wp), dimension(:), allocatable synthetic_ey
real(wp), dimension(:), allocatable synthetic_ez

Detailed Description

Computes gravitational and body force source terms for the momentum equations.

Function/Subroutine Documentation

◆ f_fluid_volume()

pure real(wp) function m_body_forces::f_fluid_volume ( type(integer_field), intent(in) marks,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l )
private

Volume of the fluid in cell (j, k, l): zero inside an immersed boundary.

Definition at line 499 of file m_body_forces.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_is_fluid_cell()

pure logical function m_body_forces::f_is_fluid_cell ( type(integer_field), intent(in) marks,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) l )
private

True for a cell outside every immersed boundary.

Parameters
[in]marksib_markers, passed so the device routine reads the present copy

Definition at line 470 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_apply_bodyforces()

subroutine, public m_body_forces::s_apply_bodyforces ( type(scalar_field), dimension(1:sys_size), intent(inout) q_cons_vf,
type(scalar_field), dimension(1:sys_size), intent(in) q_prim_vf_in,
type(scalar_field), dimension(1:sys_size), intent(inout) rhs_vf_in,
real(wp), intent(in) ldt,
type(scalar_field), intent(in), optional q_t_sf )

Apply the body forces source term at each Runge-Kutta stage.

Parameters
[in]ldtlocal dt
[in]q_t_sfabsent in the AMR fine advance (mean_temp: no amr)

Definition at line 2005 of file m_body_forces.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_apply_synthetic_turbulence_force()

subroutine, public m_body_forces::s_apply_synthetic_turbulence_force ( type(scalar_field), dimension(1:sys_size), intent(inout) q_cons_vf,
type(scalar_field), dimension(1:sys_size), intent(in) q_prim_vf_in,
type(scalar_field), dimension(1:sys_size), intent(inout) rhs_vf_in,
real(wp), intent(in) ldt )

Adds the synthetic turbulence forcing to the momentum and energy over the stage's local dt.

Parameters
[in]ldtlocal dt

Definition at line 2066 of file m_body_forces.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_acceleration()

subroutine m_body_forces::s_compute_acceleration ( real(wp), intent(in) t)
private

Compute the acceleration at time t.

Definition at line 1340 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_compute_body_force_with_spatial_support()

subroutine m_body_forces::s_compute_body_force_with_spatial_support ( real(wp), intent(in) t,
type(int_bounds_info), dimension(1:3), intent(in) bounds )
private

Apply the body force of Wei & Freund (JFM, 2005).

Definition at line 1380 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_compute_body_forces_rhs()

subroutine, public m_body_forces::s_compute_body_forces_rhs ( type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(inout) rhs_vf,
type(int_bounds_info), dimension(1:3), intent(in) bounds,
type(scalar_field), intent(in), optional q_t_sf )

Compute the body force source terms for momentum and energy equations.

Definition at line 1555 of file m_body_forces.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_mixture_density()

subroutine m_body_forces::s_compute_mixture_density ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(int_bounds_info), dimension(1:3), intent(in) bounds )
private

Compute the mixture density at each cell center.

Definition at line 1499 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_compute_mts_terms()

subroutine m_body_forces::s_compute_mts_terms ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), intent(in) q_t_sf )
private

Source terms of the thermally developed state, psi = T - T_s, central in x: g1 = rho cp u psi - d(lam psi)/dx - lam dpsi/dx, g2 = lam psi, for every cell. The applied source S = beta (g1 + beta g2) and the controller's A1 = sum(g1 dV), A2 = sum(g2 dV) share them.

Definition at line 1909 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_compute_synthetic_forces_rhs()

subroutine, public m_body_forces::s_compute_synthetic_forces_rhs ( type(scalar_field), dimension(sys_size), intent(in) q_prim_vf,
type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), dimension(sys_size), intent(inout) rhs_vf )

Compute the synthetic turbulence RHS contribution.

Each Fourier mode m has wave vector k_m and a pre-computed solenoidal (divergence-free) direction e_m perpendicular to k_m. The force field is F = rho * (sum_m A_m * cos(k_m.(x-U*t*xhat) + phi_m) * e_m) * (U/Lx) * G. This excites all velocity components correctly and is zero outside the bounding box of the Gaussian window.

Definition at line 2372 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_finalize_body_forces_module()

impure subroutine, public m_body_forces::s_finalize_body_forces_module

Finalize the body forces module.

Definition at line 2549 of file m_body_forces.fpp.f90.

◆ s_initialize_body_force_with_spatial_support()

impure subroutine m_body_forces::s_initialize_body_force_with_spatial_support
private

Initialize a body force with spatial support presented in Wei & Freund (JFM, 2005).

Definition at line 1154 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_initialize_body_forces_module()

impure subroutine, public m_body_forces::s_initialize_body_forces_module

Initialize the body forces module. When synthetic_turbulence is enabled, generates random wave vectors for each energy shell on rank 0, then broadcasts to all MPI ranks and copies to GPU.

Definition at line 532 of file m_body_forces.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_mean_controller()

subroutine m_body_forces::s_mean_controller ( real(wp), intent(inout) src,
real(wp), intent(in) y,
real(wp), intent(inout) y_old,
real(wp), intent(in) y_target,
real(wp), intent(in) gain,
real(wp), intent(in) c )
private

Integral (deadbeat for G = 1 and a constant load) update of a mean source s holding a fluid-mean quantity y at y_target: s += (G/dt) c (y_target - 2y^n + y^(n-1)), c the source-to-y capacity. y_old carries y^(n-1) between steps.

Definition at line 2142 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_open_history()

impure subroutine m_body_forces::s_open_history ( integer, intent(out) unit,
character(len=*), intent(in) fname )
private

Rank 0 opens a per-step history file in case_dir, appending on restart.

Definition at line 2126 of file m_body_forces.fpp.f90.

Here is the caller graph for this function:

◆ s_update_mean_sources()

impure subroutine, public m_body_forces::s_update_mean_sources ( type(scalar_field), dimension(sys_size), intent(in) q_cons_vf,
type(scalar_field), intent(in) q_t_sf,
integer, intent(in) t_step )

Once per step, fluid-cell averages driving the mean sources (sums over fluid cells). Mean pressure gradient: bulk mass flux Q_i = sum(rho u_i dV)/sum(dV), controlled to mean_mflux(i) by -dP/dx; logged to mean_dpdx.dat. Thermostat: mass-averaged temperature T_b = sum(rho T dV)/sum(rho dV), controlled to mean_temp by the heat source with capacity rho c_v (fluid mean); logged to mean_temp.dat with the mixing-cup T_m = sum(rho u_1 T dV)/sum(rho u_1 dV) and the fluid volume. With mean_temp_wall, the controller holds T_m instead and beta solves source total = beta (A1 + beta A2), A1 = sum(rho cp u_1 psi dV), A2 = sum(lam psi dV), psi = T - T_s, with A1 including the discrete conduction terms of the applied source; beta, A1, A2 are logged too.

Definition at line 2161 of file m_body_forces.fpp.f90.

Here is the call graph for this function:

Variable Documentation

◆ freq

real(wp), dimension(:), allocatable m_body_forces::freq
private

Definition at line 404 of file m_body_forces.fpp.f90.

◆ mflux_old

real(wp), dimension(3) m_body_forces::mflux_old
private

Previous-step bulk mass flux, for the controller.

Definition at line 390 of file m_body_forces.fpp.f90.

◆ mpg_dir

logical, dimension(3) m_body_forces::mpg_dir
private

Mean pressure gradient active in this direction.

Definition at line 389 of file m_body_forces.fpp.f90.

◆ mpg_unit

integer m_body_forces::mpg_unit
private

mean_dpdx.dat history file unit

Definition at line 391 of file m_body_forces.fpp.f90.

◆ mts_beta

real(wp) m_body_forces::mts_beta
private

Its streamwise decay rate beta [1/m].

Definition at line 395 of file m_body_forces.fpp.f90.

◆ mts_g1

real(wp), dimension(:,:,:), allocatable m_body_forces::mts_g1
private

Self-similar source terms of each cell (s_compute_mts_terms).

Definition at line 407 of file m_body_forces.fpp.f90.

◆ mts_g2

real(wp), dimension(:,:,:), allocatable m_body_forces::mts_g2
private

Definition at line 407 of file m_body_forces.fpp.f90.

◆ mts_on

logical m_body_forces::mts_on
private

Mean gas heat source (thermostat) active.

Definition at line 392 of file m_body_forces.fpp.f90.

◆ mts_sim

logical m_body_forces::mts_sim
private

Self-similar thermostat (mean_temp_wall set).

Definition at line 394 of file m_body_forces.fpp.f90.

◆ mts_unit

integer m_body_forces::mts_unit
private

mean_temp.dat history file unit

Definition at line 396 of file m_body_forces.fpp.f90.

◆ mts_warned

logical m_body_forces::mts_warned = .false.
private

The beta quadratic had no real root (reported once).

Definition at line 397 of file m_body_forces.fpp.f90.

◆ num_synthetic_wave_numbers

integer m_body_forces::num_synthetic_wave_numbers
private

Definition at line 421 of file m_body_forces.fpp.f90.

◆ phase

real(wp), dimension(:), allocatable m_body_forces::phase
private

Definition at line 404 of file m_body_forces.fpp.f90.

◆ rhom

real(wp), dimension(:,:,:), allocatable m_body_forces::rhom
private

Definition at line 405 of file m_body_forces.fpp.f90.

◆ spbf_amp

real(wp) m_body_forces::spbf_amp
private

Definition at line 399 of file m_body_forces.fpp.f90.

◆ spbf_conv_vel

real(wp) m_body_forces::spbf_conv_vel
private

Definition at line 402 of file m_body_forces.fpp.f90.

◆ spbf_num_freq

integer, parameter m_body_forces::spbf_num_freq = 8
private

Definition at line 398 of file m_body_forces.fpp.f90.

◆ spbf_sigma

real(wp) m_body_forces::spbf_sigma
private

Definition at line 403 of file m_body_forces.fpp.f90.

◆ spbf_xc

real(wp) m_body_forces::spbf_xc
private

Definition at line 400 of file m_body_forces.fpp.f90.

◆ spbf_yc

real(wp) m_body_forces::spbf_yc
private

Definition at line 401 of file m_body_forces.fpp.f90.

◆ synthetic_amp

real(wp), dimension(:), allocatable m_body_forces::synthetic_amp
private

Definition at line 436 of file m_body_forces.fpp.f90.

◆ synthetic_ex

real(wp), dimension(:), allocatable m_body_forces::synthetic_ex
private

Definition at line 441 of file m_body_forces.fpp.f90.

◆ synthetic_ey

real(wp), dimension(:), allocatable m_body_forces::synthetic_ey
private

Definition at line 441 of file m_body_forces.fpp.f90.

◆ synthetic_ez

real(wp), dimension(:), allocatable m_body_forces::synthetic_ez
private

Definition at line 441 of file m_body_forces.fpp.f90.

◆ synthetic_k_x

real(wp), dimension(:), allocatable m_body_forces::synthetic_k_x
private

Definition at line 435 of file m_body_forces.fpp.f90.

◆ synthetic_k_y

real(wp), dimension(:), allocatable m_body_forces::synthetic_k_y
private

Definition at line 435 of file m_body_forces.fpp.f90.

◆ synthetic_k_z

real(wp), dimension(:), allocatable m_body_forces::synthetic_k_z
private

Definition at line 435 of file m_body_forces.fpp.f90.

◆ synthetic_phase

real(wp), dimension(:), allocatable m_body_forces::synthetic_phase
private

Definition at line 436 of file m_body_forces.fpp.f90.

◆ temp_old

real(wp) m_body_forces::temp_old
private

Previous-step bulk temperature, for the controller.

Definition at line 393 of file m_body_forces.fpp.f90.