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

Time dependency and multiple functions per file #49

Merged
merged 14 commits into from
Feb 7, 2024

Conversation

jorgensd
Copy link
Owner

@jorgensd jorgensd commented Feb 2, 2024

Add support for time dependent and multi-function files.

Backward compatibility added by introducing a legacy flag in write_function.

Resolves #47

@jorgensd jorgensd changed the title Start adding functionality for time dependency. Time dependency and multiple functions per file Feb 5, 2024
@jorgensd jorgensd marked this pull request as ready for review February 5, 2024 13:25
@jorgensd
Copy link
Owner Author

jorgensd commented Feb 5, 2024

@francesco-ballarin do you mind reviewing and testing this PR with any of your existing checkpoints (turning legacy=True when using read_function)?

@francesco-ballarin
Copy link
Contributor

@jorgensd Thanks, I'll give it a try tomorrow (Wed) morning!

@@ -37,6 +37,18 @@ For scalability, the code uses [MPI Neighbourhood collectives](https://www.mpi-f
- Reading and writing meshtags associated to meshes `adios4dolfinx.read/write_meshtags`
- Reading checkpoints for any element (serial and parallel, one checkpoint per file). Use `adios4dolfinx.read/write_function`.

> [!IMPORTANT]
> For a checkpoint to be valid, you first have to store the mesh with `write_mesh`, then use `write_function` to append to the checkpoint file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had missed that, I'll fix my I/O. I guess my RBniCSx test didn't see that because I am using builtin meshes, so even if I was not reading them in I was assured (except for changes in upstream dolfinx) that the mesh was the same anyways?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, what will happen if the user tries to call read_function passing as argument a dolfinx.fem.Function defined on a mesh that is not the one obtained with read_mesh on the same file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To give you more context, in my use cases I would have the user read the mesh from a mesh checkpoint file, and then read time dependent solutions corresponding to (say) 100 different solves of a time dependent problem on 150 time steps. The 100 different solves are obtained e.g. for different coefficients in the PDE.

Each of the 100 problems, and each of the 150 time instances of the same problem, share the same mesh. The time history associated to solutions of problem 1 will be stored in checkpoint file 1 with the new time dependency feature. However, solutions of problem 2 will be stored in checkpoint file 2, and not appended at the end of checkpoint file 1, because they don't belong together (time would jump back to zero at the beginning of problem 2).

Do I need to have 100 copies of the mesh (i.e., one for every checkpoint file)? This IMPORTANT block seems to say so, but since we started this discussion I'd rather double check.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new features, you could store all the checkpoints in the same file, as they have their own time dependency array.

I cannot support reading the mesh from another file, as the ordering of cells might differ if they are in another input file (and also the very crucial cell permutations for vector-spaces).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jorgensd jorgensd merged commit 61a93bf into main Feb 7, 2024
1 check passed
@jorgensd jorgensd deleted the dokken/time-dependency branch February 7, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add writing more than one function to file
2 participants