Re: [petsc-users] DMPlex and CGNS

2023-01-16 Thread Jed Brown
Matthew Knepley  writes:

> On Mon, Jan 16, 2023 at 6:15 PM Jed Brown  wrote:
>
>> How soon do you need this? I understand the grumbling about CGNS, but it's
>> easy to build, uses HDF5 parallel IO in a friendly way, supports high order
>> elements, and is generally pretty expressive. I wrote a parallel writer
>> (with some limitations that I'll remove) and plan to replace the current
>> reader with a parallel reader because I have need to read big CGNS meshes.
>> Alas, my semester is starting so it's hard to make promises, but this is a
>> high priority for my research group and if you share your mesh file, I hope
>> to be able to make the parallel reader work in the next couple weeks.
>>
>
> The biggest hurdle for me is understanding the CGNS format. If you can tell
> me what is going on, I can help write the Plex code that
> interprets it.

I wrote the parallel writer and I'm pretty familiar with the data model. Let's 
connect in chat.


Re: [petsc-users] DMPlex and CGNS

2023-01-16 Thread Matthew Knepley
On Mon, Jan 16, 2023 at 6:15 PM Jed Brown  wrote:

> How soon do you need this? I understand the grumbling about CGNS, but it's
> easy to build, uses HDF5 parallel IO in a friendly way, supports high order
> elements, and is generally pretty expressive. I wrote a parallel writer
> (with some limitations that I'll remove) and plan to replace the current
> reader with a parallel reader because I have need to read big CGNS meshes.
> Alas, my semester is starting so it's hard to make promises, but this is a
> high priority for my research group and if you share your mesh file, I hope
> to be able to make the parallel reader work in the next couple weeks.
>

The biggest hurdle for me is understanding the CGNS format. If you can tell
me what is going on, I can help write the Plex code that
interprets it.

  Thanks,

Matt


> "Ferrand, Jesus A."  writes:
>
> > Dear PETSc team:
> >
> > I would like to use DMPlex to partition a mesh stored as a CGNS file. I
> configured my installation with --download_cgns = 1, got me a .cgns file
> and called DMPlexCreateCGNSFromFile() on it. Doing so got me this error:
> >
> > [0]PETSC ERROR: - Error Message
> --
> > [0]PETSC ERROR: Error in external library
> > [0]PETSC ERROR: CGNS file must have a single section, not 4
> > [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
> > [0]PETSC ERROR: Petsc Release Version 3.18.3, unknown
> > [0]PETSC ERROR: ./program.exe on a arch-linux-c-debug named F86 by jesus
> Mon Jan 16 17:25:11 2023
> > [0]PETSC ERROR: Configure options --download-mpich=yes
> --download-hdf5=yes --download-cgns=yes --download-metis=yes
> --download-parmetis=yes --download-ptscotch=yes --download-chaco=yes
> --with-32bits-pci-domain=1
> > [0]PETSC ERROR: #1 DMPlexCreateCGNS_Internal() at
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:104
> > [0]PETSC ERROR: #2 DMPlexCreateCGNS() at
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:60
> > [0]PETSC ERROR: #3 DMPlexCreateCGNSFromFile_Internal() at
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:27
> > [0]PETSC ERROR: #4 DMPlexCreateCGNSFromFile() at
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:29
> >
> > I looked around mail archives for clused and found this one (
> https://lists.mcs.anl.gov/pipermail/petsc-users/2018-June/035544.html).
> There, Matt provides a link to the source code for
> DMPlexCreateCGNSFromFile() and another (seemingly broken) link to CGNS
> files that can be opened with the former.  After reading the source code I
> now understand that it is hardcoded for CGNS files that feature a single
> "base" and a single "section", whatever those are.
> >
> > After navigating the CGNS documentation, I can sympathize with the
> comments in the source code.
> >
> > Anyhow, I wanted to ask if I could be furnished with one such CGNS file
> that is compatible with DMPlexCreateCGNSFromFile() to see if I can modify
> my CGNS files to conform to it. If not, I will look into building the DAG
> myself using DMPlex APIs.
> >
> >
> > Sincerely:
> >
> > J.A. Ferrand
> >
> > Embry-Riddle Aeronautical University - Daytona Beach FL
> >
> > M.Sc. Aerospace Engineering
> >
> > B.Sc. Aerospace Engineering
> >
> > B.Sc. Computational Mathematics
> >
> >
> > Phone: (386)-843-1829
> >
> > Email(s): ferra...@my.erau.edu
> >
> > jesus.ferr...@gmail.com
>


-- 
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] DMPlex and CGNS

2023-01-16 Thread Jed Brown
How soon do you need this? I understand the grumbling about CGNS, but it's easy 
to build, uses HDF5 parallel IO in a friendly way, supports high order 
elements, and is generally pretty expressive. I wrote a parallel writer (with 
some limitations that I'll remove) and plan to replace the current reader with 
a parallel reader because I have need to read big CGNS meshes. Alas, my 
semester is starting so it's hard to make promises, but this is a high priority 
for my research group and if you share your mesh file, I hope to be able to 
make the parallel reader work in the next couple weeks.

"Ferrand, Jesus A."  writes:

> Dear PETSc team:
>
> I would like to use DMPlex to partition a mesh stored as a CGNS file. I 
> configured my installation with --download_cgns = 1, got me a .cgns file and 
> called DMPlexCreateCGNSFromFile() on it. Doing so got me this error:
>
> [0]PETSC ERROR: - Error Message 
> --
> [0]PETSC ERROR: Error in external library
> [0]PETSC ERROR: CGNS file must have a single section, not 4
> [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.18.3, unknown
> [0]PETSC ERROR: ./program.exe on a arch-linux-c-debug named F86 by jesus Mon 
> Jan 16 17:25:11 2023
> [0]PETSC ERROR: Configure options --download-mpich=yes --download-hdf5=yes 
> --download-cgns=yes --download-metis=yes --download-parmetis=yes 
> --download-ptscotch=yes --download-chaco=yes --with-32bits-pci-domain=1
> [0]PETSC ERROR: #1 DMPlexCreateCGNS_Internal() at 
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:104
> [0]PETSC ERROR: #2 DMPlexCreateCGNS() at 
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:60
> [0]PETSC ERROR: #3 DMPlexCreateCGNSFromFile_Internal() at 
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:27
> [0]PETSC ERROR: #4 DMPlexCreateCGNSFromFile() at 
> /home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:29
>
> I looked around mail archives for clused and found this one 
> (https://lists.mcs.anl.gov/pipermail/petsc-users/2018-June/035544.html). 
> There, Matt provides a link to the source code for DMPlexCreateCGNSFromFile() 
> and another (seemingly broken) link to CGNS files that can be opened with the 
> former.  After reading the source code I now understand that it is hardcoded 
> for CGNS files that feature a single "base" and a single "section", whatever 
> those are.
>
> After navigating the CGNS documentation, I can sympathize with the comments 
> in the source code.
>
> Anyhow, I wanted to ask if I could be furnished with one such CGNS file that 
> is compatible with DMPlexCreateCGNSFromFile() to see if I can modify my CGNS 
> files to conform to it. If not, I will look into building the DAG myself 
> using DMPlex APIs.
>
>
> Sincerely:
>
> J.A. Ferrand
>
> Embry-Riddle Aeronautical University - Daytona Beach FL
>
> M.Sc. Aerospace Engineering
>
> B.Sc. Aerospace Engineering
>
> B.Sc. Computational Mathematics
>
>
> Phone: (386)-843-1829
>
> Email(s): ferra...@my.erau.edu
>
> jesus.ferr...@gmail.com


[petsc-users] DMPlex and CGNS

2023-01-16 Thread Ferrand, Jesus A.
Dear PETSc team:

I would like to use DMPlex to partition a mesh stored as a CGNS file. I 
configured my installation with --download_cgns = 1, got me a .cgns file and 
called DMPlexCreateCGNSFromFile() on it. Doing so got me this error:

[0]PETSC ERROR: - Error Message 
--
[0]PETSC ERROR: Error in external library
[0]PETSC ERROR: CGNS file must have a single section, not 4
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.18.3, unknown
[0]PETSC ERROR: ./program.exe on a arch-linux-c-debug named F86 by jesus Mon 
Jan 16 17:25:11 2023
[0]PETSC ERROR: Configure options --download-mpich=yes --download-hdf5=yes 
--download-cgns=yes --download-metis=yes --download-parmetis=yes 
--download-ptscotch=yes --download-chaco=yes --with-32bits-pci-domain=1
[0]PETSC ERROR: #1 DMPlexCreateCGNS_Internal() at 
/home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:104
[0]PETSC ERROR: #2 DMPlexCreateCGNS() at 
/home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:60
[0]PETSC ERROR: #3 DMPlexCreateCGNSFromFile_Internal() at 
/home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/cgns/plexcgns2.c:27
[0]PETSC ERROR: #4 DMPlexCreateCGNSFromFile() at 
/home/jesus/Desktop/JAF_NML/3rd_Party/PETSc/petsc/src/dm/impls/plex/plexcgns.c:29

I looked around mail archives for clused and found this one 
(https://lists.mcs.anl.gov/pipermail/petsc-users/2018-June/035544.html). There, 
Matt provides a link to the source code for DMPlexCreateCGNSFromFile() and 
another (seemingly broken) link to CGNS files that can be opened with the 
former.  After reading the source code I now understand that it is hardcoded 
for CGNS files that feature a single "base" and a single "section", whatever 
those are.

After navigating the CGNS documentation, I can sympathize with the comments in 
the source code.

Anyhow, I wanted to ask if I could be furnished with one such CGNS file that is 
compatible with DMPlexCreateCGNSFromFile() to see if I can modify my CGNS files 
to conform to it. If not, I will look into building the DAG myself using DMPlex 
APIs.


Sincerely:

J.A. Ferrand

Embry-Riddle Aeronautical University - Daytona Beach FL

M.Sc. Aerospace Engineering

B.Sc. Aerospace Engineering

B.Sc. Computational Mathematics


Phone: (386)-843-1829

Email(s): ferra...@my.erau.edu

jesus.ferr...@gmail.com


Re: [petsc-users] Nonconforming object sizes using TAO (TAOBNTR)

2023-01-16 Thread Alexis Marboeuf
Hi Matt,
After investigation, it fails because, at some point, the boolean needH is set 
to PETSC_FALSE when initializing the BNK method with TAOBNKInitialize (line 103 
of $PETSC_DIR/src/tao/bound/impls/bnk/bntr.c). The Hessian and the 
precondtitioner are thus not updated throughout the TAO iterations. It has 
something to do with the option BNK_INIT_INTERPOLATION set by default. It works 
when I choose BNK_INIT_CONSTANT. In my case, in all the successful calls of 
TAOSolve, the computed trial objective value is better than the current value 
which implies needH = PETSC_TRUE within TAOBNKInitialize. At some point, the 
trial value becomes equal to the current objective value up to machine 
precision and then, needH = PETSC_FALSE. I have to admit I am struggling 
understanding how that boolean needH is computed when BNK is initialized with 
BNK_INIT_INTERPOLATION. Can you help me with that?
Thanks a lot.
Alexis

De : Alexis Marboeuf 
Envoyé : samedi 14 janvier 2023 05:24
À : Matthew Knepley 
Cc : petsc-users@mcs.anl.gov 
Objet : RE: [petsc-users] Nonconforming object sizes using TAO (TAOBNTR)

Hi Matt,
Indeed, it fails on 1 process with the same error. The source code is available 
here: https://github.com/bourdin/mef90 (branch marboeuf/vdef-tao-test)
[https://opengraph.githubassets.com/8f51eb183957c4e2f2dd59e2733f43a7bc667a50d4aaad934ebb3ac8f25a17ab/bourdin/mef90]
GitHub - bourdin/mef90: Official repository for 
mef90/vDef
mef90 / vDef: A reference implementation of the variational approach to 
fracture, as described in: Francfort, G. and Marigo, J.-J. (1998). Revisiting 
brittle fracture as an energy minimization problem.
github.com
I can share the details (installation + command line) for running it. But the 
ideal would be to reproduce this error with a Petsc example so it's easier for 
you to investigate. I looked for a bound constraint minimization problem with 
TAO and TS but I didn't find it. What example could I use?
Thanks!
Alexis

De : Matthew Knepley 
Envoyé : samedi 14 janvier 2023 02:38
À : Alexis Marboeuf 
Cc : petsc-users@mcs.anl.gov 
Objet : Re: [petsc-users] Nonconforming object sizes using TAO (TAOBNTR)

On Fri, Jan 13, 2023 at 3:21 PM Alexis Marboeuf 
mailto:alexis.marbo...@hotmail.fr>> wrote:
Hi Matt,

Here is the output from Petsc when I view the TAO solver:

Okay, there is no sophisticated caching going on. So, first I would get it to 
fail on1 process. It should if it just depends on
the convergence (I hope). Then send the source so we can run it. It should be 
simple for us to find where system size
changes and the KSP is not reset (if that indeed is what happens).

  Thanks,

Matt


Tao Object: (Damage_) 4 MPI processes

  type: bntr

Tao Object: (Damage_tao_bnk_cg_) 4 MPI processes

  type: bncg

CG Type: ssml_bfgs

Skipped Stepdirection Updates: 0

Scaled gradient steps: 0

Pure gradient steps: 0

Not a descent direction: 0

Line search fails: 0

Matrix has not been preallocated yet

  TaoLineSearch Object: (Damage_tao_bnk_cg_) 4 MPI processes

type: more-thuente

maximum function evaluations=30

tolerances: ftol=0.0001, rtol=1e-10, gtol=0.9

total number of function evaluations=0

total number of gradient evaluations=0

total number of function/gradient evaluations=0

Termination reason: 0

  Active Set subset type: subvec

  convergence tolerances: gatol=1e-08,   steptol=0.,   gttol=0.

  Residual in Function/Gradient:=0.

  Objective value=0.

  total number of iterations=0,  (max: 2000)

  Solver terminated: 0

Rejected BFGS updates: 0

CG steps: 0

Newton steps: 11

BFGS steps: 0

Scaled gradient steps: 0

Gradient steps: 0

KSP termination reasons:

  atol: 4

  rtol: 0

  ctol: 7

  negc: 0

  dtol: 0

  iter: 0

  othr: 0

  TaoLineSearch Object: (Damage_) 4 MPI processes

type: more-thuente

maximum function evaluations=30

tolerances: ftol=0.0001, rtol=1e-10, gtol=0.9

total number of function evaluations=0

total number of gradient evaluations=0

total number of function/gradient evaluations=0

using variable bounds

Termination reason: 0

  KSP Object: (Damage_tao_bnk_) 4 MPI processes

type: stcg

maximum iterations=1, nonzero initial guess

tolerances:  relative=1e-08, absolute=1e-08, divergence=1e+10

left preconditioning

using UNPRECONDITIONED norm type for convergence test

  PC Object: (Damage_tao_bnk_) 4 MPI processes

type: lmvm

Mat Object: (Damage_tao_bnk_pc_lmvm_) 4 MPI processes

  type: lmvmbfgs

  rows=30634, cols=30634

Scale type: DIAGONAL

Scale history: 1

Scale params: alpha=1.,