clawpack / amrclaw

AMR version of Clawpack
http://www.clawpack.org
BSD 3-Clause "New" or "Revised" License
26 stars 45 forks source link

Adding adjoint flagging method #228

Closed BrisaDavis closed 5 years ago

BrisaDavis commented 6 years ago

Adding various files, examples, and tests for the adjoint flagging method.

This depends on Riemann solvers found in https://github.com/clawpack/riemann/pull/140

rjleveque commented 6 years ago

@BrisaDavis: This also fails for me in tests/acoustics_2d_forwardprob.

I think you need to set

        adjointdir = currentdir + '/adjoint'

in regression_tests.py. Then it runs but doesn't find the adjoint files. I think you also need to set

adjoint_output = os.path.abspath('adjoint/_output')

in setrun.py.

rjleveque commented 6 years ago

Now the Python 2 version passes but Python 3 fails. I ran into exactly the same problem with Python 3.6.2 on my laptop, but with 3.6.5 it passed. I'll try to sort it out.

BrisaDavis commented 6 years ago

@rjleveque That was the problem, thank you!

rjleveque commented 6 years ago

Tests pass! I'll try to review the code in the next few days...

rjleveque commented 5 years ago

We might want to add adjoint.data as a file that is always created by data.py in this repository, rather than created specially in setrun.py. This would allow us to check for errors in a consistent way, and avoid the warning currently printed,

 Adjoint.data file does not exist.
 If you are using the adjoint method, this is an error.

which may be confusing to users. In particular, this is correct only when running the forward problem after creating an adjoint solution. When running the code for the adjoint problem there is no adjoint.data file and this message is printed, which is particularly confusing.

See also the discussion in https://github.com/clawpack/geoclaw/pull/326.

mandli commented 5 years ago

Sounds like a good approach to me. I was looking at the setrun.py files though and did not see where this data is done.

rjleveque commented 5 years ago

travis tests now pas after merging clawpack/clawutil#132, which adds an AdjointData class needed in setrun.py, and updating clawpack/clawpack.

See other comments at https://github.com/BrisaDavis/amrclaw/pull/9

This may be ready to merge!

rjleveque commented 5 years ago

I'm going to merge this and then update clawpack/clawpack to see if travis then works on clawpack/geoclaw#326.

Some documentation started in clawpack/doc#206.