Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding output units of CFE #27

Open
hellkite500 opened this issue Nov 9, 2021 · 21 comments
Open

Understanding output units of CFE #27

hellkite500 opened this issue Nov 9, 2021 · 21 comments

Comments

@hellkite500
Copy link
Member

Looking at some of the outputs of CFE model runs, it almost looks like the Q_OUT variable is in mm/hr, much the same as the precip_rate is. But the BMI reports Q_OUT as a unit of m. When assuming this unit and converting the value to m^3/s using the catchment area, the resulting flow values are orders of magnitude higher than expected. This also points to the units declared for this variable as being inconsistent with the units the underlying formulation is using for this variable.

@SnowHydrology
Copy link
Contributor

I believe the original t-shirt code ran all the water fluxes as m, including precip. Maybe a var (or several vars) got lost in translation at some point. @jmframe do you know?

@jmframe
Copy link
Contributor

jmframe commented Nov 10, 2021

The printouts are in different units than the model variables.

fprintf(out_fptr,"# (h), (mm) , (mm) , (mm) , (mm) , (mm), (mm)\n");

rain_rate[tstep],Schaake_output_runoff_m*1000.0,infiltration_depth_m*1000.0,

cfe/src/bmi_cfe.c

Line 2438 in 3617bda

printf("# (h), (mm) , (mm) , (mm) , (mm) , (mm), (mm)\n");

cfe/src/bmi_cfe.c

Line 2443 in 3617bda

cfe_ptr->timestep_rainfall_input_m*1000.0,

@SnowHydrology
Copy link
Contributor

@jmframe Can you clarify this? I.e., does CFE convert the units only when printing output to the terminal window or does it also convert to mm in the course of its execution so that the Q_OUT that gets passed through BMI is in mm?

@jmframe
Copy link
Contributor

jmframe commented Nov 10, 2021

CFE runs with everything (fluxes and states) based on meters:

cfe/src/cfe.c

Line 211 in 3617bda

Qout_m = giuh_runoff_m + nash_lateral_runoff_m + flux_from_deep_gw_to_chan_m;
.

**No computations are done in millimeter. **

The Q_OUT that gets passed through BMI is in meters:

static const char *output_var_units[OUTPUT_VAR_NAME_COUNT] = {
.

There is some code that is included in the CFE model code that prints out converted the states and fluxes (and input) to millimeters. Shown above. I believe this was done for visual clarity when debugging (by Fred).

@SnowHydrology
Copy link
Contributor

Thanks @jmframe. @hellkite500, do you have example output in mm/h? I'm also wondering if it could be a time difference (h vs. s can induce the same order of magnitude differences as m vs. mm).

@jmframe
Copy link
Contributor

jmframe commented Nov 10, 2021

test_cfe_bmi.txt

@SnowHydrology
Copy link
Contributor

Maybe I've misunderstood, but I thought @hellkite500 was discussing CFE output through Nextgen (i.e., what the model would pass through BMI), not what prints to the screen during the example runs. If that's the case, yes the printed output is definitely in mm, while the model should still pass Q_OUT in m. If that clears up the confusion, I reckon we can close this.

@jmframe
Copy link
Contributor

jmframe commented Nov 10, 2021

I see. Yeah, the output through Nextgen should be in meters, or whatever conversion is done on the framework side. I'd like to see it, if you care to share.

@stcui007
Copy link
Contributor

stcui007 commented Nov 14, 2021 via email

@jmframe
Copy link
Contributor

jmframe commented Nov 14, 2021

The CFE Bmi shows that CFE expects precipitation input as kg m-2:

"kg m-2", //"atmosphere_water__liquid_equivalent_precipitation_rate"
. Is that consistent with the precipitation input you are using? This comes from Fred's t-shirt code:
rain_rate[i]=(double)aorc_data.precip_kg_per_m2; // assumed 1000 kg/m3 density of water. This result is mm/h;
.

@SnowHydrology
Copy link
Contributor

@stcui007, as @jmframe noted, CFE expects input precipitation in kg/m2 over its time step. Assuming a liquid water density of 1000 kg/m3 as CFE does means that you can force CFE with mm of precipitation. If your input precipitation is mm/h for a 1 h time step, then all is good. If your input precipitation is mm/s for a 1 h time step, then all is not good unless you convert the rate to a total depth by multiplying by seconds per hour.

@lcunha0118
Copy link
Contributor

@stcui007 and @hellkite500: I just checked the bmi's units in NOAH-MP and CFE, and it seems that unit conversion is necessary! I am using NCAR input, which has the exact units we need to run NOAH-Mp. NOAH-MP outputs are:

QINSUR: total liquid water input to surface rate - m/s
ETRAN: transpiration rate - mm/s
QSEVA: evaporation rate - mm/s

And CFE inputs are;

Atmosphere_water__liquid_equivalent_precipitation_rate - kg/m2 ~ mm/h
Water_potential_evaporation_flux - m/s

So both inputs to CFE need to be converted before we get any reasonable results. Water input to surface rate needs to be converted from m/s to mm/h, and potential evapotranspiration from mm/s to m/s.

@stcui007
Copy link
Contributor

stcui007 commented Nov 15, 2021 via email

@lcunha0118
Copy link
Contributor

Shengting,

We are using different inputs, since I am using the input generated by NCAR.

This conversion is not sufficient, since NOAH-MP modular requires input rainfall in mm/s. So you need to do 1000/3600 to get the right unit into NOAH-MP modular.

But I am also worried about the potential evpt that is going into CFE. Maybe due to the unit issue, it is too high, and it is just drying everything up before anything gets converted into runoff.

Luciana

@jmframe
Copy link
Contributor

jmframe commented Nov 15, 2021

Fred developed the CFE model with this example forcing file:
https://github.com/NOAA-OWP/cfe/blob/master/original_author_code/cat58_01Dec2015.csv

The BMI for CFE has been tested with the same file and gets similar results as Fred's code. Note that a few changes to the CFE since Fred's version f prevent a perfect match. But they are qualitatively identical.

You can see here that Fred used the APCP_surface to force his model, and he calls if kg m2 (~mm/h):

float precip_kg_per_m2; // Surface precipitation "kg/m^2" | APCP_surface

aorc->precip_kg_per_m2=atof(theWord);

rain_rate[i]=(double)aorc_data.precip_kg_per_m2; // assumed 1000 kg/m3 density of water. This result is mm/h;

Note that we took Fred's unit conversion:

if(tstep<num_rain_dat) timestep_rainfall_input_m=rain_rate[tstep]/1000.0; // convert from mm/h to m w/ 1h timestep

and placed it in the update function of the BMI_CFE:
cfe_ptr->timestep_rainfall_input_m = cfe_ptr->aorc.precip_kg_per_m2 /1000;

@stcui007
Copy link
Contributor

stcui007 commented Nov 16, 2021 via email

@jmframe
Copy link
Contributor

jmframe commented Nov 16, 2021

That line (921) looks to be unused and can be deleted, because that would then be overwritten by either lines 971 or 975. But it wouldn't cause a second division by 1000, because it doesn't divide the timestep_rainfall_input_m value, it divides the forcing_data_precip_kg_per_m2 value.

@stcui007
Copy link
Contributor

stcui007 commented Nov 16, 2021 via email

@jmframe
Copy link
Contributor

jmframe commented Nov 16, 2021

cfe_test_nov_16.zip
Attached are outputs from the test cases (using the make_and_run*.sh scripts in the repository)
You can also see the response in the python version here: https://github.com/NOAA-OWP/cfe/blob/master/py_cfe/run_cfe.ipynb.
If most water is going into groundwater, it sounds like a parameter issue. Or, there is not enough precipitation to cause runoff, which could be a unit issue. Maybe check that the values for precipitation that go into the model from the framework match what you would expect?

@stcui007
Copy link
Contributor

stcui007 commented Nov 16, 2021 via email

@SnowHydrology
Copy link
Contributor

@hellkite500, @jmframe, @stcui007, @lcunha0118, can this issue be closed? Q_OUT should definitely be m per time step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants