第18回:Nitsche法とは何か — Dirichlet境界条件を弱く課す
ChatGPTで作る有限要素プログラム入門 Season 2 第6回(通算第18回)
はじめに――boundary nodeを消さずにDirichlet conditionを入れる
これまでのconforming P1 Poisson FEMでは, Dirichlet boundary nodeの値を直接固定しました. これはstrong impositionです.
Nitsche法では,trial spaceそのものにはboundary conditionを組み込まず, bilinear formとlinear functionalへboundary termsを追加して \[ u=g \qquad\text{on }\partial\Omega \] をweakly imposeします.
\[ \boxed{ \text{consistency terms} + \text{symmetry term} + \text{penalty term} } \] をboundaryへ加え, Dirichlet conditionをvariational equationの一部にする.
1.model problem
\[ -\Delta u=f \qquad\text{in }\Omega, \tag{1} \] \[ u=g \qquad\text{on }\partial\Omega \tag{2} \] を考えます.
standard strong formulationでは \[ V(g) = \left\{ v\in H^1(\Omega): v=g\text{ on }\partial\Omega \right\} \tag{3} \] を使います.
Nitsche法ではdiscrete trial spaceを \[ V_h=P_1^c(\mathcal T_h) \tag{4} \] のままにして, boundary nodesを未知量として残します.
2.symmetric Nitsche formulation
boundary face集合を \(\mathcal F_h^\partial\) とします. symmetric Nitsche bilinear formを \[ \begin{aligned} a_h^{N}(v,w) :={}& (\nabla v,\nabla w)_\Omega \\ &- \sum_{F\in\mathcal F_h^\partial} (\partial_n v,w)_F - \sum_{F\in\mathcal F_h^\partial} (v,\partial_n w)_F \\ &+ \sum_{F\in\mathcal F_h^\partial} \gamma\,\kappa_F (v,w)_F \end{aligned} \tag{5} \] とします.
linear functionalは \[ \begin{aligned} \ell_h^{N}(w) :={}& (f,w)_\Omega - \sum_{F\in\mathcal F_h^\partial} (g,\partial_n w)_F \\ &+ \sum_{F\in\mathcal F_h^\partial} \gamma\,\kappa_F (g,w)_F. \end{aligned} \tag{6} \]
求める \(u_h\in V_h\) は \[ \boxed{ a_h^{N}(u_h,v_h) = \ell_h^{N}(v_h) \qquad \forall v_h\in V_h. } \tag{7} \]
3.三つのboundary termの役割
式 (5) の三種類のboundary termにはそれぞれ役割があります.
| term | role |
|---|---|
| \(-(\partial_n v,w)_F\) | integration by partsから来るconsistency |
| \(-(v,\partial_n w)_F\) | symmetric formulationを作るadjoint-consistency term |
| \(\gamma\kappa_F(v,w)_F\) | boundary valueを安定に制御するpenalty |
penaltyだけを追加する方法と異なり, Nitsche法ではconsistencyを保つboundary flux termが入っています.
4.exact solutionはNitsche equationを満たす
十分smoothなexact solution \(u\) について, \[ -\Delta u=f, \qquad u=g \] を使うと \[ \boxed{ a_h^{N}(u,v_h) = \ell_h^{N}(v_h) \qquad \forall v_h\in V_h. } \tag{8} \]
従ってclassical symmetric Nitscheはconsistentです.
ここが後で扱うWOPSIP-based formulationとの重要な違いです.
5.penalty scaleを単に \(1/h\) と覚えない
boundary face \(F=\partial T\cap\partial\Omega\) に対して, anisotropic geometryを意識したface scaleを \[ \boxed{ \ell_{T,F} = \frac{ d\,|T|_d }{ |F|_{d-1} } } \tag{9} \] とします.
2次元では \[ \ell_{T,F} = \frac{2|T|}{|F|} \tag{10} \] なので,boundary edge \(F\) に対するtriangleの高さそのものです.
classical symmetric Nitscheでは \[ \boxed{ \kappa_F(0) = \ell_{T,F}^{-1} } \tag{11} \] というnormal-direction scaleを使えます.
\[ \gamma/h_F \] とedge lengthだけでpenaltyを決めると, thin elementのnormal thicknessを見失うことがあります.
boundary penaltyでは faceに垂直なelement scaleを見ることが重要です.
6.coercivityにはpenalty parameterが必要
energy normを \[ \boxed{ |v|_{N}^2 = |v|_{H^1(\Omega)}^2 + \sum_{F\in\mathcal F_h^\partial} \kappa_F(0) \|v\|_{L^2(F)}^2 } \tag{12} \] とします.
\(\gamma\) を十分大きく選び, 適切なtrace / inverse estimateを使うと \[ \boxed{ a_h^{N}(v_h,v_h) \ge \alpha |v_h|_{N}^2 } \tag{13} \] が得られます.
したがって \[ \gamma>0 \] なら何でもよいわけではありません.
7.\(\gamma\) を大きくしすぎればよいわけでもない
coercivityのためにはpenaltyを十分大きくする必要がありますが, 極端に大きくするとmatrix conditioningを悪化させます.
従って実装では \[ \boxed{ \text{coercivity} \quad\text{と}\quad \text{conditioning} } \] を両方監査します.
「大きな \(\gamma\) ほど安全」という単純な理解では不十分です.
8.boundary element matrix
P1 basis \(\phi_i\) を使うと, boundary face \(F\subset\partial T\) から \[ \begin{aligned} K_{ij}^{F} ={}& - \int_F (\nabla\phi_j\cdot n)\phi_i\,ds - \int_F \phi_j(\nabla\phi_i\cdot n)\,ds \\ &+ \gamma\kappa_F(0) \int_F \phi_j\phi_i\,ds. \end{aligned} \tag{14} \]
nonhomogeneous boundary data \(g\) は \[ \boxed{ F_i^{F} = - \int_F g\,\nabla\phi_i\cdot n\,ds + \gamma\kappa_F(0) \int_F g\phi_i\,ds. } \tag{15} \]
boundary nodeをmatrixから削除しないことが, strong impositionとの実装上の大きな違いです.
9.Python assemblyの核心
for local_edge in boundary_edges_of_T:
a, b = local_edge
pa = P[a]
pb = P[b]
tangent = pb - pa
edge_length = np.linalg.norm(tangent)
n_out = np.array([
tangent[1],
-tangent[0]
]) / edge_length
ell_TF = (
2.0 * area
/ edge_length
)
kappa = 1.0 / ell_TF
for s, w in edge_quad:
x = (
(1.0 - s) * pa
+ s * pb
)
phi = p1_basis_on_T(x)
dn_phi = grads @ n_out
g = boundary_value(*x)
weight = edge_length * w
A_loc += weight * (
-np.outer(phi, dn_phi)
-np.outer(dn_phi, phi)
+ gamma
* kappa
* np.outer(phi, phi)
)
b_loc += weight * (
-g * dn_phi
+ gamma
* kappa
* g
* phi
)
positive element orientation \[ \det J_T>0 \] を仮定し,local edge orderからoutward normalを一貫して作ります.
10.Nitsche patch test
affine harmonic function \[ u(x,y) = 1+x+2y, \qquad f=0, \qquad g=u|_{\partial\Omega} \tag{16} \] を使います.
\(u\in P_1\) なのでexact integrationなら \[ \boxed{ u_h=u } \tag{17} \] となるべきです.
| \(n\) | max nodal error |
|---|---|
| 2 | 4.44e-16 |
| 4 | 1.33e-15 |
| 8 | 1.78e-15 |
| 16 | 2.66e-15 |
このtestはboundary normal,consistency term,penalty term, nonhomogeneous right-hand sideをまとめて監査できます.
11.smooth solutionの収束test
次に \[ u(x,y) = \sin(\pi x)\sin(\pi y) + 1+x+2y \tag{18} \] を使います.
\[ f = 2\pi^2 \sin(\pi x)\sin(\pi y), \qquad g=u|_{\partial\Omega}. \tag{19} \]
uniform triangulation,\(\gamma=20\), \(\kappa_F(0)=1/\ell_{T,F}\) で計算すると次の結果になりました.
| \(n\) | \(L^2\) rel. | rate | \(H^1\) rel. | rate | boundary \(L^2\) rel. |
|---|---|---|---|---|---|
| 4 | 2.3838e-2 | — | 2.5871e-1 | — | 5.3877e-3 |
| 8 | 6.7928e-3 | 1.811 | 1.3623e-1 | 0.926 | 1.2343e-3 |
| 16 | 1.7668e-3 | 1.943 | 6.8944e-2 | 0.983 | 2.8911e-4 |
| 32 | 4.4778e-4 | 1.980 | 3.4569e-2 | 0.996 | 6.9795e-5 |
regular mesh上のsmooth solutionでは, \[ \boxed{ \|u-u_h\|_{L^2} = O(h^2), \qquad |u-u_h|_{H^1} = O(h) } \tag{20} \] へ漸近しています.
12.strong impositionとの違いを数値仕様として見る
strong Dirichlet FEMではboundary nodal errorは構成上0です. Nitsche法ではboundary unknownもsolveするので, \[ u_h-g \] は有限mesh上では一般に0ではありません.
従ってboundary errorが小さくなっていくこと自体が Nitsche implementationのverification targetになります.
13.classical symmetric Nitscheの異方性上の難しさ
semi-regularなanisotropic meshでは, Lagrange interpolationそのものは方向別評価 \[ \boxed{ |u-I_T^L u|_{H^1(T)} \le C \sum_{i=1}^{d} h_i \left\| \frac{\partial u}{\partial r_i} \right\|_{H^1(T)} } \tag{21} \] を持ちます.
ところがclassical symmetric Nitscheでは, boundary consistency term \[ \int_F \nabla(u-I_h^Lu)\cdot n\, v_h\,ds \] をtrace estimateで評価する必要があります.
anisotropic mesh上では,このtrace estimateから追加のmixed-scale termが現れ, interpolation errorの最適なdirectional structureをそのまま保てない場合があります.
anisotropic Lagrange interpolationがoptimalでも, Nitsche boundary consistency estimateまで自動的にoptimalになるわけではない.
14.WOPSIP-based Nitscheという別の設計
この問題を避ける一つの方法は, classical symmetric Nitscheのboundary consistency termsを直接評価する代わりに, CR spaceとweakly over-penalised boundary termを使うことです.
CR spaceを \[ V_h^{CR} = \left\{ v_h\in P_1^{dc}(\mathcal T_h): \int_F[v_h]\,ds=0 \quad \forall F\in\mathcal F_h^i \right\} \tag{22} \] とします.
boundary face \(F\) 上のconstant projectionを \[ \Pi_F^0: L^2(F)\to P_0(F) \tag{23} \] とします.
15.over-penalised boundary scale
一般に \[ \boxed{ \kappa_F(\beta) = h^{-2\beta} \ell_{T,F}^{-1}, \qquad \beta\ge0 } \tag{24} \] と置きます.
classical symmetric Nitscheで使ったのは \[ \kappa_F(0) = \ell_{T,F}^{-1}. \]
WOPSIP-based schemeでは \[ \boxed{ \kappa_F(1) = h^{-2} \ell_{T,F}^{-1} } \tag{25} \] を使います.
したがって名前どおりweakly over-penalisedです.
16.WOPSIP-based Poisson formulation
bilinear formを \[ \boxed{ a_h(v_h,w_h) = (\nabla_hv_h,\nabla_hw_h)_\Omega + \sum_{F\in\mathcal F_h^\partial} \kappa_F(1) ( \Pi_F^0v_h, \Pi_F^0w_h )_F } \tag{26} \] とします.
right-hand sideは \[ \boxed{ \ell_h(w_h) = (f,w_h)_\Omega + \sum_{F\in\mathcal F_h^\partial} \kappa_F(1) ( \Pi_F^0g, \Pi_F^0w_h )_F. } \tag{27} \]
求める \(u_h\in V_h^{CR}\) は \[ a_h(u_h,v_h) = \ell_h(v_h) \qquad \forall v_h\in V_h^{CR}. \tag{28} \]
式 (26) には \[ -(\partial_nu_h,v_h)_F - (u_h,\partial_nv_h)_F \] というboundary consistency termsがありません.
17.このschemeはconsistentではない――だから二つに分ける
classical symmetric Nitscheでは式 (8) のGalerkin consistencyが成立しました. 一方,式 (26)–(28) のCR-based schemeではexact solution \(u\) に対して \[ a_h(u,w_h)-\ell_h(w_h) \] は一般に0ではありません.
そこでenergy errorを \[ \boxed{ |u-u_h|_{1,1} \le C \inf_{v_h\in V_h^{CR}} |u-v_h|_{1,1} + E_h(u) } \tag{29} \] と分けます.
ここで \[ \boxed{ E_h(u) = \sup_{0\neq w_h\in V_h^{CR}} \frac{ |a_h(u,w_h)-\ell_h(w_h)| }{ |w_h|_{1,1} } } \tag{30} \] がconsistency errorです.
第13回で見た \[ \text{approximation} + \text{consistency} \] というnonconforming error structureがここでも再登場します.
18.best approximationはCR interpolationで扱う
boundary face meanをCR interpolationが再現するため, \[ \Pi_F^0 ( u-I_h^{CR}u ) = 0 \qquad F\in\mathcal F_h^\partial. \tag{31} \]
従ってboundary penalty partを増やさずに \[ \inf_{v_h\in V_h^{CR}} |u-v_h|_{1,1} \] をCR interpolation errorで評価できます.
semi-regular meshではdirectional estimate \[ \boxed{ \inf_{v_h\in V_h^{CR}} |u-v_h|_{1,1} \le C \left( \sum_{T\in\mathcal T_h} \sum_{i=1}^{d} h_i^2 \left\| \frac{\partial}{\partial r_i} \nabla u \right\|_{L^2(T)^d}^2 \right)^{1/2} } \tag{32} \] が基本になります.
19.consistency errorにCR–RT relationを使う
consistency estimateでは \[ I_h^{RT}\nabla u \] を導入し, \[ \boxed{ \nabla\cdot I_h^{RT}\nabla u = \Pi_h^0\Delta u } \tag{33} \] というcommuting propertyを使います.
これによりboundary traceを直接追うだけの議論から, RT interpolation errorとelementwise projection errorを使うbulk estimateへ移せます.
Season 2でCR,RT,CR–RT relationを先に扱ったのは, このNitsche consistency analysisにつながるからです.
20.semi-regular meshでのconsistency estimate
convex domain,\(u\in H^2(\Omega)\),semi-regular mesh familyなどの仮定の下では, consistency errorは代表的に \[ \begin{aligned} E_h(u) \le C\Bigg[ & \left( \sum_{T\in\mathcal T_h} \sum_{i=1}^{d} h_i^2 \left\| \frac{\partial}{\partial r_i} \nabla u \right\|_{L^2(T)^d}^2 \right)^{1/2} \\ &+ h\|\Delta u\|_{L^2(\Omega)} + h|u|_{H^1(\Omega)} \\ &+ h^{3/2} |u|_{H^1(\Omega)}^{1/2} \|\Delta u\|_{L^2(\Omega)}^{1/2} \Bigg]. \end{aligned} \tag{34} \]
ここで重要なのは, 第一項にanisotropic directional derivative structureが明示的に残っていることです.
21.「Nitsche法」と一言でまとめない
この記事では二つのschemeを区別しました.
| scheme | space | boundary treatment | error structure |
|---|---|---|---|
| classical symmetric Nitsche | continuous P1 | flux consistency + symmetry + penalty | consistent Galerkin |
| WOPSIP-based Nitsche | CR | projected over-penalty | approximation + consistency |
両者はDirichlet conditionをweakly扱いますが, 数学的な構造は同じではありません.
22.Stokesへの接続
Nitsche型boundary treatmentはStokes equationにも使えます.
第17回で扱ったCR–P0 Stokesとpressure-robust reconstructionに, weak boundary penaltyを組み合わせると, anisotropic mesh上でもvelocity boundary conditionをweakly imposeするschemeへ拡張できます.
この場合には
\[ \boxed{ \text{boundary stability} + \text{inf-sup} + \text{pressure robustness} } \]を同時に監査する必要があります.
23.ChatGPTがNitsche実装で起こしやすいミス
| mistake | consequence |
|---|---|
| boundary nodesをstrongly eliminateした上でNitsche termsも追加 | methodを二重に変更 |
| \(-u\partial_n v\) のsignを逆にする | symmetry / consistency破壊 |
| nonhomogeneous RHSの \(-g\partial_n v\) を忘れる | patch test失敗 |
| anisotropic meshでpenaltyをedge lengthだけから決める | normal thicknessを無視 |
| \(\gamma>0\) なら必ずcoerciveと仮定 | stability未確認 |
| classical NitscheとWOPSIP-based schemeを同じbilinear formと扱う | consistency structureの混同 |
24.Nitsche implementation audit prompt
このPoisson Nitsche codeを数学的に監査してください.
(1) boundary nodesをstrongly eliminateしていないか,
(2) symmetric Nitscheなら \(-(\partial_nu_h,v_h)- (u_h,\partial_nv_h)\) の二項が入っているか,
(3) nonhomogeneous \(g\) のright-hand sideが正しいか,
(4) boundary normal orientationが正しいか,
(5) penalty scaleがboundary faceに垂直なelement scaleを反映しているか,
(6) penalty parameterがcoercivityを保証する大きさか,
(7) affine nonhomogeneous patch testをmachine precisionで通るか,
(8) \(L^2\) / \(H^1\) convergence orderが期待値へ近づくか,
(9) anisotropic meshではLagrange interpolation estimateとNitsche consistency estimateを分けて考えているか,
(10) WOPSIP-based schemeではCR space,\(\Pi_F^0\),\(\kappa_F(1)\) を使い,classical boundary consistency termsが無いことを認識しているか,
(11) nonconforming errorをapproximation + consistencyに分けているか,
(12) consistency analysisでCR–RT relationとRT commuting propertyを正しく使っているか
を順に確認してください.
25.第18回の結論
Nitsche法は
\[ \boxed{ \text{Dirichlet conditionをspaceではなくvariational formへ入れる} } \tag{35} \]方法です.
classical symmetric formulationでは \[ \text{consistency} + \text{symmetry} + \text{penalty} \] がboundaryに入り, exact solutionとのGalerkin consistencyを保ちます.
一方,anisotropic meshではboundary consistency estimate自体が難しくなります. そのためCRとWOPSIP penaltyを用い,
\[ \boxed{ \text{anisotropic approximation} + \text{CR--RT consistency analysis} } \tag{36} \]へ問題を組み替える設計が有効です.
Nitsche法では penaltyの大きさだけでなく,consistencyとgeometryを同時に見る.
次回はこのboundary / face calculusをdomain内部の全facesへ広げ, DG法のjump・average・penaltyを実装します.
参考文献・関連ページ
- J. A. Nitsche, “Über ein Variationsprinzip zur Lösung von Dirichlet-Problemen bei Verwendung von Teilräumen, die keinen Randbedingungen unterworfen sind”, Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg 36 (1971), 9–15.
- H. Ishizaka, “Nitsche's method under a semi-regular mesh condition”, Numerical Algorithms 102 (2026), 291–334. DOI.
- S. C. Brenner, “Poincaré–Friedrichs inequalities for piecewise \(H^1\) functions”, SIAM Journal on Numerical Analysis 41 (2003), 306–324.
- 第13回:Crouzeix–Raviart要素を本当に実装する
- 第14回:Raviart–Thomas要素を実装する
- 第15回:CRとRTはなぜ相性がよいのか
- 第17回:Stokes方程式を有限要素法で解く
