Skip to content
Snippets Groups Projects
Commit a45a5222 authored by David Klein's avatar David Klein
Browse files

Refactoring: -start scripts (part 5): renamed submit_run(cfg) into...

Refactoring: -start scripts (part 5): renamed submit_run(cfg) into submit.R(cfg), deleted conopt files
parent 5dd2de11
No related branches found
No related tags found
1 merge request!34Refactoring start scripts (yeah!)
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-7;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-7;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-8;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-6;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-7;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-7;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-7;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-8;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-9;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
rtnwtr = 1.e-7;
lfnicr = 1000;
lfstal = 1000;
lfilog = 500;
rtredg = 1.d-5;
rvhess 100;
lfdegi 500;
lfnsup 7000;
rtmins 0.0009765625;
rtnwmi = 1.d-9;
......@@ -425,12 +425,7 @@ cfg$files2export <- list()
cfg$files2export$start <- c("config/conopt3.opt",
"config/conopt3.op2",
"config/conopt3.op3",
"config/conopt3.op4",
"config/conopt3.op5",
"config/conopt3.op8",
"config/conopt3.op9",
"scripts/run_submit/submit.cmd",
"scripts/run_submit/submit.R",
"scripts/run_submit/run_magicc.R",
"scripts/run_submit/run_magicc_temperatureImpulseResponse.R",
"scripts/run_submit/read_DAT_TOTAL_ANTHRO_RF.R",
......@@ -439,7 +434,7 @@ cfg$files2export$start <- c("config/conopt3.opt",
"scripts/input/exoGAINSAirpollutants.R",
"config/input.gdx",
"config/input_ref.gdx",
"core/magicc",
"core/magicc",
".Rprofile",
"config/mappingEDGEtoREMINDsectors.csv")
......
......@@ -24,20 +24,20 @@ if(o_modelstat eq 2,
IF(o_modelstat eq 2,
*AJS*2013-05* Default Negishi convergence scheme:
if (ord(iteration) eq 1, s80_cnptfile = 2);
if (ord(iteration) eq 2, s80_cnptfile = 3);
if (ord(iteration) eq 3, s80_cnptfile = 4);
if (ord(iteration) eq 4, s80_cnptfile = 5);
if (ord(iteration) eq 1, s80_cnptfile = 2); !! rtredg = 1.d-6
if (ord(iteration) eq 2, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 3, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 4, s80_cnptfile = 3); !! rtredg = 1.d-7
*RP* Slower convergence scheme
$IFTHEN.cm_SlowConvergence %cm_SlowConvergence% == "on"
if (ord(iteration) eq 1, s80_cnptfile = 1);
if (ord(iteration) eq 2, s80_cnptfile = 2);
if (ord(iteration) eq 3, s80_cnptfile = 2);
if (ord(iteration) eq 4, s80_cnptfile = 3);
if (ord(iteration) eq 5, s80_cnptfile = 3);
if (ord(iteration) eq 6, s80_cnptfile = 4);
if (ord(iteration) eq 7, s80_cnptfile = 4);
if (ord(iteration) eq 8, s80_cnptfile = 5);
if (ord(iteration) eq 1, s80_cnptfile = 1); !! rtredg = 1.d-5
if (ord(iteration) eq 2, s80_cnptfile = 2); !! rtredg = 1.d-6
if (ord(iteration) eq 3, s80_cnptfile = 2); !! rtredg = 1.d-6
if (ord(iteration) eq 4, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 5, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 6, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 7, s80_cnptfile = 3); !! rtredg = 1.d-7
if (ord(iteration) eq 8, s80_cnptfile = 3); !! rtredg = 1.d-7
$ENDIF.cm_SlowConvergence
);
*** EOF ./modules/80_optimization/negishi/solve.gms
......@@ -6,8 +6,7 @@
*** | Contact: remind@pik-potsdam.de
*** SOF ./modules/80_optimization/testOneRegi/solve.gms
$IFI %optimization% == "testOneRegi" s80_cnptfile = 9;
hybrid.optfile = s80_cnptfile;
hybrid.optfile = 9;
***reduce the problem to one region
regi(all_regi) = NO;
......
......@@ -688,6 +688,9 @@ prepare_and_run <- function() {
}
}
# Print REMIND runtime
cat("\n gams_runtime is ", gams_runtime, "\n")
# Collect and submit run statistics to central data base
lucode::runstatistics(file = "runstatistics.rda",
modelstat = readGDX(gdx="fulldata.gdx","o_modelstat", format="first_found"),
......@@ -714,7 +717,7 @@ prepare_and_run <- function() {
no_ref_runs <- identical(cfg$RunsUsingTHISgdxAsBAU,character(0)) | all(is.na(cfg$RunsUsingTHISgdxAsBAU)) | coupled_run
if(!no_ref_runs) {
source("scripts/start/submit_run.R")
source("scripts/start/submit.R")
# Save the current cfg settings into a different data object, so that they are not overwritten
cfg_main <- cfg
......@@ -740,7 +743,7 @@ prepare_and_run <- function() {
} else {
# Save the current cfg settings into a different data object, so that they are not overwritten
cfg_main <- cfg
source("scripts/start/submit_run.R")
source("scripts/start/submit.R")
for(run in seq(1,length(cfg_main$subsequentruns))){
# for each of the subsequent runs, read in the cfg, ...
......@@ -753,7 +756,7 @@ prepare_and_run <- function() {
# Subsequent runs will be started in submit.R using the RData files written above
# after the current run has finished.
cat("Starting subsequent run ",cfg_main$subsequentruns[run],"\n")
submit_run(cfg)
submit(cfg)
}
# Set cfg back to original
cfg <- cfg_main
......@@ -783,18 +786,6 @@ prepare_and_run <- function() {
#=================== END - Subsequent runs ========================
# Reload the REMIND run configuration
load(cfg$val_workspace)
# Print REMIND runtime
cat("\n gams_runtime is ", gams_runtime, "\n")
# Save runtime for REMIND validation
validation$technical$time$full.gms <- gams_runtime
save(validation, file = cfg$val_workspace)
# Remove unused variables
rm(gams_runtime, validation)
# Copy important files into output_folder (after REMIND execution)
for (file in cfg$files2export$end)
file.copy(file, cfg$results_folder, overwrite = TRUE)
......@@ -814,5 +805,5 @@ prepare_and_run <- function() {
}
# call prepare and run (always without cfg, because cfg is always read from results folder, where it has been copied by submit_run(cfg))
# call prepare and run (always without cfg, because cfg is always read from results folder, where it has been copied by submit(cfg))
prepare_and_run()
\ No newline at end of file
......@@ -13,7 +13,7 @@
############## Define function: runsubmit #########################
submit_run <- function(cfg) {
submit <- function(cfg) {
# Create name of output folder and output folder itself
date <- format(Sys.time(), "_%Y-%m-%d_%H.%M.%S")
......
......@@ -104,7 +104,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it
cfg_rem$gms$cm_MAgPIE_coupling <- "off"
cat("### COUPLING ### No MAgPIE report for REMIND input provided.\n")
cat("### COUPLING ### REMIND will be startet in stand-alone mode with\n ",runname,"\n ",cfg_rem$results_folder,"\n")
outfolder_rem <- submit_run(cfg_rem)
outfolder_rem <- submit(cfg_rem)
} else if (grepl(paste0("report.mif"),report)) { # if it is a MAgPIE report
######### S T A R T R E M I N D C O U P L E D ##############
cfg_rem$gms$cm_MAgPIE_coupling <- "on"
......@@ -114,7 +114,7 @@ start_coupled <- function(path_remind,path_magpie,cfg_rem,cfg_mag,runname,max_it
mag_report_keep_in_mind <- report
####### START REMIND #######
cfg_rem$pathToMagpieReport <- report
outfolder_rem <- submit_run(cfg_rem)
outfolder_rem <- submit(cfg_rem)
############################
} else if (grepl("REMIND_generic_",report)) { # if it is a REMIND report
############### O M I T R E M I N D ###############################
......
library(lucode)
source("scripts/start/submit_run.R")
source("scripts/start/submit.R")
#######################################################################
############### Select slurm partitiion ###############################
......@@ -191,7 +191,7 @@ for (scen in rownames(scenarios)) {
if (start_now){
cat("Creating and starting: ",cfg$title,"\n")
submit_run(cfg)
submit(cfg)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment