NCAR / ccpp-framework

Common Community Physics Package (CCPP)
http://www.dtcenter.org/community-code/common-community-physics-package-ccpp/
Other
26 stars 64 forks source link

capgen host model DDT problem #589

Open gold2718 opened 2 months ago

gold2718 commented 2 months ago

Description

The host CCPP metadata table type should be able to accept DDT items. However, the error variables are somewhat special and they are not handled correctly when inside a DDT.

Steps to Reproduce

  1. Create a DDT
  2. Add the ccpp_error_message and/or ccpp_error_code variables to the DDT
  3. Add a variable of this DDT type to the host table type = host metadata table
  4. Run capgen

Output

Please include any relevant log files, screenshots or other output here.

-- Traceback (most recent call last):
  File "/home/goldy/Projects/CAMDEN/ccpp_framework/scripts/ccpp_capgen.py", line 777, in <module>
    _main_func()
  File "/home/goldy/Projects/CAMDEN/ccpp_framework/scripts/ccpp_capgen.py", line 770, in _main_func
    _ = capgen(framework_env)
  File "/home/goldy/Projects/CAMDEN/ccpp_framework/scripts/ccpp_capgen.py", line 730, in capgen
    host_files = [write_host_cap(host_model, ccpp_api, cap_module,
  File "/home/goldy/Projects/CAMDEN/ccpp_framework/scripts/host_cap.py", line 679, in write_host_cap
    ConstituentVarDict.write_host_routines(cap, host_model, reg_name, init_name,
  File "/home/goldy/Projects/CAMDEN/ccpp_framework/scripts/constituents.py", line 494, in write_host_routines
    evar.write_def(cap, 2, host, dummy=True, add_intent="out")
TypeError: VarDDT.write_def() got an unexpected keyword argument 'add_intent'
dustinswales commented 2 months ago

@gold2718 I ran into a possibly related issue wrt to the ccpp error handling variables. When porting the framework ccpp_t type to the SCM, I had to remove the ccpp error handling variables from this DDT and provide them to the host as flat variables. Also, as the caps are written now, it is mandatory for you to supply ccpp error handling variables (If you don't the caps will try to initialize them, but they aren't declared).

gold2718 commented 2 months ago

@dustinswales, this is exactly the issue. I am working on a fix.