-- 2D Transport test with point source Multigroup Adjoint generation
-- SDM: PWLD
-- Test: None
num_procs = 4
--############################################### Check num_procs
if (check_num_procs==nil and chi_number_of_processes ~= num_procs) then
chiLog(LOG_0ERROR,
"Incorrect amount of processors. " ..
"Expected "..tostring(num_procs)..
". Pass check_num_procs=false to override if possible.")
os.exit(false)
end
--############################################### Setup mesh
nodes={}
N=60
L=5.0
ds=L/N
xmin=0.0
for i=0,N do
nodes[i+1] = xmin + i*ds
end
----###############################################
Set Material IDs
vol0 = NewRPP({infx=true, infy=true, infz=true})
vol1 = NewRPP({ymin=0.0,ymax=0.8*L,infx=true,infz=true})
----############################################### Set Material IDs
vol0b = NewRPP({xmin=-0.166666+2.5,xmax=0.166666+2.5,infy=true,infz=true})
vol1b = NewRPP({xmin=-1+2.5,xmax=1+2.5,ymin=0.9*L,ymax=L,infz=true})
--############################################### Add materials
materials = {}
num_groups = 10
TRANSPORT_XSECTIONS,
SIMPLEXS1,num_groups,0.01,0.01)
TRANSPORT_XSECTIONS,
SIMPLEXS1,num_groups,0.1*20,0.8)
src={}
for g=1,num_groups do
src[g] = 0.0
end
src[1] = 0.0
src[1] = 0.0
src[1] = 1.0
--############################################### Setup Physics
lbs_block =
{
num_groups = num_groups,
groupsets =
{
{
groups_from_to = {0, num_groups-1},
angular_quadrature_handle = pquad0,
inner_linear_method = "gmres",
l_abs_tol = 1.0e-6,
l_max_its = 500,
gmres_restart_interval = 100,
},
}
}
lbs_options =
{
scattering_order = 1,
}
--############################################### Initialize and Execute Solver
lbs.SetOptions(phys1, lbs_options)
--############################################### Create QOIs
tvol0 = NewRPP({xmin=2.3333,xmax=2.6666,ymin=4.16666,ymax=4.33333,infz=true})
tvol1 = NewRPP({xmin=0.5 ,xmax=0.8333,ymin=4.16666,ymax=4.33333,infz=true})
function ResponseFunction(cell_centroid, material_id)
response = {}
for g=0,9 do
response[g+1] = 0.0
end
response[5+1] = 1.0
return response
end
ss_solver =
lbs.SteadyStateSolver.Create({lbs_solver_handle = phys1})
--############################################### Get field functions
--############################################### Slice plot
--############################################### Volume integrations
--############################################### Exports
if master_export == nil then
end
void chiLog(int LogType, char LogMsg)
MaterialHandle chiPhysicsAddMaterial(char Name)
void chiPhysicsMaterialAddProperty(int MaterialHandle, int PropertyIndex)
void chiPhysicsMaterialSetProperty(int MaterialHandle, int PropertyIndex, int OperationIndex, varying Information)
Returns chiCreateProductQuadrature(int QuadratureType, varying values)
void chiOptimizeAngularQuadratureForPolarSymmetry(in handle, double normalization)
void chiVolumeMesherSetProperty(int PropertyIndex, varying PropertyValue)
void chiSolverSetBasicOption(int solver_handle, string option_name, varying option_value)
void chiSolverExecute(int solver_handle)
void chiSolverInitialize(int solver_handle)
void chiLBSWriteFluxMoments(int SolverIndex, string file_base)
void chiAdjointSolverAddResponseFunction()
handle chiGetFieldFunctionHandleByName(string FFname)
void chiExportMultiFieldFunctionToVTK(table listFFHandles, char BaseName)
void Set(VecDbl &x, const double &val)