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

Add volcanic scaling factor #291

Merged
merged 4 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions inst/include/component_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
// temperature component
#define D_DIFFUSIVITY "diff"
#define D_AERO_SCALE "alpha"
#define D_VOLCANIC_SCALE "volscl"
#define D_FLUX_MIXED "flux_mixed"
#define D_FLUX_INTERIOR "flux_interior"
#define D_HEAT_FLUX "heatflux"
Expand Down
1 change: 1 addition & 0 deletions inst/include/temperature_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class TemperatureComponent : public IModelComponent {
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 tgav; //!< global temperature delta, deg C
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector-gcam.ini
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps both scaling factors' comments should note centered around 1, i.e. 1.0 = no scaling?

; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp26.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp26_constrained.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp26_histconstrain.ini
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp45.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp45_constrained.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp60.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp60_constrained.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp85.ini
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
1 change: 1 addition & 0 deletions inst/input/hector_rcp85_constrained.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enabled=1
S=3.0 ; equilibrium climate sensitivity for 2xCO2, degC
diff=2.3 ; ocean heat diffusivity, cm2/s
alpha=1.0 ; scaling factor for aerosol forcing
volscl=1.0 ; scaling factor for volcanic forcing
; Optional global temperature constraint
; If supplied, the model will use these data, ignoring what it calculates
; tgav_constrain=csv:constraints/tgav_historical.csv
Expand Down
14 changes: 11 additions & 3 deletions src/temperature_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void TemperatureComponent::init( Core* coreptr ) {
diff.set( 0.55, U_CM2_S ); // default ocean heat diffusivity, cm2/s. value is CDICE default (varname is kappa there).
S.set( 3.0, U_DEGC ); // default climate sensitivity, K (varname is t2co in CDICE).
alpha.set( 1.0, U_UNITLESS); // default aerosol scaling, unitless (similar to alpha in CDICE).
volscl.set(1.0, U_UNITLESS); // Default volcanic scaling, unitless (works the same way as alpha)

// Register the data we can provide
core->registerCapability( D_GLOBAL_TEMP, getComponentName() );
Expand All @@ -111,6 +112,7 @@ void TemperatureComponent::init( Core* coreptr ) {
core->registerInput(D_ECS, getComponentName());
core->registerInput(D_DIFFUSIVITY, getComponentName());
core->registerInput(D_AERO_SCALE, getComponentName());
core->registerInput(D_VOLCANIC_SCALE, getComponentName());
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -151,6 +153,9 @@ void TemperatureComponent::setData( const string& varName,
} 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_TGAV_CONSTRAIN ) {
H_ASSERT( data.date != Core::undefinedIndex(), "date required" );
tgav_constrain.set(data.date, data.getUnitval(U_DEGC));
Expand Down Expand Up @@ -324,8 +329,11 @@ void TemperatureComponent::run( const double runToDate ) throw ( h_exception ) {
double aero_forcing =
double(core->sendMessage( M_GETDATA, D_RF_BC ).value( U_W_M2 )) + double(core->sendMessage( M_GETDATA, D_RF_OC).value( U_W_M2 )) +
double(core->sendMessage( M_GETDATA, D_RF_SO2d ).value( U_W_M2 )) + double(core->sendMessage( M_GETDATA, D_RF_SO2i ).value( U_W_M2 ));
double volcanic_forcing = double(core->sendMessage(M_GETDATA, D_RF_VOL));

forcing[tstep] = double(core->sendMessage( M_GETDATA, D_RF_TOTAL ).value( U_W_M2 )) - ( 1.0 - alpha ) * aero_forcing;
forcing[tstep] = double(core->sendMessage(M_GETDATA, D_RF_TOTAL).value(U_W_M2))
- (1.0 - alpha) * aero_forcing
- (1.0 - volscl) * volcanic_forcing;

// Initialize variables for time-stepping through the model
double DQ1 = 0.0;
Expand Down Expand Up @@ -441,8 +449,8 @@ unitval TemperatureComponent::getData( const std::string& varName,
returnval = heatflux;
} else if( varName == D_ECS ) {
returnval = S;
} else if(varName == D_AERO_SCALE) {
returnval = alpha;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you delete the alpha here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a duplicate. Alpha is already processed on lines 434-435 (old numbering).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, gotcha!

} else if(varName == D_VOLCANIC_SCALE) {
returnval = volscl;
} else {
H_THROW( "Caller is requesting unknown variable: " + varName );
}
Expand Down