This module contains data type and modules related to musubi lattice to physical unit convertion and vice versa. physics data type is global for all schemes, it is defined in the following format:
physics = { dt = dt_phy, -- physical time step size
rho0 = rho0_phy, -- reference density
temp0 = t_phy -- reference temperature
}
Of these quantities, dt is mandetory for conversion. Others can be omitted, thus use default values.
To add a new conversion factor, one has to do the following:
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | public, | parameter | :: | coulomb_ref | = | 1.60217657e-19_rk |
Reference coulomb is set to fundamental electrical charge |
real(kind=rk), | public, | parameter | :: | mole_ref | = | 1e-23_rk/6.02214129 |
Reference mole is set to inverse of Avogadro's constant |
real(kind=rk), | public, | parameter | :: | k_b | = | 1.38064852e-23_rk |
the boltzmann constant J K^-1 |
real(kind=rk), | public, | parameter | :: | faraday | = | 96485.3365_rk |
Faraday constant C/mol |
real(kind=rk), | public, | parameter | :: | gasConst_R | = | 8.3144621_rk |
Ideal gas constant N m / (mol K) |
This type contains the converstion factor for derived variables from lattice to physical.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | public | :: | length |
length (m) = dx |
|||
real(kind=rk), | public | :: | time |
time (s) = dt |
|||
real(kind=rk), | public | :: | vel |
velocity(m/s) = dx/dt |
|||
real(kind=rk), | public | :: | visc |
kinematic viscosity(m^2/s) = dx^2/dt |
|||
real(kind=rk), | public | :: | viscDyna |
Dynamic viscosity (Pa s) = kg/m/s |
|||
real(kind=rk), | public | :: | accel |
acceleration(m/s^2) = dx/dt^2 |
|||
real(kind=rk), | public | :: | force |
Force(N)(kg m/s^2) = rho0*dx^4/dt^2 |
|||
real(kind=rk), | public | :: | body_force |
Force per unit volume (N/m^3)(kg/s^2/m^2) = rho0*dx/dt^2 |
|||
real(kind=rk), | public | :: | press |
Pressure(N/m^2)(kg/m/s^2) = rho0*dx^2/dt^2 |
|||
real(kind=rk), | public | :: | strainRate |
Strain Rate (1/s) = 1/dt |
|||
real(kind=rk), | public | :: | energy |
Energy (N-m) (kgm^2/s^2) = rho0dx^5/dt^2 |
|||
real(kind=rk), | public | :: | chargeDens |
mole density(mol/m^3) = mole0/dx^3 Charge density (C/m^3) = Coulomb0/dx^3 |
|||
real(kind=rk), | public | :: | currentDens |
Current density (C/s/m^2) = Coulomb0/dt/dx^2 |
|||
real(kind=rk), | public | :: | moleFlux |
mole flux(mol/m^2/s) = moleDen0*dx/dt |
|||
real(kind=rk), | public | :: | flux |
mass flux(kg/m^2/s) = rho0*dx/dt |
|||
real(kind=rk), | public | :: | diffusivity |
diffusivity(m^2/s) = dx^2/dt |
|||
real(kind=rk), | public | :: | faraday |
faraday (C/mol) = coulomb0/moleDens0/dx^3 |
|||
real(kind=rk), | public | :: | gasConst |
gas constant (J/mol/K) (N m/mol/K) (kg m^2/s^2/mol/K) = rho0*dx^5/dt^2/mole0/temp0 |
|||
real(kind=rk), | public | :: | potential |
Potential (V) (kg m^2/(C*S^2)) |
This type contains the reference values as defined in the physics table by the user
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | active | = | .false. |
needed to check if physics table is defined |
|
real(kind=rk), | public | :: | dx | = | -1.0_rk |
reference length - discretization size of the coarsest level SI unit - meter |
|
real(kind=rk), | public, | allocatable | :: | dxLvl(:) | |||
real(kind=rk), | public | :: | dt | = | -1.0_rk |
reference time - time discretization for discretization size of the coarsest level SI unit - seconds |
|
real(kind=rk), | public, | allocatable | :: | dtLvl(:) | |||
real(kind=rk), | public | :: | rho0 | = | -1.0_rk |
reference physical mass density SI unit - kg/m^3 |
|
real(kind=rk), | public | :: | moleDens0 | = | -1.0_rk |
reference physical mole density SI unit - mol/m^3 |
|
real(kind=rk), | public | :: | molWeight0 | = | -1.0_rk |
reference molecular weight SI unit - kg/mol |
|
real(kind=rk), | public | :: | temp0 | = | -1.0_rk |
reference temperature SI unit - Kelvin |
|
real(kind=rk), | public | :: | coulomb0 | = | -1.0_rk |
reference fundamental electrical charge SI unit - Coulomb |
|
real(kind=rk), | public | :: | mole0 | = | -1.0_rk |
mole is defined by inverse of Avogadro Constant Avogadro Constant = 6.02214129e23 [1/mol] |
|
real(kind=rk), | public | :: | mass0 | = | -1.0_rk |
reference mass in kg derived from density or moleweight SI unit :: kg |
|
type(mus_convertFac_type), | public, | allocatable | :: | fac(:) |
Level-wise conversion factor for derived variables size: minLevel:maxLevel allocated in mus_load_physics \todo KM: conversion factor should not be level-dependent. it should be same for all levels, the lattice dx and dt for each level must be considered to scale variables in multilevel. Implemented force, visc, etc using dtL according to formula Introduced lattice speed variable: dx/dt for each level it should be same for all level for acoustic scaling and different for diffusive scaling |
||
real(kind=rk), | public, | allocatable | :: | pFac(:,:) |
Pressure (strain rate) over level scale factor. This factor is meant to convert pressure in LB unit on source level to the required pressure on target level. It is mainly used in interpolation routine. It is allocated as: allocate(pFac( minLevel:maxLevel, minLevel:maxLevel)) It is allocated and initialized in routine: mus_set_scaleFac How to use it in the code: pTargetLevel = pSourceLevel * pFac( sourceLevel, targetLevel ) |
||
real(kind=rk), | public, | allocatable | :: | vFac(:,:) |
Velocity over level scale factor Its usage is the same as pressure scale factor |
||
real(kind=rk), | public, | allocatable | :: | sFac(:,:) |
Strain rate over level scale factor Its usage is the same as pressure scale factor |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | valMinLevel | |||
integer, | intent(in) | :: | minLevel | |||
integer, | intent(in) | :: | maxLevel | |||
integer, | intent(in) | :: | scaleFac |
This routine loads the physics table from musubi config file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(out) | :: | me |
physics type |
||
type(flu_State) | :: | conf |
flu state |
|||
type(treelmesh_type), | intent(in) | :: | tree |
global treelm mesh |
||
integer, | intent(in) | :: | scaleFactor |
scaling factor: diffusive -> 4; acoustic -> 2 |
This routine computed conversion factors for lattice to physical units. inverse of this factors can be used to convert from physical to lattice units.\n use reference density to parmeterize kg and reference mole density to parmeterize mol.\n Multiply these factors with the LB quantity to get the physical quantity Divide the physical quantity by these factors to get the LB units.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | minLevel | |||
integer, | intent(in) | :: | maxLevel |
This routine creates musubi specific lua function to compute dx and dt.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | fun_str |
This string contains lua functions to compute dt from visocosity or velocity |
This routine write reference physics parameters into solver specific string in lua format.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(in) | :: | me | |||
type(aot_out_type) | :: | conf |
This routine write physics convert factor into solver specific string in lua format. use reference density to parmeterize kg and reference mole density to parmeterize mol.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(in) | :: | me | |||
type(aot_out_type) | :: | conf | ||||
integer, | intent(in) | :: | minLevel | |||
integer, | intent(in) | :: | maxLevel |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(in) | :: | me | |||
integer, | intent(in) | :: | outUnit | |||
integer, | intent(in) | :: | minLevel | |||
integer, | intent(in) | :: | maxLevel |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_physics_type), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | minLevel | |||
integer, | intent(in) | :: | maxLevel |