How w-wuxian/additive_schwarz_method works
Project type and purpose
• This is a scientific HPC code written in Fortran, parallelized with MPI, whose goal is to solve the 2D heat equation on a Cartesian grid via finite differences.
• It contains two major parts:
a. MPI_EQ_CHALEUR – a baseline MPI‐parallel heat‐equation solver
b. ADDITIVE_SCHWARZ_METHOD – two variants of a domain‐decomposition solver (Dirichlet and mixed/Robin boundary conditions)
File structure
• Top‐level directories:
• MPI_EQ_CHALEUR: main.f90 + Fortran modules (ModData.f90, ModF.f90, ModGC.f90, ModSOL.f90), Makefile, scripts & README.
• Code_Dirichlet_LAST and DD_Neuman_TRUE_LAST: share subfolders CHARGE, EXACTE_ERREUR, MAT_VIZU, SOL_NUMERIQUE plus per‐variant modules (mod_charge, mod_comm, mod_constr_mat in Neumann, mod_gradconj or mod_gmres, etc.), main.f90 and makefile.
• Common elements:
• mod_parametres.f90 houses all tunable parameters (grid sizes, time steps, overlap).
• Build scripts rely on mpif90 and standard make targets (make, clean, cleanREP).
• Execution via mpirun ‑n X --mca pml ob1 ./run
• Visualization is done post‐run with gnuplot scripts (VIZU_PLT.plt, VIZU_2_PLT.plt, VIZU_2_PLT.plt).
Extracted architectural patterns
• Layered/modules architecture:
a. Data/Parameters layer (mod_parametres, ModData)
b. Initialization and loading of boundary/initial conditions (mod_charge / CHARGE folder)
c. Discrete operator assembly (mod_matsys / mod_constr_mat)
d. Solver kernel (mod_gradconj or mod_gmres in Neumann, ModGC in MPI_EQ_CHALEUR)
e. Communication layer (mod_comm handling halo exchanges via MPI)
f. Post‐processing (EXACTE_ERREUR for error norms, SOL_NUMERIQUE for storing results, MAT_VIZU + gnuplot scripts)
• Domain decomposition: each MPI rank owns a subdomain; overlap (halo) region exchanges with rank−1 and rank+1.
• Build System (Makefile + mpif90)
• Executable (run / main.f90)
• Parameter Module (mod_parametres)
• Data Module (ModData / mod_charge)
• Discretization & Assembly Module (mod_matsys / mod_constr_mat)
• Solver Module (mod_gradconj, mod_gmres, ModGC, ModSOL)
• Communication Module (mod_comm)
• Output & Visualization (SOL_NUMERIQUE, MAT_VIZU, gnuplot scripts)
• Build System → compiles all modules → Executable
• Executable → reads parameters → Parameter Module
• Executable → calls Data Module to set initial conditions
• Executable → calls Discretization Module → constructs system matrix
• Solver Module ↔ Communication Module (halo exchanges)
• Solver Module → updates solution → Output Module
• Output Module → writes data files → Visualization scripts
c. Domain decomposition:
d. Technologies / frameworks:
• Fortran 90/95 modules
• MPI (point‐to‐point halo exchange)
• make / mpif90 build chain
• gnuplot for plotting