[petsc-users] [PATCH 2/2] Call KSPSetFromOptions before setting fieldsplit-specific options

Umut Tabak u.tabak at tudelft.nl
Sun Sep 8 01:22:49 CDT 2013


On 09/08/2013 07:54 AM, Jed Brown wrote:
> PCFieldSplitSetIS is ignored if the PC type is not set to "fieldsplit".
> The command line option -pc_type is processed in KSPSetFromOptions and
> any manual fieldsplit-specific configuration must be done afterward.
Ok, Thanks.

that was the problem, I could run the simple code now.

Maybe a naive question but on this simple system the solution is wrong 
at the moment which is surprising to me, could you see immediately the 
reason of this?

I run with

./ex2 -pc_type fieldsplit

And get

0.0909091
0.0909091
0
0

as the solution vector.
> ---
>   ex2.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ex2.c b/ex2.c
> index 82f1d97..94cea2c 100644
> --- a/ex2.c
> +++ b/ex2.c
> @@ -54,13 +54,13 @@ int main(int argc,char **args)
>     KSPGetPC(ksp,&pc);
>     KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);
>   
> +  KSPSetFromOptions(ksp);
> +
>     PCFieldSplitSetIS(pc, "1", is_row1);
>     PCFieldSplitSetIS(pc, "2", is_row2);
>     ISDestroy(&is_row1);
>     ISDestroy(&is_row2);
> -
> -  KSPSetFromOptions(ksp);
> -
> +
>     /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>        Solve the linear system
>        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */



More information about the petsc-users mailing list