DirichletCondition[beqn,pred]
方程式 beqn で表される,pred がTrueであるNDSolveおよび関連関数に渡された領域の境界の側で満足された,ディリクレ(Dirichlet)境界条件を表す.
DirichletCondition
DirichletCondition[beqn,pred]
方程式 beqn で表される,pred がTrueであるNDSolveおよび関連関数に渡された領域の境界の側で満足された,ディリクレ(Dirichlet)境界条件を表す.
詳細
- DirichletConditionは,微分方程式とともに,DSolve,NDSolve,DEigensystem,NDEigensystem,GreenFunction等の関数における境界条件の説明に用いられる.
- NDSolve[eqns,{u1,u2,…},{x1,x2,…}∈Ω]では,xiは独立変数,ujは従属変数,Ωは境界が∂Ωの領域である.
- ディリクレ条件が指定され得る場所は青で示される.これは,領域Ωの境界 ∂Ω上(薄い青),またΩの内部境界上(濃い青)に表され得るもので,これらの点における解の値が条件 beqn を満足するように指定する.
- DirichletCondition式は方程式 eqns に含まれなければならない.
- 独立変数 x1, …内の方程式および不等式の任意の論理結合を pred 述部について使うことができる.
- DirichletCondition[u1r,pred]は,境界 ∂Ω上の uiの値が r であるように指示するために使われる.一般に,境界方程式 beqn は独立変数つまり h1 u1+…r 内でアフィン線形でなければならない.ただし,hiおよび r は独立変数{x1,x2,…}のいずれに依存してもよい.
- 時間依存方程式については,beqn と pred の両方が時間に依存してもよい.pred は空間的境界についてのみ考慮される.
- 一般に,微分方程式が一意的に可解となるためには,少なくとも1つのディリクレタイプの境界条件が指定される必要がある.ディリクレ条件は第1種境界条件とも呼ばれる.
- ディリクレ条件は,pred がTrueである ∂Ωの離散化の各点で強制される.
- DirichletCondition[{eqn1,eqn2,…},pred]は{DirichletCondition[eqn1,pred],DirichletCondition[eqn2,pred],…}に等しい.
- DirichletCondition[eqn,{pred1,pred2,…}]は{DirichletCondition[eqn,pred1],DirichletCondition[eqn,pred2],…}に等しい.
- 有限要素近似の場合は,DirichletConditionは常にノードに作用し,辺や面に作用することはない.
- DirichletConditionとNeumannValueは境界の同じ部分に指定されてはならない.
- 複数のDirichletConditionインスタンスが境界に重なってはならない.
例題
すべて開く すべて閉じる例 (2)
NDSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 0, DirichletCondition[u[x, y] == Sin[x y], True]}, u, {x, y}∈Disk[]]Plot3D[%[x, y], {x, y}∈Disk[]]
について
,
について
という,複数のディリクレ条件を指定する:
NDSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 0, DirichletCondition[u[x, y] == 0, x ≤ -0.3], DirichletCondition[u[x, y] == 1, x ≥ 0.35]}, u, {x, y}∈Disk[]]Plot3D[%[x, y], {x, y}∈Disk[]]DSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 0, DirichletCondition[u[x, y] == Sin[4ArcTan[x, y]], True]}, u[x, y], {x, y}∈Disk[]]Plot3D[%, {x, y}∈Disk[], PlotRange -> All, PlotPoints -> 101, PlotStyle -> Hue[0.55]]スコープ (4)
Ω = RegionDifference[Rectangle[{-1, -1}, {1, 1}], Rectangle[{-1 / 2, -1 / 2}, {1 / 2, 1 / 2}]];
RegionPlot[Ω]内側の境界に
,外側の境界に
と,複数のディリクレ条件を設定し,この領域上でラプラス(Laplace)方程式
を解く:
NDSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 0, DirichletCondition[u[x, y] == 100., Abs[x] == 1 / 2 && -1 / 2 ≤ y ≤ 1 / 2 || -1 / 2 ≤ x ≤ 1 / 2 && Abs[y] == 1 / 2],
DirichletCondition[u[x, y] == 20., Abs[x] == 1 || Abs[y] == 1]}, u, {x, y}∈Ω]Plot3D[%[x, y], {x, y}∈Ω, Mesh -> None, PlotRange -> All]穴がありディリクレ条件もある領域上で
を解く.領域を指定する:
Ω = ImplicitRegion[x ^ 2 + y ^ 2 ≥ 1, {{x, -2, 2}, {y, -2, 2}}];
RegionPlot[Ω]NDSolveValue[{Inactive[Div][{{2, y}, {x, 3}} . Inactive[Grad][u[x, y], {x, y}], {x, y}] == 0, DirichletCondition[u[x, y] == 0, x^2 + y^2 == 1], DirichletCondition[u[x, y] == 1, x == 2 || x == -2 || y == 2 || y == -2]}, u, {x, y}∈Ω]DensityPlot[%[x, y], {x, y}∈Ω]長さ d の区間の端点で0に制約された波動方程式グリーン関数を求める:
gf = GreenFunction[{(1/c^2)Subscript[∂, {t, 2}]u[x, t] - Subscript[∂, {x, 2}]u[x, t], DirichletCondition[u[x, t] == 0, True]}, u[x, t], {x, 0, d}, t, {y, s}]領域内で部分的にDirichletConditionを指定する.境界メッシュを作成して可視化する:
Needs["NDSolve`FEM`"]
bmesh = ToBoundaryMesh["Coordinates" -> {{0, 0}, {1 / 2, 0}, {1, 0}, {1, 1}, {0, 1}, {1 / 2, 2 / 5}}, "BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 1}, {2, 6}}]}];
bmesh["Wireframe"]
でDirichletConditionが設定された偏微分方程式を解く:
mesh = ToElementMesh[bmesh];
solution = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 0, u[x, 1] == 100, u[x, 0] == 0, u[1, y] == 100 y, u[0, y] == 100 y, DirichletCondition[u[x, y] == 0, x == 1 / 2 && y <= 2 / 5]}, u, {x, y}∈mesh]Show[ContourPlot[solution[x, y], {x, y}∈mesh, Contours -> 20], Graphics[{Green, Line[{{1 / 2, 0}, {1 / 2, 2 / 5}}]}]]アプリケーション (11)
1D問題 (1)
2D問題 (1)
3D問題 (1)
時間依存問題 (4)
pde = D[u[t, x], t, t] == D[u[t, x], x, x];
ics = {u[0, x] == Exp[-20(x) ^ 2], Derivative[1, 0][u][0, x] == 0};
bcs = {u[t, -1] == 0, u[t, 1] == 0};NDSolveValue[{pde, ics, bcs}, u, {t, 0, 1}, {x, -1, 1}]Plot3D[%[t, x], {t, 0, 1}, {x, -1, 1}, PlotRange -> All]境界条件がディリクレ境界条件として指定された時間依存問題を解く:
bcs = DirichletCondition[u[t, x] == 0, x == -1 || x == 1]NDSolveValue[{pde, ics, bcs}, u, {t, 0, 1}, {x, -1, 1}]Plot3D[%[t, x], {t, 0, 1}, {x, -1, 1}, PlotRange -> All]pde = D[u[t, x], t, t] == D[u[t, x], x, x];
ics = {u[0, x] == Exp[-20(x) ^ 2], Derivative[1, 0][u][0, x] == 0};
bcs = {DirichletCondition[u[t, x] == Sin[t], x == 1], DirichletCondition[u[t, x] == 0, x == -1]}NDSolveValue[{pde, ics, bcs}, u, {t, 0, π}, {x, -1, 1}, Method -> {"PDEDiscretization" -> {"MethodOfLines", {"SpatialDiscretization" -> "FiniteElement"}}}]Plot3D[%[t, x], {t, 0, π}, {x, -1, 1}]初期条件と境界条件が指定された2D時間依存熱流量問題を解く:
ufun = NDSolveValue[{D[u[t, x, y], t] == Subsuperscript[∇, {x, y}, 2]u[t, x, y], u[0, x, y] == Sin[Pi x] Sin[Pi y], DirichletCondition[u[t, x, y] == 0, True]}, u, {t, 0, 1}, {x, 0, 1}, {y, 0, 1}, Method -> {"PDEDiscretization" -> {"MethodOfLines", {"SpatialDiscretization" -> "FiniteElement"}}}]Plot3D[ufun[0.5, x, y], {x, 0, 1}, {y, 0, 1}]ListAnimate@Table[Plot3D[ufun[t, x, y], {x, 0, 1}, {y, 0, 1}, PlotRange -> 1], {t, 0, .25, .025}]NDSolveValue[{D[u[t, x, y], {t, 2}] == Subsuperscript[∇, {x, y}, 2]u[t, x, y], u[0, x, y] == x y Sin[Pi( x ^ 2 + y ^ 2)], Derivative[1, 0, 0][u][0, x, y] == 0, DirichletCondition[u[t, x, y] == 0, True]}, u, {t, 0, 2}, {x, y}∈Disk[]]ListAnimate@Table[Plot3D[%[t, x, y], {x, y}∈Disk[], PlotRange -> 1], {t, 0, 2, .1}]複数の境界条件 (1)
boundaries = {-y, (1/25) - (-(3/2) + x)^2 - y^2, 1 - x^2 - y^2, x^2 + y^2 - 4, y - x * Tan[π / 8]};
Ω = ImplicitRegion[And@@(# ≤ 0& /@ boundaries), {x, y}];Show[RegionPlot[Ω], ContourPlot[Evaluate[Thread[boundaries == 0]], {x, 0.8, 2.2}, {y, -0.2, 1.}, ContourStyle -> {Purple, Green, Red, Blue, Purple}], PlotRange -> {{0.8, 2.2}, {-0.2, 1.}}, AspectRatio -> Automatic]気温が赤と青の境界に設定され,流束が緑の境界上に設定されたラプラス方程式を解く:
NDSolveValue[{-10 Subsuperscript[∇, {x, y}, 2]u[x, y] == NeumannValue[-1000., boundaries[[2]] == 0.], {DirichletCondition[u[x, y] == 200., boundaries[[3]] == 0.],
DirichletCondition[u[x, y] == 15., boundaries[[4]] == 0.]}}, u, {x, y}∈Ω]ContourPlot[%[x, y], {x, y}∈Ω, Mesh -> None, ColorFunction -> "TemperatureMap", Contours -> 21, AspectRatio -> Automatic]結合系の境界条件 (3)
pde = {D[-2 u[x], {x, 2}] + D[4 v[x], {x, 2}] + 10 v[x] == 1, D[-3 u[x], {x, 2}] + D[-1 v[x], {x, 2}] == 0};bcs = {DirichletCondition[2 u[x] == 1, x == 0], DirichletCondition[u[x] == 0, x == 1], DirichletCondition[v[x] == 1., x == 0], DirichletCondition[v[x] == 0, x == 1]};NDSolveValue[{pde, bcs}, {u[x], v[x]}, {x, 0, 1}]Plot[Evaluate[%], {x, 0, 1}]pde = {-Subsuperscript[∇, {x, y}, 2]u[x, y] + v[x, y] == 0, -Subsuperscript[∇, {x, y}, 2]v[x, y] + u[x, y] == 0}bcs = {DirichletCondition[u[x, y] == 1., x ≥ 0.9],
DirichletCondition[u[x, y] == 0., x ≤ -0.9],
DirichletCondition[v[x, y] == 2., y ≥ 0.8],
DirichletCondition[v[x, y] == 3., y ≤ -0.7]};NDSolveValue[{pde, bcs}, {u[x, y], v[x, y]}, {x, y}∈Disk[]]Plot3D[#, {x, y}∈Disk[]]& /@ %ヤング率Yおよびポアソン比 ν で,棒の上での平面応力演算子を指定する:
ps = {Inactive[Div][{{0, -(Y ν/1 - ν^2)}, {-(Y (1 - ν)/2 (1 - ν^2)), 0}}.Inactive[Grad][v[x, y], {x, y}], {x, y}] + Inactive[Div][{{-(Y/1 - ν^2), 0}, {0, -(Y (1 - ν)/2 (1 - ν^2))}}.Inactive[Grad][u[x, y], {x, y}], {x, y}], Inactive[Div][{{0, -(Y (1 - ν)/2 (1 - ν^2))}, {-(Y ν/1 - ν^2), 0}}.Inactive[Grad][u[x, y], {x, y}], {x, y}] + Inactive[Div][{{-(Y (1 - ν)/2 (1 - ν^2)), 0}, {0, -(Y/1 - ν^2)}}.Inactive[Grad][v[x, y], {x, y}], {x, y}]} /. {Y -> 10 ^ 3, ν -> 33 / 100};左端を固定され,
方向を保ったまま右端を負の
方向に動かされた棒の歪み(ひずみ)を計算する:
{uif, vif} = NDSolveValue[{ps == {0, 0},
DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, x == 0],
DirichletCondition[v[x, y] == -0.2, x == 5], DirichletCondition[u[x, y] == 0, x == 5]
}, {u, v}, {x, 0, 5}, {y, 0, 1}]ContourPlot[uif[x, y], {x, 0, 5}, {y, 0, 1}, ColorFunction -> "TemperatureMap", AspectRatio -> Automatic]ContourPlot[vif[x, y], {x, 0, 5}, {y, 0, 1}, ColorFunction -> "TemperatureMap", AspectRatio -> Automatic]mr = MeshRegion[uif["ElementMesh"]];
c = MeshCoordinates[mr];
Show[
BoundaryMesh[mr],
HighlightMesh[MeshRegion[c + Transpose[{uif@@@c, vif@@@c}], MeshCells[mr, {2, All}]], Style[1, Red]]
]特性と関係 (1)
NDSolveValue[{u''[x] == -x * u[x], u[0] == 0, u[4] == 1 / 2}, u[x], {x, 0, 4}, Method -> {"Shooting"}]Plot[%, {x, 0, 4}]NDSolveValue[{u''[x] == -x * u[x], u[0] == 0, u[4] == 1 / 2}, u[x], {x, 0, 4}, Method -> {"FiniteElement"}]Plot[%, {x, 0, 4}]NDSolveValue[{u''[x] == -x * u[x], DirichletCondition[u[x] == 0, x == 0], DirichletCondition[u[x] == 1 / 2, x == 4]}, u[x], {x, 0, 4}]Plot[%, {x, 0, 4}]考えられる問題 (6)
少なくとも1つのディリクレ境界条件を指定することが不可欠である:
NDSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 1}, u[x, y], {x, y}∈Disk[]]NDSolveValue[{Subsuperscript[∇, {x, y}, 2]u[x, y] == 1, DirichletCondition[u[x, y] == 0, True]}, u[x, y], {x, y}∈Disk[]]Plot3D[%, {x, y}∈Disk[]]Robin境界条件を不可欠の条件として指定することで十分なこともある:
NDSolveValue[Subsuperscript[∇, {x, y}, 2]u[x, y] == 1 + NeumannValue[3 u[x, y] + Sin[x y], True], u[x, y], {x, y}∈Disk[]]Plot3D[%, {x, y}∈Disk[]]境界条件が境界との交点を持たない場合は,警告が生成され,交点を持たない境界は,可能な場合は無視される:
NDSolveValue[{D[-2u[x], x, x] + 3 D[u[x], x] + 10u[x] == 1, DirichletCondition[2 * u[x] == -1, x == -1],
DirichletCondition[3 * u[x] == 1 / 2, x == 3]}, u, {x, -1, 2}, Method -> "FiniteElement"]NDSolveValue[{D[-2u[x], x, x] + 3 D[u[x], x] + 10u[x] == 1, DirichletCondition[2 * u[x] == -1, x == -1],
DirichletCondition[3 * u[x] == 1 / 2, x == 2]}, u, {x, -1, 2}, Method -> "FiniteElement"]Trueを述語として指定すると,内部材料境界を含むすべての境界におけるDirichletConditionの値が適用される.
mesh = NDSolve`FEM`ToElementMesh[Annulus[{0, 0}, {1, 2}], "RegionHoles" -> None];
mesh["Wireframe"]eqn = Inactive[Div][(If[x ^ 2 + y ^ 2 ≤ 1, -1, -5]) Inactive[Grad][u[x, y], {x, y}], {x, y}] == 1;すべての境界における従属変数
のすべての値が0に設定された方程式を解く:
sol = NDSolveValue[{eqn, DirichletCondition[u[x, y] == 0, True]}, u, {x, y}∈mesh];Plot3D[sol[x, y], {x, y}∈Disk[{0, 0}, 2], PlotRange -> All]外側境界における従属変数
の値が0に設定された方程式を解く:
sol = NDSolveValue[{eqn, DirichletCondition[u[x, y] == 0, x ^ 2 + y ^ 2 == 2 ^ 2]}, u, {x, y}∈mesh];Plot3D[sol[x, y], {x, y}∈Disk[{0, 0}, 2], PlotRange -> All]Trueを述語として指定すると,空間的なすべての境界にDirichletConditionの値が適用される:
sol = NDSolveValue[{D[u[t, x], {t, 1}] - Laplacian[u[t, x], {x}] == 1, DirichletCondition[u[t, x] == 0, True], u[0, x] == 0}, u, {t, 0, 1}, {x, 0, 1}]両端で境界条件が満たされていることを確認する.初期条件もまた満たされている.時間領域は空間的な境界とは見なされないので,
には境界条件がない:
GraphicsGrid[{{Plot[sol[t, 0], {t, 0, 1}], Plot[sol[t, 1], {t, 0, 1}]}, {Plot[sol[0, x], {x, 0, 1}], Plot[sol[1, x], {x, 0, 1}]}}, ImageSize -> Medium]NDSolveは,デフォルトで,この偏微分方程式を時間依存問題として扱う.純粋に空間的な離散化はMethod->{"PDEDiscretization"->"FiniteElement"}を使って指定できる:
sol = NDSolveValue[{D[u[t, x], {t, 1}] - Laplacian[u[t, x], {x}] == 1, DirichletCondition[u[t, x] == 0, True], u[0, x] == 0}, u, {t, 0, 1}, {x, 0, 1}, Method -> {"PDEDiscretization" -> "FiniteElement"}]同じ偏微分方程式を純粋に空間的な問題として解く場合は,DirichletConditionがすべての境界に適用される:
GraphicsGrid[{{Plot[sol[t, 0], {t, 0, 1}], Plot[sol[t, 1], {t, 0, 1}]}, {Plot[sol[0, x], {x, 0, 1}], Plot[sol[1, x], {x, 0, 1}]}}, ImageSize -> Medium]インポートしたメッシュあるいは生成したメッシュが数値的に不正確であることがある.例えば,目的とする領域は四角形
であるのに,領域の離散化バージョンに不正確さがあって実際には
になることがある.このような場合に
の形式の述語が指定されていれば,
は存在しないのでエラーメッセージが生成される.次の構築された例について考える:
Ω = Rectangle[{10 ^ -6, 0}, {1, 1}];
NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 1, DirichletCondition[u[x, y] == 0, x == 0]}, u, {x, y}∈Ω]これに対処する方法の一つに,述語を境界として
と定式化するものがある.ここで,
は境界の厚みである:
NDSolveValue[{-Laplacian[u[x, y], {x, y}] == 1, DirichletCondition[u[x, y] == 0, x ^ 2 <= 10 ^ -6]}, u, {x, y}∈Ω]テクニカルノート
関連するガイド
テキスト
Wolfram Research (2014), DirichletCondition, Wolfram言語関数, https://reference.wolfram.com/language/ref/DirichletCondition.html (2022年に更新).
CMS
Wolfram Language. 2014. "DirichletCondition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/DirichletCondition.html.
APA
Wolfram Language. (2014). DirichletCondition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirichletCondition.html
BibTeX
@misc{reference.wolfram_2026_dirichletcondition, author="Wolfram Research", title="{DirichletCondition}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DirichletCondition.html}", note=[Accessed: 08-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_dirichletcondition, organization={Wolfram Research}, title={DirichletCondition}, year={2022}, url={https://reference.wolfram.com/language/ref/DirichletCondition.html}, note=[Accessed: 08-September-2026]}