Re: [petsc-users] TimeStepper norm problems. EMIL Please read this

2015-04-15 Thread Barry Smith

  The more adaptors the better


> On Apr 15, 2015, at 8:51 PM, Emil Constantinescu  wrote:
> 
> 
> On 3/24/15 5:31 AM, Lisandro Dalcin wrote:
>> Emil, is there any chance you can try my code with your problem? I
>> really need some feedback to push this to PETSc, otherwise
> 
> Hi Lisandro - we checked ts_alpha_adapt and we tested it on a small system 
> (mildly stiff van der Pol ODE). I enclosed a Figure generated by Debo that 
> compares the error at the final time against ATOL - there alpha is the 
> original one (with original adaptor). For this problem your adaptor works 
> better [ error should be close to ATOL]. So from my perspective, your adaptor 
> works well. However, we need to keep the old too so that we have a one step 
> adaptor available ... since alpha is a one step method.
> 
> Emil
> 



Re: [petsc-users] TimeStepper norm problems. EMIL Please read this

2015-04-15 Thread Emil Constantinescu


On 3/24/15 5:31 AM, Lisandro Dalcin wrote:

Emil, is there any chance you can try my code with your problem? I
really need some feedback to push this to PETSc, otherwise


Hi Lisandro - we checked ts_alpha_adapt and we tested it on a small 
system (mildly stiff van der Pol ODE). I enclosed a Figure generated by 
Debo that compares the error at the final time against ATOL - there 
alpha is the original one (with original adaptor). For this problem your 
adaptor works better [ error should be close to ATOL]. So from my 
perspective, your adaptor works well. However, we need to keep the old 
too so that we have a one step adaptor available ... since alpha is a 
one step method.


Emil


Figure2.pdf
Description: application/binary


Re: [petsc-users] Time integrated adjoints

2015-04-15 Thread Emil Constantinescu

On 4/15/15 12:37 PM, Barry Smith wrote:


   Hong and Emil,

 You will need to answer this.



On Apr 15, 2015, at 6:24 AM, Dave Makhija  wrote:

Barry,

Is the method exact if I have a time dependent mass matrix (dF/dU_t changes 
each time step)? I'm not sure it's possible if TSSetIJacobian expects a 
function which computes the combination of dF/dU and a*dF/dU_t. But, perhaps 
there is something I'm missing.


In the adjoint derivation, we assumed that we have F = M U_t - f(t,U); 
so a*dF/dU_t is a*M, which holds if M=M(t). So in principle it should 
work. However, because M(t_n) and M(t_{n+1}) are different, the adjoint 
implementation might be slightly inconsistent -- and I'm saying this out 
of caution. We did not test it on problems with M=M(t). Do you have such 
an example interfaced with PETSc we can try?


Emil



Otherwise, it looks very comprehensive. I like how you added the "cost 
integrand". If I recall correctly, the Trilinos package Rythmos is missing this.

Thanks!

Dave

On Tue, Apr 14, 2015 at 8:30 AM, Barry Smith  wrote:


On Apr 14, 2015, at 1:06 AM, Dave Makhija  wrote:

Hello,

I'm evaluating my options for computing time dependent adjoints. I did not think PETSc 
supported this, but I see "TSAdjointSolve" in the development branch. That 
would be fantastic news if you plan to support time integrated adjoints!

What features are envisioned and when is the targeted release date?


   Dave,

We currently have discrete adjoint computations for explicit RK methods and 
for implicit theta methods (backward Euler and Crank-Nicholson). The 
development copy of the users manual has some discussion 
(http://www.mcs.anl.gov/petsc/petsc-master/docs/manual.pdf page 135) and there 
are several examples.   I urge you to try them out now in master and stay in 
contact with us to insure we provide what you need as we are actively 
developing them.
We plan a release for early June.

   Barry



Thanks!

Dave







Re: [petsc-users] Time integrated adjoints

2015-04-15 Thread Barry Smith

  Hong and Emil,

You will need to answer this.


> On Apr 15, 2015, at 6:24 AM, Dave Makhija  wrote:
> 
> Barry,
> 
> Is the method exact if I have a time dependent mass matrix (dF/dU_t changes 
> each time step)? I'm not sure it's possible if TSSetIJacobian expects a 
> function which computes the combination of dF/dU and a*dF/dU_t. But, perhaps 
> there is something I'm missing.
> 
> Otherwise, it looks very comprehensive. I like how you added the "cost 
> integrand". If I recall correctly, the Trilinos package Rythmos is missing 
> this.
> 
> Thanks!
> 
> Dave
> 
> On Tue, Apr 14, 2015 at 8:30 AM, Barry Smith  wrote:
> 
> > On Apr 14, 2015, at 1:06 AM, Dave Makhija  wrote:
> >
> > Hello,
> >
> > I'm evaluating my options for computing time dependent adjoints. I did not 
> > think PETSc supported this, but I see "TSAdjointSolve" in the development 
> > branch. That would be fantastic news if you plan to support time integrated 
> > adjoints!
> >
> > What features are envisioned and when is the targeted release date?
> 
>   Dave,
> 
>We currently have discrete adjoint computations for explicit RK methods 
> and for implicit theta methods (backward Euler and Crank-Nicholson). The 
> development copy of the users manual has some discussion 
> (http://www.mcs.anl.gov/petsc/petsc-master/docs/manual.pdf page 135) and 
> there are several examples.   I urge you to try them out now in master and 
> stay in contact with us to insure we provide what you need as we are actively 
> developing them.
> We plan a release for early June.
> 
>   Barry
> 
> >
> > Thanks!
> >
> > Dave
> 
> 



Re: [petsc-users] petsc4py and mumps (or other direct sparse solver)

2015-04-15 Thread Lisandro Dalcin
On 15 April 2015 at 18:15, Hong  wrote:
> Benoit :
>
> mumps options can be called from PETSc C-code as
> ierr = PetscOptionsInsertString("-mat_mumps_icntl_13 1 -mat_mumps_icntl_24 1
> -mat_mumps_cntl_3 1e-12");CHKERRQ(ierr);
>
> or see petsc/src/ksp/ksp/examples/tutorials/ex52.c
>
> I do not know how to translate these calls into python API though.
>

opts = PETSc.Options() # dict-like
opts["mat_mumps_icntl_13"] = 1
opts["mat_mumps_icntl_24"] = 1
opts["mat_mumps_cntl_3"] = 1e-12

Or also:

opts = PETSc.Options()
opts.prefixPush("mat_mumps_")
opts["icntl_13"] = 1
opts["icntl_24"] = 1
opts["cntl_3"] = 1e-12
opts.prefixPop()

Or also:

opts = PETSc.Options("mat_mumps_")
opts["icntl_13"] = 1
opts["icntl_24"] = 1
opts["cntl_3"] = 1e-12


-- 
Lisandro Dalcin

Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Numerical Porous Media Center (NumPor)
King Abdullah University of Science and Technology (KAUST)
http://numpor.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 4332
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459


Re: [petsc-users] petsc4py and mumps (or other direct sparse solver)

2015-04-15 Thread Hong
Benoit :

mumps options can be called from PETSc C-code as
ierr = PetscOptionsInsertString("-mat_mumps_icntl_13 1 -mat_mumps_icntl_24
1 -mat_mumps_cntl_3 1e-12");CHKERRQ(ierr);

or see petsc/src/ksp/ksp/examples/tutorials/ex52.c

I do not know how to translate these calls into python API though.

Hong

Dear petsc-users,
>
> I am a beginner in petsc and I have some question with the python
> interface. I am trying to solve problem with mumps (or other direct sparse
> solver)
>
> I have written the following piece of code
>
> ksp = PETSc.KSP()
> ksp.create(PETSc.COMM_WORLD)
> ksp.setOperators(A)
> ksp.setType('preonly')
> pc=ksp.getPC()
> pc.setType('lu')
> pc.setFactorSolverPackage('mumps')
>
> It seems to works, however I have 2 questions
> 1/ how to set the Icntl parameters of mumps ? I didn't find the function
> MatMumpsSetIcntl.
> 2/ Is this piece of code right or written in good petsc style ?
>
> thanks a lot,
>
> Benoit
>
>


[petsc-users] petsc4py and mumps (or other direct sparse solver)

2015-04-15 Thread NENNIG Benoit
Dear petsc-users,

I am a beginner in petsc and I have some question with the python interface. I 
am trying to solve problem with mumps (or other direct sparse solver)

I have written the following piece of code

ksp = PETSc.KSP()
ksp.create(PETSc.COMM_WORLD)
ksp.setOperators(A)
ksp.setType('preonly')  
pc=ksp.getPC()
pc.setType('lu')
pc.setFactorSolverPackage('mumps')

It seems to works, however I have 2 questions
1/ how to set the Icntl parameters of mumps ? I didn't find the function 
MatMumpsSetIcntl. 
2/ Is this piece of code right or written in good petsc style ?

thanks a lot,

Benoit



Re: [petsc-users] Time integrated adjoints

2015-04-15 Thread Dave Makhija
Barry,

Is the method exact if I have a time dependent mass matrix (dF/dU_t changes
each time step)? I'm not sure it's possible if TSSetIJacobian expects a
function which computes the combination of dF/dU and a*dF/dU_t. But,
perhaps there is something I'm missing.

Otherwise, it looks very comprehensive. I like how you added the "cost
integrand". If I recall correctly, the Trilinos package Rythmos is missing
this.

Thanks!

Dave

On Tue, Apr 14, 2015 at 8:30 AM, Barry Smith  wrote:

>
> > On Apr 14, 2015, at 1:06 AM, Dave Makhija  wrote:
> >
> > Hello,
> >
> > I'm evaluating my options for computing time dependent adjoints. I did
> not think PETSc supported this, but I see "TSAdjointSolve" in the
> development branch. That would be fantastic news if you plan to support
> time integrated adjoints!
> >
> > What features are envisioned and when is the targeted release date?
>
>   Dave,
>
>We currently have discrete adjoint computations for explicit RK methods
> and for implicit theta methods (backward Euler and Crank-Nicholson). The
> development copy of the users manual has some discussion (
> http://www.mcs.anl.gov/petsc/petsc-master/docs/manual.pdf page 135) and
> there are several examples.   I urge you to try them out now in master and
> stay in contact with us to insure we provide what you need as we are
> actively developing them.
> We plan a release for early June.
>
>   Barry
>
> >
> > Thanks!
> >
> > Dave
>
>