Sections:
magpar is based on PETSc, which provides the required parallel data structures, linear algebra operations and solvers. PETSc in turn is based on MPI for message passing and the BLAS and LAPACK libraries (non-parallel) for linear algebra.
PETSc structure
TAO and PVODE are used for energy minimization and dynamic time integration. Mesh partitioning, data compression, and graphics output are done by some more (non-parallel) libraries, Metis, zlib, and libpng, respectively.
Additional libraries
The following figure gives a coarse flow chart of magpar (not quite up to date).
magpar flow chart
More detailed information about the libraries can be found on the page about Required Software.
ierr = InitInfo();CHKERRQ(ierr); ierr = ReadMesh(gdata);CHKERRQ(ierr); ierr = ReadKrn(gdata);CHKERRQ(ierr); ierr = ModifyPropSer(gdata);CHKERRQ(ierr); ierr = ModifyPropSerGrains(gdata);CHKERRQ(ierr); ierr = MagInit(gdata);CHKERRQ(ierr); ierr = Hext_in1_Init(gdata);CHKERRQ(ierr); ierr = Hext_in2_Init(gdata);CHKERRQ(ierr); ierr = FilterElements(&gdata->n_ele,&gdata->elevert,&gdata->eleprop,gdata->propdat);CHKERRQ(ierr); ierr = MeshMirror(&gdata->n_vert,&gdata->n_ele,&gdata->vertxyz,&gdata->elevert,&gdata->eleprop);CHKERRQ(ierr); ierr = FilterNodes(&gdata->n_vert,&gdata->n_ele,&gdata->vertxyz,gdata->elevert,&gdata->M,&gdata->VH1,&gdata->VH2);CHKERRQ(ierr); ierr = FilterElements(&gdata->n_ele,&gdata->elevert,&gdata->eleprop,gdata->propdat);CHKERRQ(ierr); ierr = RegularRefinement(gdata);CHKERRQ(ierr); ierr = DecoupleGrains(gdata);CHKERRQ(ierr); ierr = Reorder(gdata);CHKERRQ(ierr); ierr = FacNB(gdata);CHKERRQ(ierr); ierr = VertProp(gdata);CHKERRQ(ierr); ierr = DataPartitionSurfSer(gdata);CHKERRQ(ierr); ierr = DistortMesh(gdata);CHKERRQ(ierr); ierr = DataMoveData(gdata);CHKERRQ(ierr);
ierr = PetscOptionsGetInt(PETSC_NULL,"-mode",(PetscInt*)&gdata->mode,&flg);CHKERRQ(ierr); ierr = ModifyPropPar(gdata);CHKERRQ(ierr); ierr = EleVertVol(gdata);CHKERRQ(ierr); ierr = PetscOptionsGetReal(PETSC_NULL,"-ts_init_time",&tstart,&flg);CHKERRQ(ierr); ierr = Htot(gdata);CHKERRQ(ierr); ierr = Htot_Energy(gdata);CHKERRQ(ierr); ierr = myTSCreatePVode(gdata);CHKERRQ(ierr); ierr = WriteFEMAVS(gdata);CHKERRQ(ierr); ierr = CheckIterationLLG(gdata);CHKERRQ(ierr); ierr = myTSCreateEmini(gdata);CHKERRQ(ierr); ierr = WriteFEMAVS(gdata);CHKERRQ(ierr); ierr = CheckIterationEmini(gdata);CHKERRQ(ierr); ierr = DataDestroyInit(gdata);CHKERRQ(ierr);
# pseudocode while (keepsolving) switch: -mode
(see allopt.txt)
main.c::keepsolving: check exit conditions, write project.9999.* (checkpoint) files, check after each iteration
ierr = Hcubic(gdata,VHtotsum);CHKERRQ(ierr); ierr = Hdemag(gdata,VHtotsum);CHKERRQ(ierr); ierr = Helastic(gdata,VHtotsum);CHKERRQ(ierr); ierr = Hexchani(gdata,VHtotsum);CHKERRQ(ierr); ierr = Hexternal(gdata,VHtotsum);CHKERRQ(ierr); [...]
accordingly for energy (note that in general E!=M.H !)
Initialization: eminisolve.c::myTSCreateEmini
Solution: eminisolve.c::EminiSolve : call TaoSolve to find energ minimum
Initialization: mytscreatepvode.c::myTSCreatePVode
Solution: mytssteppvode.c::myTSStepPVode : call CVode to take on time step
LLG right hand side: rhsfunction.c::RHSfunction calls calc_dMdt::calc_dMdt.c
Preconditioning: precond.c::Precond, Jacobian: myllgjacobian.c::myLLGJacobian
Write final entry in log files and final set of output files
At the end of the program we do not clean up carefully (i.e. we do not destroy all data structures or free dynamically allocated memory) because the OS will do it for us anyway.
(see HTML documentation)