-
Notifications
You must be signed in to change notification settings - Fork 2
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
Time-dependent with multiple timesteps #20
base: main
Are you sure you want to change the base?
Conversation
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.
This looks great @acse-xt221, keep up the good work! I left some comments that will hopefully be useful.
examples/burgers_n2n/config.py
Outdated
@@ -0,0 +1,38 @@ | |||
from models.burgers_n2n import * |
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.
If this file is identical to examples/burgers/config.py
, perhaps you could avoid duplicating all these lines by just having the single line from examples.burgers.config import *
?
examples/burgers_one2n/config.py
Outdated
@@ -0,0 +1,38 @@ | |||
from models.burgers_one2n import * |
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.
Same again here.
examples/burgers_n2n/network.py
Outdated
@@ -0,0 +1,43 @@ | |||
from nn_adapt.layout import NetLayoutBase |
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.
Similarly, you could plausibly import from examples/burgers/network.py
, unless you plan to change the network architecture.
examples/burgers_one2n/network.py
Outdated
@@ -0,0 +1,43 @@ | |||
from nn_adapt.layout import NetLayoutBase |
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.
And again.
examples/makefile
Outdated
MODEL = steady_turbine | ||
NUM_TRAINING_CASES = 100 | ||
MODEL = burgers | ||
NUM_TRAINING_CASES = 1 |
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.
This is okay to start off with. However, further down the line I think it would be a good idea to use a larger number of cases.
nn_adapt/solving_one2n.py
Outdated
q_plus = solver_obj_plus.solution | ||
# J = config.get_qoi(refined_mesh[-1])(q_plus[-1]) |
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.
I don't think you need these lines.
nn_adapt/solving_one2n.py
Outdated
V_plus = adj_sol_plus[step].function_space() | ||
fwd_sol_plg = Function(V_plus) | ||
tm.prolong(out["forward"][step], fwd_sol_plg) | ||
adj_sol_plg = Function(V_plus) | ||
tm.prolong(out["adjoint"][step], adj_sol_plg) |
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.
Yes, this looks right.
nn_adapt/solving_one2n.py
Outdated
|
||
# Evaluate errors | ||
dwr += dwr_indicator(config, mesh, fwd_sol_plg, adj_error) | ||
dwr_list.append(dwr_indicator(config, mesh, fwd_sol_plg, adj_error)) |
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.
Nice. So these can be used as the "target" data for each timestep.
nn_adapt/solving_one2n.py
Outdated
return out if retall else out["dwr"] | ||
|
||
|
||
def dwr_indicator(config, mesh, q, q_star): |
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.
Again, if this is unmodified then you can just import it from solving.py
, to avoid duplication.
examples/models/burgers_one2n.py
Outdated
self._solver.solve() | ||
|
||
|
||
class Solver_one2n(nn_adapt.solving.Solver): |
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.
If this is largely the same as the Solver
class in examples.models.burgers
then you could just define this to be a subclass of it. That way, you only need to write out the methods that are different and don't need to repeat the others.
This PR mainly exists to provide feedback,