Checkpointing#952
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fenicsx #952 +/- ##
===========================================
- Coverage 96.14% 96.08% -0.07%
===========================================
Files 46 46
Lines 2567 2604 +37
===========================================
+ Hits 2468 2502 +34
- Misses 99 102 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@jhdark just updated the branch to pass with nightly, ready for review |
jhdark
left a comment
There was a problem hiding this comment.
Looks like a great start, could do with some more docs.
But also is it worth making a base class InitialValueFromFile, then adding another class for reading a temperature field from a file? Doesn't look like it would be too difficult to add, but would obviously increase the size of the PR.
Plus, we could consider either some checks to make sure the mesh in the file is the same as the one defined in the problem, or could maybe add some functionality to interpolate between meshes?
jhdark
left a comment
There was a problem hiding this comment.
InitialCondition should support a fem.Function as value and then we can just bundle this in a one-liner. comm could also be an argument for full flexibility
import festim as F
def read_function_from_file(filename, name, timestamp, family="P", order=1):
import dolfinx.fem as fem
import mpi4py.MPI as MPI
import adios4dolfinx
mesh_in = adios4dolfinx.read_mesh(filename, MPI.COMM_WORLD)
V_in = fem.functionspace(mesh_in, (family, order))
u_in = fem.Function(V_in)
adios4dolfinx.read_function(
filename=filename,
u=u_in,
name=name,
time=timestamp,
)
return u_in
my_model = F.HydrogenTransportProblem()
H = F.Species("H")
my_model.species = [H]
my_model.initial_conditions = [
F.InitialCondition(
value=read_function_from_file("filename.bp", "name in file", 100), species=H
)
]
RemDelaporteMathurin
left a comment
There was a problem hiding this comment.
@jhdark I modified the PR according to our discussion and added some more documentation
Co-authored-by: James Dark <65899899+jhdark@users.noreply.github.com>
Proposed changes
Contributes to #946 for the mono-material case. Checkpointing (ie. reading a function from a file) is implemented by leveraging
adios4dolfinx(thanks @jorgensd for this!).As it doesn't support submeshes for now, this only works for the non-mixed domain approach in the
HydrogenTransportProblemclassUsage:
Types of changes
What types of changes does your code introduce to FESTIM?
Checklist