# How to configure the solver parameters to reduce simulation time and lower memory usage

**URL:** https://community.freefem.org/t/how-to-configure-the-solver-parameters-to-reduce-simulation-time-and-lower-memory-usage/3989
**Category:** General Discussion
**Created:** [July 2, 2025, 8:40am UTC](https://community.freefem.org/t/how-to-configure-the-solver-parameters-to-reduce-simulation-time-and-lower-memory-usage/3989 "2025-07-02T08:40:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lancy](https://avatars.discourse-cdn.com/v4/letter/l/d07c76/32.png) [@Lancy](https://community.freefem.org/u/Lancy)
#### Post date: [July 2, 2025, 8:40am UTC](https://community.freefem.org/t/how-to-configure-the-solver-parameters-to-reduce-simulation-time-and-lower-memory-usage/3989/1 "2025-07-02T08:40:19Z")

</div>

Hello,

I am currently using FreeFEM to solve three-dimensional elasticity problems with approximately 5–10 million degrees of freedom, and I’ve encountered the following issue:

1.When running parallel simulations under the FFDDM framework, how should I configure the solver parameters to reduce computational time and lower memory usage? I have tried adjusting some parameters (e.g., reducing geneo\_nu to 10 or lower), but the overall simulation time did not improve much. What specific configurations could you recommend to further reduce computational time?

The key part of my code is as follows:

```auto
macro Varf(varfName, meshName, PhName)
varf varfName(def(u), def(v)) = int3d(meshName)(epsV(u)'*C*epsV(v)) + 
      int3d(meshName)((3.0*lambda + 
3.0*mu)*CTE*(Text - TrefTE)*epsTrace(v)) + 
                              on(1, u = 0) +
                              on(2, uB = 0) + 
                              on(7, uC = 0); // EOM, 7

ffddmbuildDmesh(E3d, ThGlobal, mpiCommWorld);
ffddmbuildDfespace(E3d, E3d, real, def, init, Pk);
ffddmsetupOperator(E3d, E3d, Varf); 
ffddmsetupPrecond(E3d, Varf); // one-level preconditioner
ffddmgeneosetup(E3d,Varf); // two-level preconditioner
real[int] rhs(1);
ffddmbuildrhs(E3d,Varf,rhs);
real[int] x0(rhs.n);
x0 = 0;
E3dVhi def(u), def(err);
u[] = E3dfGMRES(x0, rhs, 1.e-6, 500, "right");
E3dwritesummary;

```

The simulation is executed using the following command:  
ff-mpirun -np 64 Script.edp -ffddm\_schwarz\_method ras -ffddm\_schwarz\_coarse\_correction BNN -ffddm\_geneo\_nu 20

2.I also tried running the simulation with HPDDM. However, there was no significant improvement in simulation time or memory usage. If I want to use HPDDM as the solver but keep the parameter settings the same as in FFDDM, how should I configure the parameters specifically? When using HPDDM to solve the problem, how should the solver parameters be configured to reduce simulation time and lower memory usage?

The key section of my code is as follows:

```auto
ffddmbuildDmesh(E3d, ThGlobal, mpiCommWorld);
ffddmbuildDfespace(E3d, E3d, real, def, init, Pk);
macro E3dwithhpddm() 1 //
ffddmsetupOperator(E3d, E3d, Varf);
set(E3dhpddmOP, sparams = "-hpddm_E3d_krylov_method cg " + 
"-hpddm_E3d_level_1_schwarz_method ras " + 
                        "-hpddm_E3d_level_2_schwarz_coarse_correction deflated " + 
"-hpddm_E3d_level_2_geneo_nu 10 " +
                        "-hpddm_E3d_level_2_verbosity 2 "
) ;   

```

3.I saw on page 382 of the FreeFEM documentation, in the section titled “Some results: Heterogeneous 3D elasticity with GenEO”, that the figure shows solving with Schwarz GenEO takes less time compared to using PETSc. I would like to ask how the parameters were specifically configured in that case, and whether those settings would be applicable to my problem.

Thank you very much.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [July 3, 2025, 5:18am UTC](https://community.freefem.org/t/how-to-configure-the-solver-parameters-to-reduce-simulation-time-and-lower-memory-usage/3989/2 "2025-07-03T05:18:54Z")

</div>

These results were obtained on extremely convoluted problems, specially designed to make GAMG struggle. If you want better efficiency, switch to GAMG, the odds it will be faster are close to 1. You can use this example to benchmark: [FreeFem-sources/examples/hpddm/elasticity-3d-PETSc.edp at master · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/master/examples/hpddm/elasticity-3d-PETSc.edp), it should be easy to adapt it to your geometry/material coefficients.

---

<div class="post-metadata">

### Author: ![Lancy](https://avatars.discourse-cdn.com/v4/letter/l/d07c76/32.png) [@Lancy](https://community.freefem.org/u/Lancy)
#### Post date: [July 7, 2025, 9:35am UTC](https://community.freefem.org/t/how-to-configure-the-solver-parameters-to-reduce-simulation-time-and-lower-memory-usage/3989/3 "2025-07-07T09:35:58Z")

</div>

Thank you for your prompt reply. As I have multiple questions, I have sent the relevant code files to your email and would be sincerely grateful for your advice and support.
