How do I set initial solution vector to boundary values in DG?

60 views
Skip to first unread message

Abbas

unread,
Dec 3, 2022, 9:11:16 AM12/3/22
to deal.II User Group
Hello, 

I am solving a non-linear equation with DG. 
As per step 15, we set the boundary values initially using the following function: 

template <int dim>
void MinimalSurfaceProblem<dim>::set_boundary_values()
{
  std::map<types::global_dof_index, double> boundary_values;
  VectorTools::interpolate_boundary_values(dof_handler, 0, BoundaryValues<dim(), boundary_values);

   for (auto &boundary_value : boundary_values)
       current_solution(boundary_value.first) = boundary_value.second;

    hanging_node_constraints.distribute(current_solution);
}

Something like this doesn't work with DG.
Loosely speaking, my initial approach would be to solve a system with just the BC terms but I am not sure. Do I have other options?  


Wolfgang Bangerth

unread,
Dec 3, 2022, 10:56:11 AM12/3/22
to dea...@googlegroups.com
On 12/3/22 07:11, Abbas wrote:
>
> Something like this doesn't work with DG.
> Loosely speaking, my initial approach would be to solve a system with just the
> BC terms but I am not sure. Do I have other options?

In DG methods, you impose boundary values weakly, using the same strategy with
which you impose continuity between cells weakly. You might want to look at
papers on DG methods: pretty much every single one will show the jump terms
corresponding to Dirichlet boundary values.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Timo Heister

unread,
Dec 4, 2022, 8:01:32 PM12/4/22
to dea...@googlegroups.com
I would consider the boundary conditions part of the nonlinear
iteration (in contrast to step-15, where they are strongly enforced
and as such are only needed in step 0). Every step you can evaluate
your nonlinear residual which contains a residual in the boundary
condition and that difference needs to be applied in every step
(assuming you solve for an update in each Newton step).

On Sat, Dec 3, 2022 at 10:56 AM Wolfgang Bangerth
<bang...@colostate.edu> wrote:
>
> On 12/3/22 07: 11, Abbas wrote: > > Something like this doesn't work with DG. > Loosely speaking, my initial approach would be to solve a system with just the > BC terms but I am not sure. Do I have other options? In DG methods,
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> Use caution when opening links or attachments if you do not recognize the sender.
>
> ZjQcmQRYFpfptBannerEnd
> www: https://urldefense.com/v3/__http://www.math.colostate.edu/*bangerth/__;fg!!PTd7Sdtyuw!Vf-IQx7HQQ5bIq8xBQu1BzCdpZiz9Q3UC6emGlg1Z50xBT-oA9UeUBtyamyADtrTV0zLEZpa0RBQ_lV6jh5B8Uo$
>
>
> --
> The deal.II project is located at https://urldefense.com/v3/__http://www.dealii.org/__;!!PTd7Sdtyuw!Vf-IQx7HQQ5bIq8xBQu1BzCdpZiz9Q3UC6emGlg1Z50xBT-oA9UeUBtyamyADtrTV0zLEZpa0RBQ_lV6CDq7NmU$
> For mailing list/forum options, see https://urldefense.com/v3/__https://groups.google.com/d/forum/dealii?hl=en__;!!PTd7Sdtyuw!Vf-IQx7HQQ5bIq8xBQu1BzCdpZiz9Q3UC6emGlg1Z50xBT-oA9UeUBtyamyADtrTV0zLEZpa0RBQ_lV6qJBbcDU$
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://urldefense.com/v3/__https://groups.google.com/d/msgid/dealii/c1d413d2-3c55-0523-19fd-9f399d1781da*40colostate.edu__;JQ!!PTd7Sdtyuw!Vf-IQx7HQQ5bIq8xBQu1BzCdpZiz9Q3UC6emGlg1Z50xBT-oA9UeUBtyamyADtrTV0zLEZpa0RBQ_lV6CppyxvM$ .



--
Timo Heister
http://www.math.clemson.edu/~heister/

Abbas

unread,
Dec 5, 2022, 9:21:43 AM12/5/22
to deal.II User Group
Thank you Profs. 

Prof. Bangerth, I probably wasn't clear in my question. I know how to apply BCs for an interior penalty problem weakly. 
But, for a non-linear problem like step 15, one initialises the solution vector and sets it to the value of the BCs at the boundary before solving for the Newton update. This is done explicitly in function 'set_boundary_values()' in step 15 with the function  'VectorTools::interpolate_boundary_values'. 
I cannot use this function with DG elements apparently and I am wondering if there are any alternatives.  

Prof. Hiester, don't you think that subtracting small and manipulating large numbers in the residual will cause some problems? 
I'll give it a try for sure though. 

Thanks again 


Wolfgang Bangerth

unread,
Dec 6, 2022, 10:01:54 AM12/6/22
to dea...@googlegroups.com
On 12/5/22 07:21, Abbas wrote:
>
>
> Prof. Bangerth, I probably wasn't clear in my question. I know how to apply
> BCs for an interior penalty problem weakly.
> But, for a non-linear problem like step 15, one initialises the solution
> vector and sets it to the value of the BCs at the boundary before solving for
> the Newton update. This is done explicitly in function 'set_boundary_values()'
> in step 15 with the function 'VectorTools::interpolate_boundary_values
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2FnamespaceVectorTools.html%23ab2562d41bb26f362043f9719a8cd9b87&data=05%7C01%7CWolfgang.Bangerth%40colostate.edu%7C3d130cff49424b5b1e5008dad6cc0aa8%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C638058469105415682%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Avsnwwx%2BjZMnFN4YA4kxBNYU5GRIdzvd8lcRfxBVdrM%3D&reserved=0>'.
> I cannot use this function with DG elements apparently and I am wondering if
> there are any alternatives.

I see now. In that case, like Timo Heister said, the boundary conditions are
part of the weak form of the problem. The weak form is the residual that gives
you the right hand side of the Newton steps, and the derivative of the
residual gives you the Newton matrix. This is definitely the way to go.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages