-
Notifications
You must be signed in to change notification settings - Fork 0
Update build scripts #72
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
Open
acse-ej321
wants to merge
7
commits into
main
Choose a base branch
from
70_update_build_scripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
274699d
Merge fork into branch (#71)
acse-ej321 c4c8cf2
move partitioning to function and minor edits
acse-ej321 33c85db
#70 clean comments
acse-ej321 a899c3d
moved common build script to helper
acse-ej321 e4bd8e1
#70 add flow control for feature parameters
acse-ej321 6da913b
#70 add build from monitor only
acse-ej321 04808da
#70 remove extra files
acse-ej321 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 hidden or 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 |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
import movement as mv | ||
import numpy as np # noqa | ||
|
||
from firedrake.__future__ import interpolate # ej321 add | ||
|
||
__all__ = ["BurgersSolver"] | ||
|
||
|
||
|
@@ -203,6 +205,9 @@ def solve_problem(self, callback=None): | |
monitor_function=self.monitor_function, | ||
rtol=1e-3, | ||
) | ||
# ej321 - added monitor_function for feature extraction | ||
raw_monitor_val = self.monitor_function(self.mesh) # ej321 - is this the correct mesh to use? | ||
|
||
adapter.move() | ||
end = time.perf_counter() | ||
dur_ms = (end - start) * 1000 | ||
|
@@ -216,6 +221,10 @@ def solve_problem(self, callback=None): | |
function_space = fd.FunctionSpace(self.mesh, "CG", 1) | ||
uh_0 = fd.Function(function_space) | ||
uh_0.project(self.u[0]) | ||
|
||
# ej321 - added monitor_function for feature extraction | ||
monitor_val = fd.Function(function_space) | ||
monitor_val.assign(raw_monitor_val) | ||
|
||
# calculate solution on adapted mesh | ||
self.mesh.coordinates.dat.data[:] = self.adapt_coord | ||
|
@@ -240,27 +249,42 @@ def solve_problem(self, callback=None): | |
|
||
func_vec_space = fd.VectorFunctionSpace(self.mesh, "CG", 1) | ||
uh_grad = fd.interpolate(fd.grad(uh_0), func_vec_space) | ||
|
||
# ej321 - grad_norm copied from build_helmholtz_square.py | ||
grad_uh_interpolate = fd.assemble(interpolate(fd.grad(self.u[0]),func_vec_space)) | ||
grad_norm = fd.Function(function_space) | ||
grad_norm.project(grad_uh_interpolate[0] ** 2 + grad_uh_interpolate[1] ** 2) | ||
grad_norm /= grad_norm.vector().max() | ||
|
||
hessian_norm = self.f_norm | ||
hessian = self.l2_projection | ||
phi = adapter.phi | ||
phi_grad = adapter.grad_phi | ||
jwallwork23 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
sigma = adapter.sigma | ||
# sigma = adapter.sigma | ||
sigma = adapter.H # ej321 - this may be the updated hessian? | ||
I = fd.Identity(2) # noqa | ||
jacobian = I + sigma | ||
jacobian_det = fd.Function(function_space, name="jacobian_det") | ||
jacobian_det.project( | ||
# jacobian_det = fd.Function(function_space, name="jacobian_det") | ||
# jacobian_det = fd.Function(adapter.P1, name="jacobian_det") | ||
self.jacob_det = fd.Function(adapter.P1, name="jacobian_det").project( | ||
jacobian[0, 0] * jacobian[1, 1] - jacobian[0, 1] * jacobian[1, 0] | ||
) | ||
self.jacob_det = fd.project( | ||
jacobian_det, fd.FunctionSpace(self.mesh, "CG", 1) | ||
) | ||
self.jacob = fd.project( | ||
jacobian, fd.TensorFunctionSpace(self.mesh, "CG", 1) | ||
) | ||
# self.jacob_det = jacobian_det | ||
# self.jacob_det = fd.project( | ||
# jacobian_det, fd.FunctionSpace(self.mesh, "CG", 1) | ||
# ) # ej321 - not needed? | ||
# self.jacob = jacobian # ej321 - this is copied from mesh_generator.py | ||
|
||
self.jacob = fd.Function(adapter.P1_ten, name="jacobian").project(jacobian) | ||
# self.jacob.project(jacobian) | ||
# self.jacob = fd.project( | ||
# jacobian, fd.TensorFunctionSpace(self.mesh, "CG", 1) | ||
# ) # ej321 - not needed? | ||
|
||
|
||
callback( | ||
uh=uh_0, | ||
uh_grad=uh_grad, | ||
grad_norm = grad_norm, # ej321 - added grad_norm | ||
hessian_norm=hessian_norm, | ||
hessian=hessian, | ||
phi=phi, | ||
|
@@ -280,6 +304,7 @@ def solve_problem(self, callback=None): | |
dur=dur_ms, | ||
t=t, | ||
idx=self.idx, | ||
monitor_val=monitor_val, # ej321 - added monitor_val | ||
) | ||
|
||
# step forward in time | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.