Skip to content
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

Multispecies support #617

Merged
merged 82 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
08a50e4
Merge pull request #13 from jhdark/fenicsx
jhdark Oct 20, 2023
31f24e3
find based on boundary not geometry
jhdark Oct 20, 2023
08d6a58
accept dict
jhdark Oct 20, 2023
08d26e9
attriute sub_function_space
jhdark Oct 20, 2023
093c4e0
Merge branch 'multispecies_support' of https://github.com/jhdark/FEST…
jhdark Oct 20, 2023
a83bd48
find species from name
jhdark Oct 20, 2023
fa3ae11
updated for multispecies
jhdark Oct 20, 2023
f64076d
accept dict
jhdark Oct 20, 2023
9bf4373
updated tests for multispecies
jhdark Oct 20, 2023
441aeea
added tests
jhdark Oct 20, 2023
8480c60
remove commented snip, post_processing solution
jhdark Oct 20, 2023
b0e8875
post_processing solution
jhdark Oct 20, 2023
8ee41f6
uncomment test
jhdark Oct 20, 2023
b4bef5f
refactoring
jhdark Oct 20, 2023
42f6cb5
more tests and doc strings
jhdark Oct 20, 2023
449abf4
typo
jhdark Oct 20, 2023
00befdd
test new helper
jhdark Oct 20, 2023
69b2ecc
test materials more throughly
jhdark Oct 21, 2023
03aaa1f
use solution, pass species list
jhdark Oct 21, 2023
6c63813
better material processing
jhdark Oct 21, 2023
1cf208b
pass species list
jhdark Oct 21, 2023
8f894eb
more tests for material to increase coverage
jhdark Oct 21, 2023
c7eb997
line not needed
jhdark Oct 21, 2023
5d74580
comment for now
jhdark Oct 21, 2023
07d35ef
export post_processing_solution
jhdark Oct 23, 2023
e32d49a
updated doc strings
jhdark Oct 23, 2023
a2a4d87
updated tests with new export method
jhdark Oct 23, 2023
5254a20
export multispecies cases
jhdark Oct 23, 2023
6ee60b7
vtx export field as string
jhdark Oct 23, 2023
6e32e79
xdmf accept field as str
jhdark Oct 23, 2023
9a4475c
field always list, refactoring
jhdark Oct 23, 2023
42386b5
refactoring
jhdark Oct 23, 2023
ad0af6b
tempdr
jhdark Oct 23, 2023
89de52f
added doc strings
jhdark Oct 23, 2023
e3e5feb
updated comment
jhdark Oct 23, 2023
f0cd736
updated doc strings
jhdark Oct 23, 2023
2c12d44
get_diffusion_coeff doesn't require list of species
RemDelaporteMathurin Oct 23, 2023
8787e8e
only use list if multispecies
jhdark Oct 23, 2023
00c63f8
simpler naming
jhdark Oct 23, 2023
3c2cba8
typo
jhdark Oct 23, 2023
68212f3
update test doc string
jhdark Oct 23, 2023
4fdcf70
update doc strings
jhdark Oct 23, 2023
337a358
removed unused variable
RemDelaporteMathurin Oct 23, 2023
fdb5361
Merge pull request #14 from RemDelaporteMathurin/no-model-species
jhdark Oct 24, 2023
d91dd75
updated tests to improve coverage
jhdark Oct 24, 2023
a6bef0c
accept callable functions in multispecies
jhdark Oct 25, 2023
4c67bd9
test not needed
jhdark Oct 25, 2023
7ca6763
test not needed
jhdark Oct 25, 2023
619a0fb
updated doc strings
jhdark Oct 25, 2023
0652bf1
dont export results locally
jhdark Oct 25, 2023
68fc9dd
dont use tmppath in benchmark case
jhdark Oct 25, 2023
487ea24
update define_function_space doc strings
jhdark Oct 25, 2023
eab5181
facet indices not dofs
jhdark Oct 25, 2023
5eb7ebf
species list needs to be more than 0
jhdark Oct 25, 2023
33fc5b6
more readable for multispecies
jhdark Oct 25, 2023
5fe2b0d
typo
jhdark Oct 25, 2023
39d5001
not needed
jhdark Oct 25, 2023
2515c8d
split methods
RemDelaporteMathurin Oct 25, 2023
80c7ec6
refactoring
RemDelaporteMathurin Oct 25, 2023
03b5b73
callable
RemDelaporteMathurin Oct 25, 2023
5687d5b
separated things a bit
RemDelaporteMathurin Oct 25, 2023
2a81986
removed DirichletBC.create_form method
RemDelaporteMathurin Oct 25, 2023
d31c5a0
correct type for t
RemDelaporteMathurin Oct 25, 2023
69edb78
added a test that catches the previous bug
RemDelaporteMathurin Oct 25, 2023
9316037
correct condition for test
RemDelaporteMathurin Oct 25, 2023
f4d017f
documentation
RemDelaporteMathurin Oct 25, 2023
6de35aa
Merge pull request #15 from RemDelaporteMathurin/refactoring_bc_multi…
jhdark Oct 25, 2023
d254c87
refactoring for clarity
jhdark Oct 25, 2023
a5b4448
post processing same as festim test
jhdark Oct 25, 2023
2ca1b1b
comments and doc strings in permeation tests
jhdark Oct 25, 2023
0391101
species arguement null in single species case
jhdark Oct 25, 2023
d182007
updates species doc strings
jhdark Oct 25, 2023
8277fec
multispecies property
jhdark Oct 25, 2023
9eb5d65
test dirichlet bc with multispecies
jhdark Oct 25, 2023
7ba4d01
typo
jhdark Oct 25, 2023
335ce16
updated doc strings
jhdark Oct 25, 2023
87e7ab7
add doc string to dirichletbc tests
jhdark Oct 25, 2023
ccec321
refactoring
jhdark Oct 25, 2023
59be9e7
refactoring
jhdark Oct 25, 2023
2dd86f8
remove comment
jhdark Oct 25, 2023
d5c4fef
updates based on comments
jhdark Oct 25, 2023
3376833
Merge branch 'multispecies_support' of https://github.com/jhdark/FEST…
jhdark Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion festim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from .settings import Settings

from .species import Species, Trap, ImplicitSpecies
from .species import Species, Trap, ImplicitSpecies, find_species_from_name

from .subdomain.surface_subdomain import SurfaceSubdomain1D
from .subdomain.volume_subdomain import VolumeSubdomain1D
Expand Down
22 changes: 2 additions & 20 deletions festim/boundary_conditions/dirichlet_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def define_surface_subdomain_dofs(self, facet_meshtags, mesh, function_space):
"""
bc_facets = facet_meshtags.find(self.subdomain.id)
bc_dofs = fem.locate_dofs_topological(function_space, mesh.fdim, bc_facets)

return bc_dofs

def create_value(
Expand Down Expand Up @@ -98,7 +99,7 @@ def create_value(
if "t" in arguments and "x" not in arguments and "T" not in arguments:
# only t is an argument
self.value_fenics = F.as_fenics_constant(
mesh=mesh, value=self.value(t=t.value)
mesh=mesh, value=self.value(t=float(t))
)
else:
self.value_fenics = fem.Function(function_space)
Expand All @@ -118,25 +119,6 @@ def create_value(
)
self.value_fenics.interpolate(self.bc_expr)

def create_formulation(self, dofs, function_space):
"""Applies the boundary condition
Args:
dofs (numpy.ndarray): the degrees of freedom of surface facets
function_space (dolfinx.fem.FunctionSpace): the function space
"""
if isinstance(self.value_fenics, fem.Function):
form = fem.dirichletbc(
value=self.value_fenics,
dofs=dofs,
)
else:
form = fem.dirichletbc(
value=self.value_fenics,
dofs=dofs,
V=function_space,
)
return form

def update(self, t):
"""Updates the boundary condition value

Expand Down
13 changes: 8 additions & 5 deletions festim/exports/vtx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ def field(self):
@field.setter
def field(self, value):
# check that field is festim.Species or list of festim.Species
if not isinstance(value, F.Species) and not isinstance(value, list):
if not isinstance(value, (F.Species, str)) and not isinstance(value, list):
raise TypeError(
"field must be of type festim.Species or list of festim.Species"
"field must be of type festim.Species or str or a list of festim.Species or str"
)
# check that all elements of list are festim.Species
if isinstance(value, list):
for element in value:
if not isinstance(element, F.Species):
if not isinstance(element, (F.Species, str)):
raise TypeError(
"field must be of type festim.Species or list of festim.Species"
"field must be of type festim.Species or str or a list of festim.Species or str"
)
# if field is festim.Species, convert to list
if not isinstance(value, list):
Expand All @@ -72,7 +72,10 @@ def define_writer(self, comm: mpi4py.MPI.Intracomm) -> None:
comm (mpi4py.MPI.Intracomm): the MPI communicator
"""
self.writer = VTXWriter(
comm, self.filename, [field.solution for field in self.field], "BP4"
comm,
self.filename,
[field.post_processing_solution for field in self.field],
"BP4",
)

def write(self, t: float):
Expand Down
10 changes: 5 additions & 5 deletions festim/exports/xdmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ def field(self):
@field.setter
def field(self, value):
# check that field is festim.Species or list of festim.Species
if not isinstance(value, F.Species) and not isinstance(value, list):
if not isinstance(value, (F.Species, str)) and not isinstance(value, list):
raise TypeError(
"field must be of type festim.Species or list of festim.Species"
"field must be of type festim.Species or str or a list of festim.Species or str"
)
# check that all elements of list are festim.Species
if isinstance(value, list):
for element in value:
if not isinstance(element, F.Species):
if not isinstance(element, (F.Species, str)):
raise TypeError(
"field must be of type festim.Species or list of festim.Species"
"field must be of type festim.Species or str or a list of festim.Species or str"
)
# if field is festim.Species, convert to list
if not isinstance(value, list):
Expand All @@ -71,4 +71,4 @@ def write(self, t: float):
t (float): the time of export
"""
for field in self.field:
self.writer.write_function(field.solution, t)
self.writer.write_function(field.post_processing_solution, t)
Loading
Loading