zxss  
                
               
                 
                 
              
                  
                    May 6, 2025,  1:18pm
                   
                   
              1 
               
             
            
              Dear all,
I already implement the sequential version of NS equation with moving boundary in FreeFem++, the code is 
sequential_moving_boundary.edp  (2.4 KB)
Now I want to parallelize it using PETSc, just change little, for example changing matrix to Mat. And it shows error like this on my Windows machine 
and the parallel version code is 
parallel_moving_boundary.edp  (2.5 KB)
Can anyone give me any advice? Many thanks.
             
            
               
               
               
            
            
           
          
            
              
                prj  
                
               
              
                  
                    May 7, 2025,  5:58pm
                   
                   
              2 
               
             
            
              Your A is uninitialized line 59, so you need to fix that.
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
                 
              
                  
                    May 8, 2025,  1:07am
                   
                   
              3 
               
             
            
              Thank you for your reminder, Professor. It’s a stupid mistake. I have fixed the initialization of Mat like this 
However, there still exists error as shown below 
Do you know what’s wrong? Thanks a lot. 
parallel_moving_boundary_2.edp  (2.6 KB)
             
            
               
               
               
            
            
           
          
            
              
                prj  
                
               
              
                  
                    May 8, 2025,  7:18am
                   
                   
              4 
               
             
            
              You are trying to initialize with the same macro a Mat with two fields and another one with three fields, hence the error.
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
                 
              
                  
                    May 10, 2025, 12:46am
                   
                   
              5 
               
             
            
              Sorry for my late reply. Thank you very much for your reply. It’s another stupid mistake. Now I fix it as following 
And it’s the latest code 
parallel_moving_boundary_3.edp  (2.7 KB)
However, there still exists error shown as 
Do you know the reason?
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
                 
              
                  
                    May 10, 2025, 12:56am
                   
                   
              6 
               
             
            
              Sorry, I know the reason for the last error. It was because I entered the wrong file name. This time, the specific error occurred as the following 
Do you know its reason?
             
            
               
               
               
            
            
           
          
            
              
                prj  
                
               
              
                  
                    May 10, 2025,  5:41am
                   
                   
              7 
               
             
            
              This is the exact same error.
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
              
                  
                    May 10, 2025,  6:02am
                   
                   
              8 
               
             
            
              Thank you very much for your reply. Now my code can be run 
parallel_moving_boundary_3.edp  (2.7 KB) 
But it looks not converge
Apptainer> ff-mpirun -n 10 parallel_moving_boundary_3.edp -wg -v 0 
‘/usr/freefem/ff-petsc/r/bin/mpiexec’ -n 10 /usr/freefem/bin/FreeFem+±mpi -nw ‘parallel_moving_boundary_3.edp’ -wg -v 0 
KSP final norm of residual 4.42545e+15 
KSP final norm of residual 2.2619e+15 
NS Time: 0.001 
KSP final norm of residual 1.03851e+16 
KSP final norm of residual 3.69771e+15 
NS Time: 0.002 
KSP final norm of residual 1.58529e+16 
KSP final norm of residual 7.00204e+15
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
              
                  
                    May 10, 2025,  6:07am
                   
                   
              9 
               
             
            
              It can be run in my Linux machine with’ff-mpirun’, but it still exists errors on my computer machine with ‘mpiexec -n   freefem+±mpi’
             
            
               
               
               
            
            
           
          
            
              
                prj  
                
               
              
                  
                    May 10, 2025,  6:35am
                   
                   
              10 
               
             
            
              Probably because you are using the default tgv value.
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
                 
              
                  
                    May 10, 2025,  7:39am
                   
                   
              11 
               
             
            
              Thank you very much, professsor. I change ‘tgv=-1’, and then it truly converges 
             
            
               
               
               
            
            
           
          
            
              
                zxss  
                
               
              
                  
                    May 10, 2025,  7:12pm
                   
                   
              12 
               
             
            
              Dear professor, I have one last question, that is I find it calculates very slowly with ‘-pc_type lu’, is there other options can accelerate?
             
            
               
               
               
            
            
           
          
            
              
                prj  
                
               
              
                  
                    May 11, 2025,  5:07am
                   
                   
              13 
               
             
            
              A proper preconditioner could help things out.