From 112f0a6c2b2de02cf4a898a655af971f9e886c6e Mon Sep 17 00:00:00 2001 From: kdorheim Date: Wed, 23 Mar 2022 18:42:11 -0400 Subject: [PATCH] simplify qco2 --- inst/include/temperature_component.hpp | 2 +- src/temperature_component.cpp | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/inst/include/temperature_component.hpp b/inst/include/temperature_component.hpp index fbf1abe24..d3c915f1b 100644 --- a/inst/include/temperature_component.hpp +++ b/inst/include/temperature_component.hpp @@ -103,7 +103,7 @@ class TemperatureComponent : public IModelComponent { double taudif; // interior ocean heat uptake time scale, yr double tauksl; // sea-land heat exchange time scale, yr double taukls; // land-sea heat exchange time scale, yr - unitval q2co2; // radiative forcing for atmospheric CO2 doubling (W/m2) + double qco2; // radiative forcing for atmospheric CO2 doubling std::vector KT0; std::vector KTA1; diff --git a/src/temperature_component.cpp b/src/temperature_component.cpp index 9b65caadf..218f171e1 100644 --- a/src/temperature_component.cpp +++ b/src/temperature_component.cpp @@ -180,7 +180,7 @@ void TemperatureComponent::setData( const string& varName, volscl = data.getUnitval(U_UNITLESS); } else if(varName == D_QCO2) { H_ASSERT( data.date == Core::undefinedIndex(), "date not allowed" ); - q2co2 = data.getUnitval(U_UNDEFINED); + qco2 = data.getUnitval(U_UNITLESS).value(U_UNITLESS); } else if( varName == D_TGAV_CONSTRAIN ) { H_ASSERT( data.date != Core::undefinedIndex(), "date required" ); tgav_constrain.set(data.date, data.getUnitval(U_DEGC)); @@ -250,9 +250,6 @@ void TemperatureComponent::prepareToRun() { // Constants & conversion factors kcon = secs_per_Year / 10000; // conversion factor from cm2/s to m2/yr; ocean_area = (1.0 - flnd) * earth_area; // m2 - double qco2 = q2co2.value( U_UNDEFINED ); - - // Calculate climate feedback parameterisation cnum = rlam * flnd + bsi * (1.0 - flnd); // denominator used to calculate climate senstivity feedback parameters over land & sea @@ -594,7 +591,7 @@ unitval TemperatureComponent::getData( const std::string& varName, returnval = volscl; } else if( varName == D_QCO2 ) { H_ASSERT( date == Core::undefinedIndex(), "Date not allowed for q2co2" ); - returnval = q2co2; + returnval = unitval(qco2, U_DEGC); } else if( varName == D_LO_WARMING_RATIO ) { H_ASSERT( date == Core::undefinedIndex(), "Date not allowed for land ocean warming ratio" ); returnval = lo_warming_ratio;