-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interface concentration discontinuities (fenicsx) #878
Merged
RemDelaporteMathurin
merged 147 commits into
festim-dev:fenicsx
from
RemDelaporteMathurin:discontinuity-generic
Oct 30, 2024
Merged
Changes from 142 commits
Commits
Show all changes
147 commits
Select commit
Hold shift + click to select a range
b195072
started a generic script
RemDelaporteMathurin 439df28
Merge remote-tracking branch 'origin/update-dolfinx-0.8' into discont…
RemDelaporteMathurin 4034cc6
progress (runs on dolfinx nightly)
RemDelaporteMathurin 73fe94b
removed unneeded stuff
RemDelaporteMathurin 3f2f8c6
bcs generic
RemDelaporteMathurin a50810f
bcs before jacobian
RemDelaporteMathurin c59a875
issue with results
RemDelaporteMathurin c0f9d09
fixed double reaction + inner instead of dot
RemDelaporteMathurin 994931b
fixed test function for reactant
RemDelaporteMathurin 66adf7c
fixed a few random bugs
RemDelaporteMathurin 0e5f5ba
correct way of making forms with parent functions
RemDelaporteMathurin ac07643
formatting
RemDelaporteMathurin 659cc7b
added integration with parent mesh coefficients
RemDelaporteMathurin fb43151
now solubility is generic
RemDelaporteMathurin 91a6a73
back to solubility of 2
RemDelaporteMathurin 53e7430
T varies in x
RemDelaporteMathurin f1f6d65
K_S no longer hard coded
RemDelaporteMathurin 9f05c82
+ and - restrictions correspond to the correct solubilities
RemDelaporteMathurin de79789
simplified code
RemDelaporteMathurin dab4590
HTransportProblemDiscontinuous class
RemDelaporteMathurin 6a700b0
added back the derived quantities + removed unused stuff
RemDelaporteMathurin 34f82e3
correspondance dicts are initialised in species
RemDelaporteMathurin e5c6793
add subdomains arg and attribute to Species + documentation
RemDelaporteMathurin ce31d38
gather connectivity dicts
RemDelaporteMathurin 4f075be
NotImplementedError for exports for now
RemDelaporteMathurin ea3da5d
Refactor code to import HydrogenTransportProblem and HTransportProble…
RemDelaporteMathurin 76d1ac2
remove problem file + comment
RemDelaporteMathurin 1665bcf
need to define the correct ds
RemDelaporteMathurin ec5aeb5
Merge remote-tracking branch 'upstream/fenicsx' into discontinuity-ge…
RemDelaporteMathurin 5b32d26
Merge branch 'discontinuity-generic' into add_fluxes
RemDelaporteMathurin dd0f65c
particle fluxes work correctly
RemDelaporteMathurin 46b6c47
use festim k_B
RemDelaporteMathurin f7408fe
ICs not implemented
RemDelaporteMathurin 0df9338
black formatted
RemDelaporteMathurin 89fbef5
added new dict
RemDelaporteMathurin bbd3865
Merge remote-tracking branch 'upstream/fenicsx' into discontinuity-ge…
RemDelaporteMathurin d382ad4
added integration with Mesh1D
RemDelaporteMathurin 21f5a3c
Merge branch 'discontinuity-generic' into post-processing
RemDelaporteMathurin 28c1d44
added usage in implementation script
RemDelaporteMathurin eb7885c
small changes
RemDelaporteMathurin 2144141
a few changes + comment about random SEGV crash
RemDelaporteMathurin 20947cf
Merge branch 'discontinuity-generic' into post-processing
RemDelaporteMathurin 283abd4
added a map to collapsed function space and parent map
RemDelaporteMathurin b906931
store collapsed functions and function space + update in post process
RemDelaporteMathurin 256fe06
don't need to collapse here
RemDelaporteMathurin d83f0b7
integrated VTX Export
RemDelaporteMathurin 9b75dd6
integrated export in example
RemDelaporteMathurin 3f2c79c
integrated VTX export in examples
RemDelaporteMathurin ffe8212
added example for only one material (no interfaces)
RemDelaporteMathurin 2231f89
started implementing transient
RemDelaporteMathurin 2c47f52
updated times
RemDelaporteMathurin c91dd3d
added K_S to material + black
RemDelaporteMathurin 2b58f00
Implemented refactoring done by Jorgen
RemDelaporteMathurin c209600
removed unused variable
RemDelaporteMathurin 97067b6
removed unused variables
RemDelaporteMathurin ad3fd37
get_solubility_coefficient + black
RemDelaporteMathurin dfe204c
black formatted
RemDelaporteMathurin 1f714fa
removed unused import
RemDelaporteMathurin eaf13a3
dirichlet BC more generic
RemDelaporteMathurin 9c8d029
use sub functionspace instead of full functionspace for dirichletBC
RemDelaporteMathurin 10aab18
removed entity maps as attribute
RemDelaporteMathurin 26898db
Merge branch 'progress-bar-optional' into discontinuity-generic
RemDelaporteMathurin 1c83c38
adapted progress bar
RemDelaporteMathurin 959e4a9
penalty term is now exposed
RemDelaporteMathurin 8adc073
tolerance of solver is exposed
RemDelaporteMathurin 6b53b01
exposed petsc options
RemDelaporteMathurin 4005db5
Improved NewtonSolver
RemDelaporteMathurin 4f91d91
new solver
RemDelaporteMathurin aab8750
scale is now alpha + topology._cpp_object
RemDelaporteMathurin 1ca73b3
support for sources
RemDelaporteMathurin d3b0c07
added MMS test in 2D
RemDelaporteMathurin b8006ba
black
RemDelaporteMathurin e2ee473
updated dolfinx version in CI + removed dev container
RemDelaporteMathurin 45f4db7
fixed fenics script
RemDelaporteMathurin e649792
added failing test
RemDelaporteMathurin 51a6961
check for dofs functionspace
RemDelaporteMathurin 0be3749
added more tests
RemDelaporteMathurin 38057f7
removed duplicate of subdomain_1 subdomain_2
RemDelaporteMathurin 77b3f6e
docstrings + removed unused variables
RemDelaporteMathurin c92121a
more docstrings
RemDelaporteMathurin 1282892
removed mt and parent mesh from constructor of interface
RemDelaporteMathurin 01948a4
more type hinting
RemDelaporteMathurin e39946d
type check for species.subdomains
RemDelaporteMathurin 60b9b2e
fixed script
RemDelaporteMathurin 6a1456b
fixed the examples
RemDelaporteMathurin 56940d0
UPdate python version
jorgensd 2f16118
removed discontinuity-generic since we have lots of examples
RemDelaporteMathurin 67d6e4a
moved the examples to examples folder
RemDelaporteMathurin 4fbbab4
Fix docstrings
RemDelaporteMathurin ad6c4b0
Fixed docstrings again
RemDelaporteMathurin a6e1de6
domain 0 and 1 instead of 1 and 2
RemDelaporteMathurin 97a0864
Merge branch 'discontinuity-generic' of https://github.com/RemDelapor…
RemDelaporteMathurin 5df377b
- Add in/outfiles to git ignore
jorgensd f7e4916
Merge remote-tracking branch 'remi/discontinuity-generic' into dokken…
jorgensd 124fb29
removed top and bottom subscripts
RemDelaporteMathurin eab5fa5
type hinting for as_fenics_constant
RemDelaporteMathurin d46fc1a
removed unused var
RemDelaporteMathurin 8ed278c
Rewrite docs
jorgensd 8b2db98
format
RemDelaporteMathurin 4d6954e
added API
RemDelaporteMathurin e6565d8
Merge branch 'dokken/suggested-changes' of https://github.com/RemDela…
RemDelaporteMathurin ec2ceb4
fixed docstrings
RemDelaporteMathurin 586d7c1
fixed dolfinx version in benchmark
RemDelaporteMathurin 9fcd1e5
black
RemDelaporteMathurin 9ece9f4
black 2
RemDelaporteMathurin fd34d03
fixed benchmark for dolfinx 0.9
RemDelaporteMathurin 5dc7432
Refactor writers
jorgensd b278110
Black formatting / ruff
jorgensd 28c66f1
Sort imports
jorgensd 60dcb5b
Remove setup files
jorgensd 3101c40
Change linting
jorgensd 729272e
Add dependabot
jorgensd 6b174cb
Apply suggestions from code review
jorgensd ca99a72
Formatting and importing within coer
jorgensd d3883ec
Import changes
jorgensd e36a70c
Move to source layout
jorgensd 830d2ac
Merge remote-tracking branch 'remi/discontinuity-generic' into dokken…
jorgensd cef405a
Get ruff and black to agree
jorgensd 692d167
Simplify input to boundary conditions and add some error handling in …
jorgensd b67aa0b
Ruff
jorgensd edc86cf
Add tests
jorgensd 3e12a60
Make mypy non-blocking
jorgensd 35928cf
Update mesh class
jorgensd 584692b
Ruff
jorgensd 761f2c3
Merge pull request #1 from RemDelaporteMathurin/dokken/suggested-changes
RemDelaporteMathurin 682a4f3
added tolerances in the solver
RemDelaporteMathurin 99f57af
Fix switch
jorgensd e713ef5
Use 3.10 syntax
jorgensd ce344e8
fixed a few more multilines
RemDelaporteMathurin 085bd30
Last 3.10 backports of fstring
jorgensd f989dbe
One more fstring backoport
jorgensd 25a9790
Lasts tests
jorgensd 6fd66db
Simplify form compilation
jorgensd dbde7e3
Minor fixes to transfer meshtags
jorgensd f05d785
Unify formatting for integration measures with Rem(i)
jorgensd 18e4cad
Various fixes to post-processing
jorgensd 9e149e3
Fix variable name
jorgensd 7271ec9
Fix variable name
jorgensd 0ea4875
More fixes
jorgensd a4cdb82
Fix test
jorgensd f3df3b0
fixed test
RemDelaporteMathurin 403192e
format
RemDelaporteMathurin ae17698
vtxfile write in HydrogenTransportProblem
RemDelaporteMathurin 31ac03c
Merge remote-tracking branch 'upstream/fenicsx' into discontinuity-ge…
RemDelaporteMathurin d2f7787
moved convergence rates
RemDelaporteMathurin 6371bb6
comment
RemDelaporteMathurin 7d0a6d4
comment
RemDelaporteMathurin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need to keep this