Re: [petsc-users] Optimal coloring using -snes_fd_color with DMDACreate

2018-04-13 Thread Buesing, Henrik
Great! Thank you! I will have a look at the code and I will also check how much 
function evaluations are needed in my case. 

Henrik


-- 
Dipl.-Math. Henrik Büsing
Institute for Applied Geophysics and Geothermal Energy
E.ON Energy Research Center
RWTH Aachen University

Mathieustr. 10| Tel +49 (0)241 80 49907
52074 Aachen, Germany | Fax +49 (0)241 80 49889

http://www.eonerc.rwth-aachen.de/GGE
hbues...@eonerc.rwth-aachen.de

 -Ursprüngliche Nachricht-
 Von: Smith, Barry F. 
 Gesendet: Donnerstag, 12. April 2018 16:42
 An: Buesing, Henrik 
 Cc: petsc-users 
 Betreff: Re: [petsc-users] Optimal coloring using -snes_fd_color with
 DMDACreate
 
 
I'm not familiar with that paper so I am not sure if it produces
 exactly the same colorings. It is based on the same principle. The
 coloring is done in
 /src/dm/impls/da/fdda.c DMCreateColoring_DA_3d_MPIAIJ() so you could
 compare. Note if they have more efficient special cases in the paper
 they could be added to the code without too much difficulty.
 
Barry
 
 
 > On Apr 12, 2018, at 8:26 AM, Buesing, Henrik  wrote:
 >
 > Dear all,
 >
 > When I use –snes_fd_color with my da created by DMDACreate3d, will it
 use an optimal coloring algorithm (see [1]) to estimate the Jacobian?
 >
 > Thank you!
 > Henrik
 >
 >
 >
 > [1]
 > Goldfarb/Toint: Optimal estimation of Jacobian and Hessian matrices
 that arise in finite difference calculations
 > https://doi.org/10.1090/S0025-5718-1984-0744925-5
 >
 >
 > --
 > Dipl.-Math. Henrik Büsing
 > Institute for Applied Geophysics and Geothermal Energy
 > E.ON Energy Research Center
 > RWTH Aachen University
 > --
 > Mathieustr. 10|Tel +49 (0)241 80 49907
 > 52074 Aachen, Germany |Fax +49 (0)241 80 49889
 > --
 > http://www.eonerc.rwth-aachen.de/GGE
 > hbues...@eonerc.rwth-aachen.de
 > --



Re: [petsc-users] Change the matrix row order

2018-04-13 Thread

Thanks for your reply! And sorry for my late answer. I want to parallel a 
particle-method code and solve Ax=b in each timestep.  In this code, each 
partition forms a CSR matrix and assembles the final coefficient matrix by 
MatCreateMPIAIJWithArrays. But, the domain decomposition makes that the 
particles' order doesn't follow the original order. In other words, Solution 
Vector x follows the original order but Vector b follows a new order due to 
domain decomposition. So I want to change the Vector b's order and Matrix A's 
row order to follow the origin order. I have been considering to change my 
parallel code in these days, but I didn't find a best way. I'm considering to 
multiply a renumbering identity matrix at both sides of the equation with 
function MatMatMult. Do you have any suggestions for this problem? If the 
function MatMatMult can influence the parallel efficiency obviously?

Thanks again!
Daye






At 2018-04-10 22:07:04, "Smith, Barry F."  wrote:
>
>   When and where do you want to change the row order?
>
>   For PETSc and external factorization based solvers this is handled 
> automatically, no need to do anything.
>
>   The ordering of matrix rows corresponds to the ordering of the vectors; 
> almost always one partitions and orders the vectors based on the mesh that 
> underlies the problem and there is no reason to reorder once the layout is 
> initially determined.
>
>   Barry
>
>
>
>> On Apr 10, 2018, at 8:42 AM, 我  wrote:
>> 
>> Hello,
>> I want to change the row order of a sparse matrix. Are there any build-in 
>> functions and suggestions?
>> Thank you very much!
>> Daye
>> 
>> 
>>  
>


Re: [petsc-users] Change the matrix row order

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 5:45 AM, 我  wrote:

>
> Thanks for your reply! And sorry for my late answer. I want to parallel a
> particle-method code and solve Ax=b in each timestep.  In this code, each
> partition forms a CSR matrix and assembles the final coefficient matrix by
> MatCreateMPIAIJWithArrays. But, the domain decomposition makes that the
> particles' order doesn't follow the original order. In other words,
> Solution Vector x follows the original order but Vector b follows a new
> order due to domain decomposition. So I want to change the Vector b's order
> and Matrix A's row order to follow the origin order. I have been
> considering to change my parallel code in these days, but I didn't find a
> best way. I'm considering to multiply a renumbering identity matrix at both
> sides of the equation with function MatMatMult. Do you have any suggestions
> for this problem? If the function MatMatMult can influence the parallel
> efficiency obviously?
>

I would not do this. The amount of communication to assemble those things
would most likely swamp the speedup you gained.
If anything, reoder x. However, why would you need to be the original order
ever? Just use the order after partition. That is how
parallel codes work for the most part.

  Thanks,

 Matt


> Thanks again!
> Daye
>
>
>
>
> At 2018-04-10 22:07:04, "Smith, Barry F."  wrote:
> >
> >   When and where do you want to change the row order?
> >
> >   For PETSc and external factorization based solvers this is handled 
> > automatically, no need to do anything.
> >
> >   The ordering of matrix rows corresponds to the ordering of the vectors; 
> > almost always one partitions and orders the vectors based on the mesh that 
> > underlies the problem and there is no reason to reorder once the layout is 
> > initially determined.
> >
> >   Barry
> >
> >
> >
> >> On Apr 10, 2018, at 8:42 AM, 我  wrote:
> >>
> >> Hello,
> >> I want to change the row order of a sparse matrix. Are there any build-in 
> >> functions and suggestions?
> >> Thank you very much!
> >> Daye
> >>
> >>
> >>
> >
>
>
>
>
>



-- 
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] teething troubles / MatView() fails silently for transposed seqaij matrix

2018-04-13 Thread Bryan Jurish
morning all,

Apologies for what is very probably a boundlessly stupid question.  I've
just begun exploring PETSc, but find myself stumped by a pretty trivial
task.  I would like to load a real binary seqaij matrix and save its
transposition (also as a binary  seqaij matrix) to a different file.  I've
tried PETSc v3.7.5 on debian stretch and v3.6.2 on ubuntu 16.04, both with
no joy.  In both cases the program runs to completion and exits normally,
but no output file ("INFILE.T") is written.  Stepping through MatView()
with the debugger, it seems that (mat->ops->view) is not set for the
transposition I created with MatCreateTranspose(). I suppose I could always
loop over the input indices and assemble a physical transposition manually,
but that rather defeats the purpose of the exercise... can anyone here tell
me what I'm doing wrong (almost certainly something fundamental and
obvious)?  Thanks in advance for any help you can provide.

marmosets,
  Bryan

::: BEGIN MINIMUM BROKEN EXAMPLE :::
/*-*- Mode: C -*-*/

static char help[] = "Transposes a matrix in BINARY format\n\
Input parameters are:\n\
  -file INFILE : input matrix in binary format\n\
  -out OUTFILE : write output to OUTFILE (default=INFILE.T)\n\
";


#include 

//-- handle v3.7 API change
#if PETSC_VERSION_MAJOR>3 || (PETSC_VERSION_MAJOR==3 &&
PETSC_VERSION_MINOR>=7)
  #define OPTIONS_NULL NULL,NULL
#else
  #define OPTIONS_NULL NULL
#endif


#undef __FUNCT__
#define __FUNCT__ "main"
int main(int argc,char **args)
{
  MatA,B;
  char   infile[PETSC_MAX_PATH_LEN], outfile[PETSC_MAX_PATH_LEN];
  PetscErrorCode ierr;
  PetscInt   m,n;
  PetscViewerview;
  PetscBool  flg_file,flg_out;
  PetscMPIIntsize;

  PetscInitialize(&argc,&args,(char*)0,help);
  ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
  ierr = PetscPrintf(PETSC_COMM_WORLD," MPI_Comm_size reports %d
process(es) available.\n", size);CHKERRQ(ierr);
  if (size != 1) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP,"This is a
uniprocessor operation only!");

  /*-- Read in source matrix, binary --*/
  ierr =
PetscOptionsGetString(OPTIONS_NULL,"-file",infile,PETSC_MAX_PATH_LEN,&flg_file);CHKERRQ(ierr);
  if (!flg_file) SETERRQ(PETSC_COMM_WORLD,1,"Must specify a file name with
the -file option");

#if defined(PETSC_USE_COMPLEX)
  ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from binary
file `%s'...\n", infile);CHKERRQ(ierr);
#else
  ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from binary
file `%s'...\n", infile);CHKERRQ(ierr);
#endif
  ierr =
PetscViewerBinaryOpen(PETSC_COMM_WORLD,infile,FILE_MODE_READ,&view);CHKERRQ(ierr);
  ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
  ierr = MatSetFromOptions(A);CHKERRQ(ierr);
  ierr = MatLoad(A,view);CHKERRQ(ierr);
  ierr = PetscViewerDestroy(&view);CHKERRQ(ierr);
  //
  ierr = MatGetSize(A,&m,&n);
  ierr = PetscPrintf(PETSC_COMM_WORLD," Read input matrix of size
(m=%D,n=%D)\n", m,n);CHKERRQ(ierr);

  /*-- guts: transpose --*/
  ierr = PetscPrintf(PETSC_COMM_WORLD," Performing transposition
(constructive)\n");CHKERRQ(ierr);
  ierr = MatCreateTranspose(A,&B);CHKERRQ(ierr);

  /*-- dump transposed matrix --*/
  ierr =
PetscOptionsGetString(OPTIONS_NULL,"-out",outfile,PETSC_MAX_PATH_LEN,&flg_out);CHKERRQ(ierr);
  if (!flg_out) {
strcpy(outfile,infile);
strcat(outfile,".T");
  }
  ierr = PetscPrintf(PETSC_COMM_SELF," Writing transposed matrix in binary
format to '%s' ...\n", outfile);CHKERRQ(ierr);
  ierr =
PetscViewerBinaryOpen(PETSC_COMM_SELF,outfile,FILE_MODE_WRITE,&view);CHKERRQ(ierr);
  ierr = MatView(B,view);CHKERRQ(ierr);

  /* !!!
   * output file is not written: much wailing and gnashing of teeth
   * !!!
   */

  /*-- cleanup --*/
  ierr = MatDestroy(&A);CHKERRQ(ierr);
  ierr = MatDestroy(&B);CHKERRQ(ierr);
  ierr = PetscViewerDestroy(&view);CHKERRQ(ierr);
  ierr = PetscFinalize();
  return 0;
}
::: END MINIMUM BROKEN EXAMPLE :::

-- 
Bryan Jurish   "There is *always* one more bug."
moocow.bov...@gmail.com -Lubarsky's Law of Cybernetic Entomology


Re: [petsc-users] teething troubles / MatView() fails silently for transposed seqaij matrix

2018-04-13 Thread Junchao Zhang
Looks like MatCreateTranspose does not form the transpose, See the notes
here
.
You
may want to use MatTranspose

.

--Junchao Zhang

On Fri, Apr 13, 2018 at 7:25 AM, Bryan Jurish 
wrote:

> morning all,
>
> Apologies for what is very probably a boundlessly stupid question.  I've
> just begun exploring PETSc, but find myself stumped by a pretty trivial
> task.  I would like to load a real binary seqaij matrix and save its
> transposition (also as a binary  seqaij matrix) to a different file.
> I've tried PETSc v3.7.5 on debian stretch and v3.6.2 on ubuntu 16.04, both
> with no joy.  In both cases the program runs to completion and exits
> normally, but no output file ("INFILE.T") is written.  Stepping through
> MatView() with the debugger, it seems that (mat->ops->view) is not set for
> the transposition I created with MatCreateTranspose(). I suppose I could
> always loop over the input indices and assemble a physical transposition
> manually, but that rather defeats the purpose of the exercise... can anyone
> here tell me what I'm doing wrong (almost certainly something fundamental
> and obvious)?  Thanks in advance for any help you can provide.
>
> marmosets,
>   Bryan
>
> ::: BEGIN MINIMUM BROKEN EXAMPLE :::
> /*-*- Mode: C -*-*/
>
> static char help[] = "Transposes a matrix in BINARY format\n\
> Input parameters are:\n\
>   -file INFILE : input matrix in binary format\n\
>   -out OUTFILE : write output to OUTFILE (default=INFILE.T)\n\
> ";
>
>
> #include 
>
> //-- handle v3.7 API change
> #if PETSC_VERSION_MAJOR>3 || (PETSC_VERSION_MAJOR==3 &&
> PETSC_VERSION_MINOR>=7)
>   #define OPTIONS_NULL NULL,NULL
> #else
>   #define OPTIONS_NULL NULL
> #endif
>
>
> #undef __FUNCT__
> #define __FUNCT__ "main"
> int main(int argc,char **args)
> {
>   MatA,B;
>   char   infile[PETSC_MAX_PATH_LEN], outfile[PETSC_MAX_PATH_LEN];
>   PetscErrorCode ierr;
>   PetscInt   m,n;
>   PetscViewerview;
>   PetscBool  flg_file,flg_out;
>   PetscMPIIntsize;
>
>   PetscInitialize(&argc,&args,(char*)0,help);
>   ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
>   ierr = PetscPrintf(PETSC_COMM_WORLD," MPI_Comm_size reports %d
> process(es) available.\n", size);CHKERRQ(ierr);
>   if (size != 1) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP,"This is a
> uniprocessor operation only!");
>
>   /*-- Read in source matrix, binary --*/
>   ierr = PetscOptionsGetString(OPTIONS_NULL,"-file",infile,PETSC_MAX_
> PATH_LEN,&flg_file);CHKERRQ(ierr);
>   if (!flg_file) SETERRQ(PETSC_COMM_WORLD,1,"Must specify a file name
> with the -file option");
>
> #if defined(PETSC_USE_COMPLEX)
>   ierr = PetscPrintf(PETSC_COMM_WORLD," Reading COMPLEX matrix from binary
> file `%s'...\n", infile);CHKERRQ(ierr);
> #else
>   ierr = PetscPrintf(PETSC_COMM_WORLD," Reading REAL matrix from binary
> file `%s'...\n", infile);CHKERRQ(ierr);
> #endif
>   ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,infile,FILE_MODE_
> READ,&view);CHKERRQ(ierr);
>   ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
>   ierr = MatSetFromOptions(A);CHKERRQ(ierr);
>   ierr = MatLoad(A,view);CHKERRQ(ierr);
>   ierr = PetscViewerDestroy(&view);CHKERRQ(ierr);
>   //
>   ierr = MatGetSize(A,&m,&n);
>   ierr = PetscPrintf(PETSC_COMM_WORLD," Read input matrix of size
> (m=%D,n=%D)\n", m,n);CHKERRQ(ierr);
>
>   /*-- guts: transpose --*/
>   ierr = PetscPrintf(PETSC_COMM_WORLD," Performing transposition
> (constructive)\n");CHKERRQ(ierr);
>   ierr = MatCreateTranspose(A,&B);CHKERRQ(ierr);
>
>   /*-- dump transposed matrix --*/
>   ierr = PetscOptionsGetString(OPTIONS_NULL,"-out",outfile,PETSC_MAX_
> PATH_LEN,&flg_out);CHKERRQ(ierr);
>   if (!flg_out) {
> strcpy(outfile,infile);
> strcat(outfile,".T");
>   }
>   ierr = PetscPrintf(PETSC_COMM_SELF," Writing transposed matrix in binary
> format to '%s' ...\n", outfile);CHKERRQ(ierr);
>   ierr = PetscViewerBinaryOpen(PETSC_COMM_SELF,outfile,FILE_MODE_
> WRITE,&view);CHKERRQ(ierr);
>   ierr = MatView(B,view);CHKERRQ(ierr);
>
>   /* !!!
>* output file is not written: much wailing and gnashing of teeth
>* !!!
>*/
>
>   /*-- cleanup --*/
>   ierr = MatDestroy(&A);CHKERRQ(ierr);
>   ierr = MatDestroy(&B);CHKERRQ(ierr);
>   ierr = PetscViewerDestroy(&view);CHKERRQ(ierr);
>   ierr = PetscFinalize();
>   return 0;
> }
> ::: END MINIMUM BROKEN EXAMPLE :::
>
> --
> Bryan Jurish   "There is *always* one more bug."
> moocow.bov...@gmail.com -Lubarsky's Law of Cybernetic Entomology
>


[petsc-users] FIELDSPLIT preconditioner in parallel

2018-04-13 Thread Rossi, Simone
Hello,

I'm trying to use PCFIELDSPLIT to solve a two by two block system and it is 
working pretty nicely (thanks a lot for that!).

I'm still having some issues in parallel though: the ksp solver throws an error 
when one of the fields does not have DOFs  on a processor. Is there a way  
around it?

Thanks a lot for the help,

Simone


Re: [petsc-users] FIELDSPLIT preconditioner in parallel

2018-04-13 Thread Smith, Barry F.

1) Is this with the latest PETSc? some of these issues may have been fixed.

2) Please send use something that reproduces the problem and we will fix it. We 
aren't aware of this problem.

  Barry


> On Apr 13, 2018, at 9:50 AM, Rossi, Simone  wrote:
> 
> Hello,
> I'm trying to use PCFIELDSPLIT to solve a two by two block system and it is 
> working pretty nicely (thanks a lot for that!).
> I'm still having some issues in parallel though: the ksp solver throws an 
> error when one of the fields does not have DOFs  on a processor. Is there a 
> way  around it?
> Thanks a lot for the help,
> Simone



Re: [petsc-users] FIELDSPLIT preconditioner in parallel

2018-04-13 Thread Rossi, Simone
I have not tried with the latest version yet. I found this problem in v3.7.7. 
I'll try that and let you know.
If the problem is still there, I'll send you an example.
Thanks for the help,
Simone



From: Smith, Barry F. 
Sent: Friday, April 13, 2018 10:52:13 AM
To: Rossi, Simone
Cc: petsc-users@mcs.anl.gov
Subject: Re: [petsc-users] FIELDSPLIT preconditioner in parallel


1) Is this with the latest PETSc? some of these issues may have been fixed.

2) Please send use something that reproduces the problem and we will fix it. We 
aren't aware of this problem.

  Barry


> On Apr 13, 2018, at 9:50 AM, Rossi, Simone  wrote:
>
> Hello,
> I'm trying to use PCFIELDSPLIT to solve a two by two block system and it is 
> working pretty nicely (thanks a lot for that!).
> I'm still having some issues in parallel though: the ksp solver throws an 
> error when one of the fields does not have DOFs  on a processor. Is there a 
> way  around it?
> Thanks a lot for the help,
> Simone



Re: [petsc-users] FIELDSPLIT preconditioner in parallel

2018-04-13 Thread Rossi, Simone
It looks like the problem was solved in one of the updates. I cannot reproduce 
that behavior with the latest PETSc. Thanks!


I'll let you know if it happens again.


Simone


From: Smith, Barry F. 
Sent: Friday, April 13, 2018 10:52:13 AM
To: Rossi, Simone
Cc: petsc-users@mcs.anl.gov
Subject: Re: [petsc-users] FIELDSPLIT preconditioner in parallel


1) Is this with the latest PETSc? some of these issues may have been fixed.

2) Please send use something that reproduces the problem and we will fix it. We 
aren't aware of this problem.

  Barry


> On Apr 13, 2018, at 9:50 AM, Rossi, Simone  wrote:
>
> Hello,
> I'm trying to use PCFIELDSPLIT to solve a two by two block system and it is 
> working pretty nicely (thanks a lot for that!).
> I'm still having some issues in parallel though: the ksp solver throws an 
> error when one of the fields does not have DOFs  on a processor. Is there a 
> way  around it?
> Thanks a lot for the help,
> Simone



[petsc-users] PETScFE Point Source

2018-04-13 Thread Robert Walker
Hello,

Is there an example of application of a point source in one of the
tutorial  PETScFE style examples? Ideally this would be some point on the
interior, and not necessarily on a boundary.

Thanks, and apologies in advance if this is a stupid question,

Robert


Robert L. Walker
MS Petroleum Engineering
Mork Family Department of Chemicals and Materials Sciences
University of Southern California
--
Mobile US: +1 (213) - 290 -7101
Mobile EU: +34 62 274 66 40
rlwal...@usc.edu


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:

> Hello,
>
> Is there an example of application of a point source in one of the
> tutorial  PETScFE style examples? Ideally this would be some point on the
> interior, and not necessarily on a boundary.
>
> Thanks, and apologies in advance if this is a stupid question,
>

No, good question. You would have to decide what that meant in FEM terms.
All the internal integrals are done
with quadrature. So putting the source at a quadrature point would work,
although its a little difficult to know where
they will be. You could smooth it out a little, and check coordinates in
the forcing function. Last, you could check
for a "close enough" quadrature point and put it there. I think making a
slightly extended source is usually best.

  Thanks,

 Matt


> Robert
>
>
> Robert L. Walker
> MS Petroleum Engineering
> Mork Family Department of Chemicals and Materials Sciences
> University of Southern California
> --
> Mobile US: +1 (213) - 290 -7101
> Mobile EU: +34 62 274 66 40
> rlwal...@usc.edu
>



-- 
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/ 


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Robert Walker
Ok, let me rephrase that...something like way FEniCS (if i remember
correctly) handles this ... between two values with a very small difference
between them on each axis? Is there an example of something like that to
use as a security blanket from which to expand?

Robert

Robert L. Walker
MS Petroleum Engineering
Mork Family Department of Chemicals and Materials Sciences
University of Southern California
--
Mobile US: +1 (213) - 290 -7101
Mobile EU: +34 62 274 66 40
rlwal...@usc.edu

On Fri, Apr 13, 2018 at 10:46 AM, Matthew Knepley  wrote:

> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>
>> Hello,
>>
>> Is there an example of application of a point source in one of the
>> tutorial  PETScFE style examples? Ideally this would be some point on the
>> interior, and not necessarily on a boundary.
>>
>> Thanks, and apologies in advance if this is a stupid question,
>>
>
> No, good question. You would have to decide what that meant in FEM terms.
> All the internal integrals are done
> with quadrature. So putting the source at a quadrature point would work,
> although its a little difficult to know where
> they will be. You could smooth it out a little, and check coordinates in
> the forcing function. Last, you could check
> for a "close enough" quadrature point and put it there. I think making a
> slightly extended source is usually best.
>
>   Thanks,
>
>  Matt
>
>
>> Robert
>>
>>
>> Robert L. Walker
>> MS Petroleum Engineering
>> Mork Family Department of Chemicals and Materials Sciences
>> University of Southern California
>> --
>> Mobile US: +1 (213) - 290 -7101
>> Mobile EU: +34 62 274 66 40
>> rlwal...@usc.edu
>>
>
>
>
> --
> 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/
> 
>


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 1:51 PM, Robert Walker  wrote:

> Ok, let me rephrase that...something like way FEniCS (if i remember
> correctly) handles this ... between two values with a very small difference
> between them on each axis? Is there an example of something like that to
> use as a security blanket from which to expand?
>

I would start with a Gaussian source at some point, and then push it toward
the limit. That way you know
all the correct normalization, and its smooth.

  Matt


> Robert
>
> Robert L. Walker
> MS Petroleum Engineering
> Mork Family Department of Chemicals and Materials Sciences
> University of Southern California
> --
> Mobile US: +1 (213) - 290 -7101
> Mobile EU: +34 62 274 66 40
> rlwal...@usc.edu
>
> On Fri, Apr 13, 2018 at 10:46 AM, Matthew Knepley 
> wrote:
>
>> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>>
>>> Hello,
>>>
>>> Is there an example of application of a point source in one of the
>>> tutorial  PETScFE style examples? Ideally this would be some point on the
>>> interior, and not necessarily on a boundary.
>>>
>>> Thanks, and apologies in advance if this is a stupid question,
>>>
>>
>> No, good question. You would have to decide what that meant in FEM terms.
>> All the internal integrals are done
>> with quadrature. So putting the source at a quadrature point would work,
>> although its a little difficult to know where
>> they will be. You could smooth it out a little, and check coordinates in
>> the forcing function. Last, you could check
>> for a "close enough" quadrature point and put it there. I think making a
>> slightly extended source is usually best.
>>
>>   Thanks,
>>
>>  Matt
>>
>>
>>> Robert
>>>
>>>
>>> Robert L. Walker
>>> MS Petroleum Engineering
>>> Mork Family Department of Chemicals and Materials Sciences
>>> University of Southern California
>>> --
>>> Mobile US: +1 (213) - 290 -7101
>>> Mobile EU: +34 62 274 66 40
>>> rlwal...@usc.edu
>>>
>>
>>
>>
>> --
>> 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/
>> 
>>
>
>


-- 
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/ 


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Stefano Zampini
What do you mean by point sources? Dirac's delta terms ? If so, these
translates into basis function evaluations , and should not be hard to
support it, but it will require a different API. Matt?

Il Ven 13 Apr 2018, 20:51 Robert Walker  ha scritto:

> Ok, let me rephrase that...something like way FEniCS (if i remember
> correctly) handles this ... between two values with a very small difference
> between them on each axis? Is there an example of something like that to
> use as a security blanket from which to expand?
>
> Robert
>
> Robert L. Walker
> MS Petroleum Engineering
> Mork Family Department of Chemicals and Materials Sciences
> University of Southern California
> --
> Mobile US: +1 (213) - 290 -7101
> Mobile EU: +34 62 274 66 40
> rlwal...@usc.edu
>
> On Fri, Apr 13, 2018 at 10:46 AM, Matthew Knepley 
> wrote:
>
>> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>>
>>> Hello,
>>>
>>> Is there an example of application of a point source in one of the
>>> tutorial  PETScFE style examples? Ideally this would be some point on the
>>> interior, and not necessarily on a boundary.
>>>
>>> Thanks, and apologies in advance if this is a stupid question,
>>>
>>
>> No, good question. You would have to decide what that meant in FEM terms.
>> All the internal integrals are done
>> with quadrature. So putting the source at a quadrature point would work,
>> although its a little difficult to know where
>> they will be. You could smooth it out a little, and check coordinates in
>> the forcing function. Last, you could check
>> for a "close enough" quadrature point and put it there. I think making a
>> slightly extended source is usually best.
>>
>>   Thanks,
>>
>>  Matt
>>
>>
>>> Robert
>>>
>>>
>>> Robert L. Walker
>>> MS Petroleum Engineering
>>> Mork Family Department of Chemicals and Materials Sciences
>>> University of Southern California
>>> --
>>> Mobile US: +1 (213) - 290 -7101
>>> Mobile EU: +34 62 274 66 40
>>> rlwal...@usc.edu
>>>
>>
>>
>>
>> --
>> 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/
>> 
>>
>
>


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 2:07 PM, Stefano Zampini 
wrote:

> What do you mean by point sources? Dirac's delta terms ? If so, these
> translates into basis function evaluations , and should not be hard to
> support it, but it will require a different API. Matt?
>

That is another thing you could do. We will do that shortly.

  Matt


> Il Ven 13 Apr 2018, 20:51 Robert Walker  ha scritto:
>
>> Ok, let me rephrase that...something like way FEniCS (if i remember
>> correctly) handles this ... between two values with a very small difference
>> between them on each axis? Is there an example of something like that to
>> use as a security blanket from which to expand?
>>
>> Robert
>>
>> Robert L. Walker
>> MS Petroleum Engineering
>> Mork Family Department of Chemicals and Materials Sciences
>> University of Southern California
>> --
>> Mobile US: +1 (213) - 290 -7101
>> Mobile EU: +34 62 274 66 40
>> rlwal...@usc.edu
>>
>> On Fri, Apr 13, 2018 at 10:46 AM, Matthew Knepley 
>> wrote:
>>
>>> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>>>
 Hello,

 Is there an example of application of a point source in one of the
 tutorial  PETScFE style examples? Ideally this would be some point on the
 interior, and not necessarily on a boundary.

 Thanks, and apologies in advance if this is a stupid question,

>>>
>>> No, good question. You would have to decide what that meant in FEM
>>> terms. All the internal integrals are done
>>> with quadrature. So putting the source at a quadrature point would work,
>>> although its a little difficult to know where
>>> they will be. You could smooth it out a little, and check coordinates in
>>> the forcing function. Last, you could check
>>> for a "close enough" quadrature point and put it there. I think making a
>>> slightly extended source is usually best.
>>>
>>>   Thanks,
>>>
>>>  Matt
>>>
>>>
 Robert


 Robert L. Walker
 MS Petroleum Engineering
 Mork Family Department of Chemicals and Materials Sciences
 University of Southern California
 --
 Mobile US: +1 (213) - 290 -7101
 Mobile EU: +34 62 274 66 40
 rlwal...@usc.edu

>>>
>>>
>>>
>>> --
>>> 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/
>>> 
>>>
>>
>>


-- 
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/ 


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Sanjay Govindjee
Wouldn't it make the most sense to do it in a variationally consistent 
manner


rhs_a = int{ N_a delta(x - x_o) }

where x_o is the location of the point source?

-sanjay

On 4/13/18 7:46 PM, Matthew Knepley wrote:
On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker > wrote:


Hello,

Is there an example of application of a point source in one of the
tutorial  PETScFE style examples? Ideally this would be some point
on the interior, and not necessarily on a boundary.

Thanks, and apologies in advance if this is a stupid question,


No, good question. You would have to decide what that meant in FEM 
terms. All the internal integrals are done
with quadrature. So putting the source at a quadrature point would 
work, although its a little difficult to know where
they will be. You could smooth it out a little, and check coordinates 
in the forcing function. Last, you could check
for a "close enough" quadrature point and put it there. I think making 
a slightly extended source is usually best.


  Thanks,

     Matt

Robert


Robert L. Walker
MS Petroleum Engineering
Mork Family Department of Chemicals and Materials Sciences
University of Southern California
--
Mobile US: +1 (213) - 290 -7101
Mobile EU: +34 62 274 66 40
rlwal...@usc.edu 




--
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/ 


--
---
Sanjay Govindjee, PhD, PE
Horace, Dorothy, and Katherine Johnson Professor in Engineering

779 Davis Hall
University of California
Berkeley, CA 94720-1710

Voice:  +1 510 642 6060
FAX:+1 510 643 5264
s...@berkeley.edu
http://faculty.ce.berkeley.edu/sanjay
---

Books:

Engineering Mechanics of Deformable Solids
http://amzn.com/0199651647

Engineering Mechanics 3 (Dynamics) 2nd Edition
http://amzn.com/3642537111

Engineering Mechanics 3, Supplementary Problems: Dynamics
http://www.amzn.com/B00SOXN8JU

NSF NHERI SimCenter
https://simcenter.designsafe-ci.org/
---



Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Stefano Zampini
Il Ven 13 Apr 2018, 21:27 Sanjay Govindjee  ha scritto:

> Wouldn't it make the most sense to do it in a variationally consistent
> manner
>
> rhs_a = int{ N_a delta(x - x_o) }
>
> where x_o is the location of the point source?
>


This is what I meant. However, the current callbacks for residual
evaluation in PetscDS do not allow to do it.


> -sanjay
>
> On 4/13/18 7:46 PM, Matthew Knepley wrote:
>
> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>
>> Hello,
>>
>> Is there an example of application of a point source in one of the
>> tutorial  PETScFE style examples? Ideally this would be some point on the
>> interior, and not necessarily on a boundary.
>>
>> Thanks, and apologies in advance if this is a stupid question,
>>
>
> No, good question. You would have to decide what that meant in FEM terms.
> All the internal integrals are done
> with quadrature. So putting the source at a quadrature point would work,
> although its a little difficult to know where
> they will be. You could smooth it out a little, and check coordinates in
> the forcing function. Last, you could check
> for a "close enough" quadrature point and put it there. I think making a
> slightly extended source is usually best.
>
>   Thanks,
>
>  Matt
>
>
>> Robert
>>
>>
>> Robert L. Walker
>> MS Petroleum Engineering
>> Mork Family Department of Chemicals and Materials Sciences
>> University of Southern California
>> --
>> Mobile US: +1 (213) - 290 -7101
>> Mobile EU: +34 62 274 66 40
>> rlwal...@usc.edu
>>
>
>
>
> --
> 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/ 
>
>
> --
> ---
> Sanjay Govindjee, PhD, PE
> Horace, Dorothy, and Katherine Johnson Professor in Engineering
>
> 779 Davis Hall
> University of California
> Berkeley, CA 94720-1710
>
> Voice:  +1 510 642 6060
> FAX:+1 510 643 5264s_g@berkeley.eduhttp://faculty.ce.berkeley.edu/sanjay
> ---
>
> Books:
>
> Engineering Mechanics of Deformable Solidshttp://amzn.com/0199651647
>
> Engineering Mechanics 3 (Dynamics) 2nd Editionhttp://amzn.com/3642537111
>
> Engineering Mechanics 3, Supplementary Problems: Dynamics 
> http://www.amzn.com/B00SOXN8JU
>
> NSF NHERI SimCenterhttps://simcenter.designsafe-ci.org/
> ---
>
>
>


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 2:27 PM, Sanjay Govindjee  wrote:

> Wouldn't it make the most sense to do it in a variationally consistent
> manner
>
> rhs_a = int{ N_a delta(x - x_o) }
>
> where x_o is the location of the point source?
>

That is what Stefano is saying. You can do that, it just means an API
change. We are doing
that for DMSwarm

   Matt


> -sanjay
>
> On 4/13/18 7:46 PM, Matthew Knepley wrote:
>
> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>
>> Hello,
>>
>> Is there an example of application of a point source in one of the
>> tutorial  PETScFE style examples? Ideally this would be some point on the
>> interior, and not necessarily on a boundary.
>>
>> Thanks, and apologies in advance if this is a stupid question,
>>
>
> No, good question. You would have to decide what that meant in FEM terms.
> All the internal integrals are done
> with quadrature. So putting the source at a quadrature point would work,
> although its a little difficult to know where
> they will be. You could smooth it out a little, and check coordinates in
> the forcing function. Last, you could check
> for a "close enough" quadrature point and put it there. I think making a
> slightly extended source is usually best.
>
>   Thanks,
>
>  Matt
>
>
>> Robert
>>
>>
>> Robert L. Walker
>> MS Petroleum Engineering
>> Mork Family Department of Chemicals and Materials Sciences
>> University of Southern California
>> --
>> Mobile US: +1 (213) - 290 -7101
>> Mobile EU: +34 62 274 66 40
>> rlwal...@usc.edu
>>
>
>
>
> --
> 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/ 
>
>
> --
> ---
> Sanjay Govindjee, PhD, PE
> Horace, Dorothy, and Katherine Johnson Professor in Engineering
>
> 779 Davis Hall
> University of California
> Berkeley, CA 94720-1710
>
> Voice:  +1 510 642 6060
> FAX:+1 510 643 5264s_g@berkeley.eduhttp://faculty.ce.berkeley.edu/sanjay
> ---
>
> Books:
>
> Engineering Mechanics of Deformable Solidshttp://amzn.com/0199651647
>
> Engineering Mechanics 3 (Dynamics) 2nd Editionhttp://amzn.com/3642537111
>
> Engineering Mechanics 3, Supplementary Problems: Dynamics 
> http://www.amzn.com/B00SOXN8JU
>
> NSF NHERI SimCenterhttps://simcenter.designsafe-ci.org/
> ---
>
>
>


-- 
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/ 


Re: [petsc-users] PETScFE Point Source

2018-04-13 Thread Matthew Knepley
On Fri, Apr 13, 2018 at 2:37 PM, Stefano Zampini 
wrote:

> Il Ven 13 Apr 2018, 21:27 Sanjay Govindjee  ha scritto:
>
>> Wouldn't it make the most sense to do it in a variationally consistent
>> manner
>>
>> rhs_a = int{ N_a delta(x - x_o) }
>>
>> where x_o is the location of the point source?
>>
>
>
> This is what I meant. However, the current callbacks for residual
> evaluation in PetscDS do not allow to do it.
>

And I don't think they should since that is not something that can be done
by quadrature, so the interface is still unclear.
Anyone can code something up ;)

  Matt


> -sanjay
>>
>> On 4/13/18 7:46 PM, Matthew Knepley wrote:
>>
>> On Fri, Apr 13, 2018 at 1:40 PM, Robert Walker  wrote:
>>
>>> Hello,
>>>
>>> Is there an example of application of a point source in one of the
>>> tutorial  PETScFE style examples? Ideally this would be some point on the
>>> interior, and not necessarily on a boundary.
>>>
>>> Thanks, and apologies in advance if this is a stupid question,
>>>
>>
>> No, good question. You would have to decide what that meant in FEM terms.
>> All the internal integrals are done
>> with quadrature. So putting the source at a quadrature point would work,
>> although its a little difficult to know where
>> they will be. You could smooth it out a little, and check coordinates in
>> the forcing function. Last, you could check
>> for a "close enough" quadrature point and put it there. I think making a
>> slightly extended source is usually best.
>>
>>   Thanks,
>>
>>  Matt
>>
>>
>>> Robert
>>>
>>>
>>> Robert L. Walker
>>> MS Petroleum Engineering
>>> Mork Family Department of Chemicals and Materials Sciences
>>> University of Southern California
>>> --
>>> Mobile US: +1 (213) - 290 -7101
>>> Mobile EU: +34 62 274 66 40
>>> rlwal...@usc.edu
>>>
>>
>>
>>
>> --
>> 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/ 
>>
>>
>> --
>> ---
>> Sanjay Govindjee, PhD, PE
>> Horace, Dorothy, and Katherine Johnson Professor in Engineering
>>
>> 779 Davis Hall
>> University of California
>> Berkeley, CA 94720-1710
>>
>> Voice:  +1 510 642 6060
>> FAX:+1 510 643 5264s_g@berkeley.eduhttp://faculty.ce.berkeley.edu/sanjay
>> ---
>>
>> Books:
>>
>> Engineering Mechanics of Deformable Solidshttp://amzn.com/0199651647
>>
>> Engineering Mechanics 3 (Dynamics) 2nd Editionhttp://amzn.com/3642537111
>>
>> Engineering Mechanics 3, Supplementary Problems: Dynamics 
>> http://www.amzn.com/B00SOXN8JU
>>
>> NSF NHERI SimCenterhttps://simcenter.designsafe-ci.org/
>> ---
>>
>>
>>


-- 
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/