<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Dec 20, 2018 at 2:35 PM Yann JOBIC <<a href="mailto:yann.jobic@univ-amu.fr">yann.jobic@univ-amu.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <div class="gmail-m_7941325201965150681moz-cite-prefix">Le 20/12/2018 à 19:05, Matthew Knepley
      a écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">On Thu, Dec 20, 2018 at 12:56 PM Yann JOBIC
            <<a href="mailto:yann.jobic@univ-amu.fr" target="_blank">yann.jobic@univ-amu.fr</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div bgcolor="#FFFFFF">
              <div class="gmail-m_7941325201965150681gmail-m_-4337755243075422184moz-cite-prefix">Le
                20/12/2018 à 16:40, Matthew Knepley a écrit :<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">
                  <div class="gmail_quote">
                    <div dir="ltr">On Thu, Dec 20, 2018 at 9:33 AM Yann
                      JOBIC via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>
                      wrote:<br>
                    </div>
                    <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Petsc
                      Users,<br>
                      <br>
                      When i'm using DMPlexCreateBoxMesh, my code works
                      fine. However, when i <br>
                      load the "exact" same mesh from an HDF5 file, it's
                      not working anymore <br>
                      (Nonlinear solve did not converge due to
                      DIVERGED_FNORM_NAN iterations 0).<br>
                      <br>
                      The mesh view when i use DMPlexCreateBoxMesh looks
                      like (i labeled my <br>
                      boudary nodes):<br>
                      <br>
                      /* generated with DMPlexCreateBoxMesh */<br>
                      DM Object: Mesh 1 MPI processes<br>
                         type: plex<br>
                      Mesh in 3 dimensions:<br>
                         0-cells: 216<br>
                         1-cells: 540<br>
                         2-cells: 450<br>
                         3-cells: 125<br>
                      Labels:<br>
                         Faces: 6 strata with value/size (2 (121), 4
                      (121), 3 (121), 6 (121), <br>
                      5 (121), 7 (121))<br>
                         boundary: 1 strata with value/size (1 (602))<br>
                         depth: 4 strata with value/size (0 (216), 1
                      (540), 2 (450), 3 (125))<br>
                         Face Sets: 6 strata with value/size (6 (25), 5
                      (25), 3 (25), 4 (25), <br>
                      1 (25), 2 (25))<br>
                         marker: 1 strata with value/size (1 (450))<br>
                      <br>
                      And when i use DMPlexCreateFromFile, or DMLoad, i
                      have :<br>
                      <br>
                      /* generated with H5 file */<br>
                      fin label DM<br>
                      DM Object: Mesh 1 MPI processes<br>
                         type: plex<br>
                      Mesh in 3 dimensions:<br>
                         0-cells: 216<br>
                         1-cells: 540<br>
                         2-cells: 450<br>
                         3-cells: 125<br>
                      Labels:<br>
                         Faces: 6 strata with value/size (2 (121), 4
                      (121), 6 (121), 7 (121), <br>
                      5 (121), 3 (121))<br>
                         boundary: 1 strata with value/size (1 (602))<br>
                         depth: 4 strata with value/size (0 (216), 1
                      (540), 2 (450), 3 (125))<br>
                      <br>
                      It looks like my DM is not interpolated. Am i
                      wrong ?<br>
                    </blockquote>
                    <div><br>
                    </div>
                    <div>Its interpolated (you have 4 kinds of k-cells,
                      instead of 2). However, you are missing your</div>
                    <div>Face Sets marker, which probably means boundary
                      conditions are not getting applied.</div>
                  </div>
                </div>
              </blockquote>
              My Face marker is label to 1, with the label  "boundary"
              (i used DMPlexMarkBoundaryFaces)<br>
              After that, i create a new label, "Faces", with the number
              associated to the boundary condition.<br>
              Faces = 0 -> ouest<br>
              Faces = 1 -> est<br>
              ...<br>
              <br>
              But you're right, I'm missing "Face Sets".<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>You are also missing "marker". Both of these are added by
            the mesh creation function. Do you know</div>
          <div>which one you are using (setting in a boundary
            condition)?</div>
        </div>
      </div>
    </blockquote>
    I'm using DMPlexLoad_HDF5_Internal, which doesn't add those markers.
    <br>
    I'm using the label "Faces", that i create, with has a different
    value defining the physical location of the boundary.<br>
    Next, my using this label in order to define my boundary condition,
    as :<br>
      ierr = PetscDSAddBoundary(prob, DM_BC_ESSENTIAL, "wall", "Faces",
    0, Ncomp, components, (void (*)(void)) zero, NInd, nord,
    NULL);CHKERRQ(ierr);<br>
      ierr = PetscDSAddBoundary(prob, DM_BC_ESSENTIAL, "wall", "Faces",
    0, Ncomp, components, (void (*)(void)) zero, NInd, sud,
    NULL);CHKERRQ(ierr);<br>
      ierr = PetscDSAddBoundary(prob, DM_BC_ESSENTIAL, "wall", "Faces",
    0, Ncomp, components, (void (*)(void)) zero, NInd, Back,
    NULL);CHKERRQ(ierr);<br>
      ierr = PetscDSAddBoundary(prob, DM_BC_ESSENTIAL, "wall", "Faces",
    0, Ncomp, components, (void (*)(void)) zero, NInd, Top,
    NULL);CHKERRQ(ierr);<br>
      ierr = PetscDSAddBoundary(prob, DM_BC_ESSENTIAL, "in", "Faces", 0,
    Ncomp, components, (void (*)(void)) uIn, NInd, west,
    NULL);CHKERRQ(ierr);<br>
    With:<br>
      const PetscInt Ncomp = 3; /*  dim = 3 */<br>
      const PetscInt components[] = {0,1,2};<br>
      const PetscInt NInd = 1;<br>
      const PetscInt west[] = {2}; /* (x=0) */<br>
      const PetscInt est[] = {3}; /* (x=L_x) */<br>
      const PetscInt sud[] = {4}; /* (y=0) */<br>
      const PetscInt nord[] = {5}; /* (y=L_y) */<br>
      const PetscInt Back[] = {6}; /* (z=0) */<br>
      const PetscInt Top[] = {7}; /* (z=L_z) */<br>
    <br>
    Is it the right way to do it ?<br></div></blockquote><div><br></div><div>It looks right.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    Should i have a different label for each boundary condition ? I
    thought that the value was enough.<br></div></blockquote><div><br></div><div>The next thing to do is compare residuals.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    Thanks,<br>
    <br>
    Yann<br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
          <div>  Thanks,</div>
          <div><br>
          </div>
          <div>    Matt</div>
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div bgcolor="#FFFFFF"> I couldn't find the function which
              adds this label.<br>
              Is there one ? or do i have to do as in 
              DMPlexCreateCubeMesh_Internal?<br>
              <br>
              Thanks,<br>
              <br>
              Yann<br>
              <blockquote type="cite">
                <div dir="ltr">
                  <div class="gmail_quote">
                    <div>  Thanks,</div>
                    <div><br>
                    </div>
                    <div>    Matt</div>
                    <div> </div>
                    <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> It's strange,
                      because when i use DMPlexCreateFromFile, i put
                      PETSC_TRUE <br>
                      for interpolation.<br>
                      <br>
                      Even after loading the mesh, i used
                      DMPlexInterpolate, which return a <br>
                      new DM (not null).<br>
                      <br>
                      Do you know what's happening here ?<br>
                      Maybe my DIVERGED_FNORM_NAN comes from another
                      part of the code ? <br>
                      (however only the mesh is changing)<br>
                      <br>
                      Thanks,<br>
                      <br>
                      Yann<br>
                    </blockquote>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>