Chi-Tech
test/modules/Diffusion/Diffusion2D_2Unstructured_IP.lua
-- 2D Diffusion test with Dirichlet BCs.
-- SDM: PWLD
-- Test: Max-value=0.29685
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
meshgen1 = chi_mesh.MeshGenerator.Create
({
inputs =
{
({
filename = "../../../resources/TestMeshes/TriangleMesh2x2.obj"
})
}
})
--############################################### Set Material IDs
vol0 = chi_mesh.RPPLogicalVolume.Create({infx=true, infy=true, infz=true})
--############################################### Add materials
materials = {}
materials[0] = chiPhysicsAddMaterial("Test Material");
chiPhysicsMaterialAddProperty(materials[0],SCALAR_VALUE)
chiPhysicsMaterialSetProperty(materials[0],SCALAR_VALUE,SINGLE_VALUE,1.0)
--############################################### Setup Physics
chiSolverSetBasicOption(phys1,"discretization_method","PWLD_MIP")
chiSolverSetBasicOption(phys1,"residual_tolerance",1.0e-6)
--############################################### Set boundary conditions
--chiDiffusionSetProperty(phys1,"boundary_type",0,"reflecting",1.0)
--chiDiffusionSetProperty(phys1,"boundary_type",1,"vacuum",2.0)
--chiDiffusionSetProperty(phys1,"boundary_type",2,"reflecting",3.0)
--chiDiffusionSetProperty(phys1,"boundary_type",3,"vacuum",4.0)
--############################################### Initialize and Execute Solver
--############################################### Get field functions
fftemp,count = chiSolverGetFieldFunctionList(phys1)
--############################################### Slice plot
slice2 = chiFFInterpolationCreate(SLICE)
chiFFInterpolationSetProperty(slice2,SLICE_POINT,0.0,0.0,0.025)
chiFFInterpolationSetProperty(slice2,ADD_FIELDFUNCTION,fftemp[1])
--############################################### Line plot
chiFFInterpolationSetProperty(line0,LINE_FIRSTPOINT,-1.0,0.01,0.0)
chiFFInterpolationSetProperty(line0,LINE_SECONDPOINT, 1.0,0.01,0.0)
chiFFInterpolationSetProperty(line0,LINE_NUMBEROFPOINTS, 100)
chiFFInterpolationSetProperty(line0,ADD_FIELDFUNCTION,fftemp[1])
--############################################### Volume integrations
curffi = ffi1
chiFFInterpolationSetProperty(curffi,OPERATION,OP_MAX)
chiFFInterpolationSetProperty(curffi,LOGICAL_VOLUME,vol0)
chiFFInterpolationSetProperty(curffi,ADD_FIELDFUNCTION,fftemp[1])
chiLog(LOG_0,string.format("Max-value=%.5f", maxval))
--############################################### Exports
if (master_export == nil) then
end
--############################################### Plots
if ((master_export == nil) and (chi_location_id == 0)) then
local handle = io.popen("python3 ZPFFI00.py")
local handle = io.popen("python3 ZLFFI10.py")
end
virtual void Execute()
Success chiDiffusionInitialize(int SolverHandle)
void chiDiffusionSetProperty(int SolverHandle, string PropertyName, varying Values)
Handle chiDiffusionCreateSolver()
Success chiDiffusionExecute(int SolverHandle)
void chiFFInterpolationExportPython(int FFIHandle, char BaseName)
Handle chiFFInterpolationCreate(int FFITypeIndex)
void chiFFInterpolationExecute(int FFIHandle)
void chiFFInterpolationGetValue(int FFIHandle)
void chiFFInterpolationInitialize(int FFIHandle)
Handle chiFFInterpolationSetProperty(int FFIHandle, int PropertyIndex)
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)
void chiVolumeMesherSetProperty(int PropertyIndex, varying PropertyValue)
void chiVolumeMesherSetupOrthogonalBoundaries()
void chiSolverSetBasicOption(int solver_handle, string option_name, varying option_value)
void chiSolverGetFieldFunctionList(int SolverHandle)
void chiExportFieldFunctionToVTK(int FFHandle, char BaseName)
void Set(VecDbl &x, const double &val)