Yes, after the solve the x will contain correct values for ALL the locations 
including the (zeroed out rows). You use case is exactly what redistribute it 
for.

  Barry


> On Jan 10, 2023, at 11:25 AM, Karthikeyan Chockalingam - STFC UKRI 
> <[email protected]> wrote:
> 
> Thank you Barry. This is great!
>  
> I plan to solve using ‘-pc_type redistribute’ after applying the Dirichlet bc 
> using
> MatZeroRowsColumnsIS(A, isout, 1, x, b); 
>  
> While I retrieve the solution data from x (after the solve) – can I index 
> them using the original ordering (if I may say that)?
>  
> Kind regards,
> Karthik.
>  
> From: Barry Smith <[email protected] <mailto:[email protected]>>
> Date: Tuesday, 10 January 2023 at 16:04
> To: Chockalingam, Karthikeyan (STFC,DL,HC) 
> <[email protected] 
> <mailto:[email protected]>>
> Cc: [email protected] <mailto:[email protected]> 
> <[email protected] <mailto:[email protected]>>
> Subject: Re: [petsc-users] Eliminating rows and columns which are zeros
> 
>  
> https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute  
>  -pc_type redistribute
>  
>  
> It does everything for you. Note that if the right hand side for any of the 
> "zero" rows is nonzero then the system is inconsistent and the system does 
> not have a solution.
>  
> Barry
>  
> 
> 
> On Jan 10, 2023, at 10:30 AM, Karthikeyan Chockalingam - STFC UKRI via 
> petsc-users <[email protected] <mailto:[email protected]>> wrote:
>  
> Hello,
>  
> I am assembling a MATIJ of size N, where a very large number of rows (and 
> corresponding columns), are zeros. I would like to potentially eliminate them 
> before the solve.
>  
> For instance say N=7
>  
> 0 0  0  0 0 0 0
> 0 1 -1  0 0 0 0
> 0 -1 2  0 0 0 -1
> 0 0  0  0 0 0 0
> 0 0  0  0 0 0 0
> 0 0  0  0 0 0 0
> 0 0  -1 0 0 0 1
>  
> I would like to reduce it to a 3x3
>  
> 1 -1 0
> -1 2 -1
> 0 -1 1
>  
> I do know the size N.
>  
> Q1) How do I do it?
> Q2) Is it better to eliminate them as it would save a lot of memory?
> Q3) At the moment, I don’t know which rows (and columns) have the zero 
> entries but with some effort I probably can find them. Should I know which 
> rows (and columns) I am eliminating?
>  
> Thank you.
>  
> Karthik.
> This email and any attachments are intended solely for the use of the named 
> recipients. If you are not the intended recipient you must not use, disclose, 
> copy or distribute this email or any of its attachments and should notify the 
> sender immediately and delete this email from your system. UK Research and 
> Innovation (UKRI) has taken every reasonable precaution to minimise risk of 
> this email or any attachments containing viruses or malware but the recipient 
> should carry out its own virus and malware checks before opening the 
> attachments. UKRI does not accept any liability for any losses or damages 
> which the recipient may sustain due to presence of any viruses. 
> 

  • [petsc-users] Elimina... Karthikeyan Chockalingam - STFC UKRI via petsc-users
    • Re: [petsc-users... Barry Smith
      • Re: [petsc-u... Karthikeyan Chockalingam - STFC UKRI via petsc-users
        • Re: [pet... Barry Smith
          • Re: ... Karthikeyan Chockalingam - STFC UKRI via petsc-users
            • ... Barry Smith
              • ... Karthikeyan Chockalingam - STFC UKRI via petsc-users
                • ... Matthew Knepley
                • ... Karthikeyan Chockalingam - STFC UKRI via petsc-users
                • ... Barry Smith
                • ... Karthikeyan Chockalingam - STFC UKRI via petsc-users
                • ... Barry Smith
                • ... Karthikeyan Chockalingam - STFC UKRI via petsc-users
                • ... Barry Smith

Reply via email to