-
Notifications
You must be signed in to change notification settings - Fork 231
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
compiler: Patch symbolic coefficients over cross derivatives #2248
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
36cf0be
api: Patch imperfect cross derivs w symbolic coeffs
FabioLuporini 7fee995
compiler: Ensure Weights values are of type sympy
FabioLuporini 213a51b
compiler: Hack support for custom coeffs over non-trivial derivs
FabioLuporini 4f43bc9
tests: Added additional tests for substitution and unexpansion of cus…
EdCaunt a30b392
tests: Combined similar unexpansion tests
EdCaunt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ def test_backward_dt2(self): | |
assert_structure(op, ['t,x,y'], 't,x,y') | ||
|
||
|
||
class TestSymbolicCoefficients(object): | ||
class TestSymbolicCoeffs(object): | ||
|
||
def test_fallback_to_default(self): | ||
grid = Grid(shape=(8, 8, 8)) | ||
|
@@ -40,12 +40,22 @@ def test_fallback_to_default(self): | |
|
||
def test_numeric_coeffs(self): | ||
grid = Grid(shape=(11,), extent=(10.,)) | ||
|
||
u = Function(name='u', grid=grid, coefficients='symbolic', space_order=2) | ||
v = Function(name='v', grid=grid, coefficients='symbolic', space_order=2) | ||
|
||
coeffs = Substitutions(Coefficient(2, u, grid.dimensions[0], np.zeros(3))) | ||
|
||
op = Operator(Eq(u, u.dx2, coefficients=coeffs), opt=({'expand': False},)) | ||
op.cfunction | ||
opt = ('advanced', {'expand': False}) | ||
|
||
# Pure derivative | ||
Operator(Eq(u, u.dx2, coefficients=coeffs), opt=opt).cfunction | ||
|
||
# Mixed derivative | ||
Operator(Eq(u, u.dx.dx, coefficients=coeffs), opt=opt).cfunction | ||
|
||
# Non-perfect mixed derivative | ||
Operator(Eq(u, (u.dx + v.dx).dx, coefficients=coeffs), opt=opt).cfunction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to sanity check these outputs. Print them and you will see that no errors are raised currently, but the resultant stencils are incorrect |
||
|
||
|
||
class Test1Pass(object): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we should also test the case where different coefficients are passed for x and y derivatives with cross-derivatives, mixed derivatives, and non-perfect mixed derivatives. Also the case where only one of the x or y derivatives gets coefficients specified but bother are defined as symbolic.