Chi-Tech
test_framework_tutorials_tutorial_93_raytracing_lua.h
Go to the documentation of this file.
1
/** \page test_framework_tutorials_tutorial_93_raytracing_lua test/framework/tutorials/tutorial_93_raytracing.lua
2
\ingroup LuaInputExamples
3
4
\code
5
--############################################### Setup mesh
6
if (nmesh==nil) then nmesh = 11 end
7
8
nodes={}
9
N=nmesh
10
L=11.0
11
xmin = -L/2
12
dx = L/N
13
for i=1,(N+1) do
14
k=i-1
15
nodes[i] = xmin + k*dx
16
end
17
18
meshgen1 = chi_mesh.OrthogonalMeshGenerator.Create({ node_sets = {nodes,nodes} })
19
chi_mesh.MeshGenerator.Execute(meshgen1)
20
21
--############################################### Set Material IDs
22
chiVolumeMesherSetMatIDToAll(0)
23
24
chiVolumeMesherSetupOrthogonalBoundaries()
25
26
chi_unit_tests.chiSimTest93_RayTracing()
27
28
29
--###############################################
30
--############################################### Add materials
31
materials = {}
32
materials[1] = chiPhysicsAddMaterial("Test Material");
33
34
chiPhysicsMaterialAddProperty(materials[1],TRANSPORT_XSECTIONS)
35
36
num_groups = 1
37
chiPhysicsMaterialSetProperty(materials[1],
38
TRANSPORT_XSECTIONS,
39
SIMPLEXS0,1,0.27)
40
41
42
43
----############################################### Setup Physics
44
--solver_name = "LBS"
45
--phys1 = chiLBSCreateSolver(solver_name)
46
--
47
----========== Groups
48
--grp = {}
49
--for g=1,num_groups do
50
-- grp[g] = chiLBSCreateGroup(phys1)
51
--end
52
--
53
----========== ProdQuad
54
--pquad = chiCreateProductQuadrature(GAUSS_LEGENDRE_CHEBYSHEV,12*2*4, 12*4)
55
--chiOptimizeAngularQuadratureForPolarSymmetry(pquad, 4.0*math.pi)
56
--
57
----========== Groupset def
58
--gs0 = chiLBSCreateGroupset(phys1)
59
--cur_gs = gs0
60
--chiLBSGroupsetAddGroups(phys1,cur_gs,0,num_groups-1)
61
--chiLBSGroupsetSetQuadrature(phys1,cur_gs,pquad)
62
--chiLBSGroupsetSetAngleAggDiv(phys1,cur_gs,1)
63
--chiLBSGroupsetSetGroupSubsets(phys1,cur_gs,1)
64
--chiLBSGroupsetSetIterativeMethod(phys1,cur_gs,KRYLOV_RICHARDSON)
65
--chiLBSGroupsetSetResidualTolerance(phys1,cur_gs,1.0e-6)
66
--chiLBSGroupsetSetMaxIterations(phys1,cur_gs,0)
67
--chiLBSGroupsetSetGMRESRestartIntvl(phys1,cur_gs,100)
68
--
69
----############################################### Set boundary conditions
70
--
71
----############################################### Add point source
72
--src={}
73
--for g=1,num_groups do
74
-- src[g] = 0.0
75
--end
76
--src[1] = 1.0
77
--chiLBSAddPointSource(phys1, 0.0, 0.0, 0.0, src)
78
--
79
----############################################### Set solver properties
80
--chiLBSSetProperty(phys1,DISCRETIZATION_METHOD,PWLD)
81
--chiLBSSetProperty(phys1,SCATTERING_ORDER,0)
82
--
83
----############################################### Initialize and Execute Solver
84
--chiSolverInitialize(phys1)
85
--chiSolverExecute(phys1)
86
87
88
89
90
91
92
--############################################### Setup Physics
93
solver_name = "LBS"
94
pquad = chiCreateProductQuadrature(GAUSS_LEGENDRE_CHEBYSHEV,12*2*4, 12*4)
95
chiOptimizeAngularQuadratureForPolarSymmetry(pquad, 4.0*math.pi)
96
lbs_block =
97
{
98
name = solver_name,
99
num_groups = num_groups,
100
groupsets =
101
{
102
{
103
groups_from_to = {0, num_groups-1},
104
angular_quadrature_handle = pquad,
105
inner_linear_method = "richardson",
106
l_abs_tol = 1.0e-6,
107
l_max_its = 0,
108
}
109
},
110
options = {scattering_order = 0, field_function_prefix = solver_name}
111
}
112
113
phys1 = lbs.DiscreteOrdinatesSolver.Create(lbs_block)
114
115
--############################################### Add point source
116
src={}
117
for g=1,num_groups do
118
src[g] = 0.0
119
end
120
src[1] = 1.0
121
chiLBSAddPointSource(phys1, 0.0, 0.0, 0.0, src)
122
123
--############################################### Initialize and Execute Solver
124
ss_solver = lbs.SteadyStateSolver.Create({lbs_solver_handle = phys1})
125
126
chiSolverInitialize(ss_solver)
127
chiSolverExecute(ss_solver)
128
129
ff_m0 = chiLBSGetScalarFieldFunctionList(phys1)
130
131
chiExportMultiFieldFunctionToVTK({ff_m0[1]},"SimTest_93_LBS_"..solver_name)
132
chiMPIBarrier()
133
if (chi_location_id == 0) then
134
os.execute("rm SimTest_93*")
135
end\endcode
136
*/
137
138
doc
generated_files
test
framework
tutorials
test_framework_tutorials_tutorial_93_raytracing_lua.h
Generated by
1.9.3