This module contains data type and modules related to musubi lattice to physical unit convertion and vice versa. \n physics data type is global for all scheme, it is defined in the following format: \n
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: 1. add this new factor into mus_convertFac_type 2. add the defination of factor inside routine mus_set_convFac 3. add this new factor into routine mus_physics_out
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 | |
real(kind=rk), | public, | parameter | :: | gasConst_R | = | 8.3144621_rk |
This type contains the converstion factor for derived variables from lattice to physical.\n Their inverses can be used to convert physical to lattice units use reference density to parmeterize kg and reference mole density to parmeterize mol
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | private | :: | length | length (m) = dx |
|||
real(kind=rk), | private | :: | time | time (s) = dt |
|||
real(kind=rk), | private | :: | vel | velocity(m/s) = dx/dt |
|||
real(kind=rk), | private | :: | visc | kinematic viscosity(m^2/s) = dx^2/dt |
|||
real(kind=rk), | private | :: | viscDyna | Dynamic viscosity (Pa s) = kg/m/s |
|||
real(kind=rk), | private | :: | accel | acceleration(m/s^2) = dx/dt^2 |
|||
real(kind=rk), | private | :: | force | Force(N)(kg m/s^2) = rho0*dx^4/dt^2 |
|||
real(kind=rk), | private | :: | body_force | Force per unit volume (N/m^3)(kg/s^2/m^2) = rho0*dx/dt^2 |
|||
real(kind=rk), | private | :: | press | Pressure(N/m^2)(kg/m/s^2) = rho0*dx^2/dt^2 |
|||
real(kind=rk), | private | :: | strainRate | Strain Rate (1/s) = 1/dt |
|||
real(kind=rk), | private | :: | energy | Energy (N-m) (kgm^2/s^2) = rho0dx^5/dt^2 |
|||
real(kind=rk), | private | :: | chargeDens | mole density(mol/m^3) = mole0/dx^3 Charge density (C/m^3) = Coulomb0/dx^3 |
|||
real(kind=rk), | private | :: | currentDens | Current density (C/s/m^2) = Coulomb0/dt/dx^2 |
|||
real(kind=rk), | private | :: | moleFlux | mole flux(mol/m^2/s) = moleDen0*dx/dt |
|||
real(kind=rk), | private | :: | flux | mass flux(kg/m^2/s) = rho0*dx/dt |
|||
real(kind=rk), | private | :: | diffusivity | diffusivity(m^2/s) = dx^2/dt |
|||
real(kind=rk), | private | :: | faraday | faraday (C/mol) = coulomb0/moleDens0/dx^3 |
|||
real(kind=rk), | private | :: | 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), | private | :: | potential | Potential (V) (kg m^2/(C*S^2)) |
This type contains the basic SI units used to convert lattice to physical unit and vice versa. keep reference mass density, mole density and molecular weight same for all levels.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | private | :: | active | = | .false. | needed to check if physics table is defined |
|
real(kind=rk), | private | :: | dx | = | -1.0_rk | reference length - discretization size of the coarsest level SI unit - meter |
|
real(kind=rk), | private, | allocatable | :: | dxLvl(:) | |||
real(kind=rk), | private | :: | dt | = | -1.0_rk | reference time - time discretization for discretization size of the coarsest level SI unit - seconds |
|
real(kind=rk), | private, | allocatable | :: | dtLvl(:) | |||
real(kind=rk), | private | :: | rho0 | = | -1.0_rk | reference physical mass density SI unit - kg/m^3 |
|
real(kind=rk), | private | :: | moleDens0 | = | -1.0_rk | reference physical mole density SI unit - mol/m^3 |
|
real(kind=rk), | private | :: | molWeight0 | = | -1.0_rk | reference molecular weight SI unit - kg/mol |
|
real(kind=rk), | private | :: | temp0 | = | -1.0_rk | reference temperature SI unit - Kelvin |
|
real(kind=rk), | private | :: | coulomb0 | = | -1.0_rk | reference fundamental electrical charge SI unit - Coulomb |
|
real(kind=rk), | private | :: | mole0 | = | -1.0_rk | mole is defined by inverse of Avogadro Constant Avogadro Constant = 6.02214129e23 [1/mol] |
|
real(kind=rk), | private | :: | mass0 | = | -1.0_rk | reference mass in kg derived from density or moleweight SI unit :: kg |
|
type(mus_convertFac_type), | private, | 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), | private, | 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), | private, | allocatable | :: | vFac(:,:) | Velocity over level scale factor Its usage is the same as pressure scale factor |
||
real(kind=rk), | private, | 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 |
||
real(kind=rk), | intent(in), | optional | :: | dtRef | reference time step if none |
|
real(kind=rk), | intent(in), | optional | :: | dxRef | reference spacestep if none |
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 |