Skip to content

HydrogenTransportProblem class, Mesh and 1Dmesh class#584

Merged
RemDelaporteMathurin merged 13 commits into
festim-dev:fenicsxfrom
jhdark:fenicsx
Oct 6, 2023
Merged

HydrogenTransportProblem class, Mesh and 1Dmesh class#584
RemDelaporteMathurin merged 13 commits into
festim-dev:fenicsxfrom
jhdark:fenicsx

Conversation

@jhdark
Copy link
Copy Markdown
Collaborator

@jhdark jhdark commented Oct 5, 2023

Proposed changes

Proposing a new alternative to general simulation having a HydrogenTransportProblem class. Started work on meshing options having support for a 1D mesh. From this the function spaces and subdomains are defined. To ensure it works one can run the following mwe script:

import festim as F
import numpy as np
from dolfinx.io import XDMFFile
from dolfinx import fem
from mpi4py import MPI

my_model = F.HydrogenTransportProblem()

my_mesh = F.Mesh1D(vertices=np.linspace(0, 1, num=100))

my_model.geometry = F.Geometry(mesh=my_mesh)

my_model.initialise()

u = fem.Function(my_model.geometry.function_space)
u.interpolate(lambda x: 1 + x[0] ** 2)

test_xdmf = XDMFFile(MPI.COMM_WORLD, "test_output.xdmf", "w")
test_xdmf.write_mesh(my_model.geometry.mesh.mesh)
test_xdmf.write_function(u)
test_xdmf.close()

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@jhdark jhdark added the enhancement New feature or request label Oct 5, 2023
Copy link
Copy Markdown
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

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

First round of comment, I think we have to rethink what is an attribute of what.
The main comment is that ds and dx are not unique to the Geometry but unique to the model you are running. This is because the function space is unique to the model, not the geometry.

Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/geometry/mesh_1d.py Outdated
Comment thread festim/geometry/mesh_1d.py Outdated
Comment thread festim/geometry/mesh_1d.py
Comment thread festim/geometry/mesh_1d.py Outdated
Comment thread festim/hydrogen_transport_problem.py Outdated
Comment thread festim/geometry/geometry.py Outdated
Comment thread festim/hydrogen_transport_problem.py Outdated
Comment thread festim/hydrogen_transport_problem.py Outdated
Comment thread festim/hydrogen_transport_problem.py Outdated
Copy link
Copy Markdown
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin left a comment

Choose a reason for hiding this comment

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

Looks good to me, maybe the tags don't need to be stored as an attribute of HTransportProblem

Comment thread festim/hydrogen_transport_problem.py
Comment thread festim/mesh/mesh.py Outdated
@RemDelaporteMathurin RemDelaporteMathurin merged commit 289a453 into festim-dev:fenicsx Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants