Skip to content
Discussion options

You must be logged in to vote

Dear Daniela,

yes, both aspects should be possible!

a) I just updated the package (so please use the latest version from GitHub for now), so you can initialize a field from a piecewise expression. The syntax is determined by sympy:

grid = CartesianGrid([[0, 4]], 32)
field = ScalarField.from_expression(grid, "Piecewise((x**2, x>2), (1+x, x<=2))")

The field will now be linear in x for x<2 and quadratic in x for larger values.

b) Coefficients that depend on field values are certainly possible. You can simply use mathematical expressions in the definitions of general PDEs using the PDE class. If you need more flexibility, you might need to implement your own model class by subclassing PDEBase.…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@DanielaScarpelli
Comment options

Answer selected by DanielaScarpelli
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@DanielaScarpelli
Comment options

@david-zwicker
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants