[petsc-users] TSMonitor: TSConvergedReason

2018-05-01 Thread Mohammad Hassan Baghaei
Hello

Using the TSMonitorSet , I am trying to monitor the time-stepping solver.  I
use the TSSetConvergedReason() to set a limit on norm error. I found that
even though the error is below the limit at the current step, the solver
continues to solve that step. Then, in the next step, it will be converged.
I want to know whether there is a way to monitor the solver before the
stepping. Sorry if my explanation is not clear. I would inform you, if need
more information. Thanks for your time considering.

Amir 



[petsc-users] TSPseudo Solution Algorithm

2018-03-30 Thread Mohammad Hassan Baghaei
Hello

I am trying to solve system of equations using time stepping. I use
TSSetIFunction() to define the DAEs. I tried to add the xdot[] term to all
of variables. As a solution algorithm , I solved with newton line search
with ASM as a preconditioner. In the case, I want to add the xdot[] term to
only one term, energy equation, I got   PCSETUP_FAILED due to
FACTOR_NUMERIC_ZEROPIVOT and failed to solve. Do you know how I can deal
with this? So Sorry for may be confusing you with my explanation! If you
need more information of my case, let me know. Thanks for your time
answering. 

Thanks

Amir



Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Yeah! I think! You are completely right! Thanks for your suggestion. I would 
definitely look at them! 

Thanks

Amir

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Thursday, March 22, 2018 2:25 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 2:18 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Sorry ! In fact, I am trying to construct the radius and theta coordinate for 
the circular domain I am having before going to the main local functions. I 
needed that for my local functions. 

 

It sounds like you are having trouble with parallel programming. Maybe get your 
stuff working in serial, and then

look at a book like Using MPI by Gropp, et.al <http://et.al> . or Scientific 
Computing by Eijkhout to understand more about parallelism.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Thursday, March 22, 2018 1:45 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

I am trying to fill a vector based on global coordinate.

 

You can see how this might be too vague for me to follow.

 

As I am trying to use VecGetValues() on the global coordinate,

 

Okay, this does not work for any parallel vector.

 

I find it that argument goes out of range, since I am using global numbering 
rather than local numbering.

 

It is not the numbering that is a problem. It is that parallel Vectors in PETSc 
are distributed. You cannot directly access

data you do not own. You can send it to one process (for example using 
VecScatterCreateToZero()), but this is of course

not scalable.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Sorry ! In fact, I am trying to construct the radius and theta coordinate for 
the circular domain I am having before going to the main local functions. I 
needed that for my local functions.

 

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Thursday, March 22, 2018 1:45 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 1:28 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

I am trying to fill a vector based on global coordinate.

 

You can see how this might be too vague for me to follow.

 

As I am trying to use VecGetValues() on the global coordinate,

 

Okay, this does not work for any parallel vector.

 

I find it that argument goes out of range, since I am using global numbering 
rather than local numbering.

 

It is not the numbering that is a problem. It is that parallel Vectors in PETSc 
are distributed. You cannot directly access

data you do not own. You can send it to one process (for example using 
VecScatterCreateToZero()), but this is of course

not scalable.

 

  Thanks,

 

Matt

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
I am trying to fill a vector based on global coordinate. As I am trying to use 
VecGetValues() on the global coordinate, I find it that argument goes out of 
range, since I am using global numbering rather than local numbering.

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Wednesday, March 21, 2018 10:38 PM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Global Numbering

 

On Wed, Mar 21, 2018 at 8:18 AM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hello

I am trying to create a global vector of coordinates based on the parallelized 
dm. I find it really hard to work with the local numbering, how can I manage to 
create a kind of numbering on global level so that I could easily access to the 
nodes based on the new numbering. Thanks for your time.

 

DMGetCoordinates() gives you a global vector.

DMGetCoordinatesLocal() gives you a local vector.

 

What are you trying to do?

 

  Thanks,

 

 Matt

 

Amir





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 



[petsc-users] Global Numbering

2018-03-21 Thread Mohammad Hassan Baghaei
Hello

I am trying to create a global vector of coordinates based on the
parallelized dm. I find it really hard to work with the local numbering, how
can I manage to create a kind of numbering on global level so that I could
easily access to the nodes based on the new numbering. Thanks for your time.

Amir



[petsc-users] error regarding filling section fields

2018-03-11 Thread Mohammad Hassan Baghaei
Hi

I am trying to fill the global vector . Using single processor, it works
fine. However, switching to several processors, I get the error regarding
the section offset out of range for several points. The short of error
message is below. Can you let me know what causes the offset to become [0,0(
in this case and How I can solve this issue. Thanks for your time.

Amir 

 

[1]PETSC ERROR: - Error Message
--

[1]PETSC ERROR: Argument out of range

[1]PETSC ERROR: Section point 1 should be in [0, 0)

[1]PETSC ERROR: #1 PetscSectionGetOffset() line 1155 in
/home/amir/petsc/src/vec/is/utils/vsectionis.c

[1]PETSC ERROR: #2 PetscSectionGetFieldOffset() line 1208 in
/home/amir/petsc/src/vec/is/utils/vsectionis.c

 



Re: [petsc-users] Dealing with DMPlexDistribute()

2018-02-15 Thread Mohammad Hassan Baghaei
Oh! Thanks for your help! I am currently looking at the test examples. I would 
definitely try your method. In the first impression, I thought it was 
DMPlexDistribute() problem.

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Friday, February 16, 2018 6:51 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Dealing with DMPlexDistribute()

 

On Thu, Feb 15, 2018 at 5:43 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hi Matt

In fact, I created a routine for my specific mesh generation. I firstly, create 
the DMPlex object at first, then setting the chart, then doing symmetrize and 
interpolate. Next, I created coordinate section and giving the coordinates. 
After finishing giving the coordinates, I declare the distribution in routine, 
with this two lines:

 

If you are creating the whole mesh, then you want to enclose the creation steps 
in

 

if (!rank) {

  

} else {

  DMCreate()

  DMSetType()

}

DMPlexSymmetrize()

DMPlexInterpolate()

 

There are examples of me doing this in the Plex tests.

 

  Thanks,

 

 Matt

 

DMPlexDistribute(*dm, 0, NULL, );

if (dmDist) {DMDestroy(dm); *dm = dmDist;}

Thanks

Amir

 

From: Matthew Knepley [mailto:knep...@gmail.com <mailto:knep...@gmail.com> ] 
Sent: Friday, February 16, 2018 6:34 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn 
<mailto:mhbagh...@mail.sjtu.edu.cn> >
Cc: PETSc <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> >
Subject: Re: [petsc-users] Dealing with DMPlexDistribute()

 

On Thu, Feb 15, 2018 at 4:40 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hi 

I am using DMPlex as interface for mesh generation. On single core, I got 
around 3 mesh cells. Whenever, I run on multiple core, say 3, in the output 
file for DM, VTK, I got 3 times mesh cell and point numbers. Does it mean that 
DMPlexDistribute() does not work properly!

 

Hi Amir,

 

It sounds like you are generating a mesh on every process. How are you 
generating the mesh?

 

  Thanks,

 

Matt

 

Thanks 

Amir





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 



Re: [petsc-users] Dealing with DMPlexDistribute()

2018-02-15 Thread Mohammad Hassan Baghaei
Hi Matt

In fact, I created a routine for my specific mesh generation. I firstly, create 
the DMPlex object at first, then setting the chart, then doing symmetrize and 
interpolate. Next, I created coordinate section and giving the coordinates. 
After finishing giving the coordinates, I declare the distribution in routine, 
with this two lines:

DMPlexDistribute(*dm, 0, NULL, );

if (dmDist) {DMDestroy(dm); *dm = dmDist;}

Thanks

Amir

 

From: Matthew Knepley [mailto:knep...@gmail.com] 
Sent: Friday, February 16, 2018 6:34 AM
To: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>
Cc: PETSc <petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Dealing with DMPlexDistribute()

 

On Thu, Feb 15, 2018 at 4:40 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hi 

I am using DMPlex as interface for mesh generation. On single core, I got 
around 3 mesh cells. Whenever, I run on multiple core, say 3, in the output 
file for DM, VTK, I got 3 times mesh cell and point numbers. Does it mean that 
DMPlexDistribute() does not work properly!

 

Hi Amir,

 

It sounds like you are generating a mesh on every process. How are you 
generating the mesh?

 

  Thanks,

 

Matt

 

Thanks 

Amir





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 



[petsc-users] Dealing with DMPlexDistribute()

2018-02-15 Thread Mohammad Hassan Baghaei
Hi 

I am using DMPlex as interface for mesh generation. On single core, I got
around 3 mesh cells. Whenever, I run on multiple core, say 3, in the
output file for DM, VTK, I got 3 times mesh cell and point numbers. Does it
mean that DMPlexDistribute() does not work properly!

Thanks 

Amir



Re: [petsc-users] Accessing a field values of Staggered grid

2018-02-13 Thread Mohammad Hassan Baghaei
Thanks for your great note, Dave. Yeah! I would be able to at least view the 
edge values, although I could not specify the data. Previously I searched in 
points data, I now view the values by Surface With Edges option.

 

From: Dave May [mailto:dave.mayhe...@gmail.com] 
Sent: Wednesday, February 14, 2018 5:37 AM
To: Matthew Knepley <knep...@gmail.com>
Cc: Mohammad Hassan Baghaei <mhbagh...@mail.sjtu.edu.cn>; PETSc 
<petsc-users@mcs.anl.gov>
Subject: Re: [petsc-users] Accessing a field values of Staggered grid

 

 

 

On 13 February 2018 at 21:17, Matthew Knepley <knep...@gmail.com 
<mailto:knep...@gmail.com> > wrote:

On Tue, Feb 13, 2018 at 3:21 PM, Mohammad Hassan Baghaei 
<mhbagh...@mail.sjtu.edu.cn <mailto:mhbagh...@mail.sjtu.edu.cn> > wrote:

Hi

I am filling the local vector from dm , has a section layout. The thing is I 
want to know how I can see the field variable values defined on edges, the 
staggered grid. In fact, Whenever I output to VTK in preview, I would be able 
to see the main grid. But the values which are defined on edges, I could not 
see them and that makes me unsure about the way I fill the local vector. How I 
would be babe to check the field value on staggered grid?

 

VTK does not have a way to specify data on edges, only on cells or vertices.

 

This is not entirely true.

 

At least for a staggered grid, where you have one DOF per edge, you can 
represent the edge data via the type VTK_VERTEX.

You won't generate a beautiful picture, as your field will be rendered as a set 
of points (your edge faces) - but you can at least inspect the values within 
ParaView.

 

Thanks,

  Dave

 

 

  Thanks,

 

Matt

 

Thanks 

Amir

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/> 

 



[petsc-users] Accessing a field values of Staggered grid

2018-02-13 Thread Mohammad Hassan Baghaei
Hi

I am filling the local vector from dm , has a section layout. The thing is I
want to know how I can see the field variable values defined on edges, the
staggered grid. In fact, Whenever I output to VTK in preview, I would be
able to see the main grid. But the values which are defined on edges, I
could not see them and that makes me unsure about the way I fill the local
vector. How I would be babe to check the field value on staggered grid?

Thanks 

Amir



[petsc-users] pseudo-transient ?

2018-02-06 Thread Mohammad Hassan Baghaei
Hi

I wanted to use my solve the system of equation using pseudo-transient
continuation. I found that we can refer to this version for driven cavity
example. However, I could not find it within files
(src/snes/examples/tutorials/ex27.c). Would it be possible for you to share
this file? 

Thanks

Amir

 



Re: [petsc-users] Using DMPlex

2017-12-25 Thread Mohammad Hassan Baghaei
Hello

I want to know whether is it possible that a specific field in the section have 
been defined at some time on edges and other times on the vertices. This change 
in the dof , I think, may cause problem, especially in the global vector size 
of the dm. At times when the field changes to be defined on the edges, I think, 
I need to reset the dof with routine. I know how to do this, thanks to Matt.  
But, how I can deal with the global vector. At first, the global vector was 
defined on the vertices, but by this change. How would the global vector would 
response? Do I need to change the global vector?

Thanks

Amir

 

 

 

Hello

I am using the DMPlex interface for the solving PDEs.

 

Great. What discretization are you using?

 

A  part of mesh, considering, is staggered grid, at the location of middle of 
each edge.

 

So you would like to put variables at each edge midpoint?

 

After generation of main grid points, I find it hard to have the staggered grid 
at the prescribed location.

 

In Plex, the topology is specified by the DMPlex, but the dof layout is 
specified by a PetscSection. To put

variables on edges, you could use:

 

DMGetDefaultSection(dm, );

DMPlexGetDepthStratum(dm, 1, , );

for (e = eStart; e < eEnd; ++e) {

  PetscSectionAddDof(s, e, 1);

}

 

and of course any other dofs you are using.

 

I want to know how to deal with the staggered besides of main grid. Is it 
better to have another DM for the staggered?

 

Another option is to use several DMDA. This has its own drawbacks.

 

Is it possible to extend the DMChart and inserting the points.

 

If the chart does not have edges, it is because it has not been interpolated. 
Either pass the PETSC_TRUE, or call

 

  
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexInterpolate.html

 

  Thanks,

 

  Matt

 

I would really appreciate for your time.

Amir  





 

-- 

What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

 

https://www.cse.buffalo.edu/~knepley/  



[petsc-users] Using DMPlex

2017-12-24 Thread Mohammad Hassan Baghaei
Hello

I am using the DMPlex interface for the solving PDEs. A  part of mesh,
considering, is staggered grid, at the location of middle of each edge.
After generation of main grid points, I find it hard to have the staggered
grid at the prescribed location. I want to know how to deal with the
staggered besides of main grid. Is it better to have another DM for the
staggered? Is it possible to extend the DMChart and inserting the points. I
would really appreciate for your time.

Amir  



[petsc-users] Boundary condition IS

2017-12-06 Thread Mohammad Hassan Baghaei
Hello

I am using DMPlex to construct a fully circular 2D domain for my PDEs. As I
am discretizing the PDEs using finite difference method, I need to know , to
define the layout of PetscSection, how I can find the boundary condition IS.
I know the location of the boundaries in Sieve chart. However, I noticed
that I need to know the Index Set of that location. Can I use the Sieve
point number for Index Set. It seems I think I am not familiar with IS. Can
you help me? Thank for your help. 

Amir



[petsc-users] tensor-product mesh

2017-11-25 Thread Mohammad Hassan Baghaei
Hi

I am going to solve the PDEs on a domain of a circle, which I need to use
the polar coordinates. As dm is supposed for Cartesian coordinate system. Is
it possible to define a new coordinate system in that or I need to use
dmplex for that. Thanks for your great time answering me.