Conversation
joewallwork
left a comment
There was a problem hiding this comment.
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.
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 * | |||
| @@ -0,0 +1,43 @@ | |||
| from nn_adapt.layout import NetLayoutBase | |||
There was a problem hiding this comment.
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 | |||
examples/makefile
Outdated
| MODEL = steady_turbine | ||
| NUM_TRAINING_CASES = 100 | ||
| MODEL = burgers | ||
| NUM_TRAINING_CASES = 1 |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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,