Skip to content

Commit 631cf61

Browse files
committed
Pull request JGCRI#226: Get Non-CO2 Emissions in GCAM-USA
Merge in JGCRI/gcam-core from maw/feature/gcam-usa-non-co2-byu to master Squashed commit of the following: commit e6d53a0fa9c44adbea1ab46823d71b5b3ff5a061 Merge: 1b6ca6e1b ea406d0 Author: Pralit Patel <[email protected]> Date: Fri Jun 3 13:23:36 2022 -0400 Merge remote-tracking branch 'origin/master' into maw/feature/gcam-usa-non-co2-byu commit 1b6ca6e1bbc9ec2f995729c5e24a14ea1c228327 Author: marideeweber <[email protected]> Date: Thu Jun 2 13:55:55 2022 -0700 Modifying L271.nonghg_trn_USA.R to extend the linear control into all future periods. This removes a warning from the slurm-XXXXXXXX.out file. commit 5326b2c3ab63ed26d480091ca8a4baa9ed06710b Author: marideeweber <[email protected]> Date: Thu Jun 2 11:51:51 2022 -0700 Making electric generation disable linear control section more robust commit 80878ad3b4a72d05312b31fb1a9b51a3421c8fcc Author: marideeweber <[email protected]> Date: Wed Jun 1 16:23:03 2022 -0700 Adding a disable emissions control for future years for electric generation to overcome warnings in the .out file commit e15125f84b0b3b26e953d53bcd636d7f58c6439a Author: marideeweber <[email protected]> Date: Wed Jun 1 16:22:25 2022 -0700 Deleting energy final demand at the USA level for urban processes to remove a SEVERE ERROR in the .out file commit ef74655d0fee63a5eac5d22a8a474ffb6abc630b Author: marideeweber <[email protected]> Date: Thu May 26 08:55:46 2022 -0700 Addressing PR comments: changing gcamusa.DUST to function using TRUE or FALSE commit 24f1097253d25544a3d62f366a73a3fb00526a2c Author: marideeweber <[email protected]> Date: Thu May 26 08:55:26 2022 -0700 Removing an unused input commit d350f12ef0d14d36f74f991f8e3efa94aaf5d463 Author: marideeweber <[email protected]> Date: Sun May 22 22:02:20 2022 -0700 Addressing PR comments: NEI_to_GCAM function commit e62a79b9a3e3282c69d686acf8d05d8fb5337293 Author: marideeweber <[email protected]> Date: Sun May 22 22:01:57 2022 -0700 Addressing PR comments: changing constants to the GCAM convention commit 04ec02589adae1148a65f3050c25cd166aa273cd Author: enlochner <[email protected]> Date: Fri May 6 15:04:25 2022 -0500 Update prebuilt and data map commit 0d4b53b44fc09d8c873ae18649c80124cfcc17ea Author: marideeweber <[email protected]> Date: Wed May 4 12:17:57 2022 -0700 Get testing framework up to date commit 4150e99c9b7272d8215f551d9b3cb99dff1d0c4e Author: marideeweber <[email protected]> Date: Tue May 3 14:20:07 2022 -0700 Revert "This is for a test. Will be reverted." This reverts commit 06d0b4b2502fa3a997d891f231fb4cdc704b053b. commit 06d0b4b2502fa3a997d891f231fb4cdc704b053b Author: marideeweber <[email protected]> Date: Tue May 3 12:46:38 2022 -0700 This is for a test. Will be reverted. commit b89a13918c06a02885222d3e4e68f8f859f37605 Author: marideeweber <[email protected]> Date: Tue May 3 09:36:37 2022 -0700 Remove an unused input commit d37b7febc1d9c8f6e41ba21e4b9622b022756a7a Author: marideeweber <[email protected]> Date: Mon May 2 20:21:15 2022 -0700 Changing "industry" to "other industry" for consistency with global detailed industry commit 527f57083e15f6575ced9fdebd8edd5a8430c48d Author: marideeweber <[email protected]> Date: Mon May 2 17:12:17 2022 -0700 Changing "industrial energy use" to "other industrial energy use" for consistency with global detailed industry commit 68d0246a5855354f82cba920918dbf6d2ee198e0 Author: marideeweber <[email protected]> Date: Mon May 2 14:45:56 2022 -0700 Changing "industrial energy use" to "other industrial energy use" for consistency with global detailed industry changes commit c9d08f8c0f50748a1b26cd63079ddb583ce4957d Author: marideeweber <[email protected]> Date: Mon May 2 11:52:00 2022 -0700 Revising zchunk_L112.ceds_ghg_en_R_S_T_Y.R to reassign a table that was assigned to itself, complicating a chunk downstream. commit e97d30109cbafb45e96adcb6ae334ecf8a5414e4 Author: marideeweber <[email protected]> Date: Sun May 1 22:30:20 2022 -0700 Revert "Delete Main_queries.xml" This reverts commit 9f73aea15af365f23647105ca09dea62d3e0a119. commit 9f73aea15af365f23647105ca09dea62d3e0a119 Author: marideeweber <[email protected]> Date: Sun May 1 22:26:57 2022 -0700 Delete Main_queries.xml ... and 213 more commits
1 parent ea406d0 commit 631cf61

File tree

75 files changed

+263372
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+263372
-64
lines changed

cvs/objects/emissions/include/linear_control.h

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class LinearControl: public AEmissionsControl {
9696
//! Final emissions coefficient
9797
DEFINE_VARIABLE( SIMPLE, "final-emissions-coefficient", mFinalEmCoefficient, Value ),
9898

99+
//! Emissions redution percentage (alternative to specifying emissions coefficient)
100+
DEFINE_VARIABLE( SIMPLE, "control-percentage", mControlFraction, Value ),
101+
99102
//! Flag if wish to allow emissions factor increase
100103
DEFINE_VARIABLE( SIMPLE, "allow-ef-increase", mAllowIncrease, bool )
101104
)

cvs/objects/emissions/source/linear_control.cpp

+36-27
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* CONTRACTOR MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY
77
* LIABILITY FOR THE USE OF THIS SOFTWARE. This notice including this
88
* sentence must appear on any copies of this computer software.
9-
*
9+
*
1010
* EXPORT CONTROL
1111
* User agrees that the Software will not be shipped, transferred or
1212
* exported into any country or used in any manner prohibited by the
@@ -21,17 +21,17 @@
2121
* (including without limitation Iran, Syria, Sudan, Cuba, and North Korea)
2222
* and that User is not otherwise prohibited
2323
* under the Export Laws from receiving the Software.
24-
*
24+
*
2525
* Copyright 2011 Battelle Memorial Institute. All Rights Reserved.
26-
* Distributed as open-source under the terms of the Educational Community
26+
* Distributed as open-source under the terms of the Educational Community
2727
* License version 2.0 (ECL 2.0). http://www.opensource.org/licenses/ecl2.php
28-
*
28+
*
2929
* For further details, see: http://www.globalchange.umd.edu/models/gcam/
3030
*
3131
*/
3232

3333

34-
/*!
34+
/*!
3535
* \file mac_control.cpp
3636
* \ingroup Objects
3737
* \brief LinearControl class source file.
@@ -94,6 +94,7 @@ void LinearControl::copy( const LinearControl& aOther ){
9494
mTargetYear = aOther.mTargetYear;
9595
mStartYear = aOther.mStartYear;
9696
mFinalEmCoefficient = aOther.mFinalEmCoefficient;
97+
mControlFraction = aOther.mControlFraction;
9798
mAllowIncrease = aOther.mAllowIncrease;
9899
}
99100

@@ -117,6 +118,7 @@ const string& LinearControl::getXMLNameStatic(){
117118
void LinearControl::toDebugXMLDerived( const int aPeriod, ostream& aOut, Tabs* aTabs ) const {
118119
const Modeltime* modeltime = scenario->getModeltime();
119120
XMLWriteElement( mFinalEmCoefficient, "final-emissions-coefficient", aOut, aTabs);
121+
XMLWriteElement( mControlFraction, "control-percentage", aOut, aTabs);
120122
XMLWriteElement( mTargetYear, "end-year", aOut, aTabs);
121123
XMLWriteElementCheckDefault( mStartYear, "start-year", aOut, aTabs,
122124
modeltime->getper_to_yr( modeltime->getFinalCalibrationPeriod() ) );
@@ -128,13 +130,13 @@ void LinearControl::completeInit( const string& aRegionName, const string& aSect
128130
const IInfo* aTechInfo )
129131
{
130132

131-
if ( ( mTargetYear == 0 ) || !mFinalEmCoefficient.isInited() && !mDisableEmControl ) {
133+
if ( !mDisableEmControl && (( mTargetYear == 0 ) || (!mFinalEmCoefficient.isInited() && !mControlFraction.isInited()))) {
132134
ILogger& mainLog = ILogger::getLogger( "main_log" );
133135
mainLog.setLevel( ILogger::ERROR );
134136
mainLog << "Linear control function " << getName() << " has not been parameterized. " << endl;
135137
abort();
136138
}
137-
139+
138140
}
139141

140142
void LinearControl::initCalc( const string& aRegionName,
@@ -151,7 +153,7 @@ void LinearControl::initCalc( const string& aRegionName,
151153
mainLog << "Linear control function improperly parameterized. Target year <= last calibration year." << endl;
152154
abort();
153155
}
154-
156+
155157
// Make sure start year is not before final calibration year
156158
if ( mStartYear < finalCalibYr && !mDisableEmControl ) {
157159
ILogger& mainLog = ILogger::getLogger( "main_log" );
@@ -160,11 +162,11 @@ void LinearControl::initCalc( const string& aRegionName,
160162
<< " before final calibration year, resetting to " << finalCalibYr << endl;
161163
mStartYear = finalCalibYr;
162164
}
163-
165+
164166
// Make sure start year is not before the first model period for this object.
165167
int thisModelYear = scenario->getModeltime()->getper_to_yr( aPeriod );
166168
if ( aTechInfo->getBoolean( "new-vintage-tech", true ) && mStartYear < thisModelYear ) {
167-
169+
168170
// But don't warn if the current object has been disabled via user input
169171
if ( !mDisableEmControl ) {
170172
ILogger& mainLog = ILogger::getLogger( "main_log" );
@@ -174,8 +176,8 @@ void LinearControl::initCalc( const string& aRegionName,
174176
}
175177
mStartYear = thisModelYear;
176178
}
177-
178-
// Need to get the emissions coefficient from start period to serve as starting point
179+
180+
// Need to get the emissions coefficient from start period to serve as starting point
179181
// for linear decline.
180182
int startPeriod = scenario->getModeltime()->getyr_to_per( mStartYear );
181183
if ( mDisableEmControl ) {
@@ -188,12 +190,12 @@ void LinearControl::initCalc( const string& aRegionName,
188190
calcEmissionsReductionInternal( baseEmissionsCoef, aPeriod );
189191
}
190192
}
191-
192-
// Note, the emissions driver in NonCO2Emissions::calcEmission for input driver is
193-
// defined as the sum of all physical inputs (e.g. getPhysicalDemandSum). This means
194-
// that the emissions factor has an unusual definition for quantities with more than
193+
194+
// Note, the emissions driver in NonCO2Emissions::calcEmission for input driver is
195+
// defined as the sum of all physical inputs (e.g. getPhysicalDemandSum). This means
196+
// that the emissions factor has an unusual definition for quantities with more than
195197
// one input. This function should be used with caution in these cases.
196-
// Fortunately, these cases are currently rare. If multiple inputs become more common
198+
// Fortunately, these cases are currently rare. If multiple inputs become more common
197199
// changes, a means of specifying the appropriate input would need to be added.
198200
// Electricity inputs, for example, should never be associated with non-CO2 emissions.
199201
}
@@ -207,7 +209,7 @@ void LinearControl::calcEmissionsReduction( const std::string& aRegionName, cons
207209

208210
/*!
209211
* \brief Calculate a linear reduction in the emissions factor and save it to mReduction.
210-
* \details The reduction is calculated from the given aBaseEmissionsCoef and the
212+
* \details The reduction is calculated from the given aBaseEmissionsCoef and the
211213
* parsed parameters that define the start/end year and final value. We
212214
* only allow the emissions factor to increase if the mAllowIncrease flag
213215
* was explicitly set.
@@ -220,31 +222,38 @@ void LinearControl::calcEmissionsReductionInternal( const double aBaseEmissionsC
220222
const int aPeriod )
221223
{
222224
double reduction = 0.0;
223-
225+
224226
double thisYear = scenario->getModeltime()->getper_to_yr( aPeriod );
225-
227+
226228
// Don't bother if no emissions or haven't passed starting point yet
227-
if ( aBaseEmissionsCoef > 0 && thisYear > mStartYear && mFinalEmCoefficient.isInited() ) {
228-
229+
if ( aBaseEmissionsCoef > 0 && thisYear > mStartYear &&
230+
( mFinalEmCoefficient.isInited() || mControlFraction.isInited() ) ) {
231+
229232
// Derivation of emission reduction formula below
230233
// newEF = baseEF - (baseEF - targetEF) * ( year - baseYear ) / ( targetYear - baseYear )
231234
// newEF = baseEF * ( 1 - reduction ) therefore reduction = 1 - newEF / baseEF
232235
// reduction = ( 1 - targetEF / baseEF ) * ( year - baseYear ) / ( targetYear - baseYear )
233-
236+
234237
// This is the final reduction
235-
reduction = ( 1 - mFinalEmCoefficient / aBaseEmissionsCoef );
236-
238+
// Emissions coefficient takes precidence if control fraction is also inited
239+
// Note, have already established that at least one of these is defined.
240+
if ( mFinalEmCoefficient.isInited() ) {
241+
reduction = ( 1 - mFinalEmCoefficient / aBaseEmissionsCoef );
242+
} else {
243+
reduction = mControlFraction;
244+
}
245+
237246
// If not at final year yet, phase this in linearly
238247
if ( thisYear < mTargetYear ) {
239248
reduction *= static_cast<double>( thisYear - mStartYear ) /
240249
static_cast<double>( mTargetYear - mStartYear );
241250
}
242-
251+
243252
// Ensure that reduction is not negative unless user specifically requires this
244253
if ( reduction < 0.0 && !mAllowIncrease ) {
245254
reduction = 0.0;
246255
}
247256
}
248-
257+
249258
setEmissionsReduction( reduction );
250259
}

exe/configuration_usa.xml

+27-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Value write-output="0" append-scenario-name="0" name="landAllocatorGraphName">LandAllocatorGraph.dot</Value>
1818
</Files>
1919
<ScenarioComponents>
20-
<Value name = "climate">../input/gcamdata/xml/no_climate_model.xml</Value>
20+
<Value name = "climate">../input/gcamdata/xml/hector.xml</Value>
2121
<Value name = "socioeconomics">../input/gcamdata/xml/socioeconomics_gSSP2.xml</Value>
2222

2323
<Value name = "resources">../input/gcamdata/xml/resources.xml</Value>
@@ -127,6 +127,32 @@
127127
<!--GHG EMISSIONS USA-->
128128
<Value name = "ghg_usa">../input/gcamdata/xml/ghg_emissions_USA.xml</Value>
129129
<Value name = "ghg_usa">../input/gcamdata/xml/elecS_ghg_emissions_water_USA.xml</Value>
130+
<Value name = "ghg_usa">../input/gcamdata/xml/trn_ghg_emissions_USA.xml</Value>
131+
132+
<!-- Global nonCO2 GHG files -->
133+
<Value name = "ind_urb_proc">../input/gcamdata/xml/ind_urb_processing_sectors.xml</Value>
134+
<Value name = "nonco2_energy">../input/gcamdata/xml/all_energy_emissions.xml</Value>
135+
<Value name = "nonco2_fgas">../input/gcamdata/xml/all_fgas_emissions.xml</Value>
136+
<Value name = "nonco2_unmgd">../input/gcamdata/xml/all_unmgd_emissions.xml</Value>
137+
<Value name = "nonco2_aglu">../input/gcamdata/xml/all_aglu_emissions_IRR_MGMT.xml</Value>
138+
<Value name = "nonco2_aglu_prot">../input/gcamdata/xml/all_protected_unmgd_emissions.xml</Value>
139+
140+
<!-- Global nonCO2 GHG MAC files -->
141+
<Value name = "nonco2_energy">../input/gcamdata/xml/all_energy_emissions_MAC.xml</Value>
142+
<Value name = "nonco2_fgas">../input/gcamdata/xml/all_fgas_emissions_MAC.xml</Value>
143+
<Value name = "nonco2_aglu">../input/gcamdata/xml/all_aglu_emissions_IRR_MGMT_MAC.xml</Value>
144+
<Value name = "nonco2_proc">../input/gcamdata/xml/ind_urb_processing_sectors_MAC.xml</Value>
145+
146+
<!-- USA nonGHG files -->
147+
<Value name = "bld_emiss_USA">../input/gcamdata/xml/bld_emissions_USA.xml</Value>
148+
<Value name = "othertrn_emiss_USA">../input/gcamdata/xml/othertrn_emissions_USA.xml</Value>
149+
<Value name = "indenergy_emiss_USA">../input/gcamdata/xml/indenergy_emissions_USA.xml</Value>
150+
<Value name = "elc_emiss_USA">../input/gcamdata/xml/elc_emissions_USA.xml</Value>
151+
<Value name = "transport_emiss_USA">../input/gcamdata/xml/transport_emissions_USA.xml</Value>
152+
<Value name = "prc_usa">../input/gcamdata/xml/ind_urb_processing_sectors_USA.xml</Value>
153+
<Value name = "process_emiss_USA">../input/gcamdata/xml/ind_urb_proc_emissions_USA.xml</Value>
154+
<Value name = "refining_emiss_USA">../input/gcamdata/xml/refinery_emissions_USA.xml</Value>
155+
130156
<Value name = "ghg_usa">../input/gcamdata/xml/trn_ghg_emissions_USA.xml</Value>
131157

132158
<Value name = "solver">../input/solution/cal_broyden_config.xml</Value>

0 commit comments

Comments
 (0)