How to use a numerical boundary condition in deal.II

42 views
Skip to first unread message

Smith Jack

unread,
Dec 15, 2023, 10:28:22 PM12/15/23
to deal.II User Group
Hello:
I want to know how to use a numerical boundary condition in deal.II. For example, I want to solve a set of diffusion equations:
\partial c_1 / \partial t = d_1 \partial c_1^2 / \partial x^2
\partial c_2 / \partial t = d_2 \partial c_2^2 / \partial x^2
on the one dimensional domain [0, L].
At the right boundary, the Dirichlet boundary condition is applied: c_1(x = L, t) = c_{10},  c_2(x = L, t) = c_{20}.
At the left boundary, the flux of c_1, c_2 is set by:
\partial c_1 / \partial x  (x = 0, t) = r_1(c_1, c_2)
\partial c_2 / \partial x  (x = 0, t) = r_2(c_1, c_2)
Here, r1 r2 are reactions rates solved by an ODE solver. Then how to use such a boundary condition ? There is no analytic expression for r1 and r2. I can only get them numerically. 屏幕截图 2023-12-16 095822.jpg

Wolfgang Bangerth

unread,
Dec 16, 2023, 11:02:43 AM12/16/23
to dea...@googlegroups.com
On 12/15/23 20:28, Smith Jack wrote:
> At the right boundary, the Dirichlet boundary condition is applied: c_1(x = L,
> t) = c_{10},  c_2(x = L, t) = c_{20}.
> At the left boundary, the flux of c_1, c_2 is set by:
> *\partial c_1 / \partial x  (x = 0, t) = r_1(c_1, c_2)*
> *\partial c_2 / \partial x  (x = 0, t) = r_2(c_1, c_2)*
> Here, r1 r2 are reactions rates solved by an ODE solver. Then how to use such
> a boundary condition ? There is no analytic expression for r1 and r2. I can
> only get them numerically

This is a nonlinear problem. Make it simpler for conceptual reasons by
assuming that you have only one species, c=c1 for the moment. Then if you
write down the weak formulation of the equation, you will see where
r(c)=r1(c1) appears in the weak form. This ends up being a situation not so
different from what step-15 does, and it is solved with the same methods as
step-15. (A better version of step-15 is step-77, but it is useful to start
with step-15 if you want to understand the concepts.)

Best
W.

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


Reply all
Reply to author
Forward
0 new messages