1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976 |
- ///////////////////////////////////////////////////////////////////////////////////////
- /// \file outputmodule.cpp
- /// \brief Implementation of the common output module
- ///
- /// \author Joe Siltberg
- /// $Date: 2015-04-09 18:40:34 +0200 (Thu, 09 Apr 2015) $
- ///
- ///////////////////////////////////////////////////////////////////////////////////////
- #include "config.h"
- #include "miscoutput.h"
- #include "parameters.h"
- #include "guess.h"
- // ecev3 - add lpjguess_to_string to avoid problems with std library to_string not being available on NSC platforms
- #include <string.h>
- #include <sstream>
- using namespace std;
- std::string lpjguess_to_string(double d) {
- std::ostringstream os;
- os << d;
- return os.str();
- }
- namespace GuessOutput {
- // Nitrogen output is in kgN/ha instead of kgC/m2 as for carbon
- const double m2toha = 10000.0;
- REGISTER_OUTPUT_MODULE("misc", MiscOutput)
- MiscOutput::MiscOutput() {
- // Annual output variables
- declare_parameter("file_cmass_cropland", &file_cmass_cropland, 300, "Annual cropland cmass output file");
- declare_parameter("file_cmass_pasture", &file_cmass_pasture, 300, "Annual pasture cmass output file");
- declare_parameter("file_cmass_natural", &file_cmass_natural, 300, "Annual natural vegetation cmass output file");
- declare_parameter("file_cmass_forest", &file_cmass_forest, 300, "Annual managed forest cmass output file");
- declare_parameter("file_anpp_cropland", &file_anpp_cropland, 300, "Annual cropland NPP output file");
- declare_parameter("file_anpp_pasture", &file_anpp_pasture, 300, "Annual pasture NPP output file");
- declare_parameter("file_anpp_natural", &file_anpp_natural, 300, "Annual natural vegetation NPP output file");
- declare_parameter("file_anpp_forest", &file_anpp_forest, 300, "Annual managed forest NPP output file");
- declare_parameter("file_yield", &file_yield, 300, "Crop yield output file");
- declare_parameter("file_yield1", &file_yield1, 300, "Crop first yield output file");
- declare_parameter("file_yield2", &file_yield2, 300, "Crop second yield output file");
- declare_parameter("file_sdate1", &file_sdate1, 300, "Crop first sowing date output file");
- declare_parameter("file_sdate2", &file_sdate2, 300, "Crop second sowing date output file");
- declare_parameter("file_hdate1", &file_hdate1, 300, "Crop first harvest date output file");
- declare_parameter("file_hdate2", &file_hdate2, 300, "Crop second harvest date output file");
- declare_parameter("file_lgp", &file_lgp, 300, "Crop length of growing period output file");
- declare_parameter("file_phu", &file_phu, 300, "Crop potential heat units output file");
- declare_parameter("file_fphu", &file_fphu, 300, "Crop attained fraction of potential heat units output file");
- declare_parameter("file_fhi", &file_fhi, 300, "Crop attained fraction of harvest index output file");
- declare_parameter("file_irrigation", &file_irrigation, 300, "Crop irrigation output file");
- declare_parameter("file_seasonality", &file_seasonality, 300, "Seasonality output file");
- declare_parameter("file_mco2", &file_mco2, 300, "Monthly CO2 output file");
- declare_parameter("file_cflux_cropland", &file_cflux_cropland, 300, "C fluxes output file");
- declare_parameter("file_cflux_pasture", &file_cflux_pasture, 300, "C fluxes output file");
- declare_parameter("file_cflux_natural", &file_cflux_natural, 300, "C fluxes output file");
- declare_parameter("file_cflux_forest", &file_cflux_forest, 300, "C fluxes output file");
- declare_parameter("file_dens_natural", &file_dens_natural, 300, "Natural vegetation tree density output file");
- declare_parameter("file_dens_forest", &file_dens_forest, 300, "Managed forest tree density output file");
- declare_parameter("file_cpool_cropland", &file_cpool_cropland, 300, "Soil C output file");
- declare_parameter("file_cpool_pasture", &file_cpool_pasture, 300, "Soil C output file");
- declare_parameter("file_cpool_natural", &file_cpool_natural, 300, "Soil C output file");
- declare_parameter("file_cpool_forest", &file_cpool_forest, 300, "Soil C output file");
- declare_parameter("file_nflux_cropland", &file_nflux_cropland, 300, "N fluxes output file");
- declare_parameter("file_nflux_pasture", &file_nflux_pasture, 300, "N fluxes output file");
- declare_parameter("file_nflux_natural", &file_nflux_natural, 300, "N fluxes output file");
- declare_parameter("file_nflux_forest", &file_nflux_forest, 300, "N fluxes output file");
- declare_parameter("file_npool_cropland", &file_npool_cropland, 300, "Soil N output file");
- declare_parameter("file_npool_pasture", &file_npool_pasture, 300, "Soil N output file");
- declare_parameter("file_npool_natural", &file_npool_natural, 300, "Soil N output file");
- declare_parameter("file_npool_forest", &file_npool_forest, 300, "Soil N output file");
- //daily
- declare_parameter("file_daily_lai", &file_daily_lai, 300, "Daily output.");
- declare_parameter("file_daily_npp", &file_daily_npp, 300, "Daily output.");
- declare_parameter("file_daily_nmass", &file_daily_nmass, 300, "Daily output.");
- declare_parameter("file_daily_ndemand", &file_daily_ndemand, 300, "Daily output.");
- declare_parameter("file_daily_cmass", &file_daily_cmass, 300, "Daily output.");
- declare_parameter("file_daily_cton", &file_daily_cton, 300, "Daily output.");
- declare_parameter("file_daily_cmass_leaf", &file_daily_cmass_leaf, 300, "Daily output.");
- declare_parameter("file_daily_nmass_leaf", &file_daily_nmass_leaf, 300, "Daily output.");
- declare_parameter("file_daily_cmass_root", &file_daily_cmass_root, 300, "Daily output.");
- declare_parameter("file_daily_nmass_root", &file_daily_nmass_root, 300, "Daily output.");
- declare_parameter("file_daily_cmass_stem", &file_daily_cmass_stem, 300, "Daily output.");
- declare_parameter("file_daily_nmass_stem", &file_daily_nmass_stem, 300, "Daily output.");
- declare_parameter("file_daily_cmass_storage", &file_daily_cmass_storage, 300, "Daily output.");
- declare_parameter("file_daily_nmass_storage", &file_daily_nmass_storage, 300, "Daily output.");
- declare_parameter("file_daily_cmass_dead_leaf", &file_daily_cmass_dead_leaf, 300, "Daily output.");
- declare_parameter("file_daily_nmass_dead_leaf", &file_daily_nmass_dead_leaf, 300, "Daily output.");
- declare_parameter("file_daily_n_input_soil", &file_daily_n_input_soil, 300, "Daily output.");
- declare_parameter("file_daily_avail_nmass_soil", &file_daily_avail_nmass_soil, 300, "Daily output.");
- declare_parameter("file_daily_upper_wcont", &file_daily_upper_wcont, 300, "Daily output.");
- declare_parameter("file_daily_lower_wcont", &file_daily_lower_wcont, 300, "Daily output.");
- declare_parameter("file_daily_irrigation", &file_daily_irrigation, 300, "Daily output.");
- declare_parameter("file_daily_nminleach", &file_daily_nminleach, 300, "Daily output.");
- declare_parameter("file_daily_norgleach", &file_daily_norgleach, 300, "Daily output.");
- declare_parameter("file_daily_nuptake", &file_daily_nuptake, 300, "Daily output.");
- declare_parameter("file_daily_temp", &file_daily_temp, 300, "Daily output.");
- declare_parameter("file_daily_prec", &file_daily_prec, 300, "Daily output.");
- declare_parameter("file_daily_rad", &file_daily_rad, 300, "Daily output.");
- declare_parameter("file_daily_fphu", &file_daily_fphu, 300, "Daily DS output file"); //daglig ds
- if (ifnlim) {
- declare_parameter("file_daily_ds", &file_daily_ds, 300, "Daily DS output file"); //daglig ds
- declare_parameter("file_daily_stem", &file_daily_stem, 300, "Daily stem allocation output file");
- declare_parameter("file_daily_leaf", &file_daily_leaf, 300, "Daily leaf allocation output file");
- declare_parameter("file_daily_root", &file_daily_root, 300, "Daily root allocation output file");
- declare_parameter("file_daily_storage", &file_daily_storage, 300, "Daily storage allocation output file");
- }
- declare_parameter("file_baresoilFrac_yearly", &file_baresoilFrac_yearly, 300, "Gridcell fraction covered by bare soils [-]");
- declare_parameter("file_residualFrac_yearly", &file_residualFrac_yearly, 300, "Gridcell fraction covered by by non-vegetation and non-bare-soil [-]");
- declare_parameter("file_cLitter_yearly", &file_cLitter_yearly, 300, "Carbon in vegetation [kg C m-2]");
- declare_parameter("file_cLitterLut_yearly", &file_cLitterLut_yearly, 300, "Carbon in Above and Below Ground Litter Pools on Land Use Tiles [kg m-2]");
- declare_parameter("file_cProduct_yearly", &file_cProduct_yearly, 300, "Carbon in vegetation [kg C m-2]");
- declare_parameter("file_cProductLut_yearly", &file_cProductLut_yearly, 300, "Wood and agricultural product pool carbon associated with land use tiles; examples of products include paper, cardboard, timber for construction, and crop harvest for food or fuel.[kg m-2]");
- declare_parameter("file_cropFrac_yearly", &file_cropFrac_yearly, 300, "Gridcell fraction covered by crops [-]");
- declare_parameter("file_cSoil_yearly", &file_cSoil_yearly, 300, "Carbon in vegetation [kg C m-2]");
- declare_parameter("file_cSoilLut_yearly", &file_cSoilLut_yearly, 300, "Carbon in soil pool on land use tiles [kg m-2]");
- declare_parameter("file_cVeg_yearly", &file_cVeg_yearly, 300, "Carbon in vegetation [kg C m-2]");
- declare_parameter("file_cVegLut_yearly", &file_cVegLut_yearly, 300, "Carbon in vegetation on land use tiles [kg m-2]");
- declare_parameter("file_fracInLut_yearly", &file_fracInLut_yearly, 300, "Gross fraction that was transferred into this tile from other land use tiles [%]");
- declare_parameter("file_fracLut_yearly", &file_fracLut_yearly, 300, "Fraction of grid cell for each land use tile [%]");
- declare_parameter("file_fracOutLut_yearly", &file_fracOutLut_yearly, 300, "Gross fraction of land use tile that was transferred into other land use tiles [%]");
- declare_parameter("file_grassFrac_yearly", &file_grassFrac_yearly, 300, "Gridcell fraction covered by grass [-]");
- declare_parameter("file_pastureFrac_yearly", &file_pastureFrac_yearly, 300, "Gridcell fraction covered by pasture [-]");
- declare_parameter("file_shrubFrac_yearly", &file_shrubFrac_yearly, 300, "Gridcell fraction covered by shrubs [-]");
- declare_parameter("file_treeFrac_yearly", &file_treeFrac_yearly, 300, "Gridcell fraction covered by trees [-]");
- declare_parameter("file_vegFrac_yearly", &file_vegFrac_yearly, 300, "Gridcell fraction covered by vegetation [-]");
- declare_parameter("file_burntFractionAll_yearly", &file_burntFractionAll_yearly, 300, "Percentage of grid cell burned due to all fires including natural (should also include anthropogenic fires and those associated with anthropogenic Land-use change but doesn't) [-]");
- declare_parameter("file_burntFractionAll_monthly", &file_burntFractionAll_monthly, 300, "Percentage of grid cell burned due to all fires including natural (should also include anthropogenic fires and those associated with anthropogenic Land-use change but doesn't) [-]");
- declare_parameter("file_cLand_monthly", &file_cLand_monthly, 300, "Carbon on Land [kg C m-2]");
- declare_parameter("file_cLand1_monthly", &file_cLand1_monthly, 300, "Carbon on Land on 1st day of month [kg C m-2]");
- declare_parameter("file_cLandYr_yearly", &file_cLand_yearly, 300, "Carbon on Land [kg C m-2]");
- declare_parameter("file_cFluxYr_yearly", &file_cFlux_yearly, 300, "Yearly flux to the atmosphere [kg C m-2]");
- declare_parameter("file_cLitterCwd_monthly", &file_cLitterCwd_monthly, 300, "Carbon in Cwd litter [kg C m-2]");
- declare_parameter("file_cLitterSubSurf_monthly", &file_cLitterSubSurf_monthly, 300, "Carbon in sub surface litter [kg C m-2]");
- declare_parameter("file_cLitterSurf_monthly", &file_cLitterSurf_monthly, 300, "Carbon in surface litter [kg C m-2]");
- declare_parameter("file_cOther_monthly", &file_cOther_monthly, 300, "Carbon in other organs [kg C m-2]");
- declare_parameter("file_cropFracC3_monthly", &file_cropFracC3_monthly, 300, "C3 Crop Area Percentage [%]");
- declare_parameter("file_cropFracC4_monthly", &file_cropFracC4_monthly, 300, "C4 Crop Area Percentage [%]");
- declare_parameter("file_cSoil_monthly", &file_cSoil_monthly, 300, "Carbon in soil [kg C m-2]");
- declare_parameter("file_cStem_monthly", &file_cStem_monthly, 300, "Carbon in stem [kg C m-2]");
- declare_parameter("file_cTotFireLut_monthly", &file_cTotFireLut_monthly, 300, "Carbon loss from natural and managed fire on land use tile, including deforestation fires [kg m-2 s-1]");
- declare_parameter("file_cWood_monthly", &file_cWood_monthly, 300, "Carbon in wood [kg C m-2]");
- declare_parameter("file_evspsblpot_monthly", &file_evspsblpot_monthly, 300, "Potential Evapotranspiration [kg m-2 s-1]");
- declare_parameter("file_fAnthDisturb_monthly", &file_fAnthDisturb_monthly, 300, "CO2 Flux to Atmosphere from anthropogenic disturbance [kg C m-2 s-1]");
- declare_parameter("file_fBNF_monthly", &file_fBNF_monthly, 300, "Biological nitrogen fixation [kg N m-2 s-1]");
- declare_parameter("file_fCLandToOcean_monthly", &file_fCLandToOcean_monthly, 300, "Organic carbon leaching [kg C m-2 s-1]");
- declare_parameter("file_fDeforestToAtmos_monthly", &file_fDeforestToAtmos_monthly, 300, "CO2 Flux to Atmosphere from Land Use Change [kg C m-2 s-1]");
- declare_parameter("file_fDeforestToProduct_monthly", &file_fDeforestToProduct_monthly, 300, "Carbon Flux to Products from deforestation [kg C m-2 s-1]");
- declare_parameter("file_fFireAll_monthly", &file_fFireAll_monthly, 300, "CO2 Emission from all Fire [kg C m-2 s-1]");
- declare_parameter("file_fFireNat_monthly", &file_fFireNat_monthly, 300, "CO2 Emission from natural Fire [kg C m-2 s-1]");
- declare_parameter("file_fHarvestToAtmos_monthly", &file_fHarvestToAtmos_monthly, 300, "CO2 Emission from harvest [kg C m-2 s-1]");
- declare_parameter("file_fLitterFire_monthly", &file_fLitterFire_monthly, 300, "CO2 Emission from natural litter Fire [kg C m-2 s-1]");
- declare_parameter("file_fLuc_monthly", &file_fLuc_monthly, 300, "CO2 Flux to Atmosphere from land uce change [kg C m-2 s-1]");
- declare_parameter("file_fLulccAtmLut_monthly", &file_fLulccAtmLut_monthly, 300, "Carbon transferred directly to atmosphere due to any land-use or land-cover change activities including deforestation or agricultural fire [kg m-2 s-1]");
- declare_parameter("file_fLulccProductLut_monthly", &file_fLulccProductLut_monthly, 300, "Carbon harvested due to land-use or land-cover change that enters anthropogenic product pools on tile [kg m-2 s-1]");
- declare_parameter("file_fLulccResidueLut_monthly", &file_fLulccResidueLut_monthly, 300, "Carbon transferred to soil or litter pools due to land-use or land-cover change processes on tile [kg m-2 s-1]");
- declare_parameter("file_fNAnthDisturb_monthly", &file_fNAnthDisturb_monthly, 300, "Nitrogen Flux to Atmosphere from anthropogenic disturbance [kg N m-2 s-1]");
- declare_parameter("file_fNdep_monthly", &file_fNdep_monthly, 300, "Nitrogen deposition [kg N m-2 s-1]");
- declare_parameter("file_fNfert_monthly", &file_fNfert_monthly, 300, "Total nitrogen fertilisation to the ecosystem [kg N m-2 s-1]");
- declare_parameter("file_fNgas_monthly", &file_fNgas_monthly, 300, "Nitrogen gas flux [kg N m-2 s-1]");
- declare_parameter("file_fNgasFire_monthly", &file_fNgasFire_monthly, 300, "Nitrogen fire gas flux [kg N m-2 s-1]");
- declare_parameter("file_fNgasNonFire_monthly", &file_fNgasNonFire_monthly, 300, "Nitrogen non fire gas flux [kg N m-2 s-1]");
- declare_parameter("file_fNLandToOcean_monthly", &file_fNLandToOcean_monthly, 300, "Organic and mineral nitrogen leaching [kg C m-2 s-1]");
- declare_parameter("file_fNleach_monthly", &file_fNleach_monthly, 300, "Nitrogen leached [kg N m-2 s-1]");
- declare_parameter("file_fNLitterSoil_monthly", &file_fNLitterSoil_monthly, 300, "Total Nitrogen Flux from Litter to Soil [kg N m-2 s-1]");
- declare_parameter("file_fNloss_monthly", &file_fNloss_monthly, 300, "Total nitrogen loss from the ecosystem [kg N m-2 s-1]");
- declare_parameter("file_fNnetmin_monthly", &file_fNnetmin_monthly, 300, "Net Nitrogen Mineralisation [kg N m-2 s-1]");
- declare_parameter("file_fNProduct_monthly", &file_fNProduct_monthly, 300, "Nitrogen Flux to Products from Vegetation [kg N m-2 s-1]");
- declare_parameter("file_fNup_monthly", &file_fNup_monthly, 300, "Plant nitrogen uptake [kg N m-2 s-1]");
- declare_parameter("file_fNVegLitter_monthly", &file_fNVegLitter_monthly, 300, "Total nitrogen Flux from Vegetation to Litter [kg C m-2 s-1]");
- declare_parameter("file_fProductDecomp_monthly", &file_fProductDecomp_monthly, 300, "Carbon Flux to Athmosphere from Products [kg C m-2 s-1]");
- declare_parameter("file_fProductDecompLut_monthly", &file_fProductDecompLut_monthly, 300, "Flux from wood and agricultural product pools on land use tile into atmosphere [kg m-2 s-1]");
- declare_parameter("file_fracLut_monthly", &file_fracLut_monthly, 300, "Fraction of grid cell for each land use tile [%]");
- declare_parameter("file_fVegFire_monthly", &file_fVegFire_monthly, 300, "CO2 Emission from natural vegetation Fire [kg C m-2 s-1]");
- declare_parameter("file_gppGrass_monthly", &file_gppGrass_monthly, 300, "Gross Primary Production on grass tiles [kg C m-2 s-1]");
- declare_parameter("file_gppLut_monthly", &file_gppLut_monthly, 300, "Gross primary productivity on land use tile [kg m-2 s-1]");
- declare_parameter("file_gppTree_monthly", &file_gppTree_monthly, 300, "Gross Primary Production on tree tiles [kg C m-2 s-1]");
- declare_parameter("file_grassFracC3_monthly", &file_grassFracC3_monthly, 300, "C3 Grass Area Percentage [%]");
- declare_parameter("file_grassFracC4_monthly", &file_grassFracC4_monthly, 300, "C4 Grass Area Percentage [%]");
- declare_parameter("file_irrLut_monthly", &file_irrLut_monthly, 300, "Irrigation flux including any irrigation for crops, trees, pasture, or urban lawns [kg m-2 s-1]");
- declare_parameter("file_laiLut_monthly", &file_laiLut_monthly, 300, "Leaf Area Index on Land Use Tile []");
- declare_parameter("file_mrroLut_monthly", &file_mrroLut_monthly, 300, " Total runoff from land use tile [kg m-2 s-1]");
- declare_parameter("file_mrsll_monthly", &file_mrsll_monthly, 300, "Total liquid water content of soil layer [kg m-2]");
- declare_parameter("file_mrsol_monthly", &file_mrsol_monthly, 300, "Total water content of soil layer [kg m-2]");
- declare_parameter("file_mrsoLut_monthly", &file_mrsoLut_monthly, 300, "Total soil moisture of land use tile [kg m-2]");
- declare_parameter("file_mrsosLut_monthly", &file_mrsosLut_monthly, 300, "Moisture in Upper Portion of Soil Column of land use tile [kg m-2]");
- declare_parameter("file_necbLut_monthly", &file_necbLut_monthly, 300, "Net rate of C accumulation (or loss) on land use tile [kg m-2 s-1]");
- declare_parameter("file_nep_monthly", &file_nep_monthly, 300, "Carbon Mass Flux out of Atmosphere due to Net Biospheric Production on Land excluding fire from LU [kg C m-2 s-1]");
- declare_parameter("file_netAtmosLandCO2Flux_monthly", &file_netAtmosLandCO2Flux_monthly, 300, "Carbon Mass Flux out of Atmosphere due to Net Biospheric Production on Land [kg C m-2 s-1]");
- declare_parameter("file_nLand_monthly", &file_nLand_monthly, 300, "Nitrogen on Land [kg N m-2]");
- declare_parameter("file_nLeaf_monthly", &file_nLeaf_monthly, 300, "Nitrogen in leaf [kg N m-2]");
- declare_parameter("file_nLitter_monthly", &file_nLitter_monthly, 300, "Nitrogen in litter [kg N m-2]");
- declare_parameter("file_nLitterCwd_monthly", &file_nLitterCwd_monthly, 300, "Nitrogen in Cwd litter [kg N m-2]");
- declare_parameter("file_nLitterSubSurf_monthly", &file_nLitterSubSurf_monthly, 300, "Nitrogen in sub surface litter [kg N m-2]");
- declare_parameter("file_nLitterSurf_monthly", &file_nLitterSurf_monthly, 300, "Nitrogen in surface litter [kg N m-2]");
- declare_parameter("file_nMineral_monthly", &file_nMineral_monthly, 300, "Total mineral N in soil [kg N m-2]");
- declare_parameter("file_fN2O_monthly", &file_fN2O_monthly, 300, "Total land N2O flux [kg N m-2 s-1]");
- declare_parameter("file_fNOx_monthly", &file_fNOx_monthly, 300, "Total land NOx flux [kg N m-2 s-1]");
- declare_parameter("file_nMineralNH4_monthly", &file_nMineralNH4_monthly, 300, "Total mineral NH4 in soil [kg N m-2]");
- declare_parameter("file_nMineralNO3_monthly", &file_nMineralNO3_monthly, 300, "Total mineral NO3 in soil [kg N m-2]");
- declare_parameter("file_nOther_monthly", &file_nOther_monthly, 300, "Nitrogen in other organs [kg N m-2]");
- declare_parameter("file_nppGrass_monthly", &file_nppGrass_monthly, 300, "Net Primary Production on grass tiles [kg C m-2 s-1]");
- declare_parameter("file_nppLut_monthly", &file_nppLut_monthly, 300, "Net primary productivity on land use tile [kg m-2 s-1]");
- declare_parameter("file_nppTree_monthly", &file_nppTree_monthly, 300, "Net Primary Production on tree tiles [kg C m-2 s-1]");
- declare_parameter("file_nProduct_monthly", &file_nProduct_monthly, 300, "Nitrogen in products [kg N m-2]");
- declare_parameter("file_nRoot_monthly", &file_nRoot_monthly, 300, "Nitrogen in root [kg N m-2]");
- declare_parameter("file_nSoil_monthly", &file_nSoil_monthly, 300, "Nitrogen in soil [kg N m-2]");
- declare_parameter("file_nStem_monthly", &file_nStem_monthly, 300, "Nitrogen in stem [kg N m-2]");
- declare_parameter("file_nwdFracLut_monthly", &file_nwdFracLut_monthly, 300, "Fraction of land use tile that is non-woody vegetation ( e.g. herbaceous crops) [kg m-2 s-1]");
- declare_parameter("file_nVeg_monthly", &file_nVeg_monthly, 300, "Nitrogen in vegetation [kg N m-2]");
- declare_parameter("file_pastureFracC3_monthly", &file_pastureFracC3_monthly, 300, "C3 Pasture Area Percentage [%]");
- declare_parameter("file_pastureFracC4_monthly", &file_pastureFracC4_monthly, 300, "C4 Pasture Area Percentage [%]");
- declare_parameter("file_prCrop_monthly", &file_prCrop_monthly, 300, "Precipitation on crop [kg m-2 s-1]");
- declare_parameter("file_raGrass_monthly", &file_raGrass_monthly, 300, "Autotrophic respiration on grass tiles [kg C m-2 s-1]");
- declare_parameter("file_raLeaf_monthly", &file_raLeaf_monthly, 300, "Autotrophic Respiration from leaves [kg C m-2 s-1]");
- declare_parameter("file_raLut_monthly", &file_raLut_monthly, 300, "Plant respiration on land use tile [kg m-2 s-1]");
- declare_parameter("file_raOther_monthly", &file_raOther_monthly, 300, "Autotrophic Respiration from other compartments [kg C m-2 s-1]");
- declare_parameter("file_raRoot_monthly", &file_raRoot_monthly, 300, "Autotrophic Respiration from roots [kg C m-2 s-1]");
- declare_parameter("file_raStem_monthly", &file_raStem_monthly, 300, "Autotrophic Respiration from stem [kg C m-2 s-1]");
- declare_parameter("file_raTree_monthly", &file_raTree_monthly, 300, "Autotrophic respiration on tree tiles [kg C m-2 s-1]");
- declare_parameter("file_rhLitter_monthly", &file_rhLitter_monthly, 300, "Litter Respiration [kg C m-2 s-1]");
- declare_parameter("file_rhLut_monthly", &file_rhLut_monthly, 300, "Soil heterotrophic respiration on land use tile [kg m-2 s-1]");
- declare_parameter("file_rhSoil_monthly", &file_rhSoil_monthly, 300, "Soil Respiration [kg C m-2 s-1]");
- declare_parameter("file_treeFracBdlDcd_monthly", &file_treeFracBdlDcd_monthly, 300, "Broadleaf deciduous tree fraction [%]");
- declare_parameter("file_treeFracBdlEvg_monthly", &file_treeFracBdlEvg_monthly, 300, "Broadleaf evergreen tree fraction [%]");
- declare_parameter("file_treeFracNdlDcd_monthly", &file_treeFracNdlDcd_monthly, 300, "Needleleaf deciduous tree fraction [%]");
- declare_parameter("file_treeFracNdlEvg_monthly", &file_treeFracNdlEvg_monthly, 300, "Needleleaf evergreen tree fraction [%]");
- declare_parameter("file_vegFrac_monthly", &file_vegFrac_monthly, 300, "Gridcell fraction covered by any kind of vegetation [-]");
- declare_parameter("file_vegHeightTree_monthly", &file_vegHeightTree_monthly, 300, "Average tree height [m]");
- declare_parameter("file_baresoilFrac_monthly", &file_baresoilFrac_monthly, 300, "Gridcell fraction covered by bare soil [-]");
- declare_parameter("file_cCwd_monthly", &file_cCwd_monthly, 300, "Carbon in sub surface cwd [kg C m-2]");
- declare_parameter("file_cLeaf_monthly", &file_cLeaf_monthly, 300, "Carbon in leaf [kg C m-2]");
- declare_parameter("file_cLitter_monthly", &file_cLitter_monthly, 300, "Carbon in litter [kg C m-2]");
- declare_parameter("file_cLitterAbove_monthly", &file_cLitterAbove_monthly, 300, "Carbon in above surface litter [kg C m-2]");
- declare_parameter("file_cLitterBelow_monthly", &file_cLitterBelow_monthly, 300, "Carbon in below surface litter [kg C m-2]");
- declare_parameter("file_cProduct_monthly", &file_cProduct_monthly, 300, "Carbon in products [kg C m-2]");
- declare_parameter("file_cRoot_monthly", &file_cRoot_monthly, 300, "Carbon in root [kg C m-2]");
- declare_parameter("file_cropFrac_monthly", &file_cropFrac_monthly, 300, "Gridcell fraction covered by crop [-]");
- declare_parameter("file_cSoilFast_monthly", &file_cSoilFast_monthly, 300, "Carbon Mass in Fast Soil Pool [kg C m-2]");
- declare_parameter("file_cSoilMedium_monthly", &file_cSoilMedium_monthly, 300, "Carbon Mass in Medium Soil Pool [kg C m-2]");
- declare_parameter("file_cSoilSlow_monthly", &file_cSoilSlow_monthly, 300, "Carbon Mass in Slow Soil Pool [kg C m-2]");
- declare_parameter("file_cVeg_monthly", &file_cVeg_monthly, 300, "Carbon in vegetation [kg C m-2]");
- declare_parameter("file_evspsblsoi_monthly", &file_evspsblsoi_monthly, 300, "Water Evaporation from Soil [kg m-2 s-1]");
- declare_parameter("file_evspsblveg_monthly", &file_evspsblveg_monthly, 300, "Total evaporation from Canopy [kg m-2 s-1]");
- declare_parameter("file_evspsbl_monthly", &file_evspsbl_monthly, 300, "Total Evapotranspiration [kg m-2 s-1] [kg m-2 s-1]");
- declare_parameter("file_fco2antt_monthly", &file_fCO2antt_monthly, 300, "Carbon Mass Flux into Atmosphere Due to All Anthropogenic Emissions of CO2 [kg C m-2 s-1]");
- declare_parameter("file_fco2nat_monthly", &file_fCO2nat_monthly, 300, "Surface Carbon Mass Flux into the Atmosphere Due to Natural Sources [kg C m-2 s-1]");
- declare_parameter("file_fFire_monthly", &file_fFire_monthly, 300, "CO2 Emission from natural Fire [kg C m-2 s-1]");
- declare_parameter("file_fGrazing_monthly", &file_fGrazing_monthly, 300, "Carbon Mass Flux into Atmosphere due to Grazing on Land [kg C m-2 s-1]");
- declare_parameter("file_fHarvest_monthly", &file_fHarvest_monthly, 300, "CO2 Emission from harvest and products [kg C m-2 s-1]");
- declare_parameter("file_fLitterSoil_monthly", &file_fLitterSoil_monthly, 300, "Total Carbon Flux from Litter to Soil [kg C m-2 s-1]");
- declare_parameter("file_fVegLitter_monthly", &file_fVegLitter_monthly, 300, "Total Carbon Flux from Vegetation to Litter [kg C m-2 s-1]");
- declare_parameter("file_fVegOther_monthly", &file_fVegOther_monthly, 300, "Total Carbon Flux from Vegetation to Other [kg C m-2 s-1]");
- declare_parameter("file_gpp_monthly", &file_gpp_monthly, 300, "Gross Primary Production [kg C m-2 s-1]");
- declare_parameter("file_grassFrac_monthly", &file_grassFrac_monthly, 300, "Gridcell fraction covered by grass [-]");
- declare_parameter("file_lai_monthly", &file_lai_monthly, 300, "Leaf Area Index [m2 m-2]");
- declare_parameter("file_landCoverFrac_monthly", &file_landCoverFrac_monthly, 300, "Fractional Land Cover of PFT");
- declare_parameter("file_mrro_monthly", &file_mrro_monthly, 300, "Total Runoff [kg m-2 s-1]");
- declare_parameter("file_mrros_monthly", &file_mrros_monthly, 300, "Total Surface Runoff [kg m-2 s-1]");
- declare_parameter("file_mrso_monthly", &file_mrso_monthly, 300, "Soil Water Content [kg m-2]");
- declare_parameter("file_mrsos_monthly", &file_mrsos_monthly, 300, "Moisture in Upper Portion of Soil Column [kg m-2]");
- declare_parameter("file_nbp_monthly", &file_nbp_monthly, 300, "Carbon Mass Flux out of Atmosphere due to Net Biospheric Production on Land [kg C m-2 s-1]");
- declare_parameter("file_npp_monthly", &file_npp_monthly, 300, "Net Primary Production [kg C m-2 s-1]");
- declare_parameter("file_pastureFrac_monthly", &file_pastureFrac_monthly, 300, "Gridcell fraction covered by pasture [-]");
- declare_parameter("file_prveg_monthly", &file_prveg_monthly, 300, "Total intercepted water on Canopy (interception) [kg m-2 s-1]");
- declare_parameter("file_ra_monthly", &file_ra_monthly, 300, "Autotrophic (Plant) Respiration [kg C m-2 s-1]");
- declare_parameter("file_residualFrac_monthly", &file_residualFrac_monthly, 300, "Gridcell fraction covered by non-vegetation and non-bare-soil [-]");
- declare_parameter("file_rGrowth_monthly", &file_rGrowth_monthly, 300, "Autotrophic Respiration associated to growth [kg C m-2 s-1]");
- declare_parameter("file_rh_monthly", &file_rh_monthly, 300, "Heterotrophic Respiration [kg C m-2 s-1]");
- declare_parameter("file_rMaint_monthly", &file_rMaint_monthly, 300, "Autotrophic Respiration [kg C m-2 s-1]");
- declare_parameter("file_shrubFrac_monthly", &file_shrubFrac_monthly, 300, "Gridcell fraction covered by shrub [-]");
- declare_parameter("file_tran_monthly", &file_tran_monthly, 300, "Transpiration [kg m-2 s-1]");
- declare_parameter("file_treeFrac_monthly", &file_treeFrac_monthly, 300, "Gridcell fraction covered by trees [-]");
- declare_parameter("file_tsl_monthly", &file_tsl_monthly, 300, "Top soil layer temperature [C]");
- declare_parameter("file_ec_daily", &file_ec_daily, 300, "Total interception evaporation from Canopy [kg m-2 s-1]");
- declare_parameter("file_et_daily", &file_et_daily, 300, "Total Evapotranspiration [kg m-2 s-1]");
- declare_parameter("file_evspsblpot_daily", &file_evspsblpot_daily, 300, "Potential Evapotranspiration [kg m-2 s-1]");
- declare_parameter("file_lai_daily", &file_lai_daily, 300, "Leaf Area Index [m2 m-2]");
- declare_parameter("file_mrsll_daily", &file_mrsll_daily, 300, "Total liquid water content of soil layer [kg m-2]");
- declare_parameter("file_mrso_daily", &file_mrso_daily, 300, "Total water content of soil [Kg m-2]");
- declare_parameter("file_mrsol_daily", &file_mrsol_daily, 300, "Total water content of soil layer [Kg m-2]");
- declare_parameter("file_mrsos_daily", &file_mrsos_daily, 300, "Total water content of upper soil portion [Kg m-2]");
- declare_parameter("file_mrro_daily", &file_mrro_daily, 300, "Total runoff [Kg m-2]");
- declare_parameter("file_prCrop_daily", &file_prCrop_daily, 300, "Precipitation on crop [kg m-2 s-1]");
- declare_parameter("file_tran_daily", &file_tran_daily, 300, "Transpiration [kg m-2 s-1]");
- declare_parameter("file_tsl_daily", &file_tsl_daily, 300, "Temperature of Soil [K]");
- declare_parameter("file_prveg_daily", &file_prveg_daily, 300, "Total intercepted water on Canopy [kg m-2 s-1]");
- }
- MiscOutput::~MiscOutput() {
- }
- /// Define all output tables and their formats
- void MiscOutput::init() {
- define_output_tables();
- define_cmip6_and_crescendo_output_tables();
- }
- /// Specify all columns in all output tables
- /** This function specifies all columns in all output tables, their names,
- * column widths and precision.
- *
- * For each table a TableDescriptor object is created which is then sent to
- * the output channel to create the table.
- */
- void MiscOutput::define_output_tables() {
- // create a vector with the pft names
- std::vector<std::string> pfts;
- // create a vector with the crop pft names
- std::vector<std::string> crop_pfts;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- pfts.push_back((char*)pft.name);
- if (pft.landcover == CROPLAND)
- crop_pfts.push_back((char*)pft.name);
- pftlist.nextobj();
- }
- // create a vector with the landcover column titles
- std::vector<std::string> landcovers;
- const char* landcover_string[] = { "Urban_sum", "Crop_sum", "Pasture_sum",
- "Forest_sum", "Natural_sum", "Peatland_sum", "Barren_sum" };
- for (int i = 0; i<NLANDCOVERTYPES; i++) {
- if (run[i]) {
- landcovers.push_back(landcover_string[i]);
- }
- }
- // Create the month columns
- ColumnDescriptors month_columns;
- ColumnDescriptors month_columns_wide;
- xtring months[] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
- for (int i = 0; i < 12; i++) {
- month_columns += ColumnDescriptor(months[i], 8, 3);
- month_columns_wide += ColumnDescriptor(months[i], 10, 3);
- }
- // Create the columns for each output file
- // CMASS
- ColumnDescriptors cmass_columns;
- cmass_columns += ColumnDescriptors(pfts, 8, 3);
- cmass_columns += ColumnDescriptor("Total", 8, 3);
- ColumnDescriptors cmass_columns_lc = cmass_columns;
- cmass_columns += ColumnDescriptors(landcovers, 13, 3);
- // ANPP
- ColumnDescriptors anpp_columns = cmass_columns;
- ColumnDescriptors anpp_columns_lc = cmass_columns_lc;
- // DENS
- ColumnDescriptors dens_columns;
- dens_columns += ColumnDescriptors(pfts, 8, 4);
- dens_columns += ColumnDescriptor("Total", 8, 4);
- ColumnDescriptors dens_columns_lc = dens_columns;
- // CFLUX
- ColumnDescriptors cflux_columns;
- cflux_columns += ColumnDescriptor("Veg", 8, 3);
- cflux_columns += ColumnDescriptor("Repr", 8, 3);
- cflux_columns += ColumnDescriptor("Soil", 8, 3);
- cflux_columns += ColumnDescriptor("Fire", 8, 3);
- cflux_columns += ColumnDescriptor("Est", 8, 3);
- cflux_columns += ColumnDescriptor("Seed", 8, 3);
- cflux_columns += ColumnDescriptor("Harvest", 9, 3);
- cflux_columns += ColumnDescriptor("LU_ch", 9, 3);
- cflux_columns += ColumnDescriptor("Slow_h", 9, 3);
- cflux_columns += ColumnDescriptor("NEE", 10, 5);
- // CPOOL
- ColumnDescriptors cpool_columns;
- cpool_columns += ColumnDescriptor("VegC", 8, 3);
- if (!ifcentury) {
- cpool_columns += ColumnDescriptor("LittC", 8, 3);
- cpool_columns += ColumnDescriptor("SoilfC", 8, 3);
- cpool_columns += ColumnDescriptor("SoilsC", 8, 3);
- }
- else {
- cpool_columns += ColumnDescriptor("LitterC", 8, 3);
- cpool_columns += ColumnDescriptor("SoilC", 8, 3);
- }
- if (run_landcover && ifslowharvestpool) {
- cpool_columns += ColumnDescriptor("HarvSlowC", 10, 3);
- }
- cpool_columns += ColumnDescriptor("Total", 10, 3);
- //CROP YIELD
- ColumnDescriptors crop_columns;
- crop_columns += ColumnDescriptors(crop_pfts, 8, 3);
- //CROP SDATE & HDATE
- ColumnDescriptors date_columns;
- date_columns += ColumnDescriptors(crop_pfts, 8, 0);
- //IRRIGATION
- ColumnDescriptors irrigation_columns;
- irrigation_columns += ColumnDescriptor("Total", 10, 3);
- //SEASONALITY
- ColumnDescriptors seasonality_columns;
- seasonality_columns += ColumnDescriptor("Seasonal", 10, 0);
- seasonality_columns += ColumnDescriptor("V_temp", 10, 3);
- seasonality_columns += ColumnDescriptor("V_prec", 10, 3);
- seasonality_columns += ColumnDescriptor("temp_min", 10, 1);
- seasonality_columns += ColumnDescriptor("temp_mean", 10, 1);
- seasonality_columns += ColumnDescriptor("temp_seas", 10, 0);
- seasonality_columns += ColumnDescriptor("prec_min", 10, 2);
- seasonality_columns += ColumnDescriptor("prec", 10, 1);
- seasonality_columns += ColumnDescriptor("prec_range", 12, 0);
- // NPOOL
- ColumnDescriptors npool_columns;
- npool_columns += ColumnDescriptor("VegN", 9, 4);
- npool_columns += ColumnDescriptor("LitterN", 9, 4);
- npool_columns += ColumnDescriptor("SoilN", 9, 4);
- if (run_landcover && ifslowharvestpool) {
- npool_columns += ColumnDescriptor("HarvSlowN", 10, 4);
- }
- npool_columns += ColumnDescriptor("Total", 10, 4);
- // NFLUX
- ColumnDescriptors nflux_columns;
- nflux_columns += ColumnDescriptor("dep", 8, 2);
- nflux_columns += ColumnDescriptor("fix", 8, 2);
- nflux_columns += ColumnDescriptor("fert", 8, 2);
- nflux_columns += ColumnDescriptor("flux", 8, 2);
- nflux_columns += ColumnDescriptor("leach", 8, 2);
- if (run_landcover) {
- nflux_columns += ColumnDescriptor("seed", 8, 2);
- nflux_columns += ColumnDescriptor("harvest", 8, 2);
- nflux_columns += ColumnDescriptor("LU_ch", 8, 3);
- nflux_columns += ColumnDescriptor("Slow_h", 8, 3);
- }
- nflux_columns += ColumnDescriptor("NEE", 8, 2);
- ColumnDescriptors daily_columns;
- daily_columns += ColumnDescriptors(crop_pfts, 13, 3);
- ColumnDescriptors daily_columns_single;
- daily_columns_single += ColumnDescriptor("Total", 9, 3);
- // *** ANNUAL OUTPUT VARIABLES ***
- create_output_table(out_cmass_cropland, file_cmass_cropland, cmass_columns_lc);
- create_output_table(out_cmass_pasture, file_cmass_pasture, cmass_columns_lc);
- create_output_table(out_cmass_natural, file_cmass_natural, cmass_columns_lc);
- create_output_table(out_cmass_forest, file_cmass_forest, cmass_columns_lc);
- create_output_table(out_anpp_cropland, file_anpp_cropland, anpp_columns_lc);
- create_output_table(out_anpp_pasture, file_anpp_pasture, anpp_columns_lc);
- create_output_table(out_anpp_natural, file_anpp_natural, anpp_columns_lc);
- create_output_table(out_anpp_forest, file_anpp_forest, anpp_columns_lc);
- create_output_table(out_dens_natural, file_dens_natural, dens_columns_lc);
- create_output_table(out_dens_forest, file_dens_forest, dens_columns_lc);
- create_output_table(out_cflux_cropland, file_cflux_cropland, cflux_columns);
- create_output_table(out_cflux_pasture, file_cflux_pasture, cflux_columns);
- create_output_table(out_cflux_natural, file_cflux_natural, cflux_columns);
- create_output_table(out_cflux_forest, file_cflux_forest, cflux_columns);
- create_output_table(out_cpool_cropland, file_cpool_cropland, cpool_columns);
- create_output_table(out_cpool_pasture, file_cpool_pasture, cpool_columns);
- create_output_table(out_cpool_natural, file_cpool_natural, cpool_columns);
- create_output_table(out_cpool_forest, file_cpool_forest, cpool_columns);
- if (run_landcover && run[CROPLAND]) {
- create_output_table(out_yield, file_yield, crop_columns);
- create_output_table(out_yield1, file_yield1, crop_columns);
- create_output_table(out_yield2, file_yield2, crop_columns);
- create_output_table(out_sdate1, file_sdate1, date_columns);
- create_output_table(out_sdate2, file_sdate2, date_columns);
- create_output_table(out_hdate1, file_hdate1, date_columns);
- create_output_table(out_hdate2, file_hdate2, date_columns);
- create_output_table(out_lgp, file_lgp, date_columns);
- create_output_table(out_phu, file_phu, date_columns);
- create_output_table(out_fphu, file_fphu, crop_columns);
- create_output_table(out_fhi, file_fhi, crop_columns);
- create_output_table(out_seasonality, file_seasonality, seasonality_columns);
- }
- create_output_table(out_mco2, file_mco2, month_columns);
- if (run_landcover)
- create_output_table(out_irrigation, file_irrigation, irrigation_columns);
- create_output_table(out_npool_cropland, file_npool_cropland, npool_columns);
- create_output_table(out_npool_pasture, file_npool_pasture, npool_columns);
- create_output_table(out_npool_natural, file_npool_natural, npool_columns);
- create_output_table(out_npool_forest, file_npool_forest, npool_columns);
- create_output_table(out_nflux_cropland, file_nflux_cropland, nflux_columns);
- create_output_table(out_nflux_pasture, file_nflux_pasture, nflux_columns);
- create_output_table(out_nflux_natural, file_nflux_natural, nflux_columns);
- create_output_table(out_nflux_forest, file_nflux_forest, nflux_columns);
- // *** DAILY OUTPUT VARIABLES ***
- create_output_table(out_daily_lai, file_daily_lai, daily_columns);
- create_output_table(out_daily_npp, file_daily_npp, daily_columns);
- create_output_table(out_daily_ndemand, file_daily_ndemand, daily_columns);
- create_output_table(out_daily_nmass, file_daily_nmass, daily_columns);
- create_output_table(out_daily_cmass, file_daily_cmass, daily_columns);
- create_output_table(out_daily_nmass_leaf, file_daily_nmass_leaf, daily_columns);
- create_output_table(out_daily_cmass_leaf, file_daily_cmass_leaf, daily_columns);
- create_output_table(out_daily_nmass_root, file_daily_nmass_root, daily_columns);
- create_output_table(out_daily_cmass_root, file_daily_cmass_root, daily_columns);
- create_output_table(out_daily_nmass_stem, file_daily_nmass_stem, daily_columns);
- create_output_table(out_daily_cmass_stem, file_daily_cmass_stem, daily_columns);
- create_output_table(out_daily_nmass_storage, file_daily_nmass_storage, daily_columns);
- create_output_table(out_daily_cmass_storage, file_daily_cmass_storage, daily_columns);
- create_output_table(out_daily_nmass_dead_leaf, file_daily_nmass_dead_leaf, daily_columns);
- create_output_table(out_daily_cmass_dead_leaf, file_daily_cmass_dead_leaf, daily_columns);
- create_output_table(out_daily_n_input_soil, file_daily_n_input_soil, daily_columns);
- create_output_table(out_daily_avail_nmass_soil, file_daily_avail_nmass_soil, daily_columns);
- create_output_table(out_daily_upper_wcont, file_daily_upper_wcont, daily_columns);
- create_output_table(out_daily_lower_wcont, file_daily_lower_wcont, daily_columns);
- create_output_table(out_daily_irrigation, file_daily_irrigation, daily_columns);
- create_output_table(out_daily_temp, file_daily_temp, daily_columns);
- create_output_table(out_daily_prec, file_daily_prec, daily_columns);
- create_output_table(out_daily_rad, file_daily_rad, daily_columns);
- create_output_table(out_daily_cton, file_daily_cton, daily_columns);
- create_output_table(out_daily_nminleach, file_daily_nminleach, daily_columns);
- create_output_table(out_daily_norgleach, file_daily_norgleach, daily_columns);
- create_output_table(out_daily_nuptake, file_daily_nuptake, daily_columns);
- if (ifnlim) {
- create_output_table(out_daily_ds, file_daily_ds, daily_columns);
- create_output_table(out_daily_fphu, file_daily_fphu, daily_columns);
- create_output_table(out_daily_stem, file_daily_stem, daily_columns);
- create_output_table(out_daily_leaf, file_daily_leaf, daily_columns);
- create_output_table(out_daily_root, file_daily_root, daily_columns);
- create_output_table(out_daily_storage, file_daily_storage, daily_columns);
- }
- ColumnDescriptors mpft_columns;
- mpft_columns += ColumnDescriptors(pfts, 9, 4);
- create_output_table(out_mlambda, "mlambda.out", mpft_columns);
- }
- /// Specify all columns in all CMIP6 and CRESCENDO output tables
- /** This function specifies all columns in all output tables, their names,
- * column widths and precision for the CMIP6 and CRESCENDO projects.
- *
- * For each table a TableDescriptor object is created which is then sent to
- * the output channel to create the table.
- */
- void MiscOutput::define_cmip6_and_crescendo_output_tables() {
- if (!printcrescendo && !printcmip6 && !printcrescendodaily && !printcmip6daily && !printcrescendofacedaily)
- return;
- if (printcrescendo) {
- ColumnDescriptors single_column_8_2, single_column_9_3, single_column_11_5;
- single_column_8_2 += ColumnDescriptor("Total", 8, 2);
- single_column_9_3 += ColumnDescriptor("Total", 9, 3);
- single_column_11_5 += ColumnDescriptor("Total", 11, 5);
- ColumnDescriptors month_columns_7_2, month_columns_9_4, month_columns_11_6, month_columns_12_7, month_columns_15_10, month_columns_17_12;
- xtring months[] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
- for (int i = 0; i < 12; i++) {
- month_columns_7_2 += ColumnDescriptor(months[i], 7, 2);
- month_columns_9_4 += ColumnDescriptor(months[i], 9, 4);
- month_columns_11_6 += ColumnDescriptor(months[i], 11, 6);
- month_columns_12_7 += ColumnDescriptor(months[i], 12, 7);
- month_columns_15_10 += ColumnDescriptor(months[i], 15, 10);
- month_columns_17_12 += ColumnDescriptor(months[i], 17, 12);
- }
- // create a vector with soil layer names
- std::vector<std::string> soillayers;
- double soildepth[NSOILLAYER] = { SOILDEPTH_UPPER * 0.001, (SOILDEPTH_UPPER + SOILDEPTH_LOWER) * 0.001 };
-
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- char columnname[100] = { '\0' };
- // ecev3 - avoid problems with std library to_string not being available on NSC platforms
- std::string numStr = lpjguess_to_string(soildepth[lyr]);
- strcat(columnname, numStr.c_str());
- soillayers.push_back(columnname);
- }
- ColumnDescriptors soillayer_columns_8_2;
- soillayer_columns_8_2 += ColumnDescriptors(soillayers, 8, 2);
- // create a vector with the pft names
- std::vector<std::string> pfts;
- // create a vector with the pft names and barren
- std::vector<std::string> pftsbarren;
- // create a vector with the tree pft names
- std::vector<std::string> tree_pfts;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- pfts.push_back((char*)pft.name);
- pftsbarren.push_back((char*)pft.name);
- if (pft.lifeform == TREE)
- tree_pfts.push_back((char*)pft.name);
- pftlist.nextobj();
- }
- pftsbarren.push_back("Barren");
- ColumnDescriptors pft_columns_8_2, mpft_columns_8_3, mtree_pft_columns_9_2, mtree_pft_columns_10_5, mlcf_pft_columns_9_4;
- mpft_columns_8_3 += ColumnDescriptors(pfts, 8, 3);
- mtree_pft_columns_9_2 += ColumnDescriptors(tree_pfts, 9, 2);
- mtree_pft_columns_10_5 += ColumnDescriptors(tree_pfts, 10, 5);
- mlcf_pft_columns_9_4 += ColumnDescriptors(pftsbarren, 9, 4);
- pft_columns_8_2 += ColumnDescriptors(pfts, 8, 2);
- pft_columns_8_2 += ColumnDescriptor("Total", 8, 2);
- // Physical variables
- // Near Surface Air Temperature [K]
- create_output_table(cresc_tas, "CRESCENDO/Crescendo_tas.out", month_columns_7_2);
- // Precipitation [kg m-2 s-1]
- create_output_table(cresc_pr, "CRESCENDO/Crescendo_pr.out", month_columns_12_7);
-
- // Surface Downwelling Shortwave Radiation [W m-2]
- create_output_table(cresc_rsds, "CRESCENDO/Crescendo_rsds.out", month_columns_7_2);
-
- // Total Soil Moisture Content [kg m-2]
- create_output_table(cresc_mrso, "CRESCENDO/Crescendo_mrso.out", month_columns_7_2);
-
- // Total Runoff [kg m-2 s-1]
- create_output_table(cresc_mrro, "CRESCENDO/Crescendo_mrro.out", month_columns_12_7);
-
- // Total Evapo-Transpiration [kg m-2 s-1]
- create_output_table(cresc_evapotrans, "CRESCENDO/Crescendo_evapotrans.out", month_columns_12_7);
-
- // Total Evaporation from Canopy (interception) [kg m-2 s-1]
- create_output_table(cresc_evspsblveg, "CRESCENDO/Crescendo_evspsblveg.out", month_columns_12_7);
-
- // Water Evaporation from Soil [kg m-2 s-1]
- create_output_table(cresc_evspsblsoi, "CRESCENDO/Crescendo_evspsblsoi.out", month_columns_12_7);
-
- // Transpiration [kg m-2 s-1]
- create_output_table(cresc_tran, "CRESCENDO/Crescendo_tran.out", month_columns_12_7);
-
- // Depth of snow layer [m]
- create_output_table(cresc_snd, "CRESCENDO/Crescendo_snd.out", month_columns_7_2);
-
- // Carbon in vegetation [kg C m-2]
- create_output_table(cresc_cVeg, "CRESCENDO/Crescendo_cVeg.out", single_column_9_3);
-
- // Nitrogen in vegetation [kg N m-2]
- create_output_table(cresc_nVeg, "CRESCENDO/Crescendo_nVeg.out", single_column_11_5);
-
- // Carbon in litter [kg C m-2]
- create_output_table(cresc_cLitter, "CRESCENDO/Crescendo_cLitter.out", single_column_9_3);
-
- // Nitrogen in litter [kg N m-2]
- create_output_table(cresc_nLitter, "CRESCENDO/Crescendo_nLitter.out", single_column_11_5);
-
- // Carbon in soil [kg C m-2]
- create_output_table(cresc_cSoil, "CRESCENDO/Crescendo_cSoil.out", single_column_9_3);
-
- // Nitrogen in soil [kg N m-2]
- create_output_table(cresc_nSoil, "CRESCENDO/Crescendo_nSoil.out", single_column_11_5);
-
- // Carbon in products [kg C m-2]
- create_output_table(cresc_cProduct, "CRESCENDO/Crescendo_cProduct.out", single_column_9_3);
-
- // Nitrogen in products [kg N m-2]
- create_output_table(cresc_nProduct, "CRESCENDO/Crescendo_nProduct.out", single_column_11_5);
-
- // Gross Primary Production [kg C m-2 s-1]
- create_output_table(cresc_gpp, "CRESCENDO/Crescendo_gpp.out", month_columns_15_10);
-
- // Net Primary Production [kg C m-2 s-1]
- create_output_table(cresc_npp, "CRESCENDO/Crescendo_npp.out", month_columns_15_10);
-
- // Autotrophic (Plant) Respiration [kg C m-2 s-1]
- create_output_table(cresc_ra, "CRESCENDO/Crescendo_ra.out", month_columns_15_10);
-
- // Heterotrophic Respiration [kg C m-2 s-1]
- create_output_table(cresc_rh, "CRESCENDO/Crescendo_rh.out", month_columns_15_10);
-
- // CO2 Emission from Fire [kg C m-2 s-1]
- create_output_table(cresc_fFire, "CRESCENDO/Crescendo_fFire.out", month_columns_15_10);
-
- // CO2 Flux to Atmosphere from Land Use Change [kg C m-2 s-1]
- create_output_table(cresc_fLuc, "CRESCENDO/Crescendo_fLuc.out", month_columns_15_10);
-
- // Net Biospheric Production [kg C m-2 s-1]
- create_output_table(cresc_nbp, "CRESCENDO/Crescendo_nbp.out", month_columns_17_12);
-
- // Reproduction and Establishmentflux [kg C m-2 s-1]
- create_output_table(cresc_fReprEst, "CRESCENDO/Crescendo_fReprEst.out", month_columns_15_10);
-
- // Seed flux [kg C m-2 s-1]
- create_output_table(cresc_fSeed, "CRESCENDO/Crescendo_fSeed.out", month_columns_15_10);
-
- // Harvest flux [kg C m-2 s-1]
- create_output_table(cresc_fHarv, "CRESCENDO/Crescendo_fHarv.out", month_columns_15_10);
-
- // Harvested crop flux [kg C m-2 s-1]
- create_output_table(cresc_harvcrop, "CRESCENDO/Crescendo_fHarvest.out", month_columns_15_10);
-
- // Harvested grazing flux [kg C m-2 s-1]
- create_output_table(cresc_harvgraz, "CRESCENDO/Crescendo_fGrazing.out", month_columns_15_10);
-
- // Production flux [kg C m-2 s-1]
- create_output_table(cresc_prod, "CRESCENDO/Crescendo_fProd.out", month_columns_15_10);
-
- // Total Carbon Flux from Vegetation to Litter [kg C m-2 s-1]
- create_output_table(cresc_fVegLitter, "CRESCENDO/Crescendo_fVegLitter.out", month_columns_15_10);
-
- // Total nitrogen Flux from Vegetation to Litter [kg N m-2 s-1]
- create_output_table(cresc_fNVegLitter, "CRESCENDO/Crescendo_fNVegLitter.out", month_columns_17_12);
-
- // Total Carbon Flux from Litter to Soil [kg C m-2 s-1]
- create_output_table(cresc_fLitterSoil, "CRESCENDO/Crescendo_fLitterSoil.out", month_columns_15_10);
-
- // Total Carbon Flux from Litter to Soil [kg N m-2 s-1]
- create_output_table(cresc_fNLitterSoil, "CRESCENDO/Crescendo_fNLitterSoil.out", month_columns_17_12);
-
- // Nitrogen deposition [kg N m-2 s-1]
- create_output_table(cresc_fNdep, "CRESCENDO/Crescendo_fNdep.out", month_columns_17_12);
-
- // Biological nitrogen fixation [kg N m-2 s-1]
- create_output_table(cresc_fBNF, "CRESCENDO/Crescendo_fBNF.out", month_columns_17_12);
-
- // Plant nitrogen uptake [kg N m-2 s-1]
- create_output_table(cresc_fNup, "CRESCENDO/Crescendo_fNup.out", month_columns_17_12);
-
- // Net nitrogen mineralisation [kg N m-2 s-1]
- create_output_table(cresc_fNnetmin, "CRESCENDO/Crescendo_fNnetmin.out", month_columns_17_12);
-
- // Nitrogen leached [kg N m-2 s-1]
- create_output_table(cresc_fNleach, "CRESCENDO/Crescendo_fNleach.out", month_columns_17_12);
-
- // Carbon leached [kg C m-2 s-1]
- create_output_table(cresc_fCleach, "CRESCENDO/Crescendo_fCleach.out", month_columns_17_12);
-
- // Nitrogen gas flux [kg N m-2 s-1]
- create_output_table(cresc_fNgas, "CRESCENDO/Crescendo_fNgas.out", month_columns_17_12);
-
- // Nitrogen fire gas flux [kg N m-2 s-1]
- create_output_table(cresc_fNgasFire, "CRESCENDO/Crescendo_fNgasFire.out", month_columns_17_12);
-
- // N2O flux [kg N m-2 s-1]
- create_output_table(cresc_fN2O, "CRESCENDO/Crescendo_fN2O.out", month_columns_17_12);
-
- // NOx flux [kg N m-2 s-1]
- create_output_table(cresc_fNOx, "CRESCENDO/Crescendo_fNOx.out", month_columns_17_12);
-
- // Total nitrogen loss from the ecosystem [kg N m-2 s-1]
- create_output_table(cresc_fNloss, "CRESCENDO/Crescendo_fNloss.out", month_columns_17_12);
-
- // Carbon in Leaves [kg C m-2]
- create_output_table(cresc_cLeaf, "CRESCENDO/Crescendo_cLeaf.out", single_column_9_3);
-
- // Carbon in Roots [kg C m-2]
- create_output_table(cresc_cRoot, "CRESCENDO/Crescendo_cRoot.out", single_column_9_3);
-
- // Carbon in wood [kg C m-2]
- create_output_table(cresc_cWood, "CRESCENDO/Crescendo_cWood.out", single_column_9_3);
-
- // Carbon in coarse woody debris [kg C m-2]
- create_output_table(cresc_cCwd, "CRESCENDO/Crescendo_cCwd.out", single_column_9_3);
-
- // Nitrogen in leaves [kg N m-2]
- create_output_table(cresc_nLeaf, "CRESCENDO/Crescendo_nLeaf.out", single_column_11_5);
-
- // Nitrogen in roots [kg N m-2]
- create_output_table(cresc_nRoot, "CRESCENDO/Crescendo_nRoot.out", single_column_11_5);
-
- // Nitrogen in wood [kg N m-2]
- create_output_table(cresc_nWood, "CRESCENDO/Crescendo_nWood.out", single_column_11_5);
-
- // Nitrogen in coarse woody debis [kg N m-2]
- create_output_table(cresc_nCwd, "CRESCENDO/Crescendo_nCwd.out", single_column_11_5);
-
- // Burnt area [%]
- create_output_table(cresc_burntArea, "CRESCENDO/Crescendo_burntArea.out", single_column_8_2);
-
- // Top soil layer temperature [C]
- create_output_table(cresc_tsl, "CRESCENDO/Crescendo_tsl.out", month_columns_7_2);
- // Monthly soil layer specific outputs
- // Moisture of Soil [kg m-2]
- create_output_table(cresc_msl, "CRESCENDO/Crescendo_msl.out", soillayer_columns_8_2);
- // Monthly PFT specific outputs
- // LAI [m2 m-2]
- create_output_table(cresc_lai, "CRESCENDO/Crescendo_lai.out", mpft_columns_8_3);
- // Fractional Land Cover of PFT
- create_output_table(cresc_lcf, "CRESCENDO/Crescendo_landCoverFrac.out", mlcf_pft_columns_9_4);
- // Fraction of Absorbed Photosynthetically Active Radiation
- create_output_table(cresc_fapar, "CRESCENDO/Crescendo_fapar.out", mpft_columns_8_3);
- // Vegetation Height [m]
- create_output_table(cresc_vH, "CRESCENDO/Crescendo_vegHeight.out", mtree_pft_columns_9_2);
-
- // Tree Population Density [m-2]
- create_output_table(cresc_tD, "CRESCENDO/Crescendo_treeDens.out", mtree_pft_columns_10_5);
- // Vegetation C:N ratio
- create_output_table(cresc_cton_veg, "CRESCENDO/Crescendo_ctonVeg.out", pft_columns_8_2);
- }
- if (printcrescendodaily) {
- ColumnDescriptors single_column;
- single_column += ColumnDescriptor("Total", 8, 3);
- // Gridcell fraction covered by grass [-]
- create_output_table(cresc_dlai, "CRESCENDO/Crescendo_dlai.out", single_column);
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- ColumnDescriptors single_column_11_3, single_column_12_6;
- single_column_11_3 += ColumnDescriptor("Total", 11, 3);
- single_column_12_6 += ColumnDescriptor("Total", 12, 6);
- // CO2 [Mean ppm]
- if (face_co2.invalid()) {
- create_output_table(face_co2, "CRESCENDO/FACE/FACE_co2.out", single_column_11_3);
- }
- // Precipitation [mm d-1]
- if (face_ppt.invalid()) {
- create_output_table(face_ppt, "CRESCENDO/FACE/FACE_ppt.out", single_column_11_3);
- }
- // PAR [mol m-2]
- if (face_par.invalid()) {
- create_output_table(face_par, "CRESCENDO/FACE/FACE_par.out", single_column_11_3);
- }
- // Air temp canopy [Mean oC]
- if (face_at.invalid()) {
- create_output_table(face_at, "CRESCENDO/FACE/FACE_at.out", single_column_11_3);
- }
- // Soil temp 10 cm [Mean oC]
- if (face_st.invalid()) {
- create_output_table(face_st, "CRESCENDO/FACE/FACE_st.out", single_column_11_3);
- }
- // Surface soil water [Mean %]
- if (face_sw.invalid()) {
- create_output_table(face_sw, "CRESCENDO/FACE/FACE_sw.out", single_column_11_3);
- }
- // Nitrogen deposition [gN m-2 d-1]
- if (face_ndep.invalid()) {
- create_output_table(face_ndep, "CRESCENDO/FACE/FACE_ndep.out", single_column_12_6);
- }
- // Evapotranspiration [kgH2O m-2 d-1]
- if (face_et.invalid()) {
- create_output_table(face_et, "CRESCENDO/FACE/FACE_et.out", single_column_11_3);
- }
- // Transpiration [kgH2O m-2 d-1]
- if (face_t.invalid()) {
- create_output_table(face_t, "CRESCENDO/FACE/FACE_t.out", single_column_11_3);
- }
- // Soil Evaporation [kgH2O m-2 d-1]
- if (face_es.invalid()) {
- create_output_table(face_es, "CRESCENDO/FACE/FACE_es.out", single_column_11_3);
- }
- // Canopy evaporation [kgH2O m-2 d-1]
- if (face_ec.invalid()) {
- create_output_table(face_ec, "CRESCENDO/FACE/FACE_ec.out", single_column_12_6);
- }
- // Runoff [kgH2O m-2 d-1]
- if (face_ro.invalid()) {
- create_output_table(face_ro, "CRESCENDO/FACE/FACE_ro.out", single_column_11_3);
- }
- // Drainage [kgH2O m-2 d-1]
- if (face_drain.invalid()) {
- create_output_table(face_drain, "CRESCENDO/FACE/FACE_drain.out", single_column_11_3);
- }
- // Net Eco Prod [gC m-2 d-1]
- if (face_nep.invalid()) {
- create_output_table(face_nep, "CRESCENDO/FACE/FACE_nep.out", single_column_12_6);
- }
- // Gross Prim Prod [gC m-2 d-1]
- if (face_gpp.invalid()) {
- create_output_table(face_gpp, "CRESCENDO/FACE/FACE_gpp.out", single_column_12_6);
- }
- // Net Prim Prod [gC m-2 d-1]
- if (face_npp.invalid()) {
- create_output_table(face_npp, "CRESCENDO/FACE/FACE_npp.out", single_column_12_6);
- }
- // Resp ecosystem [gC m-2 d-1]
- if (face_reco.invalid()) {
- create_output_table(face_reco, "CRESCENDO/FACE/FACE_reco.out", single_column_12_6);
- }
- // Resp autotrophic [gC m-2 d-1]
- if (face_rauto.invalid()) {
- create_output_table(face_rauto, "CRESCENDO/FACE/FACE_rauto.out", single_column_12_6);
- }
- // Resp leaves (maint) [gC m-2 d-1]
- if (face_rleaf.invalid()) {
- create_output_table(face_rleaf, "CRESCENDO/FACE/FACE_rleaf.out", single_column_12_6);
- }
- // Resp Wood (maint) [gC m-2 d-1]
- if (face_rwood.invalid()) {
- create_output_table(face_rwood, "CRESCENDO/FACE/FACE_rwood.out", single_column_12_6);
- }
- // Resp Fine Root (maint) [gC m-2 d-1]
- if (face_rroot.invalid()) {
- create_output_table(face_rroot, "CRESCENDO/FACE/FACE_rroot.out", single_column_12_6);
- }
- // Resp growth [gC m-2 d-1]
- if (face_rgrow.invalid()) {
- create_output_table(face_rgrow, "CRESCENDO/FACE/FACE_rgrow.out", single_column_12_6);
- }
- // Resp heterotrophic [gC m-2 d-1]
- if (face_rhet.invalid()) {
- create_output_table(face_rhet, "CRESCENDO/FACE/FACE_rhet.out", single_column_12_6);
- }
- // Resp from soil [gC m-2 d-1]
- if (face_rsoil.invalid()) {
- create_output_table(face_rsoil, "CRESCENDO/FACE/FACE_rsoil.out", single_column_12_6);
- }
- // Resp from other sources [gC m-2 d-1]
- if (face_rother.invalid()) {
- create_output_table(face_rother, "CRESCENDO/FACE/FACE_rother.out", single_column_12_6);
- }
- // Carbon Leaf Mass [gC m-2]
- if (face_cl.invalid()) {
- create_output_table(face_cl, "CRESCENDO/FACE/FACE_cl.out", single_column_11_3);
- }
- // Carbon Wood mass [gC m-2]
- if (face_cw.invalid()) {
- create_output_table(face_cw, "CRESCENDO/FACE/FACE_cw.out", single_column_11_3);
- }
- // Carbon Fine Root Mass [gC m-2]
- if (face_cfr.invalid()) {
- create_output_table(face_cfr, "CRESCENDO/FACE/FACE_cfr.out", single_column_11_3);
- }
- // Carbon Storage as TNC [gC m-2]
- if (face_tnc.invalid()) {
- create_output_table(face_tnc, "CRESCENDO/FACE/FACE_tnc.out", single_column_11_3);
- }
- // Carbon Fine Litter Total [gC m-2]
- if (face_cflit.invalid()) {
- create_output_table(face_cflit, "CRESCENDO/FACE/FACE_cflit.out", single_column_11_3);
- }
- // Carbon Fine Litter above [gC m-2]
- if (face_cflita.invalid()) {
- create_output_table(face_cflita, "CRESCENDO/FACE/FACE_cflita.out", single_column_11_3);
- }
- // Carbon Fine Litter below [gC m-2]
- if (face_cflitb.invalid()) {
- create_output_table(face_cflitb, "CRESCENDO/FACE/FACE_cflitb.out", single_column_11_3);
- }
- // Carbon Coarse Litter [gC m-2]
- if (face_cclitb.invalid()) {
- create_output_table(face_cclitb, "CRESCENDO/FACE/FACE_cclitb.out", single_column_11_3);
- }
- // Carbon Soil [gC m-2]
- if (face_csoil.invalid()) {
- create_output_table(face_csoil, "CRESCENDO/FACE/FACE_csoil.out", single_column_11_3);
- }
- // Carbon Leaf growth [gC m-2 d-1]
- if (face_gl.invalid()) {
- create_output_table(face_gl, "CRESCENDO/FACE/FACE_gl.out", single_column_11_3);
- }
- // Carbon Wood growth [gC m-2 d-1]
- if (face_gw.invalid()) {
- create_output_table(face_gw, "CRESCENDO/FACE/FACE_gw.out", single_column_11_3);
- }
- // Carbon Fine Root growth [gC m-2 d-1]
- if (face_gr.invalid()) {
- create_output_table(face_gr, "CRESCENDO/FACE/FACE_gr.out", single_column_11_3);
- }
- // Carbon Leaf Litterfall [gC m-2 d-1]
- if (face_cllfall.invalid()) {
- create_output_table(face_cllfall, "CRESCENDO/FACE/FACE_cllfall.out", single_column_11_3);
- }
- // Carbon Root litter inputs [gC m-2 d-1]
- if (face_crlin.invalid()) {
- create_output_table(face_crlin, "CRESCENDO/FACE/FACE_crlin.out", single_column_11_3);
- }
- // Carbon Wood/branch inputs [gC m-2 d-1]
- if (face_cwin.invalid()) {
- create_output_table(face_cwin, "CRESCENDO/FACE/FACE_cwin.out", single_column_11_3);
- }
- // LAI projected [m2 m-2]
- if (face_lai.invalid()) {
- create_output_table(face_lai, "CRESCENDO/FACE/FACE_lai.out", single_column_11_3);
- }
- // Leaf gC/leaf area [gC m-2]
- if (face_lma.invalid()) {
- create_output_table(face_lma, "CRESCENDO/FACE/FACE_lma.out", single_column_11_3);
- }
- // Nitrogen Conc Leaves [gN gd. m.1]
- if (face_ncon.invalid()) {
- create_output_table(face_ncon, "CRESCENDO/FACE/FACE_ncon.out", single_column_11_3);
- }
- // Nitrogen Mass Leaves [gN m-2]
- if (face_ncan.invalid()) {
- create_output_table(face_ncan, "CRESCENDO/FACE/FACE_ncan.out", single_column_12_6);
- }
- // Nitrogen Mass Wood [gN m-2]
- if (face_nwood.invalid()) {
- create_output_table(face_nwood, "CRESCENDO/FACE/FACE_nwood.out", single_column_12_6);
- }
- // Nitrogen Mass Fine Roots [gN m-2]
- if (face_nfr.invalid()) {
- create_output_table(face_nfr, "CRESCENDO/FACE/FACE_nfr.out", single_column_12_6);
- }
- // Nitrogen Storage [gN m-2]
- if (face_nstor.invalid()) {
- create_output_table(face_nstor, "CRESCENDO/FACE/FACE_nstor.out", single_column_12_6);
- }
- // Nitrogen Litter aboveground [gN m-2]
- if (face_nlit.invalid()) {
- create_output_table(face_nlit, "CRESCENDO/FACE/FACE_nlit.out", single_column_12_6);
- }
- // Nitrogen Litter belowground [gN m-2]
- if (face_nrlit.invalid()) {
- create_output_table(face_nrlit, "CRESCENDO/FACE/FACE_nrlit.out", single_column_12_6);
- }
- // Nitrogen Dead wood [gN m-2]
- if (face_ndw.invalid()) {
- create_output_table(face_ndw, "CRESCENDO/FACE/FACE_ndw.out", single_column_12_6);
- }
- // Nitrogen Soil Total [gN m-2]
- if (face_nsoil.invalid()) {
- create_output_table(face_nsoil, "CRESCENDO/FACE/FACE_nsoil.out", single_column_11_3);
- }
- // Nitrogen in Mineral form [gN m-2]
- if (face_npoolm.invalid()) {
- create_output_table(face_npoolm, "CRESCENDO/FACE/FACE_npoolm.out", single_column_11_3);
- }
- // Nitrogen in Organic form [gN m-2]
- if (face_npoolo.invalid()) {
- create_output_table(face_npoolo, "CRESCENDO/FACE/FACE_npoolo.out", single_column_11_3);
- }
- // Nitrogen fixation [gN m-2 d-1]
- if (face_nfix.invalid()) {
- create_output_table(face_nfix, "CRESCENDO/FACE/FACE_nfix.out", single_column_12_6);
- }
- // Nitrogen Leaf Litterfall [gN m-2 d-1]
- if (face_nlitin.invalid()) {
- create_output_table(face_nlitin, "CRESCENDO/FACE/FACE_nlitin.out", single_column_12_6);
- }
- // Nitrogen Wood/brch litterfall [gN m-2 d-1]
- if (face_nwlin.invalid()) {
- create_output_table(face_nwlin, "CRESCENDO/FACE/FACE_nwlin.out", single_column_12_6);
- }
- // Nitrogen Root litter input [gN m-2 d-1]
- if (face_nrlin.invalid()) {
- create_output_table(face_nrlin, "CRESCENDO/FACE/FACE_nrlin.out", single_column_12_6);
- }
- // Nitrogen Biomass Uptake [gN m-2 d-1]
- if (face_nup.invalid()) {
- create_output_table(face_nup, "CRESCENDO/FACE/FACE_nup.out", single_column_12_6);
- }
- // Nitrogen Gross Mineralization [gN m-2 d-1]
- if (face_ngmin.invalid()) {
- create_output_table(face_ngmin, "CRESCENDO/FACE/FACE_ngmin.out", single_column_12_6);
- }
- // Nitrogen Net mineralization [gN m-2 d-1]
- if (face_nmin.invalid()) {
- create_output_table(face_nmin, "CRESCENDO/FACE/FACE_nmin.out", single_column_12_6);
- }
- // Nitrogen Loss To Atmosphere [gN m-2 d-1]
- if (face_nvol.invalid()) {
- create_output_table(face_nvol, "CRESCENDO/FACE/FACE_nvol.out", single_column_12_6);
- }
- // Nitrogen Leaching [gN m-2 d-1]
- if (face_nleach.invalid()) {
- create_output_table(face_nleach, "CRESCENDO/FACE/FACE_nleach.out", single_column_12_6);
- }
- // Nitrogen Leaf growth [gN m-2 d-1]
- if (face_ngl.invalid()) {
- create_output_table(face_ngl, "CRESCENDO/FACE/FACE_ngl.out", single_column_12_6);
- }
- // Nitrogen Wood growth [gN m-2 d-1]
- if (face_ngw.invalid()) {
- create_output_table(face_ngw, "CRESCENDO/FACE/FACE_ngw.out", single_column_12_6);
- }
- // Nitrogen Fine Root growth [gN m-2 d-1]
- if (face_ngr.invalid()) {
- create_output_table(face_ngr, "CRESCENDO/FACE/FACE_ngr.out", single_column_12_6);
- }
- }
- #endif
- if (printcmip6) {
- ColumnDescriptors single_column_6_1, single_column_8_5, single_column_9_4, single_column_11_6;
- single_column_6_1 += ColumnDescriptor("Total", 6, 1);
- single_column_8_5 += ColumnDescriptor("Total", 8, 5);
- single_column_9_4 += ColumnDescriptor("Total", 9, 4);
- single_column_11_6 += ColumnDescriptor("Total", 11, 6);
- ColumnDescriptors month_columns_5_1, month_columns_9_4, month_columns_8_5, month_columns_9_6, month_columns_11_6, month_columns_15_10, month_columns_17_12, month_columns_19_14;
- xtring months[] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
- for (int i = 0; i < 12; i++) {
- month_columns_5_1 += ColumnDescriptor(months[i], 5, 1);
- month_columns_9_4 += ColumnDescriptor(months[i], 9, 4);
- month_columns_8_5 += ColumnDescriptor(months[i], 8, 5);
- month_columns_9_6 += ColumnDescriptor(months[i], 9, 6);
- month_columns_11_6 += ColumnDescriptor(months[i], 11, 6);
- month_columns_15_10 += ColumnDescriptor(months[i], 15, 10);
- month_columns_17_12 += ColumnDescriptor(months[i], 17, 12);
- month_columns_19_14 += ColumnDescriptor(months[i], 19, 14);
- }
- ColumnDescriptors single_column;
- single_column += ColumnDescriptor("Total", 12, 7);
- // create a vector with the pft names and barren
- std::vector<std::string> pftsbarren;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- pftsbarren.push_back((char*)pft.name);
- pftlist.nextobj();
- }
- pftsbarren.push_back("Bare_soil");
- ColumnDescriptors mpft_columns;
- mpft_columns += ColumnDescriptors(pftsbarren, 12, 7);
- create_output_table(cmip6_vegHeightTree, file_vegHeightTree_monthly, month_columns_9_4);
- create_output_table(cmip6_treeFrac, file_treeFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_grassFrac, file_grassFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_shrubFrac, file_shrubFrac_monthly, month_columns_5_1);
- create_output_table(cmip6_cropFrac, file_cropFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_pastureFrac, file_pastureFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_vegFrac, file_vegFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_acropFrac, file_cropFrac_yearly, single_column_8_5);
- create_output_table(cmip6_apastureFrac, file_pastureFrac_yearly, single_column_8_5);
- create_output_table(cmip6_agrassFrac, file_grassFrac_yearly, single_column_8_5);
- create_output_table(cmip6_ashrubFrac, file_shrubFrac_yearly, single_column_6_1);
- create_output_table(cmip6_atreeFrac, file_treeFrac_yearly, single_column_8_5);
- create_output_table(cmip6_avegFrac, file_vegFrac_yearly, single_column_8_5);
- create_output_table(cmip6_aburntFractionAll_yearly, file_burntFractionAll_yearly, single_column_8_5);
- create_output_table(cmip6_aburntFractionAll_monthly, file_burntFractionAll_monthly, month_columns_8_5);
- create_output_table(cmip6_abaresoilFrac, file_baresoilFrac_yearly, single_column_8_5);
- create_output_table(cmip6_aresidualFrac, file_residualFrac_yearly, single_column_8_5);
- create_output_table(cmip6_baresoilFrac, file_baresoilFrac_monthly, month_columns_8_5);
- create_output_table(cmip6_residualFrac, file_residualFrac_monthly, month_columns_5_1);
- create_output_table(cmip6_cropFracC3, file_cropFracC3_monthly, month_columns_8_5);
- create_output_table(cmip6_cropFracC4, file_cropFracC4_monthly, month_columns_8_5);
- create_output_table(cmip6_grassFracC3, file_grassFracC3_monthly, month_columns_8_5);
- create_output_table(cmip6_grassFracC4, file_grassFracC4_monthly, month_columns_8_5);
- create_output_table(cmip6_pastureFracC3, file_pastureFracC3_monthly, month_columns_8_5);
- create_output_table(cmip6_pastureFracC4, file_pastureFracC4_monthly, month_columns_8_5);
- create_output_table(cmip6_landCoverFrac, file_landCoverFrac_monthly, mpft_columns);
- create_output_table(cmip6_acLitter, file_cLitter_yearly, single_column_9_4);
- create_output_table(cmip6_acProduct, file_cProduct_yearly, single_column_11_6);
- create_output_table(cmip6_acSoil, file_cSoil_yearly, single_column_9_4);
- create_output_table(cmip6_acVeg, file_cVeg_yearly, single_column_9_4);
- create_output_table(cmip6_cVeg, file_cVeg_monthly, month_columns_9_4);
- create_output_table(cmip6_cLeaf, file_cLeaf_monthly, month_columns_9_4);
- create_output_table(cmip6_cRoot, file_cRoot_monthly, month_columns_9_4);
- create_output_table(cmip6_cStem, file_cStem_monthly, month_columns_9_4);
- create_output_table(cmip6_cWood, file_cWood_monthly, month_columns_9_4);
- create_output_table(cmip6_cOther, file_cOther_monthly, month_columns_9_4);
- create_output_table(cmip6_cLitter, file_cLitter_monthly, month_columns_9_4);
- create_output_table(cmip6_cCwd, file_cCwd_monthly, month_columns_5_1);
- create_output_table(cmip6_cLitterCwd, file_cLitterCwd_monthly, month_columns_9_4);
- create_output_table(cmip6_cLitterSurf, file_cLitterSurf_monthly, month_columns_9_4);
- create_output_table(cmip6_cLitterSubSurf, file_cLitterSubSurf_monthly, month_columns_9_4);
- create_output_table(cmip6_cLitterAbove, file_cLitterAbove_monthly, month_columns_9_4);
- create_output_table(cmip6_cLitterBelow, file_cLitterBelow_monthly, month_columns_9_4);
- create_output_table(cmip6_cSoil, file_cSoil_monthly, month_columns_9_4);
- create_output_table(cmip6_cSoilFast, file_cSoilFast_monthly, month_columns_9_4);
- create_output_table(cmip6_cSoilMedium, file_cSoilMedium_monthly, month_columns_9_4);
- create_output_table(cmip6_cSoilSlow, file_cSoilSlow_monthly, month_columns_9_4);
- create_output_table(cmip6_cProduct, file_cProduct_monthly, month_columns_9_6);
- create_output_table(cmip6_cLand, file_cLand_monthly, month_columns_9_4);
- create_output_table(cmip6_cLand1, file_cLand1_monthly, month_columns_9_4);
- create_output_table(cmip6_cyLand, file_cLand_yearly, single_column);
- create_output_table(cmip6_cyFlux, file_cFlux_yearly, single_column);
- create_output_table(cmip6_nVeg, file_nVeg_monthly, month_columns_11_6);
- create_output_table(cmip6_nLeaf, file_nLeaf_monthly, month_columns_11_6);
- create_output_table(cmip6_nRoot, file_nRoot_monthly, month_columns_11_6);
- create_output_table(cmip6_nStem, file_nStem_monthly, month_columns_11_6);
- create_output_table(cmip6_nOther, file_nOther_monthly, month_columns_11_6);
- create_output_table(cmip6_nLitter, file_nLitter_monthly, month_columns_11_6);
- create_output_table(cmip6_nLitterCwd, file_nLitterCwd_monthly, month_columns_11_6);
- create_output_table(cmip6_nLitterSurf, file_nLitterSurf_monthly, month_columns_11_6);
- create_output_table(cmip6_nLitterSubSurf, file_nLitterSubSurf_monthly, month_columns_11_6);
- create_output_table(cmip6_nSoil, file_nSoil_monthly, month_columns_11_6);
- create_output_table(cmip6_nProduct, file_nProduct_monthly, month_columns_15_10);
- create_output_table(cmip6_nLand, file_nLand_monthly, month_columns_11_6);
- create_output_table(cmip6_nMinNH4, file_nMineralNH4_monthly, month_columns_17_12);
- create_output_table(cmip6_nMinNO3, file_nMineralNO3_monthly, month_columns_5_1);
- create_output_table(cmip6_nMineral, file_nMineral_monthly, month_columns_17_12);
- create_output_table(cmip6_fN2O, file_fN2O_monthly, month_columns_17_12);
- create_output_table(cmip6_fNOx, file_fNOx_monthly, month_columns_17_12);
- create_output_table(cmip6_nbp, file_nbp_monthly, month_columns_19_14);
- create_output_table(cmip6_netAtmosLandCO2Flux, file_netAtmosLandCO2Flux_monthly, month_columns_19_14);
- create_output_table(cmip6_nep, file_nep_monthly, month_columns_19_14);
- create_output_table(cmip6_gpp, file_gpp_monthly, month_columns_19_14);
- create_output_table(cmip6_gppGrass, file_gppGrass_monthly, month_columns_17_12);
- create_output_table(cmip6_gppTree, file_gppTree_monthly, month_columns_17_12);
- create_output_table(cmip6_npp, file_npp_monthly, month_columns_19_14);
- create_output_table(cmip6_nppGrass, file_nppGrass_monthly, month_columns_17_12);
- create_output_table(cmip6_nppTree, file_nppTree_monthly, month_columns_17_12);
- create_output_table(cmip6_ra, file_ra_monthly, month_columns_17_12);
- create_output_table(cmip6_raLeaf, file_raLeaf_monthly, month_columns_17_12);
- create_output_table(cmip6_raRoot, file_raRoot_monthly, month_columns_17_12);
- create_output_table(cmip6_raStem, file_raStem_monthly, month_columns_17_12);
- create_output_table(cmip6_raOther, file_raOther_monthly, month_columns_17_12);
- create_output_table(cmip6_rGrowth, file_rGrowth_monthly, month_columns_17_12);
- create_output_table(cmip6_rMaint, file_rMaint_monthly, month_columns_17_12);
- create_output_table(cmip6_raGrass, file_raGrass_monthly, month_columns_17_12);
- create_output_table(cmip6_raTree, file_raTree_monthly, month_columns_17_12);
- create_output_table(cmip6_rh, file_rh_monthly, month_columns_17_12);
- create_output_table(cmip6_rhSoil, file_rhSoil_monthly, month_columns_17_12);
- create_output_table(cmip6_rhLitter, file_rhLitter_monthly, month_columns_17_12);
- create_output_table(cmip6_fCLandToOcean, file_fCLandToOcean_monthly, month_columns_19_14);
- create_output_table(cmip6_fNLandToOcean, file_fNLandToOcean_monthly, month_columns_19_14);
- create_output_table(cmip6_fVegLitter, file_fVegLitter_monthly, month_columns_15_10);
- create_output_table(cmip6_fVegOther, file_fVegOther_monthly, month_columns_15_10);
- create_output_table(cmip6_fNVegLitter, file_fNVegLitter_monthly, month_columns_19_14);
- create_output_table(cmip6_fLitterSoil, file_fLitterSoil_monthly, month_columns_17_12);
- create_output_table(cmip6_fNLitterSoil, file_fNLitterSoil_monthly, month_columns_19_14);
- create_output_table(cmip6_fFireNat, file_fFireNat_monthly, month_columns_17_12);
- create_output_table(cmip6_fFire, file_fFire_monthly, month_columns_17_12);
- create_output_table(cmip6_fVegFire, file_fVegFire_monthly, month_columns_17_12);
- create_output_table(cmip6_fLitterFire, file_fLitterFire_monthly, month_columns_17_12);
- create_output_table(cmip6_fFireAll, file_fFireAll_monthly, month_columns_17_12);
- create_output_table(cmip6_fluc, file_fLuc_monthly, month_columns_19_14);
- create_output_table(cmip6_fAnthDisturb, file_fAnthDisturb_monthly, month_columns_19_14);
- create_output_table(cmip6_fNAnthDisturb, file_fNAnthDisturb_monthly, month_columns_19_14);
- create_output_table(cmip6_fHarvest, file_fHarvest_monthly, month_columns_17_12);
- create_output_table(cmip6_fHarvestToAtmos, file_fHarvestToAtmos_monthly, month_columns_17_12);
- create_output_table(cmip6_fDeforestToAtmos, file_fDeforestToAtmos_monthly, month_columns_19_14);
- create_output_table(cmip6_fDeforestToProduct, file_fDeforestToProduct_monthly, month_columns_15_10);
- create_output_table(cmip6_fProductDecomp, file_fProductDecomp_monthly, month_columns_15_10);
- create_output_table(cmip6_fGrazing, file_fGrazing_monthly, month_columns_17_12);
- create_output_table(cmip6_fco2antt, file_fCO2antt_monthly, month_columns_17_12);
- create_output_table(cmip6_fco2nat, file_fCO2nat_monthly, month_columns_17_12);
- create_output_table(cmip6_fNProduct, file_fNProduct_monthly, month_columns_19_14);
- create_output_table(cmip6_fBNF, file_fBNF_monthly, month_columns_19_14);
- create_output_table(cmip6_fNloss, file_fNloss_monthly, month_columns_19_14);
- create_output_table(cmip6_fNfert, file_fNfert_monthly, month_columns_19_14);
- create_output_table(cmip6_fNup, file_fNup_monthly, month_columns_19_14);
- create_output_table(cmip6_fNleach, file_fNleach_monthly, month_columns_19_14);
- create_output_table(cmip6_fNgas, file_fNgas_monthly, month_columns_19_14);
- create_output_table(cmip6_fNdep, file_fNdep_monthly, month_columns_19_14);
- create_output_table(cmip6_fNnetmin, file_fNnetmin_monthly, month_columns_19_14);
- create_output_table(cmip6_fNgasFire, file_fNgasFire_monthly, month_columns_19_14);
- create_output_table(cmip6_fNgasNonFire, file_fNgasNonFire_monthly, month_columns_19_14);
- create_output_table(cmip6_lai, file_lai_monthly, month_columns_9_4);
- create_output_table(cmip6_mrso, file_mrso_monthly, month_columns_9_4);
- create_output_table(cmip6_mrsos, file_mrsos_monthly, month_columns_9_4);
- create_output_table(cmip6_prveg, file_prveg_monthly, month_columns_15_10);
- create_output_table(cmip6_evspsbl, file_evspsbl_monthly, month_columns_15_10);
- create_output_table(cmip6_evspsblveg, file_evspsblveg_monthly, month_columns_15_10);
- create_output_table(cmip6_evspsblsoi, file_evspsblsoi_monthly, month_columns_15_10);
- create_output_table(cmip6_evspsblpot, file_evspsblpot_monthly, month_columns_15_10);
- create_output_table(cmip6_tran, file_tran_monthly, month_columns_15_10);
- create_output_table(cmip6_mrro, file_mrro_monthly, month_columns_15_10);
- create_output_table(cmip6_mrros, file_mrros_monthly, month_columns_15_10);
- create_output_table(cmip6_prCrop, file_prCrop_monthly, month_columns_15_10);
- create_output_table(cmip6_treeFracBdlDcd, file_treeFracBdlDcd_monthly, month_columns_9_6);
- create_output_table(cmip6_treeFracBdlEvg, file_treeFracBdlEvg_monthly, month_columns_9_6);
- create_output_table(cmip6_treeFracNdlDcd, file_treeFracNdlDcd_monthly, month_columns_9_6);
- create_output_table(cmip6_treeFracNdlEvg, file_treeFracNdlEvg_monthly, month_columns_9_6);
- // create a vector with soil layer names
- std::vector<std::string> soillayers;
- double soildepth[NSOILLAYER] = { SOILDEPTH_UPPER * 0.001, (SOILDEPTH_UPPER + SOILDEPTH_LOWER) * 0.001 };
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- char columnname[100] = { '\0' };
- // ecev3 - avoid problems with std library to_string not being available on NSC platforms
- std::string numStr = lpjguess_to_string(soildepth[lyr]);
- strcat(columnname, numStr.c_str());
- soillayers.push_back(columnname);
- }
- ColumnDescriptors soillayer_columns;
- soillayer_columns += ColumnDescriptors(soillayers, 9, 4);
- create_output_table(cmip6_mrsol, file_mrsol_monthly, soillayer_columns);
- create_output_table(cmip6_mrsll, file_mrsll_monthly, soillayer_columns);
- create_output_table(cmip6_tsl, file_tsl_monthly, soillayer_columns);
- ColumnDescriptors landcover_columns_10_4, landcover_columns_12_6, landcover_columns_14_9, landcover_columns_15_10, landcover_columns_19_14;
- xtring landcover_string[] = { "psl", "crp", "pst", "urb" };
- for (int lc = 0; lc < NCMIP6LANDCOVERTYPES; lc++) {
- landcover_columns_10_4 += ColumnDescriptor(landcover_string[lc], 10, 4);
- landcover_columns_12_6 += ColumnDescriptor(landcover_string[lc], 12, 6);
- landcover_columns_14_9 += ColumnDescriptor(landcover_string[lc], 14, 9);
- landcover_columns_15_10 += ColumnDescriptor(landcover_string[lc], 15, 10);
- landcover_columns_19_14 += ColumnDescriptor(landcover_string[lc], 19, 14);
- }
- create_output_table(cmip6_cTotFireLut, file_cTotFireLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_fLulccAtmLut, file_fLulccAtmLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_fLulccProductLut, file_fLulccProductLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_fLulccResidueLut, file_fLulccResidueLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_fProductDecompLut, file_fProductDecompLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_cProductLut, file_cProductLut_yearly, landcover_columns_12_6);
- create_output_table(cmip6_gppLut, file_gppLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_irrLut, file_irrLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_fracLut, file_fracLut_yearly, landcover_columns_14_9);
- create_output_table(cmip6_mfracLut, file_fracLut_monthly, landcover_columns_14_9);
- create_output_table(cmip6_fracOutLut, file_fracOutLut_yearly, landcover_columns_14_9);
- create_output_table(cmip6_fracInLut, file_fracInLut_yearly, landcover_columns_14_9);
- create_output_table(cmip6_laiLut, file_laiLut_monthly, landcover_columns_10_4);
- create_output_table(cmip6_mrroLut, file_mrroLut_monthly, landcover_columns_15_10);
- create_output_table(cmip6_mrsoLut, file_mrsoLut_monthly, landcover_columns_12_6);
- create_output_table(cmip6_mrsosLut, file_mrsosLut_monthly, landcover_columns_12_6);
- create_output_table(cmip6_necbLut, file_necbLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_nppLut, file_nppLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_nwdFracLut, file_nwdFracLut_monthly, landcover_columns_14_9);
- create_output_table(cmip6_raLut, file_raLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_rhLut, file_rhLut_monthly, landcover_columns_19_14);
- create_output_table(cmip6_cSoilLut, file_cSoilLut_yearly, landcover_columns_10_4);
- create_output_table(cmip6_cVegLut, file_cVegLut_yearly, landcover_columns_10_4);
- create_output_table(cmip6_cLitterLut, file_cLitterLut_yearly, landcover_columns_10_4);
- }
- if (printcmip6daily) {
- ColumnDescriptors single_column_9_4, single_column_15_10, single_column_17_12;
- single_column_9_4 += ColumnDescriptor("Total", 9, 4);
- single_column_15_10 += ColumnDescriptor("Total", 15, 10);
- single_column_17_12 += ColumnDescriptor("Total", 17, 12);
- // create a vector with soil layer names
- std::vector<std::string> soillayers;
- double soildepth[NSOILLAYER] = { SOILDEPTH_UPPER * 0.001, (SOILDEPTH_UPPER + SOILDEPTH_LOWER) * 0.001 };
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- char columnname[100] = { '\0' };
- // ecev3 - avoid problems with std library to_string not being available on NSC platforms
- std::string numStr = lpjguess_to_string(soildepth[lyr]);
- strcat(columnname, numStr.c_str());
- soillayers.push_back(columnname);
- }
- ColumnDescriptors soillayer_columns_9_4, soillayer_columns_15_10;
- soillayer_columns_9_4 += ColumnDescriptors(soillayers, 9, 4);
- soillayer_columns_15_10 += ColumnDescriptors(soillayers, 15, 10);
- create_output_table(cmip6_dlai, file_lai_daily, single_column_9_4);
- create_output_table(cmip6_dmrso, file_mrso_daily, single_column_9_4);
- create_output_table(cmip6_dmrsol, file_mrsol_daily, soillayer_columns_9_4);
- create_output_table(cmip6_dmrsos, file_mrsos_daily, single_column_9_4);
- create_output_table(cmip6_dmrsll, file_mrsll_daily, soillayer_columns_9_4);
- create_output_table(cmip6_dmrro, file_mrro_daily, single_column_15_10);
- create_output_table(cmip6_dtsl, file_tsl_daily, soillayer_columns_9_4);
- create_output_table(cmip6_devspsblpot, file_evspsblpot_daily, single_column_17_12);
- create_output_table(cmip6_dec, file_ec_daily, single_column_17_12);
- create_output_table(cmip6_det, file_et_daily, single_column_17_12);
- create_output_table(cmip6_dprCrop, file_prCrop_daily, single_column_17_12);
- create_output_table(cmip6_dtran, file_tran_daily, single_column_17_12);
- create_output_table(cmip6_dprveg, file_prveg_daily, single_column_17_12);
- }
- if (printifsinputdaily) {
- // IFS data sent to LPJ-GUESS - daily output
- ColumnDescriptors ifs_data_column;
- ifs_data_column += ColumnDescriptor("co2", 8, 2);
- ifs_data_column += ColumnDescriptor("par", 8, 2); // really SW
- ifs_data_column += ColumnDescriptor("LW", 8, 2);
- ifs_data_column += ColumnDescriptor("precip", 8, 2);
- ifs_data_column += ColumnDescriptor("airT", 8, 2);
- ifs_data_column += ColumnDescriptor("soilT", 8, 2);
- ifs_data_column += ColumnDescriptor("surfW", 8, 2);
- ifs_data_column += ColumnDescriptor("deepW", 8, 2);
- if (ifs_input.invalid()) {
- create_output_table(ifs_input, "ifs_input.out", ifs_data_column);
- }
- }
- }
- /// Local analogue of OutputRows::add_value for restricting output
- /** Use to restrict output to specified range of years
- * (or other user-specified limitation)
- *
- * If only yearly output between, say 1961 and 1990 is requred, use:
- * if (date.get_calendar_year() >= 1961 && date.get_calendar_year() <= 1990)
- * (assuming the input module has set the first calendar year in the date object)
- */
- void outlimit_misc(OutputRows& out, const Table& table, double d) {
- if (date.year >= nyear_spinup)
- out.add_value(table, d);
- }
- /// Output of simulation results at the end of each year
- /** Output of simulation results at the end of each year, or for specific years in
- * the simulation of each stand or grid cell.
- * This function does not have to provide any information to the framework.
- *
- * Restrict output to specific years in the local helper function outlimit_misc().
- *
- * Changes in the structure of CommonOutput::outannual() should be mirrored here.
- */
- void MiscOutput::outannual(Gridcell& gridcell) {
- if (date.year < nyear_spinup - 2) {
- if (printseparatestands || printcrescendo)
- closelocalfiles(gridcell);
- return;
- }
- if (printseparatestands) {
- openlocalfiles(gridcell);
- }
- double lon = gridcell.get_lon();
- double lat = gridcell.get_lat();
- const double EPS = 1.0e-12;
- Landcover& lc = gridcell.landcover;
- // The OutputRows object manages the next row of output for each
- // output table
- OutputRows out(output_channel, lon, lat, date.get_calendar_year());
- double landcover_cmass[NLANDCOVERTYPES] = { 0.0 };
- double landcover_nmass[NLANDCOVERTYPES] = { 0.0 };
- double landcover_clitter[NLANDCOVERTYPES] = { 0.0 };
- double landcover_nlitter[NLANDCOVERTYPES] = { 0.0 };
- double landcover_anpp[NLANDCOVERTYPES] = { 0.0 };
- double landcover_densindiv_total[NLANDCOVERTYPES] = { 0.0 };
- double mean_standpft_anpp_lc[NLANDCOVERTYPES] = { 0.0 };
- double mean_standpft_cmass_lc[NLANDCOVERTYPES] = { 0.0 };
- double mean_standpft_densindiv_total_lc[NLANDCOVERTYPES] = { 0.0 };
- double mean_standpft_densindiv_total = 0.0;
- // CREDSCENDO
- double irrigation_gridcell = 0.0;
- double cVeg_gridcell = 0.0;
- double nVeg_gridcell = 0.0;
- double cLitter_gridcell = 0.0;
- double nLitter_gridcell = 0.0;
- double cSoil_gridcell = 0.0;
- double nSoil_gridcell = 0.0;
- double availn = 0.0;
- double cProduct_gridcell = 0.0;
- double nProduct_gridcell = 0.0;
- double cLeaf_gridcell = 0.0;
- double nLeaf_gridcell = 0.0;
- double cRoot_gridcell = 0.0;
- double nRoot_gridcell = 0.0;
- double cWood_gridcell = 0.0;
- double nWood_gridcell = 0.0;
- double cCwd_gridcell = 0.0;
- double nCwd_gridcell = 0.0;
- double cVegLitter_gridcell = 0.0;
- double cmass_veg_gridcell = 0.0;
- double nmass_veg_gridcell = 0.0;
- double standpft_cLitter_CR = 0.0;
- double standpft_nLitter_CR = 0.0;
- double standpft_cSoil_CR = 0.0;
- double standpft_nSoil_CR = 0.0;
- double standpft_cLeaf = 0.0;
- double standpft_nLeaf = 0.0;
- double standpft_cRoot = 0.0;
- double standpft_nRoot = 0.0;
- double standpft_cWood = 0.0;
- double standpft_nWood = 0.0;
- double standpft_cCwd = 0.0;
- double standpft_nCwd = 0.0;
- double standpft_cmass = 0.0;
- double standpft_nmass = 0.0;
- double standpft_clitter = 0.0;
- double standpft_nlitter = 0.0;
- double standpft_anpp = 0.0;
- double standpft_yield = 0.0;
- double standpft_yield1 = 0.0;
- double standpft_yield2 = 0.0;
- double standpft_densindiv_total = 0.0;
- double standpft_cmass_veg = 0.0;
- double standpft_nmass_veg = 0.0;
- double mean_standpft_cmass_veg = 0.0;
- double mean_standpft_nmass_veg = 0.0;
- double pft_mlambda_gpp[12][MAXNUMBER_PFTS] = { 0.0 };
- double pft_mgpp[12][MAXNUMBER_PFTS] = { 0.0 };
- double pft_treedens[MAXNUMBER_PFTS] = { 0.0 };
- double pft_vegheight[MAXNUMBER_PFTS] = { 0.0 };
- double pft_mlai[12][MAXNUMBER_PFTS] = { 0.0 };
- double pft_mlcf[12][MAXNUMBER_PFTS] = { 0.0 };
- double pft_mfapar[12][MAXNUMBER_PFTS] = { 0.0 };
- double kgtog = 1000.0;
- double secondsperday = 86400.0;
- double secondspermonth[12];
- for (int m = 0; m < 12; m++) {
- secondspermonth[m] = secondsperday * (double)date.month_length(m);
- }
- // CMIP6
- double vegHeightTree = 0.0;
- double treefpc = 0.0;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- // Sum values across stands, patches and PFTs
- double mean_standpft_yield = 0.0;
- double mean_standpft_yield1 = 0.0;
- double mean_standpft_yield2 = 0.0;
- double standpft_heightindiv_total = 0.0;
- double standpft_fpcindiv_total = 0.0;
- mean_standpft_densindiv_total = 0.0;
- mean_standpft_cmass_veg = 0.0;
- mean_standpft_nmass_veg = 0.0;
- for (int i = 0; i<NLANDCOVERTYPES; i++) {
- mean_standpft_anpp_lc[i] = 0.0;
- mean_standpft_cmass_lc[i] = 0.0;
- mean_standpft_densindiv_total_lc[i] = 0.0;
- }
- // Determine area fraction of stands where this pft is active:
- double active_fraction = 0.0;
- double active_fraction_lc[NLANDCOVERTYPES] = { 0.0 };
- Gridcell::iterator gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- if (stand.pft[pft.id].active) {
- active_fraction += stand.get_gridcell_fraction();
- active_fraction_lc[stand.landcover] += stand.get_gridcell_fraction();
- }
- ++gc_itr;
- }
- // Loop through Stands
- gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- Standpft& standpft = stand.pft[pft.id];
- if (!standpft.active) {
- ++gc_itr;
- continue;
- }
- // Sum values across patches and PFTs
- standpft_cmass = 0.0;
- standpft_nmass = 0.0;
- standpft_clitter = 0.0;
- standpft_nlitter = 0.0;
- standpft_anpp = 0.0;
- standpft_yield = 0.0;
- standpft_yield1 = 0.0;
- standpft_yield2 = 0.0;
- standpft_densindiv_total = 0.0;
- standpft_cLitter_CR = 0.0;
- standpft_nLitter_CR = 0.0;
- standpft_cSoil_CR = 0.0;
- standpft_nSoil_CR = 0.0;
- standpft_cLeaf = 0.0;
- standpft_nLeaf = 0.0;
- standpft_cRoot = 0.0;
- standpft_nRoot = 0.0;
- standpft_cWood = 0.0;
- standpft_nWood = 0.0;
- standpft_cCwd = 0.0;
- standpft_nCwd = 0.0;
- standpft_cmass_veg = 0.0;
- standpft_nmass_veg = 0.0;
- stand.firstobj();
- // Loop through Patches
- while (stand.isobj) {
- Patch& patch = stand.getobj();
- Patchpft& patchpft = patch.pft[pft.id];
- Vegetation& vegetation = patch.vegetation;
- double to_gridcell_average = stand.get_gridcell_fraction() / (double)stand.npatch();
- standpft_anpp += patch.fluxes.get_annual_flux(Fluxes::NPP, pft.id);
- standpft_clitter += patchpft.litter_leaf + patchpft.litter_root + patchpft.litter_sap + patchpft.litter_heart + patchpft.litter_repr;
- standpft_nlitter += patchpft.nmass_litter_leaf + patchpft.nmass_litter_root + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart;
- standpft_cLitter_CR += patchpft.litter_leaf + patchpft.litter_sap + patchpft.litter_heart + patchpft.litter_repr;
- standpft_nLitter_CR += patchpft.nmass_litter_leaf + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart;
- standpft_cSoil_CR += patchpft.litter_root;
- standpft_nSoil_CR += patchpft.nmass_litter_root;
- standpft_cCwd += patchpft.litter_sap + patchpft.litter_heart;
- standpft_nCwd += patchpft.nmass_litter_sap + patchpft.nmass_litter_heart;
- vegetation.firstobj();
- while (vegetation.isobj) {
- Individual& indiv = vegetation.getobj();
- if (indiv.id != -1 && indiv.alive && indiv.pft.id == pft.id) {
- standpft_cmass += indiv.ccont();
- standpft_nmass += indiv.ncont();
- standpft_cLeaf += indiv.cleafcont();
- standpft_nLeaf += indiv.nleafcont();
- standpft_cRoot += indiv.crootcont();
- standpft_nRoot += indiv.nrootcont();
- standpft_cWood += indiv.cmass_wood();
- standpft_nWood += indiv.nmass_wood();
- standpft_cmass_veg += indiv.cmass_veg;
- standpft_nmass_veg += indiv.nmass_veg;
- if (indiv.pft.lifeform == TREE) {
- standpft_nWood += indiv.nstore();
- }
- if (pft.landcover == CROPLAND) {
- standpft_yield += indiv.cropindiv->harv_yield;
- standpft_yield1 += indiv.cropindiv->yield_harvest[0];
- standpft_yield2 += indiv.cropindiv->yield_harvest[1];
- }
- else {
- if (vegmode == COHORT || vegmode == INDIVIDUAL) {
- // guess2008 - only count trees with a trunk above a certain diameter
- if (pft.lifeform == TREE && indiv.age>0) {
- double diam = pow(indiv.height / indiv.pft.k_allom2, 1.0 / indiv.pft.k_allom3);
- if (diam>0.03) {
- standpft_densindiv_total += indiv.densindiv; // indiv/m2
- standpft_heightindiv_total += indiv.height * indiv.fpc * to_gridcell_average;
- standpft_fpcindiv_total += indiv.fpc * to_gridcell_average;
- vegHeightTree += indiv.height * indiv.fpc * to_gridcell_average;
- treefpc += indiv.fpc * to_gridcell_average;
- }
- }
- }
- }
- // Calculate monthly LAI
- for (int m = 0; m<12; m++) {
- pft_mlai[m][pft.id] += indiv.mlai[m] * to_gridcell_average;
- pft_mlcf[m][pft.id] += indiv.mfpc[m] * to_gridcell_average * patch.fpc_rescale;
- pft_mfapar[m][pft.id] += indiv.mfpar[m] * to_gridcell_average;
- pft_mlambda_gpp[m][pft.id] += max(0.0, indiv.mlambda_gpp[m]) * to_gridcell_average;
- pft_mgpp[m][pft.id] += max(0.0, indiv.mgpp[m]) * to_gridcell_average;
- }
- }
- vegetation.nextobj();
- }
- stand.nextobj();
- } // end of patch loop
- standpft_cmass /= (double)stand.npatch();
- standpft_nmass /= (double)stand.npatch();
- standpft_clitter /= (double)stand.npatch();
- standpft_nlitter /= (double)stand.npatch();
- standpft_anpp /= (double)stand.npatch();
- standpft_densindiv_total /= (double)stand.npatch();
- standpft_yield /= (double)stand.npatch();
- standpft_yield1 /= (double)stand.npatch();
- standpft_yield2 /= (double)stand.npatch();
- standpft_cLitter_CR /= (double)stand.npatch();
- standpft_nLitter_CR /= (double)stand.npatch();
- standpft_cSoil_CR /= (double)stand.npatch();
- standpft_nSoil_CR /= (double)stand.npatch();
- standpft_cLeaf /= (double)stand.npatch();
- standpft_cRoot /= (double)stand.npatch();
- standpft_cWood /= (double)stand.npatch();
- standpft_cCwd /= (double)stand.npatch();
- standpft_nLeaf /= (double)stand.npatch();
- standpft_nRoot /= (double)stand.npatch();
- standpft_nWood /= (double)stand.npatch();
- standpft_nCwd /= (double)stand.npatch();
- standpft_cmass_veg /= (double)stand.npatch();
- standpft_nmass_veg /= (double)stand.npatch();
- //Update landcover totals
- landcover_cmass[stand.landcover] += standpft_cmass*stand.get_landcover_fraction();
- landcover_nmass[stand.landcover] += standpft_nmass*stand.get_landcover_fraction();
- landcover_clitter[stand.landcover] += standpft_clitter*stand.get_landcover_fraction();
- landcover_nlitter[stand.landcover] += standpft_nlitter*stand.get_landcover_fraction();
- landcover_anpp[stand.landcover] += standpft_anpp*stand.get_landcover_fraction();
- landcover_densindiv_total[stand.landcover] += standpft_densindiv_total*stand.get_landcover_fraction();
- // Update pft means for active stands
- if (active_fraction > 0.0) { // ecev3 - Peter Anthoni (KIT)
- mean_standpft_yield += standpft_yield * stand.get_gridcell_fraction() / active_fraction;
- mean_standpft_yield1 += standpft_yield1 * stand.get_gridcell_fraction() / active_fraction;
- mean_standpft_yield2 += standpft_yield2 * stand.get_gridcell_fraction() / active_fraction;
- }
- if (active_fraction_lc[stand.landcover] > 0.0) { // ecev3 - Peter Anthoni (KIT)
- // Update pft mean for active stands in landcover
- mean_standpft_anpp_lc[stand.landcover] += standpft_anpp * stand.get_gridcell_fraction() / active_fraction_lc[stand.landcover];
- mean_standpft_cmass_lc[stand.landcover] += standpft_cmass * stand.get_gridcell_fraction() / active_fraction_lc[stand.landcover];
- mean_standpft_densindiv_total_lc[stand.landcover] += standpft_densindiv_total * stand.get_gridcell_fraction() / active_fraction_lc[stand.landcover];
- }
- if (active_fraction > 0.0) { // ecev3 - added active_fraction check
- mean_standpft_densindiv_total += standpft_densindiv_total * stand.get_gridcell_fraction() / active_fraction;
- mean_standpft_cmass_veg += standpft_cmass_veg * stand.get_gridcell_fraction() / active_fraction;
- mean_standpft_nmass_veg += standpft_nmass_veg * stand.get_gridcell_fraction() / active_fraction;
- }
- //Update stand totals
- stand.anpp += standpft_anpp;
- stand.cmass += standpft_cmass;
- // CRESCENDO output
- cVeg_gridcell += standpft_cmass * stand.get_gridcell_fraction();
- nVeg_gridcell += standpft_nmass * stand.get_gridcell_fraction();
- cLitter_gridcell += standpft_cLitter_CR * stand.get_landcover_fraction();
- nLitter_gridcell += standpft_nLitter_CR * stand.get_landcover_fraction();
- cLeaf_gridcell += standpft_cLeaf * stand.get_gridcell_fraction();
- cRoot_gridcell += standpft_cRoot * stand.get_gridcell_fraction();
- cWood_gridcell += standpft_cWood * stand.get_gridcell_fraction();
- cCwd_gridcell += standpft_cCwd * stand.get_gridcell_fraction();
- nLeaf_gridcell += standpft_nLeaf * stand.get_gridcell_fraction();
- nRoot_gridcell += standpft_nRoot * stand.get_gridcell_fraction();
- nWood_gridcell += standpft_nWood * stand.get_gridcell_fraction();
- nCwd_gridcell += standpft_nCwd * stand.get_gridcell_fraction();
- cmass_veg_gridcell += standpft_cmass_veg * stand.get_gridcell_fraction();
- nmass_veg_gridcell += standpft_nmass_veg * stand.get_gridcell_fraction();
- cSoil_gridcell += standpft_cSoil_CR * stand.get_landcover_fraction();
- nSoil_gridcell += standpft_nSoil_CR * stand.get_landcover_fraction();
- // Print per-stand pft values
- if (printseparatestands) {
- int id = stand.id;
- if (stand.id >= MAXNUMBER_STANDS)
- fail("Number of stands to high, increase MAXNUMBER_STANDS for output of individual stands !\n");
- if (stand.landcover == NATURAL) {
- if (!out_anpp_stand_natural[id].invalid())
- outlimit_misc(out, out_anpp_stand_natural[id], standpft_anpp);
- if (!out_cmass_stand_natural[id].invalid())
- outlimit_misc(out, out_cmass_stand_natural[id], standpft_cmass);
- }
- else if (stand.landcover == FOREST) {
- if (!out_anpp_stand_forest[id].invalid())
- outlimit_misc(out, out_anpp_stand_forest[id], standpft_anpp);
- if (!out_cmass_stand_forest[id].invalid())
- outlimit_misc(out, out_cmass_stand_forest[id], standpft_cmass);
- }
- }
- ++gc_itr;
- }//End of loop through stands
- pft_treedens[pft.id] = mean_standpft_densindiv_total;
- pft_vegheight[pft.id] = !negligible(standpft_fpcindiv_total) ? min(99.9, standpft_heightindiv_total / standpft_fpcindiv_total) : 0.0;
- outlimit_misc(out, cresc_cton_veg, !negligible(mean_standpft_nmass_veg) ? min(999.9, mean_standpft_cmass_veg / mean_standpft_nmass_veg) : 0.0);
- // Print to landcover files in case pft:s are common to several landcovers (currently only used in NATURAL and FOREST)
- if (run_landcover) {
- for (int i = 0; i<NLANDCOVERTYPES; i++) {
- if (run[i]) {
- switch (i) {
- case CROPLAND:
- break;
- case PASTURE:
- if (run[NATURAL]) {
- outlimit_misc(out, out_anpp_pasture, mean_standpft_anpp_lc[i]);
- outlimit_misc(out, out_cmass_pasture, mean_standpft_cmass_lc[i]);
- }
- break;
- case BARREN:
- break;
- case NATURAL:
- // if(run[FOREST] || run[PASTURE]) {
- if (run[FOREST]) {
- outlimit_misc(out, out_anpp_natural, mean_standpft_anpp_lc[i]);
- outlimit_misc(out, out_cmass_natural, mean_standpft_cmass_lc[i]);
- outlimit_misc(out, out_dens_natural, mean_standpft_densindiv_total_lc[i]);
- }
- break;
- case FOREST:
- if (run[NATURAL]) {
- outlimit_misc(out, out_anpp_forest, mean_standpft_anpp_lc[i]);
- outlimit_misc(out, out_cmass_forest, mean_standpft_cmass_lc[i]);
- outlimit_misc(out, out_dens_forest, mean_standpft_densindiv_total_lc[i]);
- }
- break;
- case URBAN:
- break;
- case PEATLAND:
- break;
- default:
- if (date.year == nyear_spinup)
- dprintf("Modify code to deal with landcover output!\n");
- }
- }
- }
- }
- if (pft.landcover == CROPLAND) {
- outlimit_misc(out, out_yield, mean_standpft_yield);
- outlimit_misc(out, out_yield1, mean_standpft_yield1);
- outlimit_misc(out, out_yield2, mean_standpft_yield2);
- int pft_sdate1 = -1;
- int pft_sdate2 = -1;
- int pft_hdate1 = -1;
- int pft_hdate2 = -1;
- int pft_lgp = -1;
- double pft_phu = -1;
- double pft_fphu = -1;
- double pft_fhi = -1;
- Gridcell::iterator gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- if (stlist[stand.stid].pftinrotation(pft.name) >= 0) {
- pft_sdate1 = stand[0].pft[pft.id].cropphen->sdate_thisyear[0];
- pft_sdate2 = stand[0].pft[pft.id].cropphen->sdate_thisyear[1];
- pft_hdate1 = stand[0].pft[pft.id].cropphen->hdate_harvest[0];
- pft_hdate2 = stand[0].pft[pft.id].cropphen->hdate_harvest[1];
- pft_lgp = stand[0].pft[pft.id].cropphen->lgp;
- pft_phu = stand[0].pft[pft.id].cropphen->phu;
- pft_fphu = stand[0].pft[pft.id].cropphen->fphu_harv;
- pft_fhi = stand[0].pft[pft.id].cropphen->fhi_harv;
- }
- ++gc_itr;
- }
- outlimit_misc(out, out_sdate1, pft_sdate1);
- outlimit_misc(out, out_sdate2, pft_sdate2);
- outlimit_misc(out, out_hdate1, pft_hdate1);
- outlimit_misc(out, out_hdate2, pft_hdate2);
- outlimit_misc(out, out_lgp, pft_lgp);
- outlimit_misc(out, out_phu, pft_phu);
- outlimit_misc(out, out_fphu, pft_fphu);
- outlimit_misc(out, out_fhi, pft_fhi);
- }
- pftlist.nextobj();
- } // *** End of PFT loop ***
- outlimit_misc(out, cresc_cton_veg, !negligible(nmass_veg_gridcell) ? min(999.9, cmass_veg_gridcell / nmass_veg_gridcell) : 0.0);
- double flux_veg_lc[NLANDCOVERTYPES], flux_repr_lc[NLANDCOVERTYPES],
- flux_soil_lc[NLANDCOVERTYPES], flux_fire_lc[NLANDCOVERTYPES],
- flux_est_lc[NLANDCOVERTYPES], flux_seed_lc[NLANDCOVERTYPES];
- double flux_charvest_lc[NLANDCOVERTYPES], c_org_leach_lc[NLANDCOVERTYPES];
- double c_litter_lc[NLANDCOVERTYPES], c_fast_lc[NLANDCOVERTYPES],
- c_slow_lc[NLANDCOVERTYPES], c_harv_slow_lc[NLANDCOVERTYPES];
- double surfsoillitterc_lc[NLANDCOVERTYPES], cwdc_lc[NLANDCOVERTYPES],
- centuryc_lc[NLANDCOVERTYPES];
- double n_harv_slow_lc[NLANDCOVERTYPES], availn_lc[NLANDCOVERTYPES],
- andep_lc[NLANDCOVERTYPES], anfert_lc[NLANDCOVERTYPES];
- double anmin_lc[NLANDCOVERTYPES], animm_lc[NLANDCOVERTYPES],
- anfix_lc[NLANDCOVERTYPES], n_org_leach_lc[NLANDCOVERTYPES],
- n_min_leach_lc[NLANDCOVERTYPES];
- double flux_ntot_lc[NLANDCOVERTYPES], flux_nharvest_lc[NLANDCOVERTYPES],
- flux_nseed_lc[NLANDCOVERTYPES];
- double surfsoillittern_lc[NLANDCOVERTYPES], cwdn_lc[NLANDCOVERTYPES],
- centuryn_lc[NLANDCOVERTYPES];
- // CRESCEDO and CMIP6 variables
- double awc_tot, burntArea = 0.0;
- double mmrso[12], mmrsos[12], mmrro[12], mmrros[12], mevapotrans[12], mevspsblveg[12], mevspsblsoi[12], mevspsblpot[12], mtran[12], msnd[12], mprecip[12];
- double mnpp[12], mgpp[12], mrh[12], mra[12], mnbp[12], mnep[12], mfFire[12], mfLuc[12], mcfLucdeforest[12], mreprest[12], mseed[12], mharv[12], mharvcrop[12], mharvgraz[12];
- double mfNdep[12], mfBNF[12], mnfert[12], mfNup[12], mfNnetmin[12], mfNleach[12], mfCleach[12], mfNgas[12], mfNgasFire[12], mfN2O[12], mfNOx[12], mnseed[12], mnharv[12], mnfLuc[12];
- double mfNloss[12], mfVegLitter[12], mfNVegLitter[12], mfLitterSoil[12], mfNLitterSoil[12], mfDeforestToProduct[12], mfProductDecomp[12], mfNProductDecomp[12], mfNProduct[12], mfco2antt[12], mfco2nat[12];
- double mtsl[12];
- double mmsl[12][NSOILLAYER] = { 0.0 };
- double mcVeg[12], mnVeg[12], mcLeaf[12], mnLeaf[12], mcRoot[12], mnRoot[12], mcStem[12], mnStem[12], mcOther[12], mcOtherNPP[12], mcOtherPhen[12], mnOther[12];
- double mcLitter[12], mnLitter[12], mcLitterCwd[12], mnLitterCwd[12], mcLitterSurf[12], mnLitterSurf[12], mcLitterSubSurf[12], mnLitterSubSurf[12], mcLitterAbove[12], mcLitterBelow[12];
- double mcSoil[12], mnSoil[12], mcFast[12], mcMedium[12], mcSlow[12];
- double mcProduct[12], mnProduct[12], mcLand[12], mnLand[12], mnMinNH4[12], mnMinNO3[12];
- double mgppGrass[12], mgppTree[12];
- double mrhsoil[12], mrhlitter[12];
- double mraleaf[12], mraroot[12], mrastem[12], mraother[12], mraGrass[12], mraTree[12], mfVegFire[12], mfLitterFire[12];
- double mBdlDcd[12], mBdlEvg[12], mNdlDcd[12], mNdlEvg[12];
- double mlai[12], mcropFrac[12], mcropFracC3[12], mcropFracC4[12], mpastureFrac[12], mpastureFracC3[12], mpastureFracC4[12], mgrassFrac[12], mgrassFracC3[12], mgrassFracC4[12], mtreeFrac[12];
- double mvegFrac[12], mshrubFrac[12], mbaresoilFrac[12], mresidualFrac[12];
- double dlai[366], dpet[366], daet[366], devap[366], dintercep[366], dprecip[366], dtsl[366][NSOILLAYER], dmrsol[366][NSOILLAYER], dmrro[366], dmrsll[366][NSOILLAYER];
- double acropFrac, apastureFrac, agrassFrac, ashrubfrac, atreeFrac, avegFrac, abaresoilFrac, aresidualFrac, total_land;
- double mgppLut[NCMIP6LANDCOVERTYPES+1][12], mraLut[NCMIP6LANDCOVERTYPES+1][12], mnppLut[NCMIP6LANDCOVERTYPES+1][12], mcTotFireLut[NCMIP6LANDCOVERTYPES+1][12], mrhLut[NCMIP6LANDCOVERTYPES+1][12], mnecbLut[NCMIP6LANDCOVERTYPES+1][12], mnwdFracLut[NCMIP6LANDCOVERTYPES+1][12];
- double mlaiLut[NCMIP6LANDCOVERTYPES+1][12], mrsoLut[NCMIP6LANDCOVERTYPES+1][12], mrsosLut[NCMIP6LANDCOVERTYPES+1][12], mrroLut[NCMIP6LANDCOVERTYPES+1][12], mirrLut[NCMIP6LANDCOVERTYPES+1][12];
- double mfLulccAtmLut[NCMIP6LANDCOVERTYPES+1][12], mfLulccProductLut[NCMIP6LANDCOVERTYPES+1][12], mfLulccResidueLut[NCMIP6LANDCOVERTYPES+1][12], mfProductDecompLut[NCMIP6LANDCOVERTYPES+1][12];
- double acSoilLut[NCMIP6LANDCOVERTYPES+1], acVegLut[NCMIP6LANDCOVERTYPES+1], acLitterLut[NCMIP6LANDCOVERTYPES+1], acProductLut[NCMIP6LANDCOVERTYPES+1];
- double fracLut[NCMIP6LANDCOVERTYPES+1], fracOutLut[NCMIP6LANDCOVERTYPES+1], fracInLut[NCMIP6LANDCOVERTYPES+1];
- #ifdef CRESCENDO_FACE
- double drunoff[366], ddrain[366], dgpp[366], dnpp[366], dother[366], drhet[366], drleaf[366], drroot[366], drwood[366], drgrowth[366];
- double dcleaf[366], dnleaf[366], dcroot[366], dnroot[366], dcwood[366], dnwood[366], dcother[366], dnother[366];
- double dcflita[366], dnlit[366], dcflitb[366], dnrlit[366], dcclitb[366], dndw[366], dcsoil[366], dnsoil[366], dnmineral[366], dnfix[366], dnup[366], dngmin[366], dnmin[366], dnvol[366], dnleach[366];
- double dgl[366], dgw[366], dgr[366], dngl[366], dngw[366], dngr[366], dnlitin[366], dnwlin[366], dnrlin[366], dcllfall[366], dcrlin[366], dcwin[366];
- #endif
- acropFrac = apastureFrac = agrassFrac = ashrubfrac = atreeFrac = avegFrac = abaresoilFrac = aresidualFrac = total_land = 0.0;
- for (int i = 0; i < NLANDCOVERTYPES; i++) {
- flux_veg_lc[i] = 0.0;
- flux_repr_lc[i] = 0.0;
- flux_soil_lc[i] = 0.0;
- flux_fire_lc[i] = 0.0;
- flux_est_lc[i] = 0.0;
- flux_seed_lc[i] = 0.0;
- flux_charvest_lc[i] = 0.0;
- c_org_leach_lc[i] = 0.0;
- c_litter_lc[i] = 0.0;
- c_fast_lc[i] = 0.0;
- c_slow_lc[i] = 0.0;
- c_harv_slow_lc[i] = 0.0;
- surfsoillitterc_lc[i] = 0.0;
- cwdc_lc[i] = 0.0;
- centuryc_lc[i] = 0.0;
- flux_ntot_lc[i] = 0.0;
- flux_nharvest_lc[i] = 0.0;
- flux_nseed_lc[i] = 0.0;
- availn_lc[i] = 0.0;
- andep_lc[i] = 0.0; // same value for all land covers
- anfert_lc[i] = 0.0;
- anmin_lc[i] = 0.0;
- animm_lc[i] = 0.0;
- anfix_lc[i] = 0.0;
- n_org_leach_lc[i] = 0.0;
- n_min_leach_lc[i] = 0.0;
- n_harv_slow_lc[i] = 0.0;
- surfsoillittern_lc[i] = 0.0;
- cwdn_lc[i] = 0.0;
- centuryn_lc[i] = 0.0;
- }
- for (int i = 0; i<NCMIP6LANDCOVERTYPES+1; i++) {
- // CMIP6
- for (int m = 0; m < 12; m++) {
- mgppLut[i][m] = 0.0;
- mraLut[i][m] = 0.0;
- mnppLut[i][m] = 0.0;
- mcTotFireLut[i][m] = 0.0;
- mrhLut[i][m] = 0.0;
- mnecbLut[i][m] = 0.0;
- mnwdFracLut[i][m] = 0.0;
- mlaiLut[i][m] = 0.0;
- mrsoLut[i][m] = 0.0;
- mrsosLut[i][m] = 0.0;
- mrroLut[i][m] = 0.0;
- mirrLut[i][m] = 0.0;
- mfLulccAtmLut[i][m] = 0.0;
- mfLulccProductLut[i][m] = 0.0;
- mfLulccResidueLut[i][m] = 0.0;
- mfProductDecompLut[i][m] = 0.0;
- }
- acSoilLut[i] = 0.0;
- acVegLut[i] = 0.0;
- acLitterLut[i] = 0.0;
- acProductLut[i] = 0.0;
- fracLut[i] = 0.0;
- fracOutLut[i] = 0.0;
- fracInLut[i] = 0.0;
- }
- for (int m = 0; m < 12; m++) {
- mmrso[m] = 0.0;
- mmrsos[m] = 0.0;
- mmrro[m] = 0.0;
- mmrros[m] = 0.0;
- mevapotrans[m] = 0.0;
- mevspsblveg[m] = 0.0;
- mevspsblsoi[m] = 0.0;
- mevspsblpot[m] = 0.0;
- mtran[m] = 0.0;
- msnd[m] = 0.0;
- mprecip[m] = 0.0;
- mnpp[m] = 0.0;
- mgpp[m] = 0.0;
- mrh[m] = 0.0;
- mra[m] = 0.0;
- mnbp[m] = 0.0;
- mnep[m] = 0.0;
- mfFire[m] = 0.0;
- mfLuc[m] = 0.0;
- mcfLucdeforest[m] = 0.0;
- mreprest[m] = 0.0;
- mseed[m] = 0.0;
- mharv[m] = 0.0;
- mharvcrop[m] = 0.0;
- mharvgraz[m] = 0.0;
- mfco2antt[m] = 0.0;
- mfco2nat[m] = 0.0;
- mfNdep[m] = 0.0;
- mfBNF[m] = 0.0;
- mnfert[m] = 0.0;
- mfNup[m] = 0.0;
- mfNnetmin[m] = 0.0;
- mfNleach[m] = 0.0;
- mfCleach[m] = 0.0;
- mfNgas[m] = 0.0;
- mfNgasFire[m] = 0.0;
- mfN2O[m] = 0.0;
- mfNOx[m] = 0.0;
- mnseed[m] = 0.0;
- mnharv[m] = 0.0;
- mnfLuc[m] = 0.0;
- mfNloss[m] = 0.0;
- mfVegLitter[m] = 0.0;
- mfNVegLitter[m] = 0.0;
- mfLitterSoil[m] = 0.0;
- mfNLitterSoil[m] = 0.0;
- mfDeforestToProduct[m] = 0.0;
- mfProductDecomp[m] = 0.0;
- mfNProductDecomp[m] = 0.0;
- mfNProduct[m] = 0.0;
- mtsl[m] = 0.0;
- mcVeg[m] = 0.0;
- mnVeg[m] = 0.0;
- mcLeaf[m] = 0.0;
- mnLeaf[m] = 0.0;
- mcRoot[m] = 0.0;
- mnRoot[m] = 0.0;
- mcStem[m] = 0.0;
- mnStem[m] = 0.0;
- mcOther[m] = 0.0;
- mcOtherNPP[m] = 0.0;
- mcOtherPhen[m] = 0.0;
- mnOther[m] = 0.0;
- mcLitter[m] = mnLitter[m] = mcLitterCwd[m] = mnLitterCwd[m] = mcLitterSurf[m] = mnLitterSurf[m] = mcLitterSubSurf[m] = mnLitterSubSurf[m] = mcLitterAbove[m] = mcLitterBelow[m] = 0.0;
- mcSoil[m] = mnSoil[m] = mcFast[m] = mcMedium[m] = mcSlow[m] = 0.0;
- mcProduct[m] = mnProduct[m] = mcLand[m] = mnLand[m] = mnMinNH4[m] = mnMinNO3[m] = 0.0;
- mgppGrass[m] = mgppTree[m] = 0.0;
- mrhsoil[m] = mrhlitter[m] = 0.0;
- mraleaf[m] = mraroot[m] = mrastem[m] = mraother[m] = mraGrass[m] = mraTree[m] = 0.0;
- mfVegFire[m] = mfLitterFire[m] = 0.0;
- mlai[m] = mcropFrac[m] = mcropFracC3[m] = mcropFracC4[m] = mpastureFrac[m] = mpastureFracC3[m] = mpastureFracC4[m] = mgrassFrac[m] = mgrassFracC3[m] = mgrassFracC4[m] = mtreeFrac[m] = 0.0;
- mvegFrac[m] = mshrubFrac[m] = mbaresoilFrac[m] = mresidualFrac[m] = 0.0;
- mBdlDcd[m] = mBdlEvg[m] = mNdlDcd[m] = mNdlEvg[m] = mtreeFrac[m] = 0.0;
- }
- for (int d = 0; d < date.year_length(); d++) {
- dlai[d] = 0.0;
- dpet[d] = 0.0;
- devap[d] = 0.0;
- dprecip[d] = 0.0;
- daet[d] = 0.0;
- dintercep[d] = 0.0;
- dmrro[d] = 0.0;
- #ifdef CRESCENDO_FACE
- drunoff[d] = 0.0;
- ddrain[d] = 0.0;
- dgpp[d] = 0.0;
- dnpp[d] = 0.0;
- dother[d] = 0.0;
- drhet[d] = 0.0;
- drleaf[d] = 0.0;
- drroot[d] = 0.0;
- drwood[d] = 0.0;
- drgrowth[d] = 0.0;
- dcleaf[d] = 0.0;
- dnleaf[d] = 0.0;
- dcroot[d] = 0.0;
- dnroot[d] = 0.0;
- dcwood[d] = 0.0;
- dnwood[d] = 0.0;
- dcother[d] = 0.0;
- dnother[d] = 0.0;
- dcflita[d] = 0.0;
- dnlit[d] = 0.0;
- dcflitb[d] = 0.0;
- dnrlit[d] = 0.0;
- dcclitb[d] = 0.0;
- dndw[d] = 0.0;
- dcsoil[d] = 0.0;
- dnsoil[d] = 0.0;
- dnmineral[d] = 0.0;
- dnfix[d] = 0.0;
- dnup[d] = 0.0;
- dngmin[d] = 0.0;
- dnmin[d] = 0.0;
- dnvol[d] = 0.0;
- dnleach[d] = 0.0;
- dgl[d] = 0.0;
- dgw[d] = 0.0;
- dgr[d] = 0.0;
- dngl[d] = 0.0;
- dngw[d] = 0.0;
- dngr[d] = 0.0;
- dnlitin[d] = 0.0;
- dnwlin[d] = 0.0;
- dnrlin[d] = 0.0;
- dcllfall[d] = 0.0;
- dcrlin[d] = 0.0;
- dcwin[d] = 0.0;
- #endif
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- dtsl[d][lyr] = 0.0;
- dmrsol[d][lyr] = 0.0;
- dmrsll[d][lyr] = 0.0;
- }
- }
- // Sum C fluxes, dead C pools and runoff across patches
- Gridcell::iterator gc_itr = gridcell.begin();
- // Loop through Stands
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- stand.firstobj();
- int LCT = 0;
- if (stand.landcover == URBAN)
- LCT = URB;
- else if (stand.landcover == PASTURE)
- LCT = PST;
- else if (stand.landcover == CROPLAND)
- LCT = CRP;
- else if (stand.landcover == BARREN)
- LCT = 4; // will not be included in ouput because it is not land
- else
- LCT = PSL;
- // Loop through Patches
- while (stand.isobj) {
- Patch& patch = stand.getobj();
- Soil& soil = patch.soil;
- double to_gridcell_average = stand.get_gridcell_fraction() / (double)stand.npatch();
- awc_tot = 0.0;
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- awc_tot += soil.soiltype.awc[lyr];
- }
- flux_nseed_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::SEEDN)*to_gridcell_average;
- flux_nharvest_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::HARVESTN)*to_gridcell_average;
- flux_ntot_lc[stand.landcover] += (patch.fluxes.get_annual_flux(Fluxes::NH3_FIRE) +
- patch.fluxes.get_annual_flux(Fluxes::NOx_FIRE) +
- patch.fluxes.get_annual_flux(Fluxes::N2O_FIRE) +
- patch.fluxes.get_annual_flux(Fluxes::N2_FIRE) +
- patch.fluxes.get_annual_flux(Fluxes::N_SOIL)) * to_gridcell_average;
- flux_veg_lc[stand.landcover] += -patch.fluxes.get_annual_flux(Fluxes::NPP)*to_gridcell_average;
- flux_repr_lc[stand.landcover] += -patch.fluxes.get_annual_flux(Fluxes::REPRC)*to_gridcell_average;
- flux_soil_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::SOILC)*to_gridcell_average;
- flux_fire_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::FIREC)*to_gridcell_average;
- flux_est_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::ESTC)*to_gridcell_average;
- flux_seed_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::SEEDC)*to_gridcell_average;
- flux_charvest_lc[stand.landcover] += patch.fluxes.get_annual_flux(Fluxes::HARVESTC)*to_gridcell_average;
- c_fast_lc[stand.landcover] += patch.soil.cpool_fast*to_gridcell_average;
- c_slow_lc[stand.landcover] += patch.soil.cpool_slow*to_gridcell_average;
- //Sum slow pools of harvested products
- if (run_landcover && ifslowharvestpool) {
- for (int q = 0; q<npft; q++) {
- Patchpft& patchpft = patch.pft[q];
- c_harv_slow_lc[stand.landcover] += patchpft.harvested_products_slow*to_gridcell_average; //slow pool in receiving landcover (1)
- n_harv_slow_lc[stand.landcover] += patchpft.harvested_products_slow_nmass*to_gridcell_average;
- cProduct_gridcell += patchpft.harvested_products_slow*to_gridcell_average;
- nProduct_gridcell += patchpft.harvested_products_slow_nmass*to_gridcell_average;
- }
- }
- //Gridcell irrigation
- irrigation_gridcell += patch.irrigation_y*to_gridcell_average;
- andep_lc[stand.landcover] += stand.get_climate().andep * to_gridcell_average;
- anfert_lc[stand.landcover] += patch.anfert * to_gridcell_average;
- anmin_lc[stand.landcover] += patch.soil.anmin * to_gridcell_average;
- animm_lc[stand.landcover] += patch.soil.animmob * to_gridcell_average;
- anfix_lc[stand.landcover] += patch.soil.anfix * to_gridcell_average;
- n_min_leach_lc[stand.landcover] += patch.soil.aminleach * to_gridcell_average;
- n_org_leach_lc[stand.landcover] += patch.soil.aorgNleach * to_gridcell_average;
- c_org_leach_lc[stand.landcover] += patch.soil.aorgCleach * to_gridcell_average;
- availn_lc[stand.landcover] += (patch.soil.nmass_avail + patch.soil.snowpack_nmass) * to_gridcell_average;
- availn += (patch.soil.nmass_avail + patch.soil.snowpack_nmass) * to_gridcell_average;
- for (int r = 0; r < NSOMPOOL - 1; r++) {
- if (r == SURFMETA || r == SURFSTRUCT || r == SOILMETA || r == SOILSTRUCT) {
- surfsoillitterc_lc[stand.landcover] += patch.soil.sompool[r].cmass * to_gridcell_average;
- surfsoillittern_lc[stand.landcover] += patch.soil.sompool[r].nmass * to_gridcell_average;
- }
- else if (r == SURFFWD || r == SURFCWD) {
- cwdc_lc[stand.landcover] += patch.soil.sompool[r].cmass * to_gridcell_average;
- cwdn_lc[stand.landcover] += patch.soil.sompool[r].nmass * to_gridcell_average;
- }
- else {
- centuryc_lc[stand.landcover] += patch.soil.sompool[r].cmass * to_gridcell_average;
- centuryn_lc[stand.landcover] += patch.soil.sompool[r].nmass * to_gridcell_average;
- }
- // CRESCENDO
- if (r == SURFMETA || r == SURFSTRUCT) {
- cLitter_gridcell += soil.sompool[r].cmass * to_gridcell_average;
- nLitter_gridcell += soil.sompool[r].nmass * to_gridcell_average;
- }
- else if (r == SURFFWD || r == SURFCWD) {
- cLitter_gridcell += soil.sompool[r].cmass * to_gridcell_average;
- nLitter_gridcell += soil.sompool[r].nmass * to_gridcell_average;
- cCwd_gridcell += soil.sompool[r].cmass * to_gridcell_average;
- nCwd_gridcell += soil.sompool[r].nmass * to_gridcell_average;
- }
- else {
- cSoil_gridcell += soil.sompool[r].cmass * to_gridcell_average;
- nSoil_gridcell += soil.sompool[r].nmass * to_gridcell_average;
- }
- }
- // CRESCENDO / CMIP6 variables
- if (printcrescendo || printcmip6) {
- burntArea += patch.fireprob * 100.0 * to_gridcell_average;
- double mnwdFrac[12] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
- double fpcrescale = 0.0;
- double fpctotal = 0.0;
- double mfpctotal[12] = { 0.0 };
- double mfpcrescale[12] = { 0.0 };
- if (printcmip6) {
- Vegetation& vegetation = patch.vegetation;
- // Calculate correct FPC rescaling
- vegetation.firstobj();
- while (vegetation.isobj) {
- Individual& indiv = vegetation.getobj();
- fpctotal += indiv.fpc;
- for (int m = 0; m < 12; m++) {
- mfpctotal[m] += indiv.mfpc[m];
- }
- vegetation.nextobj();
- }
- fpcrescale = 1.0 / max(fpctotal, 1.0);
- for (int m = 0; m < 12; m++) {
- mfpcrescale[m] = 1.0 / max(mfpctotal[m], 1.0);
- }
- // Loop trough individuals
- vegetation.firstobj();
- while (vegetation.isobj) {
- Individual& indiv = vegetation.getobj();
- acVegLut[LCT] += indiv.ccont() * to_gridcell_average;
- double indiv_fpc = indiv.fpc * to_gridcell_average * fpcrescale;
- if (indiv.pft.landcover == CROPLAND) {
- acropFrac += indiv_fpc;
- }
- else if (indiv.pft.landcover == PASTURE) {
- apastureFrac += indiv_fpc;
- }
- else if (indiv.pft.lifeform == GRASS) {
- agrassFrac += indiv_fpc;
- }
- else if (indiv.pft.lifeform == TREE && (indiv.pft.name == "BLSE" || indiv.pft.name == "BLSS")) {
- ashrubfrac += indiv_fpc;
- }
- else if (indiv.pft.lifeform == TREE) {
- atreeFrac += indiv_fpc;
- }
- avegFrac += indiv_fpc;
- for (int m = 0; m < 12; m++) {
- mlai[m] += indiv.mlai[m] * to_gridcell_average;
- mlaiLut[LCT][m] += indiv.mlai[m] * to_gridcell_average;
- double indiv_mfpc = indiv.mfpc[m] * to_gridcell_average * mfpcrescale[m];
- if (indiv.pft.landcover == CROPLAND) {
- mcropFrac[m] += indiv_mfpc;
- if (indiv.pft.pathway == C3)
- mcropFracC3[m] += indiv_mfpc;
- else // C4
- mcropFracC4[m] += indiv_mfpc;
- }
- else if (indiv.pft.landcover == PASTURE) {
- mpastureFrac[m] += indiv_mfpc;
- if (indiv.pft.pathway == C3)
- mpastureFracC3[m] += indiv_mfpc;
- else // C4
- mpastureFracC4[m] += indiv_mfpc;
- }
- else if (indiv.pft.lifeform == GRASS) {
- mgrassFrac[m] += indiv_mfpc;
- if (indiv.pft.pathway == C3)
- mgrassFracC3[m] += indiv_mfpc;
- else // C4
- mgrassFracC4[m] += indiv_mfpc;
- }
- else if (indiv.pft.lifeform == TREE) {
- if (indiv.pft.name == "BLSE" || indiv.pft.name == "BLSS") {
- mshrubFrac[m] += indiv_mfpc;
- }
- else {
- if (indiv.pft.leafphysiognomy == BROADLEAF && (indiv.pft.phenology == SUMMERGREEN || indiv.pft.phenology == RAINGREEN)) {
- mBdlDcd[m] += indiv_mfpc;
- }
- else if (indiv.pft.leafphysiognomy == BROADLEAF && indiv.pft.phenology == EVERGREEN) {
- mBdlEvg[m] += indiv_mfpc;
- }
- else if (indiv.pft.leafphysiognomy == NEEDLELEAF && indiv.pft.phenology == SUMMERGREEN) {
- mNdlDcd[m] += indiv_mfpc;
- }
- else if (indiv.pft.leafphysiognomy == NEEDLELEAF && indiv.pft.phenology == EVERGREEN) {
- mNdlEvg[m] += indiv_mfpc;
- }
- mtreeFrac[m] += indiv_mfpc;
- }
- }
-
- if (indiv.pft.lifeform == TREE) {
- mnwdFrac[m] -= indiv.mfpc[m] * mfpcrescale[m];
- }
- }
- vegetation.nextobj();
- }
- for (int q = 0; q < npft; q++) {
- Patchpft& patchpft = patch.pft[q];
- acProductLut[LCT] += patchpft.harvested_products_slow*to_gridcell_average;
- }
- for (int r = 0; r < NSOMPOOL - 1; r++) {
- if (r == SURFMETA || r == SURFSTRUCT || r == SOILMETA || r == SOILSTRUCT || r == SURFFWD || r == SURFCWD) {
- acLitterLut[LCT] += soil.sompool[r].cmass * to_gridcell_average;
- }
- else {
- acSoilLut[LCT] += soil.sompool[r].cmass * to_gridcell_average;
- }
- }
- fracLut[LCT] += to_gridcell_average;
- }
- if (stand.landcover != BARREN)
- total_land += to_gridcell_average;
- for (int m = 0; m < 12; m++) {
- mmrso[m] += (soil.mwcont[m][0] * soil.soiltype.awc[0] + soil.mwcont[m][1] * soil.soiltype.awc[1]) * to_gridcell_average;
- mmrsos[m] += soil.mwcont[m][0] * soil.soiltype.awc[0] * to_gridcell_average / SOILDEPTH_UPPER * 100.0; // top 10cm
- mmrro[m] += patch.mrunoff[m] * to_gridcell_average;
- mevspsblveg[m] += patch.mintercep[m] * to_gridcell_average;
- mevspsblsoi[m] += patch.mevap[m] * to_gridcell_average;
- mevspsblpot[m] += patch.mpet[m] * to_gridcell_average;
- mtran[m] += patch.maet[m] * to_gridcell_average;
- mevapotrans[m] += (patch.maet[m] + patch.mevap[m] + patch.mintercep[m]) * to_gridcell_average;
- mgpp[m] += patch.fluxes.get_monthly_flux(Fluxes::GPP, m) * to_gridcell_average;
- mra[m] += patch.fluxes.get_monthly_flux(Fluxes::RA, m) * to_gridcell_average;
- mrh[m] += patch.fluxes.get_monthly_flux(Fluxes::SOILC, m) * to_gridcell_average;
- mreprest[m] += (patch.fluxes.get_monthly_flux(Fluxes::ESTC, m) + patch.fluxes.get_monthly_flux(Fluxes::REPRC, m)) * to_gridcell_average;
- mseed[m] += patch.fluxes.get_monthly_flux(Fluxes::SEEDC, m) * to_gridcell_average;
- mharv[m] += patch.fluxes.get_monthly_flux(Fluxes::HARVESTC, m) * to_gridcell_average;
- mharvgraz[m] += patch.fluxes.get_monthly_flux(Fluxes::HARVGRAZC, m) * to_gridcell_average;
- mfFire[m] += patch.fluxes.get_monthly_flux(Fluxes::FIREC, m) * to_gridcell_average;
- mfNdep[m] += patch.fluxes.get_monthly_flux(Fluxes::NDEP, m) * to_gridcell_average;
- mfBNF[m] += patch.fluxes.get_monthly_flux(Fluxes::NFIX, m) * to_gridcell_average;
- mfNup[m] += patch.fluxes.get_monthly_flux(Fluxes::NUP, m) * to_gridcell_average;
- mfNnetmin[m] += patch.fluxes.get_monthly_flux(Fluxes::NMIN, m) * to_gridcell_average;
- mfNleach[m] += patch.fluxes.get_monthly_flux(Fluxes::LEACHN, m) * to_gridcell_average;
- mfCleach[m] += patch.fluxes.get_monthly_flux(Fluxes::LEACHC, m) * to_gridcell_average;
- mfNgas[m] += (patch.fluxes.get_monthly_flux(Fluxes::NH3_FIRE, m) +
- patch.fluxes.get_monthly_flux(Fluxes::NOx_FIRE, m) + patch.fluxes.get_monthly_flux(Fluxes::N2O_FIRE, m) +
- patch.fluxes.get_monthly_flux(Fluxes::N2_FIRE, m) + patch.fluxes.get_monthly_flux(Fluxes::N_SOIL, m)) /
- to_gridcell_average;
- mfNgasFire[m] += (patch.fluxes.get_monthly_flux(Fluxes::NH3_FIRE, m) + patch.fluxes.get_monthly_flux(Fluxes::NOx_FIRE, m) +
- patch.fluxes.get_monthly_flux(Fluxes::N2O_FIRE, m) + patch.fluxes.get_monthly_flux(Fluxes::N2_FIRE, m)) /
- to_gridcell_average;
- mnseed[m] += patch.fluxes.get_monthly_flux(Fluxes::SEEDN, m) * to_gridcell_average;
- mnharv[m] += patch.fluxes.get_monthly_flux(Fluxes::HARVESTN, m) * to_gridcell_average;
- mfVegLitter[m] += patch.fluxes.get_monthly_flux(Fluxes::VEGLITTERC, m) * to_gridcell_average;
- mfNVegLitter[m] += patch.fluxes.get_monthly_flux(Fluxes::VEGLITTERN, m) * to_gridcell_average;
- mfLitterSoil[m] += patch.fluxes.get_monthly_flux(Fluxes::LITTERSOILC, m) * to_gridcell_average;
- mfNLitterSoil[m] += patch.fluxes.get_monthly_flux(Fluxes::LITTERSOILN, m) * to_gridcell_average;
- mtsl[m] += soil.mtemp_K[m] * to_gridcell_average;
- mfco2nat[m] += patch.fluxes.get_monthly_flux(Fluxes::CO2NAT, m) * to_gridcell_average;
- mfco2antt[m] += patch.fluxes.get_monthly_flux(Fluxes::CO2ANTT, m) * to_gridcell_average;
- if (stand.landcover != CROPLAND) { // Cropland has daily allocation so NPP is moved to Vegetation directly
- mcOtherNPP[m] += (patch.fluxes.get_monthly_flux(Fluxes::GPP, m) - patch.fluxes.get_monthly_flux(Fluxes::RA, m)) * to_gridcell_average;
- }
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- mmsl[m][lyr] += soil.mwcont[m][lyr] * soil.soiltype.awc[lyr] * to_gridcell_average;
- }
- if (printcrescendo) {
- msnd[m] += soil.msnd[m] * to_gridcell_average;
- mharvcrop[m] += patch.fluxes.get_monthly_flux(Fluxes::HARVCROPC, m) * to_gridcell_average;
- mfN2O[m] += patch.fluxes.get_monthly_flux(Fluxes::N2O_FIRE, m) * to_gridcell_average;
- mfNOx[m] += patch.fluxes.get_monthly_flux(Fluxes::NOx_FIRE, m) * to_gridcell_average;
- }
- if (printcmip6) {
- mmrros[m] += patch.mrunoff_surf[m] * to_gridcell_average;
- mcVeg[m] += patch.mcVeg[m] * to_gridcell_average;
- mnVeg[m] += patch.mnVeg[m] * to_gridcell_average;
- mcLeaf[m] += patch.mcLeaf[m] * to_gridcell_average;
- mnLeaf[m] += patch.mnLeaf[m] * to_gridcell_average;
- mcRoot[m] += patch.mcRoot[m] * to_gridcell_average;
- mnRoot[m] += patch.mnRoot[m] * to_gridcell_average;
- mcStem[m] += patch.mcStem[m] * to_gridcell_average;
- mnStem[m] += patch.mnStem[m] * to_gridcell_average;
- mcOther[m] += patch.mcOther[m] * to_gridcell_average;
- mcOtherPhen[m] += patch.mcOtherPhen[m] * to_gridcell_average;
- mnOther[m] += patch.mnOther[m] * to_gridcell_average;
- mcProduct[m] += patch.mcProduct[m] * to_gridcell_average;
- mnProduct[m] += patch.mnProduct[m] * to_gridcell_average;
- mcLitter[m] += soil.mcLitter[m] * to_gridcell_average;
- mnLitter[m] += soil.mnLitter[m] * to_gridcell_average;
- mcLitterCwd[m] += soil.mcLitterCwd[m] * to_gridcell_average;
- mnLitterCwd[m] += soil.mnLitterCwd[m] * to_gridcell_average;
- mcLitterSurf[m] += soil.mcLitterSurf[m] * to_gridcell_average;
- mnLitterSurf[m] += soil.mnLitterSurf[m] * to_gridcell_average;
- mcLitterSubSurf[m] += soil.mcLitterSubSurf[m] * to_gridcell_average;
- mnLitterSubSurf[m] += soil.mnLitterSubSurf[m] * to_gridcell_average;
- mcLitterAbove[m] += soil.mcLitterAbove[m] * to_gridcell_average;
- mcLitterBelow[m] += soil.mcLitterBelow[m] * to_gridcell_average;
- mcSoil[m] += soil.mcSoil[m] * to_gridcell_average;
- mnSoil[m] += soil.mnSoil[m] * to_gridcell_average;
- mcFast[m] += (soil.mcSoil[m] - (soil.mcMedium[m] + soil.mcSlow[m])) * to_gridcell_average;
- mcMedium[m] += soil.mcMedium[m] * to_gridcell_average;
- mcSlow[m] += soil.mcSlow[m] * to_gridcell_average;
- mnMinNH4[m] += soil.mnMineralNH4[m] * to_gridcell_average;
- mnMinNO3[m] += soil.mnMineralNO3[m] * to_gridcell_average;
- mnLand[m] = mnVeg[m] + mnProduct[m] + mnLitter[m] + mnSoil[m] + mnMinNH4[m] + mnMinNO3[m]; // to_gridcell_average is already considered
- mrhsoil[m] += (patch.fluxes.get_monthly_flux(Fluxes::SOILC, m) - patch.fluxes.get_monthly_flux(Fluxes::LITTERC, m)) * to_gridcell_average;
- mrhlitter[m] += patch.fluxes.get_monthly_flux(Fluxes::LITTERC, m) * to_gridcell_average;
- mgppGrass[m] += patch.fluxes.get_monthly_flux(Fluxes::GPPGRASS, m) * to_gridcell_average;
- mgppTree[m] += patch.fluxes.get_monthly_flux(Fluxes::GPPTREE, m) * to_gridcell_average;
- mraleaf[m] += patch.fluxes.get_monthly_flux(Fluxes::RALEAF, m) * to_gridcell_average;
- mraroot[m] += patch.fluxes.get_monthly_flux(Fluxes::RAROOT, m) * to_gridcell_average;
- mrastem[m] += patch.fluxes.get_monthly_flux(Fluxes::RASTEM, m) * to_gridcell_average;
- mraother[m] += patch.fluxes.get_monthly_flux(Fluxes::RAGROWTH, m) * to_gridcell_average;
- mraGrass[m] += patch.fluxes.get_monthly_flux(Fluxes::RAGRASS, m) * to_gridcell_average;
- mraTree[m] += patch.fluxes.get_monthly_flux(Fluxes::RATREE, m) * to_gridcell_average;
- mfVegFire[m] += patch.fluxes.get_monthly_flux(Fluxes::FIREVEGC, m) * to_gridcell_average;
- mfLitterFire[m] += patch.fluxes.get_monthly_flux(Fluxes::FIRELITTERC, m) * to_gridcell_average;
- mnfert[m] += patch.fluxes.get_monthly_flux(Fluxes::NFERT, m) * to_gridcell_average;
- mcTotFireLut[LCT][m] += patch.fluxes.get_monthly_flux(Fluxes::FIREC, m) * to_gridcell_average;
- mgppLut[LCT][m] += patch.fluxes.get_monthly_flux(Fluxes::GPP, m) * to_gridcell_average;
- mraLut[LCT][m] += patch.fluxes.get_monthly_flux(Fluxes::RA, m) * to_gridcell_average;
- mnppLut[LCT][m] += (patch.fluxes.get_monthly_flux(Fluxes::GPP, m) - patch.fluxes.get_monthly_flux(Fluxes::RA, m)) * to_gridcell_average;
- mrhLut[LCT][m] += patch.fluxes.get_monthly_flux(Fluxes::SOILC, m) * to_gridcell_average;
- mnecbLut[LCT][m] += (patch.fluxes.get_monthly_flux(Fluxes::GPP, m) - (patch.fluxes.get_monthly_flux(Fluxes::RA, m) +
- patch.fluxes.get_monthly_flux(Fluxes::SOILC, m) + patch.fluxes.get_monthly_flux(Fluxes::FIREC, m) +
- patch.fluxes.get_monthly_flux(Fluxes::ESTC, m) + patch.fluxes.get_monthly_flux(Fluxes::REPRC, m) + patch.fluxes.get_monthly_flux(Fluxes::LEACHC, m) +
- patch.fluxes.get_monthly_flux(Fluxes::SEEDC, m) + patch.fluxes.get_monthly_flux(Fluxes::HARVESTC, m))) * to_gridcell_average;
-
- mnwdFracLut[LCT][m] += max(0.0, mnwdFrac[m]) * to_gridcell_average;
- mrroLut[LCT][m] += patch.mrunoff[m] * to_gridcell_average;
- mrsoLut[LCT][m] += (soil.mwcont[m][0] * soil.soiltype.awc[0] + soil.mwcont[m][1] * soil.soiltype.awc[1]) * to_gridcell_average;
- mrsosLut[LCT][m] += soil.mwcont[m][0] * soil.soiltype.awc[0] * to_gridcell_average / SOILDEPTH_UPPER * 100.0; // top 10cm;
- mirrLut[LCT][m] += patch.irrigation_m[m] * to_gridcell_average;
- mfLulccProductLut[LCT][m] += (patch.fluxes.get_monthly_flux(Fluxes::HARVCROPSLOWC, m) + patch.fluxes.get_monthly_flux(Fluxes::HARVGRAZSLOWC, m)) * to_gridcell_average;
- mfLulccResidueLut[LCT][m] += patch.fluxes.get_monthly_flux(Fluxes::HARVCROPRESC, m) * to_gridcell_average;
- mfLulccAtmLut[LCT][m] += (patch.fluxes.get_monthly_flux(Fluxes::HARVCROPC, m) + patch.fluxes.get_monthly_flux(Fluxes::HARVGRAZC, m)) * to_gridcell_average; }
- }
- }
- if (printcmip6daily || printcrescendodaily || printcrescendofacedaily) {
- for (int d = 0; d < date.year_length(); d++) {
- dlai[d] += patch.dlai[d] * to_gridcell_average;
- if (printcmip6daily || printcrescendofacedaily) {
- dpet[d] += patch.dpet[d] * to_gridcell_average;
- daet[d] += patch.daet[d] * to_gridcell_average;
- devap[d] += patch.devap[d] * to_gridcell_average;
- dintercep[d] += patch.dintercep[d] * to_gridcell_average;
- dmrro[d] += patch.dmrro[d] * to_gridcell_average;
- dmrsll[d][0] += soil.dwcontupper[d] * soil.soiltype.awc[0] * to_gridcell_average;
- dmrsll[d][1] += soil.dwcontlower[d] * soil.soiltype.awc[1] * to_gridcell_average;
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- dtsl[d][lyr] += soil.dtsl[d][lyr] * to_gridcell_average;
- dmrsol[d][lyr] += soil.dmrsol[d][lyr] * to_gridcell_average;
- }
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- dgpp[d] += patch.fluxes.get_daily_flux(Fluxes::GPP, d) * to_gridcell_average;
- dnpp[d] += (patch.fluxes.get_daily_flux(Fluxes::GPP, d) - patch.fluxes.get_daily_flux(Fluxes::GPP, d)) * to_gridcell_average;
- drunoff[d] += patch.drunoff[d] * to_gridcell_average;
- ddrain[d] += patch.ddrain[d] * to_gridcell_average;
- dcleaf[d] += patch.dcLeaf[d] * to_gridcell_average;
- dnleaf[d] += patch.dnLeaf[d] * to_gridcell_average;
- dcroot[d] += patch.dcRoot[d] * to_gridcell_average;
- dnroot[d] += patch.dnRoot[d] * to_gridcell_average;
- dcwood[d] += patch.dcStem[d] * to_gridcell_average;
- dnwood[d] += patch.dnStem[d] * to_gridcell_average;
- dcother[d] += patch.dcOther[d] * to_gridcell_average;
- dnother[d] += patch.dnOther[d] * to_gridcell_average;
- dcflita[d] += soil.dcflita[d] * to_gridcell_average;
- dnlit[d] += soil.dnlit[d] * to_gridcell_average;
- dcflitb[d] += soil.dcflitb[d] * to_gridcell_average;
- dnrlit[d] += soil.dnrlit[d] * to_gridcell_average;
- dcclitb[d] += soil.dcclitb[d] * to_gridcell_average;
- dndw[d] += soil.dndw[d] * to_gridcell_average;
- dcsoil[d] += soil.dcsoil[d] * to_gridcell_average;
- dnsoil[d] += soil.dnsoil[d] * to_gridcell_average;
- dnmineral[d] += soil.dnmineral[d] * to_gridcell_average;
- dother[d] += (-patch.fluxes.get_daily_flux(Fluxes::DREPRC, d) + patch.fluxes.get_daily_flux(Fluxes::FIREC, d) + patch.fluxes.get_daily_flux(Fluxes::DESTC, d) + patch.fluxes.get_daily_flux(Fluxes::SEEDC, d) + patch.fluxes.get_daily_flux(Fluxes::HARVESTC, d)) * to_gridcell_average;
- drhet[d] += patch.fluxes.get_daily_flux(Fluxes::SOILC, d) * to_gridcell_average;
- drleaf[d] += patch.fluxes.get_daily_flux(Fluxes::DRALEAF, d) * to_gridcell_average;
- drroot[d] += patch.fluxes.get_daily_flux(Fluxes::DRAROOT, d) * to_gridcell_average;
- drwood[d] += patch.fluxes.get_daily_flux(Fluxes::DRASTEM, d) * to_gridcell_average;
- drgrowth[d] += patch.fluxes.get_daily_flux(Fluxes::DRAGROWTH, d) * to_gridcell_average;
- dnfix[d] += patch.fluxes.get_daily_flux(Fluxes::DNFIX, d) * to_gridcell_average;
- dnup[d] += patch.fluxes.get_daily_flux(Fluxes::DNUP, d) * to_gridcell_average;
- dngmin[d] += patch.fluxes.get_daily_flux(Fluxes::DGNMIN, d) * to_gridcell_average;
- dnmin[d] += patch.fluxes.get_daily_flux(Fluxes::DNMIN, d) * to_gridcell_average;
- dnvol[d] += patch.fluxes.get_daily_flux(Fluxes::DN_SOIL, d) * to_gridcell_average;
- dnleach[d] += patch.fluxes.get_daily_flux(Fluxes::DLEACHN, d) * to_gridcell_average;
- dngl[d] += patch.fluxes.get_daily_flux(Fluxes::DNGL, d) * to_gridcell_average;
- dngw[d] += patch.fluxes.get_daily_flux(Fluxes::DNGW, d) * to_gridcell_average;
- dngr[d] += patch.fluxes.get_daily_flux(Fluxes::DNGR, d) * to_gridcell_average;
- dnlitin[d] += patch.fluxes.get_daily_flux(Fluxes::DLEAFLITN, d) * to_gridcell_average;
- dnwlin[d] += patch.fluxes.get_daily_flux(Fluxes::DWOODLITN, d) * to_gridcell_average;
- dnrlin[d] += patch.fluxes.get_daily_flux(Fluxes::DROOTLITN, d) * to_gridcell_average;
- dcllfall[d] += patch.fluxes.get_daily_flux(Fluxes::DLEAFLITC, d) * to_gridcell_average;
- dcwin[d] += patch.fluxes.get_daily_flux(Fluxes::DWOODLITC, d) * to_gridcell_average;
- dcrlin[d] += patch.fluxes.get_daily_flux(Fluxes::DROOTLITC, d) * to_gridcell_average;
- if (d == date.year_length() - 1) {
- dgl[d] += patch.gl * to_gridcell_average;
- dgw[d] += patch.gw * to_gridcell_average;
- dgr[d] += patch.gr * to_gridcell_average;
- }
- }
- #endif
- }
- }
- stand.nextobj();
- } // patch loop
- ++gc_itr;
- } // stand loop
- // CMIP6
- if (printcmip6) {
- stlist.firstobj();
- while (stlist.isobj) {
- StandType& st = stlist.getobj();
- int LCT = 0;
- if (st.landcover == URBAN)
- LCT = URB;
- else if (st.landcover == PASTURE)
- LCT = PST;
- else if (st.landcover == CROPLAND)
- LCT = CRP;
- else
- LCT = PSL;
- fracOutLut[LCT] += gridcell.st[st.id].gross_frac_decrease;
- fracInLut[LCT] += gridcell.st[st.id].gross_frac_increase;
- mfLulccAtmLut[LCT][0] += gridcell.landcover.acflux_landuse_change_lc[st.landcover];
- mcTotFireLut[LCT][0] += gridcell.landcover.acflux_landuse_change_lc[st.landcover];
- mfProductDecompLut[LCT][0] += gridcell.landcover.acflux_harvest_slow_lc[st.landcover];
- mfLulccProductLut[LCT][0] += gridcell.landcover.harvest_product_lc[st.landcover];
- mfLulccResidueLut[LCT][0] += gridcell.landcover.acflux_harvest_wood_res_lc[st.landcover];
- mnecbLut[LCT][0] -= (gridcell.landcover.acflux_landuse_change_lc[st.landcover] + gridcell.landcover.acflux_harvest_slow_lc[st.landcover]);
-
- stlist.nextobj();
- }
- for (int m = 0; m < 12; m++) {
- mprecip[m] = gridcell.climate.mprec[m];
- }
- for (int d = 0; d < date.year_length(); d++) {
- dprecip[d] = gridcell.climate.dprec[d];
- }
- }
- // CRESCENDO/CMIP6
- if (printcrescendo || printcmip6) {
- mfLuc[0] = gridcell.landcover.acflux_landuse_change;
- mnfLuc[0] = gridcell.landcover.anflux_landuse_change;
- mcfLucdeforest[0] = gridcell.landcover.anflux_landuse_change_lc[NATURAL];
- mfProductDecomp[0] = gridcell.landcover.acflux_harvest_slow;
- mfNProductDecomp[0] = gridcell.landcover.anflux_harvest_slow;
- mfDeforestToProduct[0] += gridcell.landcover.harvest_product;
- mfNProduct[0] = gridcell.landcover.harvest_product_nmass;
- abaresoilFrac = max(0.0, 1.0 - (acropFrac + apastureFrac + agrassFrac + ashrubfrac + atreeFrac));
- for (int m = 0; m < 12; m++) {
- mnpp[m] = mgpp[m] - mra[m];
- mnep[m] = mnpp[m] - (mrh[m] + mfFire[m] + mreprest[m] + mfCleach[m]); // Natural fluxes
- mnbp[m] = mnep[m] - (mfLuc[m] + mseed[m] + mharv[m] + mfProductDecomp[m]); // Adding anthropogenic fluxes
- mfNloss[m] = mnfLuc[m] + mfNProductDecomp[m] + mfNleach[m] + mfNgas[m] + mnseed[m] + mnharv[m];
- if (m > 0) {
- mcOtherNPP[m] += mcOtherNPP[m - 1];
- }
- mcVeg[m] += mcOtherNPP[m];
- mcLand[m] = mcVeg[m] + mcProduct[m] + mcLitter[m] + mcSoil[m];
- }
- }
- #ifdef CRESCENDO_FACE
- // CRESCENDO
- if (printcrescendofacedaily) {
- dother[0] += gridcell.landcover.acflux_landuse_change;
- dother[0] += gridcell.landcover.acflux_harvest_slow;
- }
- #endif
- // Print per-stand totals
- if (printseparatestands) {
- Gridcell::iterator gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- int id = stand.id;;
- if (stand.landcover == NATURAL) {
- if (!out_anpp_stand_natural[id].invalid())
- outlimit_misc(out, out_anpp_stand_natural[id], stand.anpp);
- if (!out_cmass_stand_natural[id].invalid())
- outlimit_misc(out, out_cmass_stand_natural[id], stand.cmass);
- }
- else if (stand.landcover == FOREST) {
- if (!out_anpp_stand_forest[id].invalid())
- outlimit_misc(out, out_anpp_stand_forest[id], stand.anpp);
- if (!out_cmass_stand_forest[id].invalid())
- outlimit_misc(out, out_cmass_stand_forest[id], stand.cmass);
- }
- ++gc_itr;
- }
- }
- if (run[CROPLAND]) {
- outlimit_misc(out, out_irrigation, irrigation_gridcell);
- }
- // Print landcover totals to files
- if (run_landcover) {
- for (int i = 0; i<NLANDCOVERTYPES; i++) {
- if (run[i]) {
- switch (i) {
- case CROPLAND:
- break;
- case PASTURE:
- if (run[NATURAL]) {
- outlimit_misc(out, out_anpp_pasture, landcover_anpp[i]);
- outlimit_misc(out, out_cmass_pasture, landcover_cmass[i]);
- }
- break;
- case BARREN:
- break;
- case NATURAL:
- // if(run[FOREST] || run[PASTURE]) {
- if (run[FOREST]) {
- outlimit_misc(out, out_anpp_natural, landcover_anpp[i]);
- outlimit_misc(out, out_cmass_natural, landcover_cmass[i]);
- outlimit_misc(out, out_dens_natural, landcover_densindiv_total[i]);
- }
- break;
- case FOREST:
- if (run[NATURAL]) {
- outlimit_misc(out, out_anpp_forest, landcover_anpp[i]);
- outlimit_misc(out, out_cmass_forest, landcover_cmass[i]);
- outlimit_misc(out, out_dens_forest, landcover_densindiv_total[i]);
- }
- break;
- case URBAN:
- break;
- case PEATLAND:
- break;
- default:
- if (date.year == nyear_spinup)
- dprintf("Modify code to deal with landcover output!\n");
- }
- }
- }
- }
- // Print C fluxes to per-landcover files
- if (run_landcover) {
- for (int i = 0; i < NLANDCOVERTYPES; i++) {
- if (run[i]) {
- GuessOutput::Table* table_p = NULL;
- GuessOutput::Table* table_p_N = NULL;
- switch (i) {
- case CROPLAND:
- table_p = &out_cflux_cropland;
- table_p_N = &out_nflux_cropland;
- break;
- case PASTURE:
- table_p = &out_cflux_pasture;
- table_p_N = &out_nflux_pasture;
- break;
- case NATURAL:
- table_p = &out_cflux_natural;
- table_p_N = &out_nflux_natural;
- break;
- case FOREST:
- table_p = &out_cflux_forest;
- table_p_N = &out_nflux_forest;
- break;
- case URBAN:
- break;
- case PEATLAND:
- break;
- case BARREN:
- break;
- default:
- if (date.year == nyear_spinup)
- dprintf("Modify code to deal with landcover output!\n");
- }
- if (table_p) {
- outlimit_misc(out, *table_p, flux_veg_lc[i]);
- outlimit_misc(out, *table_p, -flux_repr_lc[i]);
- outlimit_misc(out, *table_p, flux_soil_lc[i] + c_org_leach_lc[i]);
- outlimit_misc(out, *table_p, flux_fire_lc[i]);
- outlimit_misc(out, *table_p, flux_est_lc[i]);
- outlimit_misc(out, *table_p_N, -andep_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, -anfix_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, -anfert_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, flux_ntot_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, (n_min_leach_lc[i] + n_org_leach_lc[i]) * m2toha);
- if (run_landcover) {
- outlimit_misc(out, *table_p, flux_seed_lc[i]);
- outlimit_misc(out, *table_p, flux_charvest_lc[i]);
- outlimit_misc(out, *table_p, lc.acflux_landuse_change_lc[i]);
- outlimit_misc(out, *table_p, lc.acflux_harvest_slow_lc[i]);
- outlimit_misc(out, *table_p_N, flux_nseed_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, flux_nharvest_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, lc.anflux_landuse_change_lc[i] * m2toha);
- outlimit_misc(out, *table_p_N, lc.anflux_harvest_slow_lc[i] * m2toha);
- }
- }
- double cflux_total = flux_veg_lc[i] - flux_repr_lc[i] + flux_soil_lc[i] + flux_fire_lc[i] + flux_est_lc[i] + c_org_leach_lc[i];
- double nflux_total = -andep_lc[i] - anfix_lc[i] - anfert_lc[i] + flux_ntot_lc[i] + n_min_leach_lc[i] + n_org_leach_lc[i];
- if (run_landcover) {
- cflux_total += flux_seed_lc[i];
- cflux_total += flux_charvest_lc[i];
- cflux_total += lc.acflux_landuse_change_lc[i];
- cflux_total += lc.acflux_harvest_slow_lc[i];
- nflux_total += flux_nseed_lc[i];
- nflux_total += flux_nharvest_lc[i];
- nflux_total += lc.anflux_landuse_change_lc[i];
- nflux_total += lc.anflux_harvest_slow_lc[i];
- }
- if (table_p) {
- outlimit_misc(out, *table_p, cflux_total);
- outlimit_misc(out, *table_p_N, nflux_total * m2toha);
- }
- }
- }
- // Print C pools to per-landcover files
- for (int i = 0; i < NLANDCOVERTYPES; i++) {
- if (run[i]) {
- GuessOutput::Table* table_p = NULL;
- GuessOutput::Table* table_p_N = NULL;
- switch (i) {
- case CROPLAND:
- table_p = &out_cpool_cropland;
- table_p_N = &out_npool_cropland;
- break;
- case PASTURE:
- table_p = &out_cpool_pasture;
- table_p_N = &out_npool_pasture;
- break;
- case NATURAL:
- table_p = &out_cpool_natural;
- table_p_N = &out_npool_natural;
- break;
- case FOREST:
- table_p = &out_cpool_forest;
- table_p_N = &out_npool_forest;
- break;
- case URBAN:
- break;
- case PEATLAND:
- break;
- case BARREN:
- break;
- default:
- if (date.year == nyear_spinup)
- dprintf("Modify code to deal with landcover output!\n");
- }
- if (table_p) {
- outlimit_misc(out, *table_p, landcover_cmass[i] * lc.frac[i]);
- outlimit_misc(out, *table_p_N, (landcover_nmass[i] + landcover_nlitter[i]) * lc.frac[i]);
- if (!ifcentury) {
- outlimit_misc(out, *table_p, landcover_clitter[i] * lc.frac[i]);
- outlimit_misc(out, *table_p, c_fast_lc[i]);
- outlimit_misc(out, *table_p, c_slow_lc[i]);
- }
- else {
- outlimit_misc(out, *table_p, landcover_clitter[i] * lc.frac[i] + surfsoillitterc_lc[i] + cwdc_lc[i]);
- outlimit_misc(out, *table_p, centuryc_lc[i]);
- outlimit_misc(out, *table_p_N, surfsoillittern_lc[i] + cwdn_lc[i]);
- outlimit_misc(out, *table_p_N, centuryn_lc[i] + availn_lc[i]);
- }
- if (run_landcover && ifslowharvestpool) {
- outlimit_misc(out, *table_p, c_harv_slow_lc[i]);
- outlimit_misc(out, *table_p_N, n_harv_slow_lc[i]);
- }
- }
- // Calculate total cpool, starting with cmass and litter...
- double cpool_total = (landcover_cmass[i] + landcover_clitter[i]) * lc.frac[i];
- double npool_total = (landcover_nmass[i] + landcover_nlitter[i]) * lc.frac[i];
- // Add SOM pools
- if (!ifcentury) {
- cpool_total += c_fast_lc[i] + c_slow_lc[i];
- }
- else {
- cpool_total += centuryc_lc[i] + surfsoillitterc_lc[i] + cwdc_lc[i];
- npool_total += centuryn_lc[i] + surfsoillittern_lc[i] + cwdn_lc[i] + availn_lc[i];
- }
- // Add slow harvest pool if needed
- if (run_landcover && ifslowharvestpool) {
- cpool_total += c_harv_slow_lc[i];
- npool_total += n_harv_slow_lc[i];
- }
- if (table_p) {
- outlimit_misc(out, *table_p, cpool_total);
- outlimit_misc(out, *table_p_N, npool_total);
- }
- }
- }
- }
- // Output of seasonality variables
- if (run[CROPLAND]) {
- outlimit_misc(out, out_seasonality, gridcell.climate.seasonality);
- outlimit_misc(out, out_seasonality, gridcell.climate.var_temp);
- outlimit_misc(out, out_seasonality, gridcell.climate.var_prec);
- outlimit_misc(out, out_seasonality, gridcell.climate.mtemp_min20);
- outlimit_misc(out, out_seasonality, gridcell.climate.atemp_mean);
- outlimit_misc(out, out_seasonality, gridcell.climate.temp_seasonality);
- outlimit_misc(out, out_seasonality, gridcell.climate.mprec_petmin20);
- outlimit_misc(out, out_seasonality, gridcell.climate.aprec);
- outlimit_misc(out, out_seasonality, gridcell.climate.prec_range);
- }
- // Monthly CO2
- for (int m = 0; m < 12; m++) {
- outlimit_misc(out, out_mco2, gridcell.climate.mco2[m]);
- }
- // Annual output of CRESCENDO variables
- if (printcrescendo) {
- outlimit_misc(out, cresc_burntArea, burntArea);
- outlimit_misc(out, cresc_cVeg, cVeg_gridcell);
- outlimit_misc(out, cresc_nVeg, nVeg_gridcell);
- outlimit_misc(out, cresc_cLitter, cLitter_gridcell);
- outlimit_misc(out, cresc_nLitter, nLitter_gridcell);
- outlimit_misc(out, cresc_cSoil, cSoil_gridcell);
- outlimit_misc(out, cresc_nSoil, nSoil_gridcell + availn);
- outlimit_misc(out, cresc_cProduct, cProduct_gridcell);
- outlimit_misc(out, cresc_nProduct, nProduct_gridcell);
- outlimit_misc(out, cresc_cLeaf, cLeaf_gridcell);
- outlimit_misc(out, cresc_nLeaf, nLeaf_gridcell);
- outlimit_misc(out, cresc_cRoot, cRoot_gridcell);
- outlimit_misc(out, cresc_nRoot, nRoot_gridcell);
- outlimit_misc(out, cresc_cWood, cWood_gridcell);
- outlimit_misc(out, cresc_nWood, nWood_gridcell);
- outlimit_misc(out, cresc_cCwd, cCwd_gridcell);
- outlimit_misc(out, cresc_nCwd, nCwd_gridcell);
- }
- // Annual output of CMIP6 variables
- if (printcmip6) {
- for (int lc = 0; lc < NCMIP6LANDCOVERTYPES; lc++) {
- outlimit_misc(out, cmip6_fracLut, fracLut[lc]);
- outlimit_misc(out, cmip6_cSoilLut, fracLut[lc] > EPS ? acSoilLut[lc] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_cVegLut, fracLut[lc] > EPS ? acVegLut[lc] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_cLitterLut, fracLut[lc] > EPS ? acLitterLut[lc] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_cProductLut, fracLut[lc] > EPS ? acProductLut[lc] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_fracOutLut, fracOutLut[lc]);
- outlimit_misc(out, cmip6_fracInLut, fracInLut[lc]);
- }
- outlimit_misc(out, cmip6_acropFrac, acropFrac);
- outlimit_misc(out, cmip6_apastureFrac, apastureFrac);
- outlimit_misc(out, cmip6_agrassFrac, agrassFrac);
- outlimit_misc(out, cmip6_ashrubFrac, ashrubfrac);
- outlimit_misc(out, cmip6_atreeFrac, atreeFrac);
- outlimit_misc(out, cmip6_avegFrac, avegFrac);
- outlimit_misc(out, cmip6_abaresoilFrac, abaresoilFrac);
- outlimit_misc(out, cmip6_aresidualFrac, aresidualFrac);
- outlimit_misc(out, cmip6_acVeg, cVeg_gridcell);
- outlimit_misc(out, cmip6_acLitter, cLitter_gridcell);
- outlimit_misc(out, cmip6_acSoil, cSoil_gridcell);
- outlimit_misc(out, cmip6_acProduct, cProduct_gridcell);
- outlimit_misc(out, cmip6_aburntFractionAll_yearly, burntArea);
- for (int m = 0; m < 11; m++) {
- outlimit_misc(out, cmip6_aburntFractionAll_monthly, 0);
- }
- outlimit_misc(out, cmip6_aburntFractionAll_monthly, burntArea);
- }
- outlimit_misc(out, cmip6_cyLand, gridcell.cLand);
- outlimit_misc(out, cmip6_cyFlux, gridcell.cFlux);
- // Monthly output CRESCENDO/CMIP6 on a single row
- if (printcrescendo || printcmip6) {
- double NPP_acc;
- for (int m = 0; m < 12; m++) {
- double mthtosec = 1.0 / secondspermonth[m];
- NPP_acc = m > 0 ? NPP_acc + mnpp[m - 1] : 0.0;
- if (printcrescendo) {
- outlimit_misc(out, cresc_tas, gridcell.climate.mtemp_K[m]);
- outlimit_misc(out, cresc_pr, gridcell.climate.mprec[m] * mthtosec);
- outlimit_misc(out, cresc_rsds, gridcell.climate.mrsds[m] * mthtosec);
- outlimit_misc(out, cresc_mrso, mmrso[m]);
- outlimit_misc(out, cresc_mrro, mmrro[m] * mthtosec);
- outlimit_misc(out, cresc_evapotrans, mevapotrans[m] * mthtosec);
- outlimit_misc(out, cresc_evspsblveg, mevspsblveg[m] * mthtosec);
- outlimit_misc(out, cresc_evspsblsoi, mevspsblsoi[m] * mthtosec);
- outlimit_misc(out, cresc_tran, mtran[m] * mthtosec);
- outlimit_misc(out, cresc_snd, msnd[m]);
- outlimit_misc(out, cresc_gpp, mgpp[m] * mthtosec);
- outlimit_misc(out, cresc_ra, mra[m] * mthtosec);
- outlimit_misc(out, cresc_rh, mrh[m] * mthtosec);
- outlimit_misc(out, cresc_npp, mnpp[m] * mthtosec);
- outlimit_misc(out, cresc_nbp, mnbp[m] * mthtosec);
- outlimit_misc(out, cresc_fFire, mfFire[m] * mthtosec);
- outlimit_misc(out, cresc_fLuc, mfLuc[m] * mthtosec);
- outlimit_misc(out, cresc_fReprEst, mreprest[m] * mthtosec);
- outlimit_misc(out, cresc_fSeed, mseed[m] * mthtosec);
- outlimit_misc(out, cresc_fHarv, mharv[m] * mthtosec);
- outlimit_misc(out, cresc_harvcrop, mharvcrop[m] * mthtosec);
- outlimit_misc(out, cresc_harvgraz, mharvgraz[m] * mthtosec);
- outlimit_misc(out, cresc_prod, mfProductDecomp[m] * mthtosec);
- outlimit_misc(out, cresc_fNdep, mfNdep[m] * mthtosec);
- outlimit_misc(out, cresc_fBNF, mfBNF[m] * mthtosec);
- outlimit_misc(out, cresc_fNup, mfNup[m] * mthtosec);
- outlimit_misc(out, cresc_fNnetmin, mfNnetmin[m] * mthtosec);
- outlimit_misc(out, cresc_fNleach, mfNleach[m] * mthtosec);
- outlimit_misc(out, cresc_fCleach, mfCleach[m] * mthtosec);
- outlimit_misc(out, cresc_fNgas, mfNgas[m] * mthtosec);
- outlimit_misc(out, cresc_fNgasFire, mfNgasFire[m] * mthtosec);
- outlimit_misc(out, cresc_fN2O, mfN2O[m] * mthtosec);
- outlimit_misc(out, cresc_fNOx, mfNOx[m] * mthtosec);
- outlimit_misc(out, cresc_fNloss, mfNloss[m] * mthtosec);
- outlimit_misc(out, cresc_fVegLitter, mfVegLitter[m] * mthtosec);
- outlimit_misc(out, cresc_fNVegLitter, mfNVegLitter[m] * mthtosec);
- outlimit_misc(out, cresc_fLitterSoil, mfLitterSoil[m] * mthtosec);
- outlimit_misc(out, cresc_fNLitterSoil, mfNLitterSoil[m] * mthtosec);
- outlimit_misc(out, cresc_tsl, mtsl[m]);
- }
- if (printcmip6) {
- mvegFrac[m] = mtreeFrac[m] + mgrassFrac[m] + mshrubFrac[m] + mcropFrac[m] + mpastureFrac[m];
- mbaresoilFrac[m] = max(0.0, total_land - (mvegFrac[m] + mresidualFrac[m]));
- outlimit_misc(out, cmip6_treeFrac, mtreeFrac[m]);
- outlimit_misc(out, cmip6_grassFrac, mgrassFrac[m]);
- outlimit_misc(out, cmip6_shrubFrac, mshrubFrac[m]);
- outlimit_misc(out, cmip6_cropFrac, mcropFrac[m]);
- outlimit_misc(out, cmip6_pastureFrac, mpastureFrac[m]);
- outlimit_misc(out, cmip6_vegFrac, mvegFrac[m]);
- outlimit_misc(out, cmip6_baresoilFrac, mbaresoilFrac[m]);
- outlimit_misc(out, cmip6_residualFrac, mresidualFrac[m]);
- outlimit_misc(out, cmip6_pastureFracC3, mpastureFracC3[m]);
- outlimit_misc(out, cmip6_pastureFracC4, mpastureFracC4[m]);
- outlimit_misc(out, cmip6_grassFracC3, mgrassFracC3[m]);
- outlimit_misc(out, cmip6_grassFracC4, mgrassFracC4[m]);
- outlimit_misc(out, cmip6_cropFracC3, mcropFracC3[m]);
- outlimit_misc(out, cmip6_cropFracC4, mcropFracC4[m]);
- outlimit_misc(out, cmip6_lai, mlai[m]);
- outlimit_misc(out, cmip6_cVeg, mcVeg[m]);
- outlimit_misc(out, cmip6_cLeaf, mcLeaf[m]);
- outlimit_misc(out, cmip6_cRoot, mcRoot[m]);
- outlimit_misc(out, cmip6_cStem, mcStem[m]);
- outlimit_misc(out, cmip6_cWood, mcStem[m]);
- outlimit_misc(out, cmip6_cOther, mcOther[m] + mcOtherNPP[m] + mcOtherPhen[m]);
- outlimit_misc(out, cmip6_cLitter, mcLitter[m]);
- outlimit_misc(out, cmip6_cLitterCwd, mcLitterCwd[m]);
- outlimit_misc(out, cmip6_cCwd, 0.0); // dead organic matter composed of coarse wood. It is distinct from litter.
- outlimit_misc(out, cmip6_cLitterSurf, mcLitterSurf[m]);
- outlimit_misc(out, cmip6_cLitterAbove, mcLitterAbove[m]);
- outlimit_misc(out, cmip6_cLitterSubSurf, mcLitterSubSurf[m]);
- outlimit_misc(out, cmip6_cLitterBelow, mcLitterBelow[m]);
- outlimit_misc(out, cmip6_cSoil, mcSoil[m]);
- outlimit_misc(out, cmip6_cSoilFast, mcFast[m]);
- outlimit_misc(out, cmip6_cSoilMedium, mcMedium[m]);
- outlimit_misc(out, cmip6_cSoilSlow, mcSlow[m]);
- outlimit_misc(out, cmip6_cProduct, mcProduct[m]);
- outlimit_misc(out, cmip6_cLand, mcLand[m]);
- outlimit_misc(out, cmip6_nVeg, mnVeg[m]);
- outlimit_misc(out, cmip6_nLeaf, mnLeaf[m]);
- outlimit_misc(out, cmip6_nRoot, mnRoot[m]);
- outlimit_misc(out, cmip6_nStem, mnStem[m]);
- outlimit_misc(out, cmip6_nOther, mnOther[m]);
- outlimit_misc(out, cmip6_nLitter, mnLitter[m]);
- outlimit_misc(out, cmip6_nLitterCwd, mnLitterCwd[m]);
- outlimit_misc(out, cmip6_nLitterSurf, mnLitterSurf[m]);
- outlimit_misc(out, cmip6_nLitterSubSurf, mnLitterSubSurf[m]);
- outlimit_misc(out, cmip6_nSoil, mnSoil[m]);
- outlimit_misc(out, cmip6_nProduct, mnProduct[m]);
- outlimit_misc(out, cmip6_nLand, mnLand[m]);
- outlimit_misc(out, cmip6_nMinNH4, mnMinNH4[m]);
- outlimit_misc(out, cmip6_nMinNO3, mnMinNO3[m]);
- outlimit_misc(out, cmip6_nMineral, mnMinNH4[m] + mnMinNO3[m]);
- outlimit_misc(out, cmip6_fN2O, mfN2O[m] * mthtosec);
- outlimit_misc(out, cmip6_fNOx, mfNOx[m] * mthtosec);
- outlimit_misc(out, cmip6_nbp, mnbp[m] * mthtosec);
- outlimit_misc(out, cmip6_netAtmosLandCO2Flux, mnbp[m] * mthtosec);
- outlimit_misc(out, cmip6_nep, mnep[m] * mthtosec);
- outlimit_misc(out, cmip6_gpp, mgpp[m] * mthtosec);
- outlimit_misc(out, cmip6_gppGrass, mgppGrass[m] * mthtosec);
- outlimit_misc(out, cmip6_gppTree, mgppTree[m] * mthtosec);
- outlimit_misc(out, cmip6_ra, mra[m] * mthtosec);
- outlimit_misc(out, cmip6_rh, mrh[m] * mthtosec);
- outlimit_misc(out, cmip6_npp, mnpp[m] * mthtosec);
- outlimit_misc(out, cmip6_nppGrass, (mgppGrass[m] - mraGrass[m]) * mthtosec);
- outlimit_misc(out, cmip6_nppTree, (mgppTree[m] - mraTree[m]) * mthtosec);
- outlimit_misc(out, cmip6_rhSoil, mrhsoil[m] * mthtosec);
- outlimit_misc(out, cmip6_rhLitter, mrhlitter[m] * mthtosec);
- outlimit_misc(out, cmip6_fCLandToOcean, mfCleach[m] * mthtosec);
- outlimit_misc(out, cmip6_fNLandToOcean, mfNleach[m] * mthtosec);
- outlimit_misc(out, cmip6_raLeaf, mraleaf[m] * mthtosec);
- outlimit_misc(out, cmip6_raRoot, mraroot[m] * mthtosec);
- outlimit_misc(out, cmip6_raStem, mrastem[m] * mthtosec);
- outlimit_misc(out, cmip6_raOther, mraother[m] * mthtosec);
- outlimit_misc(out, cmip6_raGrass, mraGrass[m] * mthtosec);
- outlimit_misc(out, cmip6_raTree, mraTree[m] * mthtosec);
- outlimit_misc(out, cmip6_rGrowth, mraother[m] * mthtosec);
- outlimit_misc(out, cmip6_rMaint, (mra[m] - mraother[m]) * mthtosec);
- outlimit_misc(out, cmip6_fVegLitter, mfVegLitter[m] * mthtosec);
- outlimit_misc(out, cmip6_fVegOther, (mreprest[m] + mseed[m] + mharv[m]) * mthtosec);
- outlimit_misc(out, cmip6_fNVegLitter, mfNVegLitter[m] * mthtosec);
- outlimit_misc(out, cmip6_fLitterSoil, mfLitterSoil[m] * mthtosec);
- outlimit_misc(out, cmip6_fNLitterSoil, mfNLitterSoil[m] * mthtosec);
- outlimit_misc(out, cmip6_fFireNat, mfFire[m] * mthtosec);
- outlimit_misc(out, cmip6_fFire, mfFire[m] * mthtosec);
- outlimit_misc(out, cmip6_fVegFire, mfVegFire[m] * mthtosec);
- outlimit_misc(out, cmip6_fLitterFire, mfLitterFire[m] * mthtosec);
- outlimit_misc(out, cmip6_fFireAll, (mfFire[m] + mfLuc[m]) * mthtosec);
- outlimit_misc(out, cmip6_fAnthDisturb, (mfLuc[m] + mharv[m]) * mthtosec);
- outlimit_misc(out, cmip6_fHarvestToAtmos, mharv[m] * mthtosec);
- outlimit_misc(out, cmip6_fDeforestToAtmos, mcfLucdeforest[m] * mthtosec);
- outlimit_misc(out, cmip6_fluc, mfLuc[m] * mthtosec);
- outlimit_misc(out, cmip6_fHarvest, mharv[m] * mthtosec);
- outlimit_misc(out, cmip6_fDeforestToProduct, mfDeforestToProduct[m] * mthtosec);
- outlimit_misc(out, cmip6_fProductDecomp, mfProductDecomp[m] * mthtosec);
- outlimit_misc(out, cmip6_fco2antt, mfco2antt[m] * mthtosec);
- outlimit_misc(out, cmip6_fco2nat, mfco2nat[m] * mthtosec);
- outlimit_misc(out, cmip6_fNProduct, mfNProduct[m] * mthtosec);
- outlimit_misc(out, cmip6_fNAnthDisturb, (mnfLuc[m] + mnharv[m]) * mthtosec);
- outlimit_misc(out, cmip6_fGrazing, mharvgraz[m] * mthtosec);
- outlimit_misc(out, cmip6_fBNF, mfBNF[m] * mthtosec);
- outlimit_misc(out, cmip6_fNloss, mfNloss[m] * mthtosec);
- outlimit_misc(out, cmip6_fNfert, mnfert[m] * mthtosec);
- outlimit_misc(out, cmip6_fNup, mfNup[m] * mthtosec);
- outlimit_misc(out, cmip6_fNnetmin, mfNnetmin[m] * mthtosec);
- outlimit_misc(out, cmip6_fNleach, mfNleach[m] * mthtosec);
- outlimit_misc(out, cmip6_fNgas, mfNgas[m] * mthtosec);
- outlimit_misc(out, cmip6_fNdep, mfNdep[m] * mthtosec);
- outlimit_misc(out, cmip6_fNgasFire, mfNgasFire[m] * mthtosec);
- outlimit_misc(out, cmip6_fNgasNonFire, (mfNgas[m] - mfNgasFire[m]) * mthtosec);
- outlimit_misc(out, cmip6_mrso, mmrso[m]);
- outlimit_misc(out, cmip6_evspsbl, mevapotrans[m] * mthtosec);
- outlimit_misc(out, cmip6_evspsblveg, mevspsblveg[m] * mthtosec);
- outlimit_misc(out, cmip6_prveg, mevspsblveg[m] * mthtosec);
- outlimit_misc(out, cmip6_evspsblsoi, mevspsblsoi[m] * mthtosec);
- outlimit_misc(out, cmip6_evspsblpot, mevspsblpot[m] * mthtosec);
- outlimit_misc(out, cmip6_tran, mtran[m] * mthtosec);
- outlimit_misc(out, cmip6_mrro, mmrro[m] * mthtosec);
- outlimit_misc(out, cmip6_mrros, mmrros[m] * mthtosec);
- outlimit_misc(out, cmip6_prCrop, mprecip[m] * mthtosec);
- outlimit_misc(out, cmip6_mrsos, mmrsos[m]);
- outlimit_misc(out, cmip6_treeFracBdlDcd, mBdlDcd[m]);
- outlimit_misc(out, cmip6_treeFracBdlEvg, mBdlEvg[m]);
- outlimit_misc(out, cmip6_treeFracNdlDcd, mNdlDcd[m]);
- outlimit_misc(out, cmip6_treeFracNdlEvg, mNdlEvg[m]);
- outlimit_misc(out, cmip6_vegHeightTree, min(99.9, treefpc > 0.0 ? vegHeightTree / treefpc : 0.0));
- outlimit_misc(out, cmip6_cLand1, gridcell.mcLand1[m] + NPP_acc);
- }
- }
- }
- // Montly output for CRESCENDO/CMIP6 on multiple rows
- if (printcrescendo || printcmip6) {
- for (int m = 0; m < 12; m++) {
- OutputRows out(output_channel, lon, lat, date.get_calendar_year(), CTMONTH, m + 1);
- double mthtosec = 1.0 / secondspermonth[m];
- double bare_soil = total_land;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- if (printcrescendo) {
- outlimit_misc(out, cresc_lai, pft_mlcf[m][pft.id] > 0 ? pft_mlai[m][pft.id] / pft_mlcf[m][pft.id] : 0);
- outlimit_misc(out, cresc_lcf, pft_mlcf[m][pft.id]);
- outlimit_misc(out, cresc_fapar, pft_mfapar[m][pft.id]);
- if (pft.lifeform == TREE) {
- outlimit_misc(out, cresc_vH, pft_vegheight[pft.id]);
- outlimit_misc(out, cresc_tD, pft_treedens[pft.id]);
- }
- }
- if (printcmip6) {
- outlimit_misc(out, cmip6_landCoverFrac, pft_mlcf[m][pft.id]);
- }
- bare_soil -= pft_mlcf[m][pft.id]; // reduce total land to represent bare soil
-
- pftlist.nextobj();
- }
- if (printcrescendo) {
- outlimit_misc(out, cresc_lcf, bare_soil);
- }
- if (printcmip6) {
- outlimit_misc(out, cmip6_landCoverFrac, bare_soil);
- }
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- if (printcrescendo) {
- outlimit_misc(out, cresc_msl, mmsl[m][lyr]);
- }
- if (printcmip6) {
- outlimit_misc(out, cmip6_mrsol, mmsl[m][lyr]);
- outlimit_misc(out, cmip6_mrsll, mmsl[m][lyr]);
- outlimit_misc(out, cmip6_tsl, mtsl[m]);
- }
- }
- if (printcmip6) {
- for (int lc = 0; lc < NCMIP6LANDCOVERTYPES; lc++) {
- outlimit_misc(out, cmip6_mfracLut, fracLut[lc]);
- outlimit_misc(out, cmip6_cTotFireLut, fracLut[lc] > EPS ? mcTotFireLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_fLulccAtmLut, fracLut[lc] > EPS ? mfLulccAtmLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_fLulccProductLut, fracLut[lc] > EPS ? mfLulccProductLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_fLulccResidueLut, fracLut[lc] > EPS ? mfLulccResidueLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_fProductDecompLut, fracLut[lc] > EPS ? mfProductDecompLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_gppLut, fracLut[lc] > EPS ? mgppLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_irrLut, fracLut[lc] > EPS ? mirrLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_laiLut, fracLut[lc] > EPS ? mlaiLut[lc][m] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_mrroLut, fracLut[lc] > EPS ? mrroLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_mrsoLut, fracLut[lc] > EPS ? mrsoLut[lc][m] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_mrsosLut, fracLut[lc] > EPS ? mrsosLut[lc][m] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_necbLut, fracLut[lc] > EPS ? mnecbLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_nppLut, fracLut[lc] > EPS ? mnppLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_nwdFracLut, fracLut[lc] > EPS ? mnwdFracLut[lc][m] / fracLut[lc] : 0.0);
- outlimit_misc(out, cmip6_raLut, fracLut[lc] > EPS ? mraLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- outlimit_misc(out, cmip6_rhLut, fracLut[lc] > EPS ? mrhLut[lc][m] / fracLut[lc] * mthtosec : 0.0);
- }
- }
- }
- }
- // Daily output for CRESCENDO/CMIP6
- if (printcrescendodaily || printcmip6daily || printcrescendofacedaily) {
- for (int d = 0; d < date.year_length(); d++) {
- OutputRows out(output_channel, lon, lat, date.get_calendar_year(), CTDAY, d+1);
- double daytosec = 1.0 / secondsperday;
- if (printcrescendodaily) {
- outlimit_misc(out, cresc_dlai, dlai[d]);
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- outlimit_misc(out, face_co2, gridcell.climate.co2_daily[d]);
- outlimit_misc(out, face_ppt, gridcell.climate.ppt_daily[d]);
- outlimit_misc(out, face_par, gridcell.climate.par_daily[d]);
- outlimit_misc(out, face_at, gridcell.climate.at_daily[d]);
- outlimit_misc(out, face_st, dtsl[d][0] - K2degC);
- outlimit_misc(out, face_sw, 100.0 * dmrso[d] / awc_tot);
- outlimit_misc(out, face_ndep, gridcell.climate.ndep_daily[d] * kgtog);
- outlimit_misc(out, face_et, (daet[d] + devap[d]) * daytosec);
- outlimit_misc(out, face_t, daet[d] * daytosec);
- outlimit_misc(out, face_es, devap[d] * daytosec);
- outlimit_misc(out, face_ec, dintercep[d] * daytosec);
- outlimit_misc(out, face_ro, drunoff[d]);
- outlimit_misc(out, face_drain, ddrain[d]);
- outlimit_misc(out, face_nep, (dnpp[d] - drhet[d]) * kgtog);
- outlimit_misc(out, face_gpp, dgpp[d] * kgtog);
- outlimit_misc(out, face_npp, dnpp[d] * kgtog);
- outlimit_misc(out, face_reco, (drhet[d] + (dgpp[d] - dnpp[d])) * kgtog);
- outlimit_misc(out, face_rauto, (dgpp[d] - dnpp[d]) * kgtog);
- outlimit_misc(out, face_rhet, drhet[d] * kgtog);
- outlimit_misc(out, face_rsoil, drhet[d] * kgtog);
- outlimit_misc(out, face_rother, dother[d] * kgtog);
- outlimit_misc(out, face_rleaf, drleaf[d] * kgtog);
- outlimit_misc(out, face_rroot, drroot[d] * kgtog);
- outlimit_misc(out, face_rwood, drwood[d] * kgtog);
- outlimit_misc(out, face_rgrow, drgrowth[d] * kgtog);
- outlimit_misc(out, face_cl, dcleaf[d] * kgtog);
- outlimit_misc(out, face_cw, dcwood[d] * kgtog);
- outlimit_misc(out, face_cfr, dcroot[d] * kgtog);
- outlimit_misc(out, face_tnc, dcother[d] * kgtog);
- outlimit_misc(out, face_ncon, dnleaf[d] > 0.0 ? dcleaf[d] / dnleaf[d] : 0.0);
- outlimit_misc(out, face_ncan, dnleaf[d] * kgtog);
- outlimit_misc(out, face_nwood, dnwood[d] * kgtog);
- outlimit_misc(out, face_nfr, dnroot[d] * kgtog);
- outlimit_misc(out, face_nstor, dnother[d] * kgtog);
- outlimit_misc(out, face_lai, dlai[d]);
- outlimit_misc(out, face_lma, !negligible(dlai[d]) ? dcleaf[d] * kgtog / dlai[d] : 0.0);
- outlimit_misc(out, face_cflit, (dcflita[d] + dcflitb[d]) * kgtog);
- outlimit_misc(out, face_cflita, dcflita[d] * kgtog);
- outlimit_misc(out, face_nlit, dnlit[d] * kgtog);
- outlimit_misc(out, face_cflitb, dcflitb[d] * kgtog);
- outlimit_misc(out, face_nrlit, dnrlit[d] * kgtog);
- outlimit_misc(out, face_cclitb, dcclitb[d] * kgtog);
- outlimit_misc(out, face_ndw, dndw[d] * kgtog);
- outlimit_misc(out, face_csoil, dcsoil[d] * kgtog);
- outlimit_misc(out, face_nsoil, (dnsoil[d] + dnmineral[d]) * kgtog);
- outlimit_misc(out, face_npoolm, dnmineral[d] * kgtog);
- outlimit_misc(out, face_npoolo, dnsoil[d] * kgtog);
- outlimit_misc(out, face_nfix, dnfix[d] * kgtog);
- outlimit_misc(out, face_nup, dnup[d] * kgtog);
- outlimit_misc(out, face_ngmin, dngmin[d] * kgtog);
- outlimit_misc(out, face_nmin, dnmin[d] * kgtog);
- outlimit_misc(out, face_nvol, dnvol[d] * kgtog);
- outlimit_misc(out, face_nleach, dnleach[d] * kgtog);
- outlimit_misc(out, face_gl, dgl[d] * kgtog);
- outlimit_misc(out, face_gw, dgw[d] * kgtog);
- outlimit_misc(out, face_gr, dgr[d] * kgtog);
- outlimit_misc(out, face_ngl, dngl[d] * kgtog);
- outlimit_misc(out, face_ngw, dngw[d] * kgtog);
- outlimit_misc(out, face_ngr, dngr[d] * kgtog);
- outlimit_misc(out, face_nlitin, dnlitin[d] * kgtog);
- outlimit_misc(out, face_nwlin, dnwlin[d] * kgtog);
- outlimit_misc(out, face_nrlin, dnrlin[d] * kgtog);
- outlimit_misc(out, face_cllfall, dcllfall[d] * kgtog);
- outlimit_misc(out, face_crlin, dcrlin[d] * kgtog);
- outlimit_misc(out, face_cwin, dcwin[d] * kgtog);
- }
- #endif
- if (printcmip6daily) {
- outlimit_misc(out, cmip6_dlai, dlai[d]);
- outlimit_misc(out, cmip6_devspsblpot, dpet[d] * daytosec);
- outlimit_misc(out, cmip6_dprCrop, dprecip[d] * daytosec);
- outlimit_misc(out, cmip6_dtran, daet[d] * daytosec);
- outlimit_misc(out, cmip6_dec, dintercep[d] * daytosec);
- outlimit_misc(out, cmip6_dprveg, dintercep[d] * daytosec);
- outlimit_misc(out, cmip6_det, (daet[d] + devap[d]) * daytosec);
- outlimit_misc(out, cmip6_dmrso, dmrsol[d][0] + dmrsol[d][1]);
- outlimit_misc(out, cmip6_dmrsos, dmrsol[d][0]);
- outlimit_misc(out, cmip6_dmrro, dmrro[d] * daytosec);
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- outlimit_misc(out, cmip6_dmrsol, dmrsol[d][lyr]);
- outlimit_misc(out, cmip6_dtsl, dtsl[d][lyr]);
- outlimit_misc(out, cmip6_dmrsll, dmrsll[d][lyr]);
- }
- }
- }
- }
- // IFS data sent to LPJ-GUESS - daily output
- if (printifsinputdaily) {
- for (int d = 0; d < date.year_length(); d++) {
- OutputRows out(output_channel, lon, lat, date.get_calendar_year(), CTDAY, d+1);
- outlimit_misc(out, ifs_input, gridcell.ifs_co2[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_par[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_lw[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_precip[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_temp2m[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_tempsoil[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_soilw_surf[d]);
- outlimit_misc(out, ifs_input, gridcell.ifs_soilw_deep[d]);
- }
- }
- // Monthly output of lambda
- for (int m = 0; m < 12; m++) {
- OutputRows out(output_channel, lon, lat, date.get_calendar_year(), CTMONTH, m+1);
- for (int q = 0; q < npft; q++) {
- outlimit_misc(out, out_mlambda, !negligible(pft_mgpp[m][q]) ? pft_mlambda_gpp[m][q] / pft_mgpp[m][q] : 0.0);
- }
- }
- }
- /// Output of simulation results at the end of each day
- /** This function does not have to provide any information to the framework.
- */
- void MiscOutput::outdaily(Gridcell& gridcell) {
- double lon = gridcell.get_lon();
- double lat = gridcell.get_lat();
- OutputRows out(output_channel, lon, lat, date.get_calendar_year(), CTDAY, date.day);
- if (date.year < nyear_spinup) {
- return;
- }
- Climate& climate = gridcell.climate;
- // reset mean monthly temperature output
- if (date.day == 0) {
- if (printcrescendo || printcmip6) {
- for (int m = 0; m < 12; m++) {
- climate.mtemp_K[m] = 0.0;
- climate.mprec[m] = 0.0;
- climate.mrsds[m] = 0.0;
- }
- for (int d = 0; d < date.year_length(); d++) {
- climate.dprec[d] = 0.0;
- }
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- for (int d = 0; d < date.year_length(); d++) {
- climate.co2_daily[d] = 0.0;
- climate.ppt_daily[d] = 0.0;
- climate.par_daily[d] = 0.0;
- climate.at_daily[d] = 0.0;
- climate.ndep_daily[d] = 0.0;
- }
- }
- #endif
- }
- // CRESCENDO and CMIP6 outputs
- if (printcrescendo || printcmip6) {
- climate.mtemp_K[date.month] += (climate.temp + K2degC) / (double)date.month_length(date.month);
- climate.mprec[date.month] += climate.prec;
- climate.mrsds[date.month] += climate.rad;
- climate.dprec[date.day] = climate.prec;
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- climate.co2_daily[date.day] = climate.co2;
- climate.ppt_daily[date.day] = climate.prec;
- climate.par_daily[date.day] = climate.par * 0.00000456; // 1 J/s == 4.56*10-6 Mol/s in Daylight
- climate.at_daily[date.day] = climate.temp;
- climate.ndep_daily[date.day] = climate.dndep;
- }
- #endif
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- if (pft.landcover != CROPLAND) {
- pftlist.nextobj();
- continue;
- }
- Gridcell::iterator gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- if (stand.landcover != CROPLAND || stand.npatch() > 1) {
- break;
- }
- stand.firstobj();
- while (stand.isobj) {
- Patch& patch = stand.getobj();
- Vegetation& vegetation = patch.vegetation;
- Patchpft& patchpft = patch.pft[pft.id];
- double cwdn = patch.soil.sompool[SURFCWD].nmass + patch.soil.sompool[SURFFWD].nmass;
- vegetation.firstobj();
- while (vegetation.isobj) {
- Individual& indiv = vegetation.getobj();
- if (indiv.id != -1 && indiv.pft.id == pft.id) {//&& !indiv.cropindiv->isintercropgrass) {
- //To be able to print values for the year after establishment of crops !
- // (if not dead and has existed for at least one year)
- // Ben 2007-11-28
- plot("daily leaf N [g/m2]", pft.name, date.day, indiv.nmass_leaf*m2toha);
- plot("daily leaf C [kg/m2]", pft.name, date.day, indiv.cmass_leaf_today()*m2toha);
- outlimit_misc(out, out_daily_lai, indiv.lai_today());
- outlimit_misc(out, out_daily_npp, indiv.dnpp*m2toha);
- outlimit_misc(out, out_daily_cmass_leaf, indiv.cmass_leaf_today()*m2toha);
- outlimit_misc(out, out_daily_nmass_leaf, indiv.nmass_leaf*m2toha);
- outlimit_misc(out, out_daily_cmass_root, indiv.cmass_root_today()*m2toha);
- outlimit_misc(out, out_daily_nmass_root, indiv.nmass_root*m2toha);
- outlimit_misc(out, out_daily_avail_nmass_soil, m2toha*(patch.soil.nmass_avail + cwdn));
- outlimit_misc(out, out_daily_n_input_soil, patch.soil.ninput*m2toha);
- double uw = patch.soil.dwcontupper[date.day];
- if (uw < 1e-22) {
- uw = 0.0;
- }
- // double lw = patch.soil.dwcontlower[date.day];
- double lw = patch.soil.dwcontlower_today;
- if (lw < 1e-22) {
- lw = 0.0;
- }
- outlimit_misc(out, out_daily_upper_wcont, uw);
- outlimit_misc(out, out_daily_lower_wcont, lw);
- outlimit_misc(out, out_daily_irrigation, patch.irrigation_d);
- outlimit_misc(out, out_daily_cmass_storage, indiv.cropindiv->grs_cmass_ho*m2toha);
- outlimit_misc(out, out_daily_nmass_storage, indiv.cropindiv->nmass_ho*m2toha);
- outlimit_misc(out, out_daily_ndemand, indiv.ndemand);
- outlimit_misc(out, out_daily_cton, limited_cton(indiv.cmass_leaf_today(), indiv.nmass_leaf*m2toha));
- if (ifnlim) {
- outlimit_misc(out, out_daily_ds, patch.pft[pft.id].cropphen->dev_stage); // daglig ds
- outlimit_misc(out, out_daily_cmass_stem, (indiv.cropindiv->grs_cmass_agpool + indiv.cropindiv->grs_cmass_stem)*m2toha);
- outlimit_misc(out, out_daily_nmass_stem, indiv.cropindiv->nmass_agpool*m2toha);
- outlimit_misc(out, out_daily_cmass_dead_leaf, indiv.cropindiv->grs_cmass_dead_leaf*m2toha);
- outlimit_misc(out, out_daily_nmass_dead_leaf, indiv.cropindiv->nmass_dead_leaf*m2toha);
- outlimit_misc(out, out_daily_fphu, patch.pft[pft.id].cropphen->fphu);
- outlimit_misc(out, out_daily_stem, patch.pft[pft.id].cropphen->f_alloc_stem);
- outlimit_misc(out, out_daily_leaf, patch.pft[pft.id].cropphen->f_alloc_leaf);
- outlimit_misc(out, out_daily_root, patch.pft[pft.id].cropphen->f_alloc_root);
- outlimit_misc(out, out_daily_storage, patch.pft[pft.id].cropphen->f_alloc_horg);
- }
- }
- vegetation.nextobj();
- }
- stand.nextobj();
- }
- ++gc_itr;
- }
- pftlist.nextobj();
- }
- outlimit_misc(out, out_daily_temp, gridcell.climate.temp);
- outlimit_misc(out, out_daily_prec, gridcell.climate.prec);
- outlimit_misc(out, out_daily_rad, gridcell.climate.rad);
- // CRESCENDO/CMIP6 output variables
- // Daily and summed monthly C and N pools across patches
- if (printcrescendo || printcmip6 || printcrescendofacedaily) {
- Gridcell::iterator gc_itr = gridcell.begin();
- // Loop through Stands
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- stand.firstobj();
- //Loop through Patches
- while (stand.isobj) {
- Patch& patch = stand.getobj();
- Soil& soil = patch.soil;
- Vegetation& vegetation = patch.vegetation;
- double to_gridcell_average = stand.get_gridcell_fraction() / (double)stand.npatch();
- if (date.day == 0) {
- for (int m = 0; m < 12; m++) {
- patch.mcVeg[m] = 0.0;
- patch.mnVeg[m] = 0.0;
- patch.mcLeaf[m] = 0.0;
- patch.mnLeaf[m] = 0.0;
- patch.mcRoot[m] = 0.0;
- patch.mnRoot[m] = 0.0;
- patch.mcStem[m] = 0.0;
- patch.mnStem[m] = 0.0;
- patch.mcOther[m] = 0.0;
- patch.mcOtherPhen[m] = 0.0;
- patch.mnOther[m] = 0.0;
- patch.mcProduct[m] = 0.0;
- patch.mnProduct[m] = 0.0;
- patch.mcLand[m] = 0.0;
- patch.mnLand[m] = 0.0;
- soil.msnd[m] = 0.0;
- soil.mcLitter[m] = 0.0;
- soil.mcLitterCwd[m] = 0.0;
- soil.mcLitterSurf[m] = 0.0;
- soil.mcLitterSubSurf[m] = 0.0;
- soil.mcLitterAbove[m] = 0.0;
- soil.mcLitterBelow[m] = 0.0;
- soil.mcSoil[m] = 0.0;
- soil.mcMedium[m] = 0.0;
- soil.mcSlow[m] = 0.0;
- soil.mnLitter[m] = 0.0;
- soil.mnLitterCwd[m] = 0.0;
- soil.mnLitterSurf[m] = 0.0;
- soil.mnLitterSubSurf[m] = 0.0;
- soil.mnSoil[m] = 0.0;
- soil.mnMineralNH4[m] = 0.0;
- soil.mnMineralNO3[m] = 0.0;
- soil.mtemp_K[m] = 0.0;
- }
- for (int d = 0; d < date.year_length(); d++) {
- patch.dlai[d] = 0.0;
- patch.dmrro[d] = 0.0;
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- patch.dcLeaf[d] = 0.0;
- patch.dnLeaf[d] = 0.0;
- patch.dcRoot[d] = 0.0;
- patch.dnRoot[d] = 0.0;
- patch.dcStem[d] = 0.0;
- patch.dnStem[d] = 0.0;
- patch.dcOther[d] = 0.0;
- patch.dnOther[d] = 0.0;
- soil.dcflita[d] = 0.0;
- soil.dnlit[d] = 0.0;
- soil.dcflitb[d] = 0.0;
- soil.dnrlit[d] = 0.0;
- soil.dcclitb[d] = 0.0;
- soil.dndw[d] = 0.0;
- soil.dcsoil[d] = 0.0;
- soil.dnsoil[d] = 0.0;
- soil.dnmineral[d] = 0.0;
- }
- #endif
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- soil.dtsl[d][lyr] = 0.0;
- soil.dmrsol[d][lyr] = 0.0;
- }
- }
- }
- vegetation.firstobj();
- while (vegetation.isobj) {
- Individual& indiv = vegetation.getobj();
- if (date.day == 0) {
- for (int m = 0; m < 12; m++) {
- indiv.mfpc[m] = 0.0;
- indiv.mfpar[m] = 0.0;
- }
- }
- indiv.mfpc[date.month] += indiv.fpc_today() / (double)date.month_length(date.month);
- indiv.mfpar[date.month] += indiv.fpar / (double)date.month_length(date.month);
- // Vegetation carbon
- if (date.month < 11) {
- patch.mcVeg[date.month] += (indiv.cleafcont() + indiv.crootcont() + indiv.cmass_wood()) / (double)date.month_length(date.month);
- patch.mcLeaf[date.month] += indiv.cleafcont() * indiv.phen / (double)date.month_length(date.month);
- patch.mcRoot[date.month] += indiv.crootcont() * indiv.phen / (double)date.month_length(date.month);
- patch.mcStem[date.month] += indiv.cmass_wood() / (double)date.month_length(date.month);
- patch.mcOtherPhen[date.month] += (indiv.cleafcont() + indiv.crootcont()) * (1.0 - indiv.phen) / (double)date.month_length(date.month);
- }
- else if (!date.islastday) { // last day of the year allocation of anpp will make the number inconsistent
- patch.mcVeg[date.month] += (indiv.cleafcont() + indiv.crootcont() + indiv.cmass_wood()) / (double)(date.month_length(date.month) - 1);
- patch.mcLeaf[date.month] += indiv.cleafcont() * indiv.phen / (double)(date.month_length(date.month) - 1);
- patch.mcRoot[date.month] += indiv.crootcont() * indiv.phen / (double)(date.month_length(date.month) - 1);
- patch.mcStem[date.month] += indiv.cmass_wood() / (double)(date.month_length(date.month) - 1);
- patch.mcOtherPhen[date.month] += (indiv.cleafcont() + indiv.crootcont()) * (1.0 - indiv.phen) / (double)(date.month_length(date.month) - 1);
- }
- // Vegetation nitrogen
- if (indiv.phen != 0.0) {
- patch.mnVeg[date.month] += (indiv.nleafcont() + indiv.nrootcont() + indiv.nmass_wood()) / (double)date.month_length(date.month);
- patch.mnLeaf[date.month] += indiv.nleafcont() / (double)date.month_length(date.month);
- patch.mnRoot[date.month] += indiv.nrootcont() / (double)date.month_length(date.month);
- }
- else {
- patch.mnVeg[date.month] += (indiv.nleafcont() + indiv.nrootcont()) / (double)date.month_length(date.month);
- patch.mnOther[date.month] += (indiv.nleafcont() + indiv.nrootcont()) / (double)date.month_length(date.month);
- }
- patch.mnVeg[date.month] += indiv.nmass_wood() / (double)date.month_length(date.month);
- patch.mnStem[date.month] += indiv.nmass_wood() / (double)date.month_length(date.month);
- // Crop carbon and nitrogen
- if (indiv.pft.landcover == CROPLAND) {
- patch.mcVeg[date.month] += (indiv.cropindiv->grs_cmass_ho + indiv.cropindiv->grs_cmass_agpool + indiv.cropindiv->grs_cmass_dead_leaf + indiv.cropindiv->grs_cmass_stem) / (double)date.month_length(date.month);
- patch.mnVeg[date.month] += (indiv.cropindiv->nmass_ho + indiv.cropindiv->nmass_agpool + indiv.cropindiv->nmass_dead_leaf) / (double)date.month_length(date.month);
- patch.mcOther[date.month] += (indiv.cropindiv->grs_cmass_ho + indiv.cropindiv->grs_cmass_agpool + indiv.cropindiv->grs_cmass_dead_leaf + indiv.cropindiv->grs_cmass_stem) / (double)date.month_length(date.month);
- patch.mnOther[date.month] += (indiv.cropindiv->nmass_ho + indiv.cropindiv->nmass_agpool + indiv.cropindiv->nmass_dead_leaf) / (double)date.month_length(date.month);
- }
- patch.dlai[date.day] += indiv.lai_today();
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- patch.dcLeaf[date.day] += indiv.cleafcont() * indiv.phen;
- patch.dcRoot[date.day] += indiv.crootcont() * indiv.phen;
- patch.dcStem[date.day] += indiv.cmass_wood();
- patch.dcOther[date.day] += (indiv.cleafcont() + indiv.crootcont()) * (1.0 - indiv.phen);
- // Vegetation nitrogen
- if (indiv.phen != 0.0) {
- patch.dnLeaf[date.day] += indiv.nleafcont();
- patch.dnRoot[date.day] += indiv.nrootcont();
- }
- else {
- patch.dnOther[date.day] += indiv.nleafcont() + indiv.nrootcont();
- }
- patch.dnStem[date.day] += indiv.nmass_wood();
- if (indiv.pft.lifeform == TREE) {
- patch.dnStem[date.day] -= indiv.nstore();
- }
- else if (indiv.phen != 0.0) {
- patch.dnRoot[date.day] -= indiv.nstore();
- }
- patch.dnOther[date.day] += indiv.nstore();
- // Crop carbon and nitrogen
- if (indiv.pft.landcover == CROPLAND) {
- patch.dcOther[date.day] += indiv.cropindiv->grs_cmass_ho + indiv.cropindiv->grs_cmass_agpool + indiv.cropindiv->grs_cmass_dead_leaf + indiv.cropindiv->grs_cmass_stem;
- patch.dnOther[date.day] += indiv.cropindiv->nmass_ho + indiv.cropindiv->nmass_agpool + indiv.cropindiv->nmass_dead_leaf;
- }
- }
- #endif
- vegetation.nextobj();
- }
- // CRESCENDO physical variables output
- soil.msnd[date.month] += soil.snowpack / (soil.snowdens * (double)date.month_length(date.month));
- soil.mnMineralNH4[date.month] += soil.nmass_avail / (double)date.month_length(date.month);
- soil.mnMineralNO3[date.month] += 0.0 / (double)date.month_length(date.month);
- soil.mtemp_K[date.month] += (soil.temp + K2degC) / (double)date.month_length(date.month);
- #ifdef CRESCENDO_FACE
- soil.dnmineral[date.day] = soil.nmass_avail;
- #endif
- for (int r = 0; r < NSOMPOOL - 1; r++) {
- if (r == SURFMETA || r == SURFSTRUCT) {
- soil.mcLitter[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitter[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- soil.mcLitterAbove[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mcLitterSurf[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitterSurf[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- soil.dcflita[date.day] += soil.sompool[r].cmass;
- soil.dnlit[date.day] += soil.sompool[r].nmass;
- }
- #endif
- }
- else if (r == SOILMETA || r == SOILSTRUCT) {
- soil.mcLitter[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitter[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- soil.mcLitterBelow[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mcLitterSubSurf[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitterSubSurf[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- soil.dcflitb[date.day] += soil.sompool[r].cmass;
- soil.dnrlit[date.day] += soil.sompool[r].nmass;
- soil.dcsoil[date.day] += soil.sompool[r].cmass;
- soil.dnsoil[date.day] += soil.sompool[r].nmass;
- }
- #endif
- }
- else if (r == SURFFWD || r == SURFCWD) {
- soil.mcLitter[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitter[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- soil.mcLitterSurf[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitterSurf[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- soil.mcLitterCwd[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnLitterCwd[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- soil.dcclitb[date.day] += soil.sompool[r].cmass;
- soil.dndw[date.day] += soil.sompool[r].nmass;
- }
- #endif
- }
- else {
- soil.mcSoil[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- soil.mnSoil[date.month] += soil.sompool[r].nmass / (double)date.month_length(date.month);
- if (r == SLOWSOM) {
- soil.mcMedium[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- }
- if (r == PASSIVESOM) {
- soil.mcSlow[date.month] += soil.sompool[r].cmass / (double)date.month_length(date.month);
- }
- #ifdef CRESCENDO_FACE
- if (printcrescendofacedaily) {
- soil.dcsoil[date.day] += soil.sompool[r].cmass;
- soil.dnsoil[date.day] += soil.sompool[r].nmass;
- }
- #endif
- }
- }
- for (int lyr = 0; lyr < NSOILLAYER; lyr++) {
- soil.dtsl[date.day][lyr] += soil.temp + K2degC;
- soil.dmrsol[date.day][lyr] += soil.wcont[lyr] * soil.soiltype.awc[lyr];
- }
- stand.nextobj();
- } // patch loop
- ++gc_itr;
- } // stand loop
- // Loop through patch pfts
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- Gridcell::iterator gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- double to_gridcell_average = stand.get_gridcell_fraction() / (double)stand.npatch();
- stand.firstobj();
- while (stand.isobj) {
- Patch& patch = stand.getobj();
- Vegetation& vegetation = patch.vegetation;
- Patchpft& patchpft = patch.pft[pft.id];
- patch.mcProduct[date.month] += patchpft.harvested_products_slow * to_gridcell_average / (double)date.ndaymonth[date.month];
- patch.mnProduct[date.month] += patchpft.harvested_products_slow_nmass * to_gridcell_average / (double)date.ndaymonth[date.month];
- if (date.month < 11) {
- patch.soil.mcLitter[date.month] += (patchpft.litter_leaf + patchpft.litter_root + patchpft.litter_sap + patchpft.litter_heart) / (double)date.month_length(date.month);
- patch.soil.mnLitter[date.month] += (patchpft.nmass_litter_leaf + patchpft.nmass_litter_root + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (double)date.month_length(date.month);
- patch.soil.mcLitterCwd[date.month] += (patchpft.litter_sap + patchpft.litter_heart) / (double)date.month_length(date.month);
- patch.soil.mnLitterCwd[date.month] += (patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (double)date.month_length(date.month);
- patch.soil.mcLitterAbove[date.month] += (patchpft.litter_leaf + patchpft.litter_root) / (double)date.month_length(date.month);
- patch.soil.mcLitterSurf[date.month] += (patchpft.litter_leaf + patchpft.litter_sap + patchpft.litter_heart) / (double)date.month_length(date.month);
- patch.soil.mnLitterSurf[date.month] += (patchpft.nmass_litter_leaf + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (double)date.month_length(date.month);
- patch.soil.mcLitterSubSurf[date.month] += patchpft.litter_root / (double)date.month_length(date.month);
- patch.soil.mnLitterSubSurf[date.month] += patchpft.nmass_litter_root / (double)date.month_length(date.month);
- }
- else if (!date.islastday) {
- patch.soil.mcLitter[date.month] += (patchpft.litter_leaf + patchpft.litter_root + patchpft.litter_sap + patchpft.litter_heart) / (date.ndaymonth[date.month] - 1);
- patch.soil.mnLitter[date.month] += (patchpft.nmass_litter_leaf + patchpft.nmass_litter_root + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (date.ndaymonth[date.month] - 1);
- patch.soil.mcLitterCwd[date.month] += (patchpft.litter_sap + patchpft.litter_heart) / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mnLitterCwd[date.month] += (patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mcLitterAbove[date.month] += (patchpft.litter_leaf + patchpft.litter_root) / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mcLitterSurf[date.month] += (patchpft.litter_leaf + patchpft.litter_sap + patchpft.litter_heart) / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mnLitterSurf[date.month] += (patchpft.nmass_litter_leaf + patchpft.nmass_litter_sap + patchpft.nmass_litter_heart) / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mcLitterSubSurf[date.month] += patchpft.litter_root / (double)(date.ndaymonth[date.month] - 1);
- patch.soil.mnLitterSubSurf[date.month] += patchpft.nmass_litter_root / (double)(date.ndaymonth[date.month] - 1);
- }
- stand.nextobj();
- }
- ++gc_itr;
- }
- pftlist.nextobj();
- }
- }
- outlimit_misc(out, out_daily_temp, gridcell.climate.temp);
- outlimit_misc(out, out_daily_prec, gridcell.climate.prec);
- outlimit_misc(out, out_daily_rad, gridcell.climate.rad);
- }
- void MiscOutput::openlocalfiles(Gridcell& gridcell) {
- if (!printseparatestands)
- return;
- bool open_natural = false;
- bool open_forest = false;
- double lon = gridcell.get_lon();
- double lat = gridcell.get_lat();
- if (printseparatestands) {
- Gridcell::iterator gc_itr = gridcell.begin();
- // Loop through Stands
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- stand.anpp = 0.0;
- stand.cmass = 0.0;
- if (stand.first_year == date.year || stand.clone_year == date.year) {
- if (stand.landcover == NATURAL) {
- open_natural = true;
- }
- else if (stand.landcover == FOREST) {
- open_forest = true;
- }
- }
- ++gc_itr;
- }
- if (PRINTFIRSTSTANDFROM1901 && date.year == nyear_spinup) {
- open_natural = true;
- open_forest = true;
- }
- if (open_natural || open_forest) {
- gc_itr = gridcell.begin();
- while (gc_itr != gridcell.end()) {
- Stand& stand = *gc_itr;
- int id = stand.id;
- char outfilename[100] = { '\0' }, buffer[50] = { '\0' };
- sprintf(buffer, "%.1f_%.1f_%d", lon, lat, id);
- strcat(buffer, ".out");
- // create a vector with the pft names
- std::vector<std::string> pfts;
- pftlist.firstobj();
- while (pftlist.isobj) {
- Pft& pft = pftlist.getobj();
- Standpft& standpft = stand.pft[pft.id];
- if (standpft.active)
- pfts.push_back((char*)pft.name);
- pftlist.nextobj();
- }
- ColumnDescriptors anpp_columns;
- anpp_columns += ColumnDescriptors(pfts, 8, 3);
- anpp_columns += ColumnDescriptor("Total", 8, 3);
- if (open_natural && stand.landcover == NATURAL) {
- strcpy(outfilename, "anpp_natural_");
- strcat(outfilename, buffer);
- if (out_anpp_stand_natural[id].invalid())
- create_output_table(out_anpp_stand_natural[id], outfilename, anpp_columns);
- outfilename[0] = '\0';
- strcpy(outfilename, "cmass_natural_");
- strcat(outfilename, buffer);
- if (out_cmass_stand_natural[id].invalid())
- create_output_table(out_cmass_stand_natural[id], outfilename, anpp_columns);
- }
- else if (open_forest && stand.landcover == FOREST) {
- strcpy(outfilename, "anpp_forest_");
- strcat(outfilename, buffer);
- if (out_anpp_stand_forest[id].invalid())
- create_output_table(out_anpp_stand_forest[id], outfilename, anpp_columns);
- outfilename[0] = '\0';
- strcpy(outfilename, "cmass_forest_");
- strcat(outfilename, buffer);
- if (out_cmass_stand_forest[id].invalid())
- create_output_table(out_cmass_stand_forest[id], outfilename, anpp_columns);
- }
- ++gc_itr;
- }
- }
- }
- }
- void MiscOutput::closelocalfiles(Gridcell& gridcell) {
- if (!printseparatestands)
- return;
- if (printseparatestands) {
- for (int id = 0; id < MAXNUMBER_STANDS; id++) {
- if (!out_anpp_stand_natural[id].invalid())
- close_output_table(out_anpp_stand_natural[id]);
- if (!out_cmass_stand_natural[id].invalid())
- close_output_table(out_cmass_stand_natural[id]);
- if (!out_anpp_stand_forest[id].invalid())
- close_output_table(out_anpp_stand_forest[id]);
- if (!out_cmass_stand_forest[id].invalid())
- close_output_table(out_cmass_stand_forest[id]);
- }
- }
- }
- } // namespace
|