Climatemachine.jl: Simple interface to apply RHS of a balance law to state

Created on 20 Aug 2020  路  4Comments  路  Source: CliMA/ClimateMachine.jl

Description

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).

For CLIMA Developers

  • [ ] This feature can be added (if it cannot be, explain why in a comment below -- lack of technical expertise, not relevant to the scope of this project, too ambitious)
  • [ ] There is a timeline for when this feature can be implemented
  • [ ] The feature has been (or will be) implemented (Please link the PR)
enhancement

Most helpful comment

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)

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glwagner picture glwagner  路  12Comments

bischtob picture bischtob  路  13Comments

kpamnany picture kpamnany  路  7Comments

simonbyrne picture simonbyrne  路  5Comments

kpamnany picture kpamnany  路  10Comments