Skip to content

Commit

Permalink
Move alpha and volscl from temp componet inputs to forcing componet i…
Browse files Browse the repository at this point in the history
…nputs
  • Loading branch information
kdorheim committed Jul 1, 2024
1 parent ddfffa4 commit dcc55d9
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 35 deletions.
4 changes: 4 additions & 0 deletions inst/include/forcing_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ class ForcingComponent : public IModelComponent {
(32.065 /
64.066); // (Tg SO2 yr–1) IPCC AR6 7.SM.1.3.1 converted to (Gg S yr-1)

// Forcing uncertainty scalars
unitval alpha; //!< aerosol forcing factor, unitless
unitval volscl; //!< volcanic forcing scaling factor, unitless

Core *core; //! Core
Logger logger; //! Logger

Expand Down
2 changes: 0 additions & 2 deletions inst/include/temperature_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ class TemperatureComponent : public IModelComponent {
// Model parameters
unitval S; //!< climate sensitivity for 2xCO2, deg C
unitval diff; //!< ocean heat diffusivity, cm2/s
unitval alpha; //!< aerosol forcing factor, unitless
unitval volscl; //!< volcanic forcing scaling factor, unitless

// Model outputs
unitval tas; //!< global average air temperature anomaly, deg C
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp119.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp119_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp126.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp126_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp245.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp245_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp370.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp370_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp434.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp434_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp460.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp460_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp534-over.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp534-over_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
5 changes: 3 additions & 2 deletions inst/input/hector_ssp585.ini
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,13 @@ rho_nh3=-0.002146032 ; (W yr m–2 NH3Tg–1) Dorheim et al. 2024
;RF_misc=csv:tables/ssp585_emiss-constraints_rf.csv
RF_misc[1750]=0

alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing

;------------------------------------------------------------------------
[temperature]
S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6)
diff=2.38 ; ocean heat diffusivity, cm2/s calibrated to historical observations Dorheim et al. 2024 for details
alpha=1.0 ; uncertainty scaling factor for aerosol forcing
volscl=1.0 ; uncertainty scaling factor for volcanic forcing
qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6)

; Optional global temperature constraint
Expand Down
12 changes: 12 additions & 0 deletions src/forcing_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ void ForcingComponent::init(Core *coreptr) {
core->registerDependency(D_RF_T_ALBEDO, getComponentName());

// Register the inputs we can receive from outside
core->registerInput(D_AERO_SCALE, getComponentName());
core->registerInput(D_VOLCANIC_SCALE, getComponentName());
core->registerInput(D_DELTA_CH4, getComponentName());
core->registerInput(D_DELTA_N2O, getComponentName());
core->registerInput(D_DELTA_CO2, getComponentName());
Expand Down Expand Up @@ -237,6 +239,12 @@ void ForcingComponent::setData(const string &varName,
} else if (varName == D_RHO_SO2) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
rho_so2 = data.getUnitval(U_W_M2_GG);
} else if (varName == D_AERO_SCALE) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
alpha = data.getUnitval(U_UNITLESS);
} else if (varName == D_VOLCANIC_SCALE) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
volscl = data.getUnitval(U_UNITLESS);
} else if (varName == D_FTOT_CONSTRAIN) {
H_ASSERT(data.date != Core::undefinedIndex(), "date required");
Ftot_constrain.set(data.date, data.getUnitval(U_W_M2));
Expand Down Expand Up @@ -532,6 +540,10 @@ unitval ForcingComponent::getData(const std::string &varName,
returnval = delta_n2o;
} else if (varName == D_DELTA_CO2) {
returnval = delta_co2;
} else if (varName == D_AERO_SCALE) {
returnval = alpha;
} else if (varName == D_VOLCANIC_SCALE) {
returnval = volscl;
} else if (varName == D_RHO_BC) {
returnval = rho_bc;
} else if (varName == D_RHO_OC) {
Expand Down
25 changes: 8 additions & 17 deletions src/temperature_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ void TemperatureComponent::init(Core *coreptr) {
core->registerDependency(D_RF_SO2, getComponentName());
core->registerDependency(D_RF_ACI, getComponentName());
core->registerDependency(D_RF_VOL, getComponentName());
core->registerDependency(D_AERO_SCALE, getComponentName());
core->registerDependency(D_VOLCANIC_SCALE, getComponentName());


// Register the inputs we can receive from outside
core->registerInput(D_ECS, getComponentName());
core->registerInput(D_QCO2, getComponentName());
core->registerInput(D_DIFFUSIVITY, getComponentName());
core->registerInput(D_AERO_SCALE, getComponentName());
core->registerInput(D_VOLCANIC_SCALE, getComponentName());
core->registerInput(D_LO_WARMING_RATIO, getComponentName());
core->registerInput(D_TAS_CONSTRAIN, getComponentName());
}

Expand Down Expand Up @@ -177,12 +178,6 @@ void TemperatureComponent::setData(const string &varName,
} else if (varName == D_DIFFUSIVITY) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
diff = data.getUnitval(U_CM2_S);
} else if (varName == D_AERO_SCALE) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
alpha = data.getUnitval(U_UNITLESS);
} else if (varName == D_VOLCANIC_SCALE) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
volscl = data.getUnitval(U_UNITLESS);
} else if (varName == D_QCO2) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
qco2 = data.getUnitval(U_UNITLESS).value(U_UNITLESS);
Expand Down Expand Up @@ -468,11 +463,15 @@ void TemperatureComponent::run(const double runToDate) {

// Adjust total forcing to account for the aerosol and volcanic forcing
// scaling factor
double alpha = core->sendMessage(M_GETDATA, D_AERO_SCALE, message_data(runToDate))
.value(U_UNITLESS);
double volscl = core->sendMessage(M_GETDATA, D_VOLCANIC_SCALE, message_data(runToDate))
.value(U_UNITLESS);
const double ftot = core->sendMessage(M_GETDATA, D_RF_TOTAL, message_data(runToDate)).value(U_W_M2);
forcing[tstep] =
double(ftot) -
(1.0 - alpha) * aero_forcing - (1.0 - volscl) * volcanic_forcing;

// Initialize variables for time-stepping through the model
double DQ1 = 0.0;
double DQ2 = 0.0;
Expand Down Expand Up @@ -695,17 +694,9 @@ unitval TemperatureComponent::getData(const std::string &varName,
H_ASSERT(date == Core::undefinedIndex(),
"Date not allowed for diffusivity");
returnval = diff;
} else if (varName == D_AERO_SCALE) {
H_ASSERT(date == Core::undefinedIndex(),
"Date not allowed for aero scaler");
returnval = alpha;
} else if (varName == D_ECS) {
H_ASSERT(date == Core::undefinedIndex(), "Date not allowed for ECS");
returnval = S;
} else if (varName == D_VOLCANIC_SCALE) {
H_ASSERT(date == Core::undefinedIndex(),
"Date not allowed for volcanic scaler");
returnval = volscl;
} else if (varName == D_QCO2) {
H_ASSERT(date == Core::undefinedIndex(), "Date not allowed for q2co2");
returnval = unitval(qco2, U_W_M2);
Expand Down

0 comments on commit dcc55d9

Please sign in to comment.