Chi-Tech
doc_Bb_bcs.h
Go to the documentation of this file.
1/** \page LBSBCs Boundary Conditions
2
3LBS supports the boundary condition `"incident_anisotropic_heterogeneous"`,
4which allows for a very intricate type of boundary condition to be specified.
5
6For example, consider the boundary condition applied to boundary `zmax` below:
7\code
8chiLBSSetOptions(phys1,
9{
10 spatial_discretization = "pwld",
11 scattering_order = 2,
12 boundary_conditions =
13 {
14 { name = "zmax", type = "incident_anisotropic_heterogeneous",
15 function_name = "luaBoundaryFunctionA"},
16 }
17})
18\endcode
19
20It points to the lua function `"luaBoundaryFunctionA"`. This lua function will
21be called with the following parameters:
22```
23size_t cell_global_id,
24int cell_material_id,
25unsigned int face_index,
26unsigned int face_node_index,
27const chi_mesh::Vector3& face_node_location,
28const chi_mesh::Vector3& face_node_normal,
29const std::vector<int>& quadrature_angle_indices,
30const std::vector<chi_mesh::Vector3>& quadrature_angle_vectors,
31const std::vector<std::pair<double,double>>& quadrature_phi_theta_angles,
32const std::vector<int>& group_indices,
33double evaluation_time;
34```
35and must return a 1D array of data-values ordered first by angle index, then
36by group index, e.g., n0g0, n0g1, n0g2, n1g0, n1g1, n1g2, etc.
37
38Example lua function:
39\code
40function luaBoundaryFunctionA(cell_global_id,
41 material_id,
42 location,
43 normal,
44 quadrature_angle_indices,
45 quadrature_angle_vectors,
46 quadrature_phi_theta_angles,
47 group_indices)
48 num_angles = rawlen(quadrature_angle_vectors)
49 num_groups = rawlen(group_indices)
50 psi = {}
51 dof_count = 0
52
53 for ni=1,num_angles do
54 omega = quadrature_angle_vectors[ni]
55 phi_theta = quadrature_phi_theta_angles[ni]
56 for gi=1,num_groups do
57 g = group_indices[gi]
58
59 value = 1.0
60
61 dof_count = dof_count + 1
62 psi[dof_count] = value
63 end
64 end
65
66 return psi
67end
68\endcode
69
70An example of a very intricate use of this functionality can be seen in the
71test \ref tests_Transport_Steady_Transport2D_5PolyA_AniHeteroBndry_lua
72
73\ingroup LBSUtilities */