flowx.ins._interface package
Submodules
flowx.ins._interface._mass_balance module
- flowx.ins._interface._mass_balance.get_convvel(grid, ivar)
Get convective outflow velocity.
- Parameters
grid (flowx.Grid object) – Grid containing data.
ivar (string) – Name of the velocity variable on the grid.
- Returns
convvel – Variable containing outflow velocity.
- Return type
float
- flowx.ins._interface._mass_balance.get_qin(grid, ivar)
Compute and return the mass getting in the domain.
- Parameters
grid (flowx.Grid object) – Grid containing data.
ivar (string) – Name of the velocity variable on the grid.
bctype (dictionary) – Type of boundary conditions for the variable ivar.
- Returns
Qin – Mass getting in the domain.
- Return type
float
- flowx.ins._interface._mass_balance.get_qout(grid, ivar)
Compute and return the mass getting out the domain.
- Parameters
grid (flowx.Grid object) – Grid containing data.
ivar (string) – Name of the velocity variable on the grid.
bctype (dictionary) – Type of boundary conditions for the variable ivar.
- Returns
Qout – Mass getting out the domain.
- Return type
float
- flowx.ins._interface._mass_balance.rescale_velocity(grid, ivar, Qin, Qout)
Rescale velocity.
- Parameters
grid (flowx.Grid object) – Grid containing data.
ivar (string) – Name of the velocity variable on the grid.
Qin (float) – Mass in.
Qout (float) – Mass out.
- flowx.ins._interface._mass_balance.rescale_velocity_stub(grid, ivar, Qin, Qout)
Rescale velcoity stub
- Parameters
grid (flowx.Grid object) – Grid containing data.
ivar (string) – Name of the velocity variable on the grid.
Qin (float) – Mass in.
Qout (float) – Mass out.
- flowx.ins._interface._mass_balance.update_outflow_bc(grid, ivar, dt)
Update the value of the velocity at the right boundary.
The function uses a linear convective equation in the x-direction where the convective velocity is defined as the mean x-velocity along the right boundary.
- Parameters
grid (flowx.GridFaceX object) – The grid for the velocity.
ivar (string) – Name of the variable in the Grid structure.
dt (float) – Time-step size.
convvel (float (optional)) – Convective velocity; default: None (will compute the convective velocity).
flowx.ins._interface._operators module
Routine to compute diffusion terms.
- flowx.ins._interface._operators.convective_facex(gridx, gridy, ivar)
Convection operator for the x-face grid.
- Parameters
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable to be operated on.
- Returns
F – Convective terms in the x direction as an array of floats.
- Return type
numpy.ndarray
- flowx.ins._interface._operators.convective_facey(gridx, gridy, ivar)
Convection operator for the the x-face grid.
- Parameters
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable to be operated on.
- Returns
F – Convective terms in the y direction as an array of floats.
- Return type
numpy.ndarray
- flowx.ins._interface._operators.diffusion(grid, ivar, alpha)
Compute the diffusion terms of the variable tagged “ivar”.
- Parameters
grid (grid object) – Grid containing data for a given stencil.
ivar (string) – Name of the grid variable to be operated on.
alpha (float) – Diffusion coefficient.
- Returns
D – Diffusion terms as an array of floats.
- Return type
numpy.ndarray
flowx.ins._interface._projection module
Routine to compute the predictor, corrector, and divergence.
- flowx.ins._interface._projection.corrector(gridc, gridx, gridy, ivar, pvar, delp, ifac, ipres)
Velocity correction in x and y direction.
- Parameters
gridc (grid object (cell center)) – Grid contaning data in cell center.
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable of the velocity solution.
pvar (string) – Name of the grid variable of the pressure solution.
ifac (float) – Time-step size.
- flowx.ins._interface._projection.divergence(gridc, gridx, gridy, ivar, dvar, ifac=1.0)
Compute the divergence of the variable tagged “ivar”.
- Parameters
gridc (grid object) – Grid containing data in on cell centers.
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the face-centered grid variable for velocity.
dvar (string) – Name of the cell-centered grid variable to store divergence.
ifac (float (optional)) – Multiplying factor for time-step; default: 1.0.
- flowx.ins._interface._projection.predictor_ab2(gridc, gridx, gridy, ivar, hvar, pres, Re, ifac, ipres)
Velocity prediction step in x and y direction.
- Parameters
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable of the velocity solution.
hvar (string) – Name of the grid variable to store convective + diffusion terms.
Re (float) – Reynolds number.
ifac (float) – Time-step size.
- flowx.ins._interface._projection.predictor_euler(gridc, gridx, gridy, ivar, hvar, pres, Re, ifac, ipres)
Velocity prediction step in x and y direction.
- Parameters
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable of the velocity solution.
hvar (string) – Name of the grid variable to store convective + diffusion terms.
Re (float) – Reynolds number.
ifac (float) – Time-step size.
- flowx.ins._interface._projection.predictor_rk3(gridc, gridx, gridy, ivar, hvar, pres, Re, ifac, ipres, hconst)
Velocity prediction step in x and y direction.
- Parameters
gridx (grid object (x-direction)) – Grid containing data in x-direction.
gridy (grid object (y-direction)) – Grid containing data in y-direction.
ivar (string) – Name of the grid variable of the velocity solution.
hvar (string) – Name of the grid variable to store convective + diffusion terms.
Re (float) – Reynolds number.
ifac (float) – Time-step size.
flowx.ins._interface._stats module
Routine to gather statistics.
- flowx.ins._interface._stats.stats(gridc, gridx, gridy, ivar, pvar, divc)
Velocity correction in x and y direction.
- Parameters
gridc (grid object (cell center)) – Grid contaning data in cell center
gridx (grid object (x-direction)) – Grid containing data in x-direction
gridy (grid object (y-direction)) – Grid containing data in y-direction
ivar (string) – Name of the grid variable of the velocity solution
pvar (string) – Name of the grid variable of the pressure solution
divc (string) – Name of the grid variable for divergence
- Returns
ins_stats
- Return type
dictionary for stats