How to set the options of HPDDM?

Dear FreeFEM community,

I’m calling HPDDM to solve a 3D elasticity problem by switching to hpddm within FFDDM. I have tried two methods to set the options of hpddm.

(1) Setting in the code

The key codes are:

  • mesh3 ThGlobal = readmesh3(“xxx.mesh”);

    ffddmbuildDmesh(E3d, ThGlobal, mpiCommWorld); // E3d: prefix name
    ffddmbuildDfespace(E3d, E3d, real, def, init, Pk);

    // switch to hpddm
    macro E3dwithhpddm() 1 //
    ffddmsetupOperator(E3d, E3d, Varf);

    set(E3dhpddmOP, sparams = “-hpddm_E3d_krylov_method cg -hpddm_E3d_schwarz_method asm
    -hpddm_E3d_schwarz_coarse_correction balanced -hpddm_E3d_geneo_nu 10”);

    // Schwartz preconditioning
    ffddmsetupPrecond(E3d, Varf);
    ffddmgeneosetup(E3d,Varf); // two-level geneo

The command line reads:

ff-mpirun -np 8 xxx.edp -hpddm_verbosity 2

The codes can running normally, but the displayed options of HPDDM are not consistent with the setting ones:

┌------------------------------------┐
│ HPDDM options used: │
│ E3d_orthogonalization: 1 │
│ E3d_schwarz_coarse_correction: 0 │ should be 2~balanced
│ E3d_verbosity: 5 │
│ E3d_schwarz_method: 0 │ should be 3~asm
│ E3d_level_2_verbosity: 5 │
│ E3d_geneo_nu: 20 │ should be 10
│ E3d_geneo_threshold: 5.0e-01 │
│ E3d_krylov_method: 2 │ correct
│ E3d_tol: 1.0e-06 │
│ E3d_variant: 1 │
│ E3d_gmres_restart: 200 │
│ E3d_max_it: 200

(2) Setting in the command line

ff-mpirun -np 8 xxx.edp -hpddm_verbosity 2 -hpddm_schwarz_method asm -hpddm_geneo_nu 10

The displayed options read:

│ HPDDM options used: │
│ E3d_orthogonalization: 1 │
│ E3d_schwarz_coarse_correction: 0 │
│ E3d_verbosity: 5 │
│ E3d_schwarz_method: 0 │
│ E3d_level_2_verbosity: 5 │
│ E3d_geneo_nu: 20 │
│ E3d_geneo_threshold: 5.0e-01 │
│ E3d_krylov_method: 2 │
│ E3d_tol: 1.0e-06 │
│ E3d_variant: 1 │
│ E3d_gmres_restart: 200 │
│ E3d_max_it: 200 │
│ geneo_nu: 10 │
│ schwarz_method: 3 │
│ verbosity: 2

The options with prefix E3d keep the same, and additional options (geneo_nu/schwarz_method) are consistent with the ones in command line. I wonder which ones are used in the computation.

It seems that the above two methods cannot control the options of HPDDM. Are there any mistakes in my setting? Or anyone can tell me how to set them correctly?

That is because ffddm options supersede hpddm options (you can see it e.g. here FreeFem-sources/idp/ffddm_functions.idp at develop · FreeFem/FreeFem-sources · GitHub )

In your case, you can control hpddm options by using ffddm command-line parameters -ffddm_schwarz_method asm -ffddm_schwarz_coarse_correction BNN -ffddm_geneo_nu 10

 ┌----------------------------------┐
 │ HPDDM options used:              │
 │  E_geneo_nu: 10                  │
 │  E_geneo_threshold: 0            │
 │  E_gmres_restart: 200            │
 │  E_level_2_verbosity: 5          │
 │  E_max_it: 200                   │
 │  E_orthogonalization: 1          │
 │  E_schwarz_coarse_correction: 2  │
 │  E_schwarz_method: 3             │
 │  E_tol: 1.0e-06                  │
 │  E_variant: 1                    │
 │  E_verbosity: 5                  │
 │  verbosity: 100                  │
 └----------------------------------┘

Hi Dr. Tournier, this method really works!

Many Thanks.