# How to deal with "out of memory"

**URL:** <https://community.freefem.org/t/how-to-deal-with-out-of-memory/3358>\
**Category:** General Discussion\
**Created:** [June 27, 2024, 9:08am UTC](https://community.freefem.org/t/how-to-deal-with-out-of-memory/3358 "2024-06-27T09:08:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LXX](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@LXX](https://community.freefem.org/u/LXX)\
**Post date:** [June 27, 2024, 9:08am UTC](https://community.freefem.org/t/how-to-deal-with-out-of-memory/3358/1 "2024-06-27T09:08:45Z")

</div>

Hello everyone, I am a beginner of freefem++. For the freefem++ code, I can only solve PDEs in a single thread.  
I want to use Freefem++ to solve the unsteady incompressible magnetohydrodynamic equations.

 ![截屏2024-06-27 16.45.36](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/1/12735ff7a14c2f5fabd71407a5cfe824094a79ee.png)  
I read a paper [STABILITY AND ERROR ANALYSIS OF IMEX SAV SCHEMES FORTHE MAGNETO-HYDRODYNAMIC EQUATIONS.pdf](https://community.freefem.org/uploads/short-url/Amut4QLCpyalHPN79snup42Tl0j.pdf) (1.8 MB) and I have reproduced the author’s two-dimensional numerical experiment. Now I want to expand this numerical experiment from two dimensions to three dimensions. The way I define the grid is as follows

```auto
mesh3 Th = cube(N, N, N, [x, y, z]);

```

For my own MacBook, when N\>20, it will output

```auto
Error Umfpack -1 : out_of_memory current line = 97
Exec error : Error Umfpack -1 : out_of_memory 
   -- number :1
 catch an erreur in solve => set sol = 0 !!!!!!! 
Exec error : Error Umfpack -1 : out_of_memory 
   -- number :1
 err code 8 , mpirank 0

```

I tried to use the server, but the first attempt was to use `N = 100`, and the result was still `out of memory`

```auto
Error Umfpack -1 : out_of_memory current line = 97
Exec error : Error Umfpack -1 : out_of_memory 
   -- number :1
 catch an erreur in solve => set sol = 0 !!!!!!! 
Exec error : Error Umfpack -1 : out_of_memory 
   -- number :1
 err code 8 , mpirank 0

```

Is there any good solution? I also want to learn to use PETSc parallelization to solve, but this is a bit difficult for me to get started.

Now I give the two-dimensional code I reproduced, and the three-dimensional one is similar to this  
[test.edp](https://community.freefem.org/uploads/short-url/zcKIwHX6SAwhGeZZP2uEOZySVLX.edp) (11.4 KB)
