[petsc-users] I have a question for PETSc example

Smith, Barry F. bsmith at mcs.anl.gov
Mon Jan 15 21:49:57 CST 2018



> On Jan 15, 2018, at 7:28 PM, 서승진 (기계항공및원자력공학부) <mistloin at unist.ac.kr> wrote:
> 
> sorry, I mean that
> My geometry is a rectangle.
> That means, geometry is just rectangle box shape with four boundary.
> 
> My question is that, how can I set the four boundary condition individually in example 12 of SNES?

  Of course. Ex19.c has a different boundary condition on the top than the sides. How you define and implement your boundary conditions is up to you. PETSc does't define it.

  Barry

> 
> (I think that the boundary condition should be added in right side of the weak form, where load vector f and test function term is included. However, in example of petsc, boundary condition is applied as general form.)
> 
> Seungjin Seo
> 보낸 사람: Smith, Barry F. <bsmith at mcs.anl.gov>
> 보낸 날짜: 2018년 1월 15일 월요일 오후 11:06:18
> 받는 사람: 서승진 (기계항공및원자력공학부)
> 참조: Smith, Barry F.; petsc-users at mcs.anl.gov
> 제목: Re: [petsc-users] I have a question for PETSc example
>  
> 
>    The term "rectangular mesh" usually refers to a "structured grid mesh" so it is not clear if you truly need an unstructured grid. Take a look at src/snes/examples/tutorials/ex19.c 
> 
>   Barry
> 
> 
> > On Jan 15, 2018, at 1:03 AM, 서승진 (기계항공및원자력공학부) <mistloin at unist.ac.kr> wrote:
> > 
> > Dear PETSc-user
> > 
> > I am Seungjin Seo, researcher of Korean Advanced Institute of Science and Technology, South Korea.
> > 
> > I am tring to understand the ex12.c in SNES examples, and I have a problem...
> > Could you give me some advise? Is there any good description or materials for PetscFE and DMPlex?
> >  
> > I will make a code with unstructured grid with PetscFE and SNES. My geometry is a rectangle mesh (the size is not fixed so I think this is unstructured grid).
> > The equation is  
> > I will set boundry conditions as follow;
> >   1. (Top-side boundary) Neumann boundary
> >   2. (Bottom-side boundary) Neumann boundary
> >   3. (Left-side boundary) Dirichlet boundary
> >   4. (Right-side boundary) Dirichlet boundary
> > 
> > In example ex12.c in SNES, load vector f is defiend as f_0, and neumann boundary condition is defined as f_bd_0. f_1 means the test function gradient term. The example set general type of neumann boundary condition on f_bd_0, but I want to set each boundary condition individually. Could you give me some advise?
> > 
> > Thansk for reading my email.
> > 
> > Best regard,
> > Seungjin Seo
> > 
> > 
> > 
> > 보낸 사람: Smith, Barry F. <bsmith at mcs.anl.gov>
> > 보낸 날짜: 2017년 12월 21일 목요일 오후 3:46:42
> > 받는 사람: 서승진 (기계항공및원자력공학부)
> > 참조: petsc-users at mcs.anl.gov
> > 제목: Re: [petsc-users] I have a question for PETSc example
> >  
> > 
> >   In deed you can, yes many PETSc examples only feature a single field for simplicity, but multiple fields are fine. You simple provide your FormFunction and FormJacobian to handle both degrees of freedom per cell/node at the same time. You use SNES or TS depending on if your problem is time dependent and then use -pc_type lu to start. Once you have the physics correct come back and ask us about optimizing the linear solver with preconditioners; but until you have the physics correct it is absurd to waste time worrying about making the linear solver efficient. What you want to do, many people do and is not a big deal.
> > 
> >    Barry
> > 
> > 
> > > On Dec 21, 2017, at 12:27 AM, 서승진 (기계항공및원자력공학부) <mistloin at unist.ac.kr> wrote:
> > > 
> > > Dear PETSc-user
> > >  
> > >  
> > > I am Seungjin Seo, researcher of Korean Advanced Institute of Science and Technology, South Korea.
> > >  
> > > 
> > > 
> > > I am trying to solve thermal and fluid equations within a porous structure.
> > > The thermal equation includes a non-linear term of pressure and the fluid equation has a boundary condition using temperature gradient.
> > > Is there any way I can solve these two equations at the same time, instead of solving temperature first with previous pressure distribution and then pressure and update temperature?
> > > Many examples solve only one PDF instead of coupling several physics.
> > > Please recommend me which solver is appropriate for my case?
> > > 
> > > Best regards,
> > > Seungjin Seo



More information about the petsc-users mailing list