[petsc-users] Advice on setting BCs in a PLEX
Aldo Bonfiglioli
aldo.bonfiglioli at unibas.it
Mon Nov 4 12:48:08 CST 2024
Dear users,
I have been using petsc's KSP for over 20 years and I am considering
using DMPLEX to replace my own data structure in a mixed FEM/FVM CFD code.
To do so, I am trying to understand DMPLEX by writing a 1D code that
solves u_t = u_xx using PSEUDOTS.
In order to prescribe Dirichlet BCs at the endpoints of the 1D box, I
use PetscSectionSetConstraintDof when building the PetscSection.
> A global vector is missing both the shared dofs which are not owned by
> this process, as well as /constrained/ dofs. These constraints
> represent essential (Dirichlet) boundary conditions. They are dofs
> that have a given fixed value, so they are present in local vectors
> for assembly purposes, but absent from global vectors since they are
> never solved for during algebraic solves.
My global Vec has indeed two entries less than the local one.
When initializing the solution or evaluating the rhs function I transfer
data from the global to local representation, do the calculation, then
transfer back.
I am doing something wrong, though, which shows up in the attached log file.
My simple code is also attached.
Thank you for your advice.
Aldo
--
Dr. Aldo Bonfiglioli
Associate professor of Fluid Machines
Scuola di Ingegneria
Universita' della Basilicata
V.le dell'Ateneo lucano, 10 85100 Potenza ITALY
tel:+39.0971.205203 fax:+39.0971.205215
web:https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!cWgDpzKW9KGEkqxu775gDU488CBQ5itLl2l_HUsDKcPstbcuSm0_bZPHkMciXajTi3539fuMPe8TD1YZuirDfmSBMSXXxrQZWns$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241104/e493a95c/attachment.html>
-------------- next part --------------
DM Object: box 1 MPI process
type: plex
box in 1 dimension:
Number of 0-cells per rank: 11
Number of 1-cells per rank: 10
Labels:
marker: 1 strata with value/size (1 (2))
Face Sets: 2 strata with value/size (1 (1), 2 (1))
depth: 2 strata with value/size (0 (11), 1 (10))
celltype: 2 strata with value/size (0 (11), 1 (10))
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Point 10: Global dof 0 != 1 size - number of constraints
[0]PETSC ERROR: WARNING! There are unused option(s) set! Could be the program crashed before usage or a spelling mistake, etc!
[0]PETSC ERROR: Option left: name:-ts_max_steps value: 10 source: command line
[0]PETSC ERROR: Option left: name:-ts_monitor (no value) source: command line
[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.22.0, Sep 28, 2024
[0]PETSC ERROR: ./ex15f90 with 1 MPI process(es) and PETSC_ARCH linux_gnu on DESKTOP-04AR6V6.lan by abonfi Mon Nov 4 19:28:00 2024
[0]PETSC ERROR: Configure options: --with-mpi=1 --with-mpi-dir=/usr/lib64/mpi/gcc/mpich --with-shared-libraries=1 --with-debugging=1 --with-blas-lib=/usr/lib64/libblas.a --with-lapack-lib=/usr/lib64/liblapack.a --with-triangle=1 --download-triangle=yes
[0]PETSC ERROR: #1 PetscSFSetGraphSection() at /home/abonfi/src/petsc-3.22.0/src/vec/is/sf/utils/sfutils.c:179
[0]PETSC ERROR: #2 DMCreateSectionSF() at /home/abonfi/src/petsc-3.22.0/src/dm/interface/dm.c:4783
[0]PETSC ERROR: #3 DMGetSectionSF() at /home/abonfi/src/petsc-3.22.0/src/dm/interface/dm.c:4722
[0]PETSC ERROR: #4 DMGlobalToLocalBegin() at /home/abonfi/src/petsc-3.22.0/src/dm/interface/dm.c:2851
[0]PETSC ERROR: #5 DMGlobalToLocal() at /home/abonfi/src/petsc-3.22.0/src/dm/interface/dm.c:2812
[0]PETSC ERROR: #6 ex15f90.F90:280
Abort(62) on node 0 (rank 0 in comm 16): application called MPI_Abort(MPI_COMM_SELF, 62) - process 0
there are 11 entries in depth: 0
there are 10 entries in depth: 1
Setting up a section on 11 meshpoints with 1 dofs
The DM is marked
Point 10 is a boundary point
Point 20 is a boundary point
Array u has type : seq
(Global) Array u has size : 9
coordVec has size 11
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex15f90.F90
Type: text/x-fortran
Size: 14065 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20241104/e493a95c/attachment.bin>
More information about the petsc-users
mailing list