Hacks to core and point_mode to enable unit tests#151
Hacks to core and point_mode to enable unit tests#151djmallum wants to merge 2 commits intoChrismarsh:developfrom
Conversation
|
Instead of hand crafting a mesh, would it be helpful to have CHM just create a single triangle at the point output lat/lon? Point mode config could then take an additional dict of "face" parameters. |
|
I've added some example config files to this PR. Files here: https://github.com/djmallum/CHMnew/tree/hacks/unit-testing/test_data/unit-test-example-data
I think hand writing the .param file is OK since it is hardly more complex than writing a list of parameters in the config (json) file. The part that is not needed is the .mesh file, which could be what you meant by this. Looking at my .mesh file, none of the information there actually matters for the tests I did. Do you think there are advantages to giving a lat/lon value to CHM? |
if any of the solar radiation calculation code is used it's critical What I was thinking was that the |
How is the lat/lon accessed in the solar radiation code? It is dissimilar to a normal .mesh parameter? I suspect it is since is appears in a unique location. I tried to find an example but couldn't find one. IMO, if you want to use the full functionality, you shouldn't be running CHM like this in the first place. It should really only be for running single or small (otherwise unfunctional) groups of modules. Modules that don't NEED CHM to function but cannot run without running CHM (because they are contained to a module). |
json, mesh and param file added that was used for unit testing with point_mode
4c3d80b to
4c3f8da
Compare
|
It's used for computing the solar parameters Line 203 in f9b6557 |
|
I think the goal of removing the requirement for a .mesh file is a good one. And generally, its up to the user to make sure they provide the right parameters. Lat-lon might be the only special case in that its parameter is not (a) in .param or (b) in the config section for module specific, domain wide parameters. So if the documentation for this simply emphasized the lat-lot special case I think its ok. |
Purpose
The purpose of this PR is to start a discussion on point_mode runs in CHM without requiring a mesh. A future version of CHM could have an option to have something like this but not hacky.
Details
The following are changes I made to core.cpp and point_mode to allow the running of a single module within CHM but essentially separetely from it. Manually written mesher file allows fine grained parameter control without needed to deal with built in CHM mesh components.
Currently, to run point_mode one is required to specificy a point in space. In order words, one needs to have a full prepared CHM mesh. These changes allowed for a manually written mesher file and not having to worry about the "mesh" being at a valid grid point.
Takes the first face, and in a 0D (or 1D in the case of vertical processes) face(0) is the only triangle defined in the mesher file.
In point_mode, use of a user defined flag
unit_test_new_modulesallows for user defined, run specific depends and provides in the constructor and fetching from met files in the run function.Note
This point_mode version is made to run modules that don't yet exist in CHM but are in this PR draft.
I intend to include manual mesher file and config file to this PR in the future for clarity.