Hi Yingjie,

For finite difference method, there are a lot of example in PETSc. For
instance,
https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex29.c.html

For linear eigenvalue problems,  there is a list of examples at
http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/index.html

Before you go to implement your inver power algorithm, I would like to
suggest you go though PETSc manual and SLEPc manual.
https://www.mcs.anl.gov/petsc/petsc-current/docs/manual.pdf  and
http://slepc.upv.es/documentation/slepc.pdf
SLEPc has both nonlinear and linear inverse power iteration methods, and
you can pick any version you want.

It is a good idea to have big picture before you do anything using PETSc or
SLEPc.

Fande,

On Wed, Sep 26, 2018 at 8:17 PM Yingjie Wu <yjw...@gmail.com> wrote:

> Thank you, Fande.
>
> I've seen you in moose usergroup before.
>
>
> I've just learned about SLEPC, and I wonder if I want to do neutron
> eigenvalue calculations and use finite difference to discrete grids, would
> it be difficult to implement it in SLEPC? Is there such an example(finite
> difference + linear eigenvalue)?Because I don't know much about finite
> element.Or am I still using a loop of KSP in PETSc?I'm a newcomer to petsc,
> please give me some advice
>
>
> Thanks,
>
> Yingjie
>
>
> Fande Kong <fdkong...@gmail.com> 于2018年9月27日周四 上午12:25写道:
>
>> I have implemented this algorithm in SLEPC. Take a look at this example
>> http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/ex34.c.html
>>
>> The motivation of the algorithm is also for neutron calculations (a
>> moose-based application).
>>
>> Fande,
>>
>> On Wed, Sep 26, 2018 at 10:02 AM Yingjie Wu <yjw...@gmail.com> wrote:
>>
>>> Dear Petsc developer:
>>> Hi,
>>>
>>> Thank you very much for your previous reply,  they really helped me a
>>> lot.
>>>
>>> I've been doing neutron calculations recently, and I want to use the
>>> power Iteration method to calculate the neutron flux, essentially to solve
>>> linear equations, but after each solution is done, a scalar *K* is
>>> updated to form a new right end term *b*, and the next linear equation
>>> system is solved until the convergence criterion is satisfied. The flow of
>>> the source iteration algorithm is as follows:
>>>
>>>
>>> 1: *Φ*(0) = arbitrary nonzero vector 2: K(0) = arbitrary nonzero
>>> constant 3: *for* n = 1; 2; 3; ::: do 4: *b *= 1 / K(n-1) *F * Φ(n-1)
>>> 5: *Φ*(n) * M   = *b* 6: K(n) = k(n-1)* (F * *Φ*(n)  ,F *Φ*(n)  ) / (F
>>> *Φ*(n-1)  ,F  *Φ*(n-1)  )
>>>
>>> 7: check convergence of eigenvalue and eigenvector 8: *end for*
>>>
>>>
>>> (F , M are the coefficient matrix.)
>>>
>>>
>>> The difficulty is that I need to set up an extra loop to regulate KSP.
>>> Does PETSc have such an example? How do I implement this algorithm in
>>> PETsc? Please tell me the key functions if possible.
>>>
>>>
>>> Thanks,
>>>
>>> Yingjie
>>>
>>>
>>>

Reply via email to