LBS supports the boundary condition
"incident_anisotropic_heterogeneous"
, which allows for a very intricate type of boundary condition to be specified.For example, consider the boundary condition applied to boundary
zmax
below:
chiLBSSetOptions(phys1,
{
spatial_discretization = "pwld",
scattering_order = 2,
boundary_conditions =
{
{ name = "zmax", type = "incident_anisotropic_heterogeneous",
function_name = "luaBoundaryFunctionA"},
}
})
It points to the lua function
"luaBoundaryFunctionA"
. This lua function will be called with the following parameters:
size_t cell_global_id,
int cell_material_id,
unsigned int face_index,
unsigned int face_node_index,
const std::vector<int>& quadrature_angle_indices,
const std::vector<chi_mesh::Vector3>& quadrature_angle_vectors,
const std::vector<std::pair<double,double>>& quadrature_phi_theta_angles,
const std::vector<int>& group_indices,
double evaluation_time;
and must return a 1D array of data-values ordered first by angle index, then by group index, e.g., n0g0, n0g1, n0g2, n1g0, n1g1, n1g2, etc.Example lua function:
function luaBoundaryFunctionA(cell_global_id,
material_id,
location,
normal,
quadrature_angle_indices,
quadrature_angle_vectors,
quadrature_phi_theta_angles,
group_indices)
num_angles = rawlen(quadrature_angle_vectors)
num_groups = rawlen(group_indices)
psi = {}
dof_count = 0
for ni=1,num_angles do
omega = quadrature_angle_vectors[ni]
phi_theta = quadrature_phi_theta_angles[ni]
for gi=1,num_groups do
g = group_indices[gi]
value = 1.0
dof_count = dof_count + 1
psi[dof_count] = value
end
end
return psi
end
An example of a very intricate use of this functionality can be seen in the test tests_Transport_Steady_Transport2D_5PolyA_AniHeteroBndry_lua
LBS solvers create a number of field functions. Here is the logic for it:
- Field functions are by default named
phi_gXXX_mYYY
where XXX
is a zero padded 3 digit number for the group number. YYY
is a zero padded 3 digit number for the moment number. Numbers spanning beyond the 3 digits will have no zero padding and will be represented normally (the 3 digit padding just helps in visualization cases). Example: Suppose this is a 3D simulation, 2 groups, scattering order of 1 (resulting in 4 moments) phys1 = chiLBSCreateSolver()
chiSolverAddRegion(phys1,region1)
--
-- Add Groupset construction here
--
--
chiLBSInitialize(phys1)
chiLBSExecute(phys1)
--
void chiLBSSetProperty(int SolverIndex, int PropertyIndex)
Pair chiLBSGetScalarFieldFunctionList(int SolverIndex)
will create field functions
phi_g000_m000
phi_g000_m001
phi_g000_m002
phi_g000_m003
phi_g001_m000
phi_g001_m001
phi_g001_m002
phi_g001_m003
We can get the scalar field functions with a call to
chiLBSGetScalarFieldFunctionList
which will return a table with the field function handles of only the scalar fields. E.g.,
with fflist
containing handles to
phi_g000_m000
phi_g001_m000
Additionally, LBS can create a power generation field function with the default name
power_generation
.
chiLBSSetOptions(phys1,
{
spatial_discretization = "pwld",
scattering_order = 2,
power_field_function_on = true,
power_default_kappa = 1.0,
power_normalization = -1.0, --Negative means its disabled
})
All of the field function can be supplied with a prefix, either using the solver name
chiLBSSetOptions(phys1,
{
spatial_discretization = "pwld",
scattering_order = 2,
power_field_function_on = true,
power_default_kappa = 1.0,
power_normalization = -1.0, --Negative means its disabled
field_function_prefix_option = "solver_name"
})
or by setting a different prefix
chiLBSSetOptions(phys1,
{
spatial_discretization = "pwld",
scattering_order = 2,
power_field_function_on = true,
power_default_kappa = 1.0,
power_normalization = -1.0, --Negative means its disabled
field_function_prefix = "prefixx"
})