-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #878 from RemDelaporteMathurin/discontinuity-generic
Interface concentration discontinuities (fenicsx)
- Loading branch information
Showing
113 changed files
with
4,443 additions
and
2,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "./" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,3 +105,9 @@ venv.bak/ | |
|
||
# version file | ||
**_version.py | ||
|
||
# Input/Output files | ||
*.bp | ||
*.xdmf | ||
*.h5 | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FESTIM API | ||
========== | ||
|
||
|
||
.. automodule:: festim.boundary_conditions | ||
:members: | ||
:show-inheritance: | ||
:exclude-members: __weakref__ | ||
:private-members: | ||
:inherited-members: | ||
|
||
|
||
.. .. automodule:: festim.hydrogen_transport_problem | ||
.. :members: | ||
.. :show-inheritance: | ||
.. :exclude-members: __weakref__ | ||
.. :private-members: | ||
.. :inherited-members: | ||
.. .. automodule:: festim.heat_transfer_problem | ||
.. :members: | ||
.. :show-inheritance: | ||
.. :exclude-members: __weakref__ | ||
.. :inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ Contents | |
userguide/index | ||
devguide/index | ||
publications | ||
api/index | ||
|
||
|
||
Indices and tables | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import festim as F | ||
import numpy as np | ||
|
||
import festim as F | ||
|
||
my_model = F.HydrogenTransportProblem() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import numpy as np | ||
|
||
import festim as F | ||
|
||
my_model = F.HTransportProblemDiscontinuous() | ||
|
||
interface_1 = 0.5 | ||
interface_2 = 0.7 | ||
|
||
# for some reason if the mesh isn't fine enough then I have a random SEGV error | ||
N = 2000 | ||
vertices = np.concatenate( | ||
[ | ||
np.linspace(0, interface_1, num=N), | ||
np.linspace(interface_1, interface_2, num=N), | ||
np.linspace(interface_2, 1, num=N), | ||
] | ||
) | ||
|
||
my_model.mesh = F.Mesh1D(vertices) | ||
|
||
material_left = F.Material(D_0=2.0, E_D=0) | ||
material_mid = F.Material(D_0=2.0, E_D=0) | ||
material_right = F.Material(D_0=2.0, E_D=0) | ||
|
||
material_left.K_S_0 = 2.0 | ||
material_left.E_K_S = 0 | ||
material_mid.K_S_0 = 4.0 | ||
material_mid.E_K_S = 0 | ||
material_right.K_S_0 = 6.0 | ||
material_right.E_K_S = 0 | ||
|
||
left_domain = F.VolumeSubdomain1D( | ||
3, borders=[vertices[0], interface_1], material=material_left | ||
) | ||
middle_domain = F.VolumeSubdomain1D( | ||
4, borders=[interface_1, interface_2], material=material_mid | ||
) | ||
right_domain = F.VolumeSubdomain1D( | ||
5, borders=[interface_2, vertices[-1]], material=material_right | ||
) | ||
|
||
left_surface = F.SurfaceSubdomain1D(id=1, x=vertices[0]) | ||
right_surface = F.SurfaceSubdomain1D(id=2, x=vertices[-1]) | ||
|
||
# the ids here are arbitrary in 1D, you can put anything as long as it's not the same as the surfaces | ||
my_model.interfaces = [ | ||
F.Interface(6, (left_domain, middle_domain)), | ||
F.Interface(7, (middle_domain, right_domain)), | ||
] | ||
my_model.subdomains = [ | ||
left_domain, | ||
middle_domain, | ||
right_domain, | ||
left_surface, | ||
right_surface, | ||
] | ||
my_model.surface_to_volume = { | ||
right_surface: right_domain, | ||
left_surface: left_domain, | ||
} | ||
|
||
H = F.Species("H", mobile=True) | ||
trapped_H = F.Species("H_trapped", mobile=False) | ||
empty_trap = F.ImplicitSpecies(n=0.5, others=[trapped_H]) | ||
|
||
my_model.species = [H, trapped_H] | ||
|
||
for species in my_model.species: | ||
species.subdomains = my_model.volume_subdomains | ||
|
||
|
||
my_model.reactions = [ | ||
F.Reaction( | ||
reactant=[H, empty_trap], | ||
product=[trapped_H], | ||
k_0=2, | ||
E_k=0, | ||
p_0=0.1, | ||
E_p=0, | ||
volume=domain, | ||
) | ||
for domain in [left_domain, middle_domain, right_domain] | ||
] | ||
|
||
my_model.boundary_conditions = [ | ||
F.DirichletBC(left_surface, value=0.05, species=H), | ||
F.DirichletBC(right_surface, value=0.2, species=H), | ||
] | ||
|
||
|
||
my_model.temperature = lambda x: 300 + 100 * x[0] | ||
|
||
my_model.settings = F.Settings(atol=None, rtol=1e-5, transient=False) | ||
|
||
my_model.exports = [ | ||
F.VTXSpeciesExport(filename=f"u_{subdomain.id}.bp", field=H, subdomain=subdomain) | ||
for subdomain in my_model.volume_subdomains | ||
] | ||
|
||
my_model.initialise() | ||
my_model.run() |
Oops, something went wrong.