Scalable Solver for Spectral Stochastic FEM using Domain Decomposition with One/Two-Level Preconditioner
This solver targets stochastic steady-state diffusion and static linear elasticity (2D & 3D) problems using domain decomposition methods with scalable one- and two-level preconditioners. The master branch keeps a clean copy of the code, while the cedar, graham, niagara, beluga, and other branches contain machine-specific adjustments tested on their respective clusters.
- FEniCS – deterministic FE matrix/vector assembly.
- PETSc – sparse storage and linear algebra for stochastic FE matrices.
- MPI – parallel execution of PETSc local routines.
- FORTRAN: GNU GCC
- MPI: Open MPI
- Gmsh: 3.0.4 (use this exact version)
- PETSc: 3.7.5
- Local install: https://www.mcs.anl.gov/petsc/documentation/installation.html
- Remote install: see
docs/PETSC_Install.pdf
- FEniCS: 2017.1.0 (use this exact version)
- Local install: https://fenics.readthedocs.io/en/latest/installation.html
- Remote install: follow
docs/fenics/fenics_install.pdf(scripts inside the same folder may be adapted as needed) - Troubleshooting: Compute Canada FEniCS wiki
- Required Python packages:
meshio,lxml,mpi4py
- ParaView: 5.4.0
- Python: 3.x
- MATLAB: 2017
Work from the top-level project directory and use separate terminals for concurrent steps.
$ cd data/klePceData
$ gfortran KLE_PCE_Data_commandLineArg.F90
$ ./a.out # enter desired nDim (number of random variables)
$ cd ../meshData
-
3D domain
- Edit
preprocess3D.shto tune mesh density (LC) and partitions (NP). - Run
sh preprocess3D.shto create.datmesh data. - Convert to FEniCS XML:
$ cd ../../external/dolfin/src/ $ python3 gmshData_fenicsXML_3D.py
- Edit
-
2D domain
- Edit
preprocess2D.sh(LC, NP). - Run
sh preprocess2D.shto create.datmeshes. - Convert to FEniCS XML:
$ cd ../../external/dolfin/src/ $ python3 gmshData_fenicsXML_2D.py
- Edit
$ fenicsproject start dolfin
$ cd external/dolfin/src/
- 3D domain
python poisson3D_stochasticDDM_onelevel.py→ one-level DD matrices indata/Amats/python poisson3D_stochasticDDM_twolevel.py→ two-level DD matrices indata/Amats/
- 2D domain
python poisson2D_stochasticDDM_onelevel.py→ one-level DD matricespython poisson2D_stochasticDDM_twolevel.py→ two-level DD matrices
$ cd src/2Dpoisson_* # or 3Dpoisson_* / 3Delasticity_*
$ cp clusterMakefiles/makefile_mac makefile
$ make all
$ petscexec -np $NP ./a.out # prints iteration counts and writes to data/vtkOutputs/
$ cd data/vtkOutputs
- For 3D Poisson:
matlabTerminal -r writeVtk - For 3D elasticity:
matlabTerminal -r writeVecVtk - Visualize:
paraview out_*.vtk(2D VTK files are created directly).
- Edit
preprocess2D.shfor partitions and mesh density, then run it. - Convert to XML:
$ cd ../../external/dolfin/src/ $ python3 pointElements_xml.py - Start FEniCS (
fenicsproject start dolfin) and generate DD matrices:$ cd external/dolfin/src/ $ python stoDDM_poisson.py - Build and run either
src/onelevelorsrc/twolevel:$ make all $ petscexec -np $NP ./a.out
$ git clone https://sudhipv@bitbucket.org/sudhipv/ssfem_fenics.git
$ cd ssfem_fenics
$ git fetch && git checkout <branch> # defaults to master
Run from jobscripts/<machine-name>/ (choose cedar, niagara, beluga, or graham). Each script has inline comments describing required path edits.
-
sh preprocess.sh- Prompts for
nDim(number of random variables) and writes KLE/PCE data todata/klePceData/. - Control mesh density via
lc(e.g.,lc=0.1→lc=0.09, keep the firstlcfixed at0.1). - Select coarse grid type via
wb(1= wire-basket,0= vertex). - Set partitions via
NP(default 32). Mesh/DDM data land indata/meshData/.
- Prompts for
-
sh processFEniCS.shorsh processFEniCS_MPI.sh- Adjust job resources inside the script (e.g.,
time=0-00:10→0-00:15) and set the desired output directory. - Script names invoked by
processFEniCS_MPI.shdepend on the physics (e.g.,run_fenics_poisson2D_stochasticDDM_parallel_twolevel.sh,run_fenics_elasticity3D_stochasticDDM_parallel_twolevel.sh). Mail notifications trigger only on completion/failure; update addresses inexternal/dolfin/src/jobscriptsas needed. - If MPI job initialization fails, inspect
/scratch/<user>/ssfem_fenics/data/slurm/(e.g.,/scratch/sudhipv/sudhipv/ssfem_fenics/data/slurm/) for details. A successful run prints the random variable settings, BC application, and==========================Success============================.
- Adjust job resources inside the script (e.g.,
-
sh processMPI.sh- Controls Fortran compilation and MPI/PETSc execution.
- Tunable parameters inside the script:
time=0-00:10→ modify run time (default 10 min).tasks-per-node=32(adjust to match allocation).nodes=1(increase if needed).-npflag (ensurenp = nodes * tasks-per-node).job-name/output-file(e.g.,job-name=d2_lc05_p32, whered= dimensions,lc= mesh density,p= partitions).
- Outputs are written to
data/vtkOutputs/.
- Copy
posprocess3D.sh(located indata/vtkOutputs/) to your local machine, edit the file paths, and run it or follow the manual steps below:$ cd data/vtkOutputs $ scp <cluster>:~/scratch/<user>/ssfem_fenics/data/vtkOutputs/*.dat . - For 3D ParaView visualizations also copy:
$ scp <cluster>:~/scratch/<user>/ssfem_fenics/data/meshData/points.dat . $ scp <cluster>:~/scratch/<user>/ssfem_fenics/data/meshData/tetrahedrons4c.dat . $ scp <cluster>:~/scratch/<user>/ssfem_fenics/data/klePceData/pcedata.dat . - Generate VTK:
- Poisson 3D →
matlabTerminal -r writeVtk - Elasticity 3D →
matlabTerminal -r writeVecVtk
- Poisson 3D →
- Visualize with
paraview out_*.vtk.
- Submit, monitor, and cancel jobs:
$ qsub run_ddm.sh $ qstat -u <userID> $ qdel <jobID> - Inspect outputs once jobs finish:
$ more outputfile* $ more errorfile* - Miscellaneous helpers:
sacct– view status for recent SLURM jobs.more slrum-<JobID>.out– job logs.git fetch && git checkout grahamgit checkout -f– discard local edits (useful when pulling latest changes).
src/– stochastic solvers3Delasticity_onelevel,3Delasticity_twolevel3Dpoisson_onelevel,3Dpoisson_twolevel2Dpoisson_onelevel,2Dpoisson_twolevel- Legacy solvers:
onelevel,twolevel
jobscripts/preprocessKLE.sh,preprocessMESH.sh,preprocess.shprocessFEniCS.sh,processFEniCS_MPI.shprocessMPI.sh
external/puffin(MATLAB FEM package)dolfin(Python/C++ FEM package)
data/klePceData,mallocData,meshData,vtkOutputs
docs/- Project documentation (
PETSC_Install.pdf,fenics_install.pdf, etc.)
- Project documentation (
- Deterministic case:
paraview out_deterministic.vtk
sh clean.sh– remove build and output artifacts.
- Sudhi Sharma P V –
sudhisharmapadillath@gmail.com
Scalable Domain Decomposition Methods for Nonlinear and Time-Dependent Stochastic Systems
Authors: Vasudevan, Padillath and Sharma, Sudhi
Institution: Carleton University (2023)
DOI: 10.22215/etd/2023-15817
Click to expand BibTeX citation
@phdthesis{vasudevan2023scalable,
title={Scalable Domain Decomposition Methods for Nonlinear and Time-Dependent Stochastic Systems},
author={Vasudevan, Padillath and Sharma, Sudhi},
year={2023},
school={Carleton University},
doi={10.22215/etd/2023-15817}
}
\```
</details>