-
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
Warn when Temperature
is mixed with BCs, sources, etc.
#787
Comments
I'll start working on this issue, should not take too long if I understand well the code |
Sounds good! I assigned you to it. |
@JonathanGSDUFOUR I think there has been a confusion in what exactly we need to fix. Here's an example: import festim as F
import numpy as np
my_model = F.Simulation()
# Here, we define boundary conditions for heat transfer
# and at the same time we prescribe a temperature field which overwrites everything!
my_model.T = F.Temperature(873)
my_model.boundary_conditions = [
F.DirichletBC(field="T", value=1200, surfaces=1),
F.DirichletBC(field="T", value=373, surfaces=2),
]
my_model.materials = F.Material(1, 1, 0)
my_model.mesh = F.MeshFromVertices(np.linspace(0, 1))
my_model.settings = F.Settings(
absolute_tolerance=1e-10, relative_tolerance=1e-10, transient=False
)
my_model.initialise()
my_model.run() In this model, we set the temperature to 873 K but also set boundary conditions. This should not be possible as it is not compatible. However in the current state of FESTIM, the code above runs without any issue. It should return an error saying: Does that make sense? |
Okay I understand where is the issue ! |
I think you can close the PR you opened and open a new PR. I advise you to start by writing a test. Basically the test would be running the code I sent above and checking that an error is raised. Then once you check that this test catches the bug you can implement a fix |
Currently users can setup temperature boundary conditions, sources, etc while setting up a
F.Temperature()
object.When this happens, the BCs and sources are ignored.
It would be nice to either raise an error or at least a warning that
F.Temperature()
andF.DirichletBC(field="T", ....)
should not be used together.The text was updated successfully, but these errors were encountered: