For testing purposes it would be good to have a simple interface that allows us to apply the right-hand side of a balance law to a state vector once.
Example: checking that the divergence damping operator works correctly should go like this:
1) Set up balance law that just involves divergence damping
balance_law = DivergenceDampingLaw()
2) Set up a state vector
Q_0 = cool_state()
3) Check if balance law's RHS (just divergence damping in this case) has correct results when applied to state vector in 2)
Q_1 = rhs(balance_law, Q_0)
norm(Q_1, Q_2) = value we expect
This should be easy and readable in a test and arises in a number of situations (any differential operator for example).
This pretty much possible right now with something like
balance_law = DivergenceDampingLaw()
model = DGModel(
balance_law,
grid,
numerical_flux_first_order,
numerical_flux_second_order,
numerical_flux_gradient
)
Q_0 = cool_state()
Q_1 = similar(Q_0)
model(Q_1, Q_0, nothing, 0)
Perfect! Thanks @jkozdon !
This pretty much possible right now with something like
balance_law = DivergenceDampingLaw() model = DGModel( balance_law, grid, numerical_flux_first_order, numerical_flux_second_order, numerical_flux_gradient ) Q_0 = cool_state() Q_1 = similar(Q_0) model(Q_1, Q_0, Q_0, nothing, 0)
@jkozdon 'model(Q_1, Q_0, Q_0, nothing, 0)' gives the following error msg
Any(::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any) at /home/jiahe/CliMA/ClimateMachine.jl/src/Numerics/DGMethods/DGModel.jl:109
Any(::Any, ::Any, ::Any, ::Any; increment) at /home/jiahe/CliMA/ClimateMachine.jl/src/Numerics/DGMethods/DGModel.jl:104
Should it be model(Q_1, Q_0, nothing, 0)?
@jkozdon 'model(Q_1, Q_0, Q_0, nothing, 0)' gives the following error msg
@jiahe23 you are correct. Comment is fixed now.
I never actually ran the code, just sketch what I thought would work. Let me know if you find anything else that needs correcting.
Most helpful comment
This pretty much possible right now with something like