Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG: c=0 trick for steady state problems

オープン
#910 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

src/festim/hydrogen_transport_problem.py の683-699行目から開始し、特に689-693行目の反応チェックを確認してください。提供された fenicsx スクリプトで問題を再現し、各不動種について定常状態のサブドメインがどのように選択されるかを調べてください。種ごとの反応チェックによって PETSc の失敗が防止され、再現が正常に実行されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug fenicsx good first issue

In HydrogenTransportProblem we want apply c = 0 to the formulation in steady state in subdomains where immobile species are not involved in a reaction. We do this here by looking in which subdomains each immobile species isn't defined:

https://github.com/festim-dev/FESTIM/blob/013937a860d72252436118dabcbf75b80ebc5cce/src/festim/hydrogen_transport_problem.py#L683-L699

However, this will apply $c = 0$ in all the subdomains where there is a reaction, even if this reaction doesn't involve this specific species.

These lines are the issue:
https://github.com/festim-dev/FESTIM/blob/013937a860d72252436118dabcbf75b80ebc5cce/src/festim/hydrogen_transport_problem.py#L689-L693

It should check if the species is in the product of the reaction:

 for vol in self.volume_subdomains: 
     # check reactions 
     for reaction in self.reactions: 
         if spe in reaction.product:  # <-- check if the species is in the reaction
             if vol == reaction.volume: 
                 not_defined_in_volume.remove(vol) 

To reproduce the bug, run this on fenicsx:

import festim as F
import numpy as np

my_model = F.HydrogenTransportProblem()
my_model.mesh = F.Mesh1D(
    np.concatenate([np.linspace(0, 0.5, 10), np.linspace(0.5, 1, 10)])
)

mat = F.Material(D_0=1, E_D=0.1)

vol1 = F.VolumeSubdomain1D(id=1, material=mat, borders=[0, 0.5])
vol2 = F.VolumeSubdomain1D(id=2, material=mat, borders=[0.5, 1])

surface1 = F.SurfaceSubdomain1D(id=4, x=0)
surface2 = F.SurfaceSubdomain1D(id=5, x=1)

my_model.subdomains = [vol1, vol2, surface1, surface2]

mobile = F.Species(name="H", mobile=True)
trapped = F.Species(name="H_trapped", mobile=False)
trapped2 = F.Species(name="H_trapped", mobile=False)
empty = F.ImplicitSpecies(n=0.5, others=[trapped])
empty2 = F.ImplicitSpecies(n=0.5, others=[trapped2])

my_model.species = [mobile, trapped, trapped2]

my_model.reactions = [
    F.Reaction(
        reactant=[mobile, empty],
        product=[trapped],
        k_0=1,
        E_k=mat.E_D,
        p_0=0.1,
        E_p=0.87,
        volume=vol1,
    ),
    F.Reaction(
        reactant=[mobile, empty2],
        product=[trapped2],
        k_0=1,
        E_k=mat.E_D,
        p_0=0.1,
        E_p=0.87,
        volume=vol2,
    ),
]

my_model.temperature = 600

my_model.boundary_conditions = [
    F.FixedConcentrationBC(subdomain=surface1, species=mobile, value=0),
    F.FixedConcentrationBC(subdomain=surface2, species=mobile, value=1),
]

my_model.settings = F.Settings(
    atol=1e-10,
    rtol=1e-10,
    transient=False,
)


my_model.initialise()
my_model.run()

Produces:

Traceback (most recent call last):
  File "/home/remidm/FESTIM/mwe_trick.py", line 76, in <module>
    my_model.run()
  File "/home/remidm/FESTIM/src/festim/problem.py", line 150, in run
    self.solver.solve(self.u)
  File "/home/remidm/miniconda3/envs/fenicsx-env/lib/python3.12/site-packages/dolfinx/nls/petsc.py", line 51, in solve
    n, converged = super().solve(u.x.petsc_vec)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Failed to successfully call PETSc function 'KSPSolve'. PETSc error code is: 76, Error in external library
主要言語
Python
スター
136
フォーク
47
平均マージ
4日 35分
マージ済み PR(30日)
11

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

festim-dev/FESTIM のほかの issue

festim-dev/FESTIM の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。