/*
 * cu_current_collector_dissolution.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 16 2026, 16:40 by COMSOL 6.4.0.422. */
public class cu_current_collector_dissolution {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    In the Model Wizard window, click 2D.
//    In the Select Physics tree, select Electrochemistry > Batteries > Lithium-Ion Battery (liion).
//    Click Add.
//    In the Select Physics tree, select Chemical Species Transport > Transport of Diluted Species (tds).
//    Click Add.
//    Click Study.
//    In the Select Study tree, select Preset Studies for Selected Physics Interfaces > Lithium-Ion Battery > Time Dependent with Initialization.
//    Click Done.

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 2);

    model.component("comp1").mesh().create("mesh1");

    model.component("comp1").physics().create("liion", "LithiumIonBatteryMPH", "geom1");
    model.component("comp1").physics().create("tds", "DilutedSpecies", "geom1");

    model.study().create("std1");
    model.study("std1").create("cdi", "CurrentDistributionInitialization");
    model.study("std1").feature("cdi").set("solnum", "auto");
    model.study("std1").feature("cdi").set("notsolnum", "auto");
    model.study("std1").feature("cdi").set("outputmap", new String[]{});
    model.study("std1").feature("cdi").set("ngenAUX", "1");
    model.study("std1").feature("cdi").set("goalngenAUX", "1");
    model.study("std1").feature("cdi").set("ngenAUX", "1");
    model.study("std1").feature("cdi").set("goalngenAUX", "1");
    model.study("std1").create("time", "Transient");
    model.study("std1").feature("time").set("initialtime", "0");
    model.study("std1").feature("time").set("solnum", "auto");
    model.study("std1").feature("time").set("notsolnum", "auto");
    model.study("std1").feature("time").set("outputmap", new String[]{});

//    Load the parameters from a text file.
//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file cu_current_collector_dissolution_parameters.txt.
//    To import content from file, use:
//    model.param().loadFile("FILENAME");
    model.param().set("cCu0", "1[uM]", "Initial Cu+ concentration");
    model.param().set("cCu_ref", "1[M]", "Reference Cu+ concentration");
    model.param()
         .set("cCucov", "rho_Cu/M_Cu*L_Cumono", "Molar amount of copper in plated monolayer on surface of negative active material");
    model.param().set("cs_max_neg", "31507[mol/m^3]", "Maximum negative electrode material host capacity");
    model.param().set("cs_max_pos", "50060[mol/m^3]", "Maximum positive electrode material host capacity");
    model.param().set("D_Cu", "2e-9[m^2/s]", "Diffusion coefficient of Cu+");
    model.param().set("depth_dent", "50[um]", "Dent depth in negative active material");
    model.param().set("Eeq_Cu", "3.5[V]", "Copper equilibrium potential vs Li(s)/Li+");
    model.param()
         .set("epsbinder_pos", "0.1*epss_pos", "Binder (including conductive filler) volume fraction in positive electrode");
    model.param().set("epsl_neg", "1-epss_neg", "Electrolyte volume fraction in negative electrode");
    model.param().set("epsl_pos", "1-epss_pos-epsbinder_pos", "Electrolyte volume fraction in positive electrode");
    model.param().set("epsl_sep", "0.5", "Electrolyte volume fraction in separator");
    model.param().set("epss_neg", "0.6", "Electrode volume fraction in negative electrode");
    model.param().set("epss_pos", "0.6", "Electrode volume fraction in positive electrode");
    model.param().set("I_1C_cell", "0.2[A]", "1C current for undamaged negative electrode coating");
    model.param()
         .set("i0_ref_CuMetal", "1[A/m^2]", "Dissolution/deposition reference exchange current density of copper");
    model.param().set("i0_ref_neg", "10[A/m^2]", "Exchange current density at 50% lithiation in negative electrode");
    model.param().set("i0_ref_pos", "10[A/m^2]", "Exchange current density at 50% lithiation in positive electrode");
    model.param().set("L_CC_neg", "5[um]", "Negative current collector thickness");
    model.param().set("L_CC_pos", "5[um]", "Positive current collector thickness");
    model.param().set("L_Cumono", "1e-10[m]", "Thickness deposited Cu monolayer");
    model.param()
         .set("L_neg", "L_pos*cs_max_pos*epss_pos*(socmaxpos-socminpos)*(1-Li_loss)/((1-Q_excess)*epss_neg*cs_max_neg*(socmaxneg-socminneg))", "Negative electrode thickness from electrode capacity balance");
    model.param().set("L_neg_cc", "5[um]", "Negative current collector thickness");
    model.param().set("L_pos", "40[um]", "Positive electrode thickness");
    model.param().set("L_pos_cc", "5[um]", "Positive current collector thickness");
    model.param().set("L_sep", "25[um]", "Separator thickness");
    model.param().set("Li_loss", "0.05", "Initial lithium inventory loss during formation cycling");
    model.param().set("M_Cu", "63.546[g/mol]", "Molar mass of copper");
    model.param().set("Q_excess", "0.10", "Negative electrode excess host capacity fraction");
    model.param().set("rho_Cu", "8960[kg/m^3]", "Density of copper");
    model.param().set("rp_neg", "6[um]", "Radius of negative electrode particles");
    model.param().set("rp_pos", "6[um]", "Radius of positive electrode particles");
    model.param().set("sigmas_neg", "1[S/m]", "Effective negative electrode conductivity");
    model.param().set("sigmas_pos", "1[S/m]", "Effective positive electrode conductivity");
    model.param().set("socminneg", "0.02", "Lower lithiation limit in negative active material");
    model.param().set("socminpos", "0.22", "Lower lithiation limit in positive active material");
    model.param().set("socmaxneg", "0.835", "Upper lithiation limit in negative active material");
    model.param().set("socmaxpos", "1", "Upper lithiation limit in positive active material");
    model.param().set("T", "298.15[K]", "Temperature");
    model.param().set("w_battery", "1[cm]", "Width of battery cell");
    model.param().set("w_dent", "0.5[mm]", "Width of dent in negative electrode coating");
    model.param().set("zCu", "1", "Cu+ charge");
    model.param().set("cs_init_pos", "12000[mol/m^3]", "Initial lithium concentration of positive active material");
    model.param().set("cs_init_neg", "21000[mol/m^3]", "Initial lithium concentration of negative active material");
    model.param().set("V_low", "-0.05[V]", "Lower cut-off cell voltage for discharge");
    model.param().set("V0", "4.1[V]", "Initial cell voltage");

//    Add material data for the electrolyte, the electrodes, and the copper current collector from the material library.
//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select Battery > Electrolytes > LiPF6 in 1:1 EC:DMC (Liquid, Li-ion Battery).
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup("def").func().create("an1", "Analytic");
    model.component("comp1").material("mat1").propertyGroup()
         .create("ElectrolyteConductivity", "ElectrolyteConductivity", "Electrolyte conductivity");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func()
         .create("an1", "Analytic");
    model.component("comp1").material("mat1").propertyGroup()
         .create("SpeciesProperties", "SpeciesProperties", "Species properties");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func().create("an1", "Analytic");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func().create("an2", "Analytic");
    model.component("comp1").material("mat1").label("LiPF6 in 1:1 EC:DMC (Liquid, Li-ion Battery)");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("funcname", "D");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("expr", "1.47e3*exp(1.33*c)*exp(-1.69e3/T)*exp(-5.63e2*c/T)*1e-6");
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("args", new String[]{"c", "T"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1").set("argunit", new String[]{"", ""});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotaxis", new String[]{"on", "off"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotfixedvalue", new String[]{"0", "293.15"});
    model.component("comp1").material("mat1").propertyGroup("def").func("an1")
         .set("plotargs", new String[][]{{"c", "0", "3"}, {"T", "293.15", "293.15"}});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("diffusion", new String[]{"D(c/1[M],T/1[K])[cm^2/s]", "0", "0", "0", "D(c/1[M],T/1[K])[cm^2/s]", "0", "0", "0", "D(c/1[M],T/1[K])[cm^2/s]"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .setPropertyInfo("diffusion", "Johannes Landesfeind and Hubert A. Gasteiger, Temperature and Concentration Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes, Journal of The Electrochemical Society, 166 (14) A3079-A3097 (2019)");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("concentration");
    model.component("comp1").material("mat1").propertyGroup("def").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("funcname", "sigmal");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("expr", "7.98e-1*(1+(T-2.28e2))*c*(1-1.22*sqrt(max(c,eps))+5.09e-1*(1-4e-3*exp(1000/T))*c)/(1+c^4*(3.79e-3*exp(1000/T)))");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("args", new String[]{"c", "T"});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("argunit", new String[]{"", ""});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("plotaxis", new String[]{"on", "off"});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("plotfixedvalue", new String[]{"0", "298.15"});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").func("an1")
         .set("plotargs", new String[][]{{"c", "0", "3"}, {"T", "298.15", "298.15"}});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity")
         .set("sigmal", new String[]{"max(sigmal(c/1[M],T/1[K])[mS/cm],eps)", "0", "0", "0", "max(sigmal(c/1[M],T/1[K])[mS/cm],eps)", "0", "0", "0", "max(sigmal(c/1[M],T/1[K])[mS/cm],eps)"});
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity")
         .setPropertyInfo("sigmal", "Johannes Landesfeind and Hubert A. Gasteiger, Temperature and Concentration Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes, Journal of The Electrochemical Society, 166 (14) A3079-A3097 (2019)");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").addInput("concentration");
    model.component("comp1").material("mat1").propertyGroup("ElectrolyteConductivity").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1").set("funcname", "TDF");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("expr", "-5.58+7.17*c+3.8e-2*T+1.91*c^2-6.65e-2*c*T-5.08e-5*T^2+1.1e-1*c^3-6.1e-3*c^2*T+1.51e-4*c*T^2");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("args", new String[]{"c", "T"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("argunit", new String[]{"", ""});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("plotaxis", new String[]{"on", "off"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("plotfixedvalue", new String[]{"0", "293.15"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an1")
         .set("plotargs", new String[][]{{"c", "0", "3"}, {"T", "293.15", "293.15"}});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("funcname", "t_plus");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("expr", "-7.91+2.45e-1*c+5.28e-2*T+6.98e-1*c^2-1.08e-2*c*T-8.21e-5*T^2+7.43e-4*c^3-2.22e-3*c^2*T+3.07e-5*c*T^2");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("args", new String[]{"c", "T"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("argunit", new String[]{"", ""});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("plotaxis", new String[]{"on", "off"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("plotfixedvalue", new String[]{"0", "293.15"});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").func("an2")
         .set("plotargs", new String[][]{{"c", "0", "3"}, {"T", "293.15", "293.15"}});
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties")
         .set("transpNum", "t_plus(c/1[M],T/1[K])");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties")
         .setPropertyInfo("transpNum", "Johannes Landesfeind and Hubert A. Gasteiger, Temperature and Concentration Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes, Journal of The Electrochemical Society, 166 (14) A3079-A3097 (2019)");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").set("fcl", "TDF(c/1[M],T/1[K])-1");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties")
         .setPropertyInfo("fcl", "Johannes Landesfeind and Hubert A. Gasteiger, Temperature and Concentration Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes, Journal of The Electrochemical Society, 166 (14) A3079-A3097 (2019)");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").addInput("concentration");
    model.component("comp1").material("mat1").propertyGroup("SpeciesProperties").addInput("temperature");

    model.component("comp1").geom("geom1").run();

//    In the tree, select Battery > Electrodes > Graphite, LixC6 MCMB (Negative, Li-ion Battery).
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat2", "Common");
    model.component("comp1").material("mat2").propertyGroup("def").func().create("int1", "Interpolation");
    model.component("comp1").material("mat2").propertyGroup("def").func().create("int2", "Interpolation");
    model.component("comp1").material("mat2").propertyGroup("def").func().create("int3", "Interpolation");
    model.component("comp1").material("mat2").propertyGroup("def").func().create("int4", "Interpolation");
    model.component("comp1").material("mat2").propertyGroup()
         .create("ElectrodePotential", "ElectrodePotential", "Equilibrium potential");
    model.component("comp1").material("mat2").propertyGroup()
         .create("OperationalSOC", "OperationalSOC", "Operational electrode state of charge");
    model.component("comp1").material("mat2").propertyGroup().create("ic", "ic", "Intercalation strain");
    model.component("comp1").material("mat2").propertyGroup("ic").func().create("int1", "Interpolation");
    model.component("comp1").material("mat2").propertyGroup()
         .create("EquilibriumConcentration", "EquilibriumConcentration", "Equilibrium concentration");
    model.component("comp1").material("mat2").propertyGroup()
         .create("EquilibriumPotentialWithDOCInput", "EquilibriumPotentialWithDOCInput", "Equilibrium potential (using degree of conversion as model input)");
    model.component("comp1").material("mat2").propertyGroup()
         .create("EquilibriumDegreeOfConversion", "EquilibriumDegreeOfConversion", "Equilibrium degree of conversion");
    model.component("comp1").material("mat2").label("Graphite, LixC6 MCMB (Negative, Li-ion Battery)");
    model.component("comp1").material("mat2").propertyGroup("def").func("int1").set("funcname", "E_int");
    model.component("comp1").material("mat2").propertyGroup("def").func("int1")
         .set("table", new String[][]{{"0", "32.47"}, {"0.333", "28.56"}, {"0.5", "58.06"}, {"1", "108.67"}});
    model.component("comp1").material("mat2").propertyGroup("def").func("int1").set("fununit", new String[]{"GPa"});
    model.component("comp1").material("mat2").propertyGroup("def").func("int1").set("argunit", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("def").func("int2").set("funcname", "nu_int");
    model.component("comp1").material("mat2").propertyGroup("def").func("int2")
         .set("table", new String[][]{{"0", "0.32"}, {"0.333", "0.39"}, {"0.5", "0.34"}, {"1", "0.24"}});
    model.component("comp1").material("mat2").propertyGroup("def").func("int2").set("fununit", new String[]{""});
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("funcname", "Eeq");
    model.component("comp1").material("mat2").propertyGroup("def").func("int3")
         .set("table", new String[][]{{"0", "2.781186612"}, 
         {"0.01", "1.520893224"}, 
         {"0.02", "0.893922607"}, 
         {"0.03", "0.581284406"}, 
         {"0.04", "0.42452844"}, 
         {"0.05", "0.344895805"}, 
         {"0.06", "0.303146342"}, 
         {"0.07", "0.279578072"}, 
         {"0.08", "0.264093089"}, 
         {"0.09", "0.251347845"}, 
         {"0.1", "0.238588379"}, 
         {"0.11", "0.224803164"}, 
         {"0.12", "0.210294358"}, 
         {"0.13", "0.196408586"}, 
         {"0.14", "0.184624188"}, 
         {"0.15", "0.175188157"}, 
         {"0.16", "0.167373311"}, 
         {"0.17", "0.160452107"}, 
         {"0.18", "0.154025412"}, 
         {"0.19", "0.147948522"}, 
         {"0.2", "0.142214997"}, 
         {"0.21", "0.13688271"}, 
         {"0.22", "0.132033114"}, 
         {"0.23", "0.127747573"}, 
         {"0.24", "0.124091616"}, 
         {"0.25", "0.121103387"}, 
         {"0.26", "0.11878567"}, 
         {"0.27", "0.117102317"}, 
         {"0.28", "0.115980205"}, 
         {"0.29", "0.115317054"}, 
         {"0.3", "0.114993965"}, 
         {"0.31", "0.114890105"}, 
         {"0.32", "0.114886278"}, 
         {"0.33", "0.114884619"}, 
         {"0.34", "0.114873068"}, 
         {"0.35", "0.114824904"}, 
         {"0.36", "0.114644725"}, 
         {"0.37", "0.114372614"}, 
         {"0.38", "0.114017954"}, 
         {"0.39", "0.11359371"}, 
         {"0.4", "0.11311133"}, 
         {"0.41", "0.112575849"}, 
         {"0.42", "0.111980245"}, 
         {"0.43", "0.111297682"}, 
         {"0.44", "0.110470149"}, 
         {"0.45", "0.109393081"}, 
         {"0.46", "0.107900592"}, 
         {"0.47", "0.10576964"}, 
         {"0.48", "0.102783317"}, 
         {"0.49", "0.09889031"}, 
         {"0.5", "0.094391564"}, 
         {"0.51", "0.089921069"}, 
         {"0.52", "0.086112415"}, 
         {"0.53", "0.083265315"}, 
         {"0.54", "0.081326247"}, 
         {"0.55", "0.080074892"}, 
         {"0.56", "0.07928329"}, 
         {"0.57", "0.078778765"}, 
         {"0.58", "0.078447703"}, 
         {"0.59", "0.078220432"}, 
         {"0.6", "0.078055641"}, 
         {"0.61", "0.077929111"}, 
         {"0.62", "0.077826563"}, 
         {"0.63", "0.077739397"}, 
         {"0.64", "0.077662227"}, 
         {"0.65", "0.077591472"}, 
         {"0.66", "0.077524557"}, 
         {"0.67", "0.077459463"}, 
         {"0.68", "0.077394455"}, 
         {"0.69", "0.077327934"}, 
         {"0.7", "0.077258337"}, 
         {"0.71", "0.077184077"}, 
         {"0.72", "0.077103499"}, 
         {"0.73", "0.077014851"}, 
         {"0.74", "0.076916258"}, 
         {"0.75", "0.07680571"}, 
         {"0.76", "0.07668104"}, 
         {"0.77", "0.07653992"}, 
         {"0.78", "0.076379839"}, 
         {"0.79", "0.076198086"}, 
         {"0.8", "0.075991699"}, 
         {"0.81", "0.075757371"}, 
         {"0.82", "0.075491288"}, 
         {"0.83", "0.075188813"}, 
         {"0.84", "0.07484398"}, 
         {"0.85", "0.074448647"}, 
         {"0.86", "0.07399118"}, 
         {"0.87", "0.073454466"}, 
         {"0.88", "0.072812991"}, 
         {"0.89", "0.072028722"}, 
         {"0.9", "0.071045433"}, 
         {"0.91", "0.069780996"}, 
         {"0.92", "0.068116222"}, 
         {"0.93", "0.065874599"}, 
         {"0.94", "0.062770873"}, 
         {"0.95", "0.058253898"}, 
         {"0.96", "0.051075794"}, 
         {"0.97", "0.038790069"}, 
         {"0.98", "0.020172191"}});
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("extrap", "linear");
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("fununit", new String[]{"V"});
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("argunit", new String[]{""});
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("defineinv", true);
    model.component("comp1").material("mat2").propertyGroup("def").func("int3").set("funcinvname", "Eeq_inv");
    model.component("comp1").material("mat2").propertyGroup("def").func("int4").set("funcname", "dEeqdT");
    model.component("comp1").material("mat2").propertyGroup("def").func("int4")
         .set("table", new String[][]{{"0", "3.0e-4"}, 
         {"0.17", "0"}, 
         {"0.24", "-6e-5"}, 
         {"0.28", "-1.6e-4"}, 
         {"0.5", "-1.6e-4"}, 
         {"0.54", "-9e-5"}, 
         {"0.71", "-9e-5"}, 
         {"0.85", "-1.0e-4"}, 
         {"1.0", "-1.2e-4"}});
    model.component("comp1").material("mat2").propertyGroup("def").func("int4").set("fununit", new String[]{"V/K"});
    model.component("comp1").material("mat2").propertyGroup("def").func("int4").set("argunit", new String[]{""});
    model.component("comp1").material("mat2").propertyGroup("def").set("youngsmodulus", "");
    model.component("comp1").material("mat2").propertyGroup("def").set("poissonsratio", "");
    model.component("comp1").material("mat2").propertyGroup("def").set("youngsmodulus", "E_int(c/csmax)");
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("youngsmodulus", "Yue Qi et al 2010 J. Electrochem. Soc. 157 A558");
    model.component("comp1").material("mat2").propertyGroup("def").set("poissonsratio", "nu_int(c/csmax)");
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("poissonsratio", "Yue Qi et al 2010 J. Electrochem. Soc. 157 A558");
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("electricconductivity", new String[]{"100[S/m]", "0", "0", "0", "100[S/m]", "0", "0", "0", "100[S/m]"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("electricconductivity", "V. Srinivasan, and J. Newman, \u201cDesign and Optimization of a Natural Graphite/Iron Phosphate Lithium Ion Cell,\u201d J. Electrochem. Soc., vol. 151, p. 1530, 2004.");
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("diffusion", new String[]{"1.4523e-13*exp(68025.7/8.314*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]", "0", "0", "0", "1.4523e-13*exp(68025.7/8.314*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]", "0", "0", "0", "1.4523e-13*exp(68025.7/8.314*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("diffusion", "K. Kumaresan, G. Sikha, and R. E. White, \u201cThermal Model for a Li-Ion Cell,\u201d J. Electrochem. Soc., vol. 155, p. A164, 2008.");
    model.component("comp1").material("mat2").propertyGroup("def")
         .set("thermalconductivity", new String[]{"1[W/(m*K)]", "0", "0", "0", "1[W/(m*K)]", "0", "0", "0", "1[W/(m*K)]"});
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("thermalconductivity", "S. Chen, C. Wan, and Y. Wang, J. Power Sources, 140, 111 (2005).");
    model.component("comp1").material("mat2").propertyGroup("def").set("heatcapacity", "750[J/(kg*K)]");
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("heatcapacity", "SI Chemical Data, John Wiley & Sons, 1994");
    model.component("comp1").material("mat2").propertyGroup("def").set("density", "2300[kg/m^3]");
    model.component("comp1").material("mat2").propertyGroup("def")
         .setPropertyInfo("density", "SI Chemical Data, John Wiley & Sons, 1994");
    model.component("comp1").material("mat2").propertyGroup("def").set("csmax", "31507[mol/m^3]");
    model.component("comp1").material("mat2").propertyGroup("def").descr("csmax", "");
    model.component("comp1").material("mat2").propertyGroup("def").set("T_ref", "318[K]");
    model.component("comp1").material("mat2").propertyGroup("def").descr("T_ref", "");
    model.component("comp1").material("mat2").propertyGroup("def").set("T2", "min(393.15,max(T,223.15))");
    model.component("comp1").material("mat2").propertyGroup("def").descr("T2", "");
    model.component("comp1").material("mat2").propertyGroup("def").addInput("temperature");
    model.component("comp1").material("mat2").propertyGroup("def").addInput("concentration");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").identifier("eeq");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential")
         .set("Eeq", "def.Eeq(doc)+def.dEeqdT(doc)*(T-298[K])");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential")
         .setPropertyInfo("Eeq", "D. P Karthikeyan, G. Sikha, and R. E. White, \u201cThermodynamic model development for lithium intercalation electrodes,\u201d J. Power Sources, vol. 185, p. 1398, 2008.");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").set("dEeqdT", "def.dEeqdT(doc)");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential")
         .setPropertyInfo("dEeqdT", "K. E. Thomas, and J. Newman, \u201cHeats of mixing and of entropy in porous insertion electrodes,\u201d J. Power Sources., vol. 119-121, p. 844, 2003.");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").set("cEeqref", "def.csmax");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").set("doc", "c/cEeqref");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential")
         .descr("doc", "Degree of conversion (state of lithiation)");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").addInput("concentration");
    model.component("comp1").material("mat2").propertyGroup("ElectrodePotential").addInput("temperature");
    model.component("comp1").material("mat2").propertyGroup("OperationalSOC").identifier("opsoc");
    model.component("comp1").material("mat2").propertyGroup("OperationalSOC").set("socmax", "def.Eeq_inv(E_min)");
    model.component("comp1").material("mat2").propertyGroup("OperationalSOC").set("socmin", "def.Eeq_inv(E_max)");
    model.component("comp1").material("mat2").propertyGroup("OperationalSOC").set("E_max", "1[V]");
    model.component("comp1").material("mat2").propertyGroup("OperationalSOC").set("E_min", "0.075[V]");
    model.component("comp1").material("mat2").propertyGroup("ic").func("int1").set("funcname", "dVOLdSOL");
    model.component("comp1").material("mat2").propertyGroup("ic").func("int1")
         .set("table", new String[][]{{"0", "0"}, 
         {"0.006802721088435382", "0.12500000000000178"}, 
         {"0.06316812439261421", "1.2736486486486491"}, 
         {"0.11175898931000966", "2.523648648648649"}, 
         {"0.17978620019436342", "3.5709459459459474"}, 
         {"0.2400388726919339", "4.449324324324325"}, 
         {"0.2905733722060252", "5.192567567567568"}, 
         {"0.3566569484936831", "5.66554054054054"}, 
         {"0.4188532555879494", "5.969594594594595"}, 
         {"0.48104956268221566", "6.10472972972973"}, 
         {"0.5432458697764819", "6.173648648648647"}, 
         {"0.58600583090379", "6.306081081081081"}, 
         {"0.6112730806608356", "7.726351351351352"}, 
         {"0.6443148688046647", "8.570945945945946"}, 
         {"0.694849368318756", "9.449324324324323"}, 
         {"0.7414965986394557", "10.29391891891892"}, 
         {"0.7764820213799805", "10.902027027027025"}, 
         {"0.8231292517006802", "11.543918918918918"}, 
         {"0.8542274052478133", "12.152027027027026"}, 
         {"0.8833819241982507", "12.827702702702702"}, 
         {"0.9183673469387755", "12.996621621621621"}, 
         {"0.9494655004859086", "13.16554054054054"}});
    model.component("comp1").material("mat2").propertyGroup("ic").func("int1").set("extrap", "linear");
    model.component("comp1").material("mat2").propertyGroup("ic").func("int1").set("fununit", new String[]{"%"});
    model.component("comp1").material("mat2").propertyGroup("ic").func("int1").set("argunit", new String[]{"1"});
    model.component("comp1").material("mat2").propertyGroup("ic").identifier("is");
    model.component("comp1").material("mat2").propertyGroup("ic").set("dvol", "dVOLdSOL(c/def.csmax)");
    model.component("comp1").material("mat2").propertyGroup("ic")
         .setPropertyInfo("dvol", "S. Schweidler, L. de Biasi, A. Schiele, P. Hartmann, T. Brezesinski and J. Janek, \"Volume Changes of Graphite Anodes Revisited: A Combined Operando X-Ray Diffraction and In Situ Pressure Analysis Study\", J. Phys. Chem. C, 2018, 122, 8829\u20138835");
    model.component("comp1").material("mat2").propertyGroup("ic").addInput("concentration");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumConcentration")
         .set("csEq", "def.csmax*def.Eeq_inv(V)");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumConcentration")
         .addInput("electricpotential");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumPotentialWithDOCInput")
         .set("Eeq", "def.Eeq(doc)+def.dEeqdT(doc)*(T-298[K])");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumPotentialWithDOCInput")
         .set("dEeqdT", "def.dEeqdT(doc)");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumPotentialWithDOCInput")
         .addInput("degreeofconversion");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumPotentialWithDOCInput")
         .addInput("temperature");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumDegreeOfConversion")
         .set("docEq", "def.Eeq_inv(V)");
    model.component("comp1").material("mat2").propertyGroup("EquilibriumDegreeOfConversion")
         .addInput("electricpotential");

//    In the tree, select Battery > Electrodes > NMC 811, LiNi0.8Mn0.1Co0.1O2 (Positive, Li-ion Battery).
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat3", "Common");
    model.component("comp1").material("mat3").propertyGroup("def").func().create("int1", "Interpolation");
    model.component("comp1").material("mat3").propertyGroup("def").func().create("int2", "Interpolation");
    model.component("comp1").material("mat3").propertyGroup()
         .create("ElectrodePotential", "ElectrodePotential", "Equilibrium potential");
    model.component("comp1").material("mat3").propertyGroup()
         .create("OperationalSOC", "OperationalSOC", "Operational electrode state of charge");

    return model;
  }

  public static Model run2(Model model) {
    model.component("comp1").material("mat3").propertyGroup().create("ic", "ic", "Intercalation strain");
    model.component("comp1").material("mat3").propertyGroup("ic").func().create("int1", "Interpolation");
    model.component("comp1").material("mat3").propertyGroup()
         .create("EquilibriumConcentration", "EquilibriumConcentration", "Equilibrium concentration");
    model.component("comp1").material("mat3").propertyGroup()
         .create("EquilibriumPotentialWithDOCInput", "EquilibriumPotentialWithDOCInput", "Equilibrium potential (using degree of conversion as model input)");
    model.component("comp1").material("mat3").propertyGroup()
         .create("EquilibriumDegreeOfConversion", "EquilibriumDegreeOfConversion", "Equilibrium degree of conversion");
    model.component("comp1").material("mat3").label("NMC 811, LiNi0.8Mn0.1Co0.1O2 (Positive, Li-ion Battery)");
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("funcname", "Eeq");
    model.component("comp1").material("mat3").propertyGroup("def").func("int1")
         .set("table", new String[][]{{"0.2228930343076256", "4.256817954840526"}, 
         {"0.23718770939025557", "4.2212385803217725"}, 
         {"0.2503742701253948", "4.198216215024365"}, 
         {"0.2635608308605341", "4.184354581468334"}, 
         {"0.2767473915956734", "4.175555457558853"}, 
         {"0.28993395233081265", "4.169287588472648"}, 
         {"0.3031205130659519", "4.163501863162304"}, 
         {"0.3163070738010912", "4.156631314356272"}, 
         {"0.3294936345362305", "4.145300935623516"}, 
         {"0.3426801952713697", "4.130836622347658"}, 
         {"0.355866756006509", "4.113841054248525"}, 
         {"0.3690533167416483", "4.09395262349422"}, 
         {"0.38223987747678756", "4.0746668724597415"}, 
         {"0.3954264382119268", "4.056104337089057"}, 
         {"0.4086129989470661", "4.037903409550268"}, 
         {"0.4217995596822054", "4.021944450569238"}, 
         {"0.43498612041734463", "4.007287279783036"}, 
         {"0.44817268115248393", "3.9945104697226936"}, 
         {"0.4613592418876232", "3.9798050845589046"}, 
         {"0.47454580262276247", "3.96497916345115"}, 
         {"0.4877323633579017", "3.9507559220632222"}, 
         {"0.500918924093041", "3.9348451774597786"}, 
         {"0.5141054848281803", "3.918090681248576"}, 
         {"0.5272920455633195", "3.901215649093408"}, 
         {"0.5404786062984588", "3.884581688826171"}, 
         {"0.5536651670335981", "3.8661396893994517"}, 
         {"0.5668517277687374", "3.850108408852042"}, 
         {"0.5800382885038766", "3.834920879912391"}, 
         {"0.593224849239016", "3.819612815028774"}, 
         {"0.6064114099741551", "3.806233325248605"}, 
         {"0.6195979707092945", "3.795023482459815"}, 
         {"0.6327845314444338", "3.7852600709986106"}, 
         {"0.6459710921795729", "3.77646094708913"}, 
         {"0.6591576529147123", "3.7660948559080984"}, 
         {"0.6723442136498515", "3.7569341241667216"}, 
         {"0.6855307743849908", "3.748376072145172"}, 
         {"0.6987173351201301", "3.7407823076753464"}, 
         {"0.7119038958552694", "3.7321037197098312"}, 
         {"0.7250904565904086", "3.724148347408109"}, 
         {"0.738277017325548", "3.7154697594425943"}, 
         {"0.7514635780606872", "3.7046215244857006"}, 
         {"0.7646501387958264", "3.69582240057622"}, 
         {"0.7778366995309657", "3.686541132890878"}, 
         {"0.791023260266105", "3.6770187933176044"}, 
         {"0.8042098210012443", "3.6672553818564"}, 
         {"0.8173963817363835", "3.6556839312357132"}, 
         {"0.8305829424715228", "3.643871408727096"}, 
         {"0.8437695032066621", "3.633505317546064"}, 
         {"0.8569560639418013", "3.6226570825891704"}, 
         {"0.8701426246769406", "3.6130142070719313"}, 
         {"0.8833291854120799", "3.603009723722796"}, 
         {"0.8965157461472192", "3.592643632541764"}, 
         {"0.9097023068823584", "3.585049868071939"}, 
         {"0.9228888676174977", "3.5790230708736646"}, 
         {"0.9351335311572699", "3.5724538619275457"}, 
         {"0.9505178520149323", "3.5661257248693574"}, 
         {"0.9624485498229155", "3.559857855783152"}, 
         {"0.9756351105580549", "3.5525051632012574"}, 
         {"0.9888216712931941", "3.541536392300398"}, 
         {"0.998240643246865", "3.488540755603573"}, 
         {"0.9994965061740211", "3.3640592684056174"}, 
         {"1", "3.0"}});
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("extrap", "linear");
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("fununit", new String[]{"V"});
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("argunit", new String[]{""});
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("defineinv", true);
    model.component("comp1").material("mat3").propertyGroup("def").func("int1").set("funcinvname", "Eeq_inv");
    model.component("comp1").material("mat3").propertyGroup("def").func("int2").set("funcname", "dEeqdT");
    model.component("comp1").material("mat3").propertyGroup("def").func("int2")
         .set("table", new String[][]{{"0.220410330184718", "0.014014955374719168"}, 
         {"0.23880574126341392", "0.017971951837248937"}, 
         {"0.2546142976591682", "0.024888006339594898"}, 
         {"0.27162047196369177", "0.034054905194386115"}, 
         {"0.282638556724369", "0.036404922469418094"}, 
         {"0.3020399668464311", "0.026993759520293023"}, 
         {"0.3142556695158776", "0.020431501191878212"}, 
         {"0.33365707963793967", "0.011727335839959649"}, 
         {"0.35521420199578646", "0.0148088719318831"}, 
         {"0.3681484754104945", "0.017914441947786144"}, 
         {"0.3861127440420335", "0.021513559747933717"}, 
         {"0.40838843714514184", "0.01892213947907556"}, 
         {"0.4213227105598499", "0.01702025282904991"}, 
         {"0.43856840844612727", "0.013603757832495345"}, 
         {"0.46156267229449716", "0.005230230696620208"}, 
         {"0.47449694570920525", "-0.0006265898806357695"}, 
         {"0.49389835583126734", "-0.007070755018626973"}, 
         {"0.5161740489343756", "-0.004108523109428802"}, 
         {"0.5291083223490838", "-0.001082689664639258"}, 
         {"0.5463540202353612", "0.002312976397604097"}, 
         {"0.569348284083731", "0.004079283221664273"}, 
         {"0.582282557498439", "0.004952229246388926"}, 
         {"0.6009653968752395", "0.004819533211418328"}, 
         {"0.6239596607236095", "-0.006710676178650704"}, 
         {"0.6368939341383175", "-0.014536990062410493"}, 
         {"0.6541396320245949", "-0.02419065684384447"}, 
         {"0.6771338958729649", "-0.029277265326040275"}, 
         {"0.6900681692876729", "-0.031219020261622682"}, 
         {"0.7073138671739503", "-0.033690193909531485"}, 
         {"0.7303081310223203", "-0.03336889094642845"}, 
         {"0.7432424044370283", "-0.032113209380358915"}, 
         {"0.7619252438138289", "-0.03159295149409996"}, 
         {"0.7849195076621986", "-0.03042821280099617"}, 
         {"0.7971352103316451", "-0.02983057002436801"}, 
         {"0.8150994789631842", "-0.02874483754190857"}, 
         {"0.838093742811554", "-0.024193952462184226"}, 
         {"0.851028016226262", "-0.02144719701629197"}, 
         {"0.8689922848578011", "-0.01850371317212532"}, 
         {"0.8898308364703862", "-0.024913854049501444"}, 
         {"0.9027651098850944", "-0.030147134640649775"}, 
         {"0.922885090752418", "-0.038671237648857465"}, 
         {"0.9430050716197416", "-0.05040518062533475"}, 
         {"0.958813628015496", "-0.06017799045704739"}, 
         {"0.9758198023200195", "-0.07034189432587595"}, 
         {"0.983245033354389", "-0.07341413831343596"}});
    model.component("comp1").material("mat3").propertyGroup("def").func("int2").set("fununit", new String[]{"mV/K"});
    model.component("comp1").material("mat3").propertyGroup("def").func("int2").set("argunit", new String[]{""});
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("electricconductivity", new String[]{"0.17[S/m]", "0", "0", "0", "0.17[S/m]", "0", "0", "0", "0.17[S/m]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .setPropertyInfo("electricconductivity", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("diffusion", new String[]{"5e-13*exp(1200*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]", "0", "0", "0", "5e-13*exp(1200*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]", "0", "0", "0", "5e-13*exp(1200*(1/(T_ref/1[K])-1/(T2/1[K])))[m^2/s]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .setPropertyInfo("diffusion", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("def")
         .set("thermalconductivity", new String[]{"1.58[W/(m*K)]", "0", "0", "0", "1.58[W/(m*K)]", "0", "0", "0", "1.58[W/(m*K)]"});
    model.component("comp1").material("mat3").propertyGroup("def")
         .setPropertyInfo("thermalconductivity", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("def").set("heatcapacity", "840.1[J/(kg*K)]");
    model.component("comp1").material("mat3").propertyGroup("def")
         .setPropertyInfo("heatcapacity", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("def").set("density", "4.87[g/cm^3]");
    model.component("comp1").material("mat3").propertyGroup("def")
         .setPropertyInfo("density", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("def").set("csmax", "50060[mol/m^3]");
    model.component("comp1").material("mat3").propertyGroup("def").descr("csmax", "");
    model.component("comp1").material("mat3").propertyGroup("def").set("T_ref", "298[K]");
    model.component("comp1").material("mat3").propertyGroup("def").descr("T_ref", "");
    model.component("comp1").material("mat3").propertyGroup("def").set("T2", "min(393.15,max(T,223.15))");
    model.component("comp1").material("mat3").propertyGroup("def").descr("T2", "");
    model.component("comp1").material("mat3").propertyGroup("def").addInput("temperature");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").identifier("eeq");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential")
         .set("Eeq", "def.Eeq(doc)+def.dEeqdT(doc)*(T-298[K])");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential")
         .setPropertyInfo("Eeq", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").set("dEeqdT", "def.dEeqdT(doc)");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential")
         .setPropertyInfo("dEeqdT", "Sturm, Rheinfeld, Zilberman, Spingler, Kosch, Frie and Jossen, \"Modeling and simulation of inhomogeneities in a 18650 nickel-rich, silicon-graphite lithium-ion cell during fast charging\", Journal of Power Sources 412 (2019) 204\u2013223");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").set("cEeqref", "def.csmax");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").set("doc", "c/cEeqref");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential")
         .descr("doc", "Degree of conversion (state of lithiation)");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").addInput("concentration");
    model.component("comp1").material("mat3").propertyGroup("ElectrodePotential").addInput("temperature");
    model.component("comp1").material("mat3").propertyGroup("OperationalSOC").identifier("opsoc");
    model.component("comp1").material("mat3").propertyGroup("OperationalSOC").set("socmax", "def.Eeq_inv(E_min)");
    model.component("comp1").material("mat3").propertyGroup("OperationalSOC").set("socmin", "def.Eeq_inv(E_max)");
    model.component("comp1").material("mat3").propertyGroup("OperationalSOC").set("E_max", "4.25[V]");
    model.component("comp1").material("mat3").propertyGroup("OperationalSOC").set("E_min", "3.5[V]");
    model.component("comp1").material("mat3").propertyGroup("ic").func("int1").set("funcname", "dVOLdSOL");
    model.component("comp1").material("mat3").propertyGroup("ic").func("int1")
         .set("table", new String[][]{{"1", "0"}, 
         {"0.8878314072059823", "-0.01908801696712681"}, 
         {"0.8558803535010198", "-0.09544008483563182"}, 
         {"0.8273283480625425", "-0.19724284199363806"}, 
         {"0.7919782460910945", "-0.2905620360551433"}, 
         {"0.7627464309993202", "-0.3584305408271482"}, 
         {"0.7321549966009517", "-0.42629904559915177"}, 
         {"0.7042828008157715", "-0.5026511134676568"}, 
         {"0.6709721278042148", "-0.5705196182396608"}, 
         {"0.6349422161794698", "-0.6383881230116648"}, 
         {"0.6084296397008837", "-0.7147401908801698"}, 
         {"0.5791978246091094", "-0.8335100742311776"}, 
         {"0.5506458191706322", "-0.9862142099681872"}, 
         {"0.5193745751189666", "-1.1049840933191946"}, 
         {"0.4894629503738953", "-1.2067868504772008"}, 
         {"0.45955132562882384", "-1.3425238600212097"}, 
         {"0.42556084296397", "-1.51219512195122"}, 
         {"0.39700883752549276", "-1.6818663838812302"}, 
         {"0.36573759347382717", "-1.8515376458112414"}, 
         {"0.3358259687287558", "-2.106044538706257"}, 
         {"0.3099932019034669", "-2.496288441145281"}, 
         {"0.27464309993201896", "-3.1240721102863205"}, 
         {"0.2447314751869476", "-3.921527041357371"}, 
         {"0.213460231135282", "-4.820784729586427"}, 
         {"0.18218898708361642", "-5.669141039236479"}, 
         {"0.15091774303195082", "-6.534464475079533"}});
    model.component("comp1").material("mat3").propertyGroup("ic").func("int1").set("extrap", "linear");
    model.component("comp1").material("mat3").propertyGroup("ic").func("int1").set("fununit", new String[]{"%"});
    model.component("comp1").material("mat3").propertyGroup("ic").func("int1").set("argunit", new String[]{"1"});
    model.component("comp1").material("mat3").propertyGroup("ic").identifier("is");
    model.component("comp1").material("mat3").propertyGroup("ic").set("dvol", "dVOLdSOL(c/def.csmax)");
    model.component("comp1").material("mat3").propertyGroup("ic")
         .setPropertyInfo("dvol", "R. Koerver and others, \u201cChemo-mechanical expansion of lithium electrode materials \u2014 on the route to mechanically optimized all-solid-state batteries,\u201d Energy Environ. Sci., vol. 11, pp. 2142\u20132158, 201");
    model.component("comp1").material("mat3").propertyGroup("ic").addInput("concentration");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumConcentration")
         .set("csEq", "def.csmax*def.Eeq_inv(V)");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumConcentration")
         .addInput("electricpotential");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumPotentialWithDOCInput")
         .set("Eeq", "def.Eeq(doc)+def.dEeqdT(doc)*(T-298[K])");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumPotentialWithDOCInput")
         .set("dEeqdT", "def.dEeqdT(doc)");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumPotentialWithDOCInput")
         .addInput("degreeofconversion");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumPotentialWithDOCInput")
         .addInput("temperature");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumDegreeOfConversion")
         .set("docEq", "def.Eeq_inv(V)");
    model.component("comp1").material("mat3").propertyGroup("EquilibriumDegreeOfConversion")
         .addInput("electricpotential");

//    In the tree, select Built-in > Copper.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat4", "Common");
    model.component("comp1").material("mat4").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat4").propertyGroup().create("linzRes", "linzRes", "Linearized resistivity");
    model.component("comp1").material("mat4").label("Copper");
    model.component("comp1").material("mat4").set("family", "copper");
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("relpermeability", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("electricconductivity", new String[]{"5.998e7[S/m]", "0", "0", "0", "5.998e7[S/m]", "0", "0", "0", "5.998e7[S/m]"});
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"17e-6[1/K]", "0", "0", "0", "17e-6[1/K]", "0", "0", "0", "17e-6[1/K]"});
    model.component("comp1").material("mat4").propertyGroup("def").set("heatcapacity", "385[J/(kg*K)]");
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("relpermittivity", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat4").propertyGroup("def").set("density", "8960[kg/m^3]");
    model.component("comp1").material("mat4").propertyGroup("def")
         .set("thermalconductivity", new String[]{"400[W/(m*K)]", "0", "0", "0", "400[W/(m*K)]", "0", "0", "0", "400[W/(m*K)]"});
    model.component("comp1").material("mat4").propertyGroup("Enu").set("E", "110[GPa]");
    model.component("comp1").material("mat4").propertyGroup("Enu").set("nu", "0.35");
    model.component("comp1").material("mat4").propertyGroup("linzRes").set("rho0", "1.72e-8[ohm*m]");
    model.component("comp1").material("mat4").propertyGroup("linzRes").set("alpha", "0.0039[1/K]");
    model.component("comp1").material("mat4").propertyGroup("linzRes").set("Tref", "298[K]");
    model.component("comp1").material("mat4").propertyGroup("linzRes").addInput("temperature");

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    Draw the model geometry in 2D to investigate different shapes of dents.
//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").create("r1", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type w_battery.

    model.component("comp1").geom("geom1").feature("r1").set("size", new String[]{"w_battery", "1"});

//    In the Height text field, type L_neg_cc.

    model.component("comp1").geom("geom1").feature("r1").set("size", new String[]{"w_battery", "L_neg_cc"});

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").run("r1");
    model.component("comp1").geom("geom1").create("r2", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type w_battery.

    model.component("comp1").geom("geom1").feature("r2").set("size", new String[]{"w_battery", "1"});

//    In the Height text field, type L_neg.

    model.component("comp1").geom("geom1").feature("r2").set("size", new String[]{"w_battery", "L_neg"});

//    Locate the Position section.
//    In the y text field, type L_neg_cc.

    model.component("comp1").geom("geom1").feature("r2").set("pos", new String[]{"0", "L_neg_cc"});

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").run("r2");
    model.component("comp1").geom("geom1").create("r3", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type w_battery.

    model.component("comp1").geom("geom1").feature("r3").set("size", new String[]{"w_battery", "1"});

//    In the Height text field, type L_sep.

    model.component("comp1").geom("geom1").feature("r3").set("size", new String[]{"w_battery", "L_sep"});

//    Locate the Position section.
//    In the y text field, type L_neg_cc+L_neg.

    model.component("comp1").geom("geom1").feature("r3").set("pos", new String[]{"0", "L_neg_cc+L_neg"});

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").run("r3");
    model.component("comp1").geom("geom1").create("r4", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type w_battery.

    model.component("comp1").geom("geom1").feature("r4").set("size", new String[]{"w_battery", "1"});

//    In the Height text field, type L_pos.

    model.component("comp1").geom("geom1").feature("r4").set("size", new String[]{"w_battery", "L_pos"});

//    Locate the Position section.
//    In the y text field, type L_neg_cc+L_neg+L_sep.

    model.component("comp1").geom("geom1").feature("r4").set("pos", new String[]{"0", "L_neg_cc+L_neg+L_sep"});

//    In the Geometry toolbar, click Rectangle.

    model.component("comp1").geom("geom1").run("r4");
    model.component("comp1").geom("geom1").create("r5", "Rectangle");

//    In the Settings window for Rectangle, locate the Size and Shape section.
//    In the Width text field, type w_dent.

    model.component("comp1").geom("geom1").feature("r5").set("size", new String[]{"w_dent", "1"});

//    In the Height text field, type depth_dent.

    model.component("comp1").geom("geom1").feature("r5").set("size", new String[]{"w_dent", "depth_dent"});

//    Locate the Position section.
//    In the x text field, type w_battery/2-w_dent/2.

    model.component("comp1").geom("geom1").feature("r5").set("pos", new String[]{"w_battery/2-w_dent/2", "0"});

//    In the y text field, type L_neg+L_neg_cc-depth_dent.

    model.component("comp1").geom("geom1").feature("r5").setIndex("pos", "L_neg+L_neg_cc-depth_dent", 1);

//    In the Home toolbar, click Build All.

    model.component("comp1").geom("geom1").run("fin");

//    In the Model Builder window, expand the Component 1 (comp1) > Definitions node.
//    Use the View node to scale the geometry in the <l>Graphics</l> window to better visualize the drawn domains.
//    In the Model Builder window, expand the Component 1 (comp1) > Definitions > View 1 node, then click Axis.
//    In the Settings window for Axis, locate the Axis section.
//    From the View scale list, select Manual.

    model.component("comp1").view("view1").axis().set("viewscaletype", "manual");

//    In the y scale text field, type 100.

    model.component("comp1").view("view1").axis().set("yscale", 100);

//    Click Update.
//    Click the Zoom Extents button in the Graphics toolbar.
//    Add selections to facilitate building the model.
//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel1", "Explicit");

//    In the Settings window for Explicit, type Negative Electrode in the Label text field.

    model.component("comp1").selection("sel1").label("Negative Electrode");

//    Select Domain 2.

    model.component("comp1").selection("sel1").set(2);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel2", "Explicit");

//    In the Settings window for Explicit, type Positive Electrode in the Label text field.

    model.component("comp1").selection("sel2").label("Positive Electrode");

//    Select Domain 4.

    model.component("comp1").selection("sel2").set(4);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel3", "Explicit");

//    In the Settings window for Explicit, type Separator in the Label text field.

    model.component("comp1").selection("sel3").label("Separator");

//    Select Domain 3.

    model.component("comp1").selection("sel3").set(3);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel4", "Explicit");

//    In the Settings window for Explicit, type Dent in the Label text field.

    model.component("comp1").selection("sel4").label("Dent");

//    Select Domain 5.

    model.component("comp1").selection("sel4").set(5);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel5", "Explicit");

//    In the Settings window for Explicit, type Copper Current Collector in the Label text field.

    model.component("comp1").selection("sel5").label("Copper Current Collector");

//    Select Domain 1.

    model.component("comp1").selection("sel5").set(1);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel6", "Explicit");

//    In the Settings window for Explicit, type Copper Current-Collector Boundary in the Label text field.

    model.component("comp1").selection("sel6").label("Copper Current-Collector Boundary");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel6").geom(1);

//    Select Boundary 4.

    model.component("comp1").selection("sel6").set(4);

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel7", "Explicit");

//    In the Settings window for Explicit, type Aluminum Current-Collector Boundary in the Label text field.

    model.component("comp1").selection("sel7").label("Aluminum Current-Collector Boundary");

//    Locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel7").geom(1);

//    Select Boundary 9.

    model.component("comp1").selection("sel7").set(9);

//    In the Definitions toolbar, click Nonlocal Couplings and choose Integration.

    model.component("comp1").cpl().create("intop1", "Integration");
    model.component("comp1").cpl("intop1").set("axisym", true);

//    Create an integration operator for all electrolyte filled domains to compute, for example, the total amount of cuprous ions in the cell.
//    In the Settings window for Integration, type Integration - Electrolyte-Filled Domains in the Label text field.

    model.component("comp1").cpl("intop1").label("Integration - Electrolyte-Filled Domains");

//    In the Operator name text field, type int_el_doms.

    model.component("comp1").cpl("intop1").set("opname", "int_el_doms");

//    Select Domains 2, 3, 4, 5.

    model.component("comp1").cpl("intop1").selection().set(2, 3, 4, 5);

//    Now assign the previously added materials to the different domains of the geometry.
//    In the Model Builder window, under Component 1 (comp1) > Materials, click LiPF6 in 1:1 EC:DMC (Liquid, Li-ion Battery) (mat1).
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    Click Clear Selection.

    model.component("comp1").material("mat1").selection().set();

//    Select Domains 3, 5.

    model.component("comp1").material("mat1").selection().set(3, 5);

//    In the Model Builder window, click Graphite, LixC6 MCMB (Negative, Li-ion Battery) (mat2).
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Negative Electrode.

    model.component("comp1").material("mat2").selection().named("sel1");

//    In the Model Builder window, click NMC 811, LiNi0.8Mn0.1Co0.1O2 (Positive, Li-ion Battery) (mat3).
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Positive Electrode.

    model.component("comp1").material("mat3").selection().named("sel2");

//    In the Model Builder window, click Copper (mat4).
//    In the Settings window for Material, locate the Geometric Entity Selection section.
//    From the Selection list, select Copper Current Collector.

    model.component("comp1").material("mat4").selection().named("sel5");

//    Add model variables.
//    In the Definitions toolbar, click Local Variables.

    model.component("comp1").variable().create("var1");

//    In the Settings window for Variables, locate the Variables section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file cu_current_collector_dissolution_variables.txt.
//    To import content from file, use:
//    model.component("comp1").variable("var1").loadFile("FILENAME");
    model.component("comp1").variable("var1")
         .set("delta_phil", "-R_const*T/F_const*log(cl/1[M])", "Electrolyte phase potential correction for cuprous reaction and transport");
    model.component("comp1").variable("var1")
         .set("phil_ps", "phil+delta_phil", "Pseudo-potentiostatic electrolyte potential");
    model.component("comp1").variable("var1")
         .set("cCu_cell", "int_el_doms(cCu*tds.poro)/(w_battery*(L_neg+L_sep+L_neg_cc))", "Cuprous ion concentration in cell");

//    Now begin defining the physics. Start with the Lithium-Ion Battery interface.
//    In the Model Builder window, under Component 1 (comp1) > Lithium-Ion Battery (liion), click Separator 1.
//    In the Settings window for Separator, locate the Porous Matrix Properties section.
//    In the \[\epsilon_{\textrm{l}}\] text field, type epsl_sep.

    model.component("comp1").physics("liion").feature("sep1").set("epsl", "epsl_sep");

//    In the Physics toolbar, click Domains and choose Electrolyte.

    model.component("comp1").physics("liion").create("ice1", "Electrolyte", 2);

//    In the Settings window for Electrolyte, locate the Domain Selection section.
//    From the Selection list, select Dent.

    model.component("comp1").physics("liion").feature("ice1").selection().named("sel4");

//    In the Physics toolbar, click Domains and choose Current Conductor.

    model.component("comp1").physics("liion").create("cc1", "CurrentConductor", 2);

//    In the Settings window for Current Conductor, locate the Domain Selection section.
//    From the Selection list, select Copper Current Collector.

    model.component("comp1").physics("liion").feature("cc1").selection().named("sel5");

//    In the Physics toolbar, click Domains and choose Porous Electrode.

    model.component("comp1").physics("liion").create("pce1", "PorousElectrode", 2);

//    In the Settings window for Porous Electrode, type Porous Electrode - Negative in the Label text field.

    model.component("comp1").physics("liion").feature("pce1").label("Porous Electrode - Negative");

//    Locate the Domain Selection section.

    return model;
  }

  public static Model run3(Model model) {
//    From the Selection list, select Negative Electrode.

    model.component("comp1").physics("liion").feature("pce1").selection().named("sel1");

//    Locate the Electrolyte Properties section.
//    From the Electrolyte material list, select LiPF6 in 1:1 EC:DMC (Liquid, Li-ion Battery) (mat1).

    model.component("comp1").physics("liion").feature("pce1").set("ElectrolyteMaterial", "mat1");

//    Locate the Electrode Properties section.
//    In the \[\sigma_{\textrm{s}}\] text field, type sigmas_neg.

    model.component("comp1").physics("liion").feature("pce1")
         .set("sigma", new String[]{"sigmas_neg", "0", "0", "0", "sigmas_neg", "0", "0", "0", "sigmas_neg"});

//    Locate the Porous Matrix Properties section.
//    In the \[\epsilon_{\textrm{s}}\] text field, type epss_neg.

    model.component("comp1").physics("liion").feature("pce1").set("epss", "epss_neg");

//    In the \[\epsilon_{\textrm{l}}\] text field, type epsl_neg.

    model.component("comp1").physics("liion").feature("pce1").set("epsl", "epsl_neg");

//    Locate the Effective Transport Parameter Correction section.
//    From the Electric conductivity list, select No correction.

    model.component("comp1").physics("liion").feature("pce1").set("ElectricCorrModel", "NoCorr");

//    In the negative electrode, add copper metal as dissolving–depositing species.
//    Click to expand the Dissolving–Depositing Species section.
//    Click Add.

    model.component("comp1").physics("liion").feature("pce1").setIndex("Species", "s1", 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("rhos", 8960, 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("Ms", 0.06355, 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("Species", "s1", 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("rhos", 8960, 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("Ms", 0.06355, 0, 0);

//    In the table, enter the following settings:

    model.component("comp1").physics("liion").feature("pce1").setIndex("Species", "CuMetal", 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("rhos", "rho_Cu", 0, 0);
    model.component("comp1").physics("liion").feature("pce1").setIndex("Ms", "M_Cu", 0, 0);

//    Clear the Add volume change to electrode volume fraction checkbox.

    model.component("comp1").physics("liion").feature("pce1").set("AddVolumeChangeToElectrodeVolumeFraction", false);

//    Clear the Subtract volume change from electrolyte volume fraction checkbox.

    model.component("comp1").physics("liion").feature("pce1")
         .set("SubtractVolumeChangeFromElectrolyteVolumeFraction", false);

//    In the Model Builder window, click Particle Intercalation 1.
//    In the Settings window for Particle Intercalation, locate the Species Settings section.
//    In the \[c_{\textrm{s,init}}\] text field, type cs_init_neg.

    model.component("comp1").physics("liion").feature("pce1").feature("pin1").set("csinit", "cs_init_neg");

//    Locate the Particle Transport Properties section.
//    In the \[r_{\textrm{p}}\] text field, type rp_neg.

    model.component("comp1").physics("liion").feature("pce1").feature("pin1").set("rp", "rp_neg");

//    In the Model Builder window, under Component 1 (comp1) > Lithium-Ion Battery (liion) > Porous Electrode - Negative, click Porous Electrode Reaction 1.
//    In the Settings window for Porous Electrode Reaction, type Porous Electrode Reaction - Intercalation in the Label text field.

    model.component("comp1").physics("liion").feature("pce1").feature("per1")
         .label("Porous Electrode Reaction - Intercalation");

//    Locate the Electrode Kinetics section.
//    In the \[i_{\textrm{0,ref}}\left(T\right)\] text field, type i0_ref_neg.

    model.component("comp1").physics("liion").feature("pce1").feature("per1").set("i0_ref", "i0_ref_neg");

//    Right-click Porous Electrode Reaction - Intercalation and choose Duplicate.

    model.component("comp1").physics("liion").feature("pce1").feature().duplicate("per2", "per1");

//    Define the copper dissolution/deposition reaction in an additional Porous Electrode Reaction node. To maintain electrolyte neutrality and binary conditions in the interface, cuprous ions are assumed to behave as lithium ions; that is, the copper reaction introduces a flux of lithium ions.
//    In the Settings window for Porous Electrode Reaction, type Porous Electrode Reaction - Copper in the Label text field.

    model.component("comp1").physics("liion").feature("pce1").feature("per2")
         .label("Porous Electrode Reaction - Copper");

//    Locate the Equilibrium Potential section.
//    From the \[E_{\textrm{eq}}\] list, select User defined.

    model.component("comp1").physics("liion").feature("pce1").feature("per2").set("Eeq_mat", "userdef");

//    In the associated text field, type Eeq_Cu+delta_phil.

    model.component("comp1").physics("liion").feature("pce1").feature("per2").set("Eeq", "Eeq_Cu+delta_phil");

//    Locate the Electrode Kinetics section.
//    From the Kinetics expression type list, select Concentration-dependent kinetics.

    model.component("comp1").physics("liion").feature("pce1").feature("per2")
         .set("ElectrodeKinetics", "ConcentrationDependentKinetics");

//    In the \[i_0\] text field, type i0_ref_CuMetal.

    model.component("comp1").physics("liion").feature("pce1").feature("per2").set("i0", "i0_ref_CuMetal");

//    In the \[C_{\textrm{R}}\] text field, type min(liion.c_pce1_CuMetal/(cCucov*liion.Av_pce1_per2),1).

    model.component("comp1").physics("liion").feature("pce1").feature("per2")
         .set("CR", "min(liion.c_pce1_CuMetal/(cCucov*liion.Av_pce1_per2),1)");

//    In the \[C_{\textrm{O}}\] text field, type cCu/cCu_ref.

    model.component("comp1").physics("liion").feature("pce1").feature("per2").set("CO", "cCu/cCu_ref");

//    Locate the Stoichiometric Coefficients section.
//    In the \[\nu_{\textrm{Li}\theta}\] text field, type 0.

    model.component("comp1").physics("liion").feature("pce1").feature("per2").set("VLiTheta", 0);

//    In the Stoichiometric coefficients for dissolving–depositing species: table, enter the following settings:

    model.component("comp1").physics("liion").feature("pce1").feature("per2").setIndex("Vib", 1, 0, 0);

//    In the Physics toolbar, click Domains and choose Porous Electrode.

    model.component("comp1").physics("liion").create("pce2", "PorousElectrode", 2);

//    In the Settings window for Porous Electrode, type Porous Electrode - Positive in the Label text field.

    model.component("comp1").physics("liion").feature("pce2").label("Porous Electrode - Positive");

//    Locate the Domain Selection section.
//    From the Selection list, select Positive Electrode.

    model.component("comp1").physics("liion").feature("pce2").selection().named("sel2");

//    Locate the Electrolyte Properties section.
//    From the Electrolyte material list, select LiPF6 in 1:1 EC:DMC (Liquid, Li-ion Battery) (mat1).

    model.component("comp1").physics("liion").feature("pce2").set("ElectrolyteMaterial", "mat1");

//    Locate the Electrode Properties section.
//    In the \[\sigma_{\textrm{s}}\] text field, type sigmas_pos.

    model.component("comp1").physics("liion").feature("pce2")
         .set("sigma", new String[]{"sigmas_pos", "0", "0", "0", "sigmas_pos", "0", "0", "0", "sigmas_pos"});

//    Locate the Porous Matrix Properties section.
//    In the \[\epsilon_{\textrm{s}}\] text field, type epss_pos.

    model.component("comp1").physics("liion").feature("pce2").set("epss", "epss_pos");

//    In the \[\epsilon_{\textrm{l}}\] text field, type epsl_pos.

    model.component("comp1").physics("liion").feature("pce2").set("epsl", "epsl_pos");

//    Locate the Effective Transport Parameter Correction section.
//    From the Electric conductivity list, select No correction.

    model.component("comp1").physics("liion").feature("pce2").set("ElectricCorrModel", "NoCorr");

//    In the Model Builder window, click Particle Intercalation 1.
//    In the Settings window for Particle Intercalation, locate the Species Settings section.
//    In the \[c_{\textrm{s,init}}\] text field, type cs_init_pos.

    model.component("comp1").physics("liion").feature("pce2").feature("pin1").set("csinit", "cs_init_pos");

//    Locate the Particle Transport Properties section.
//    In the \[r_{\textrm{p}}\] text field, type rp_pos.

    model.component("comp1").physics("liion").feature("pce2").feature("pin1").set("rp", "rp_pos");

//    In the Model Builder window, click Porous Electrode Reaction 1.
//    In the Settings window for Porous Electrode Reaction, locate the Electrode Kinetics section.
//    In the \[i_{\textrm{0,ref}}\left(T\right)\] text field, type i0_ref_pos.

    model.component("comp1").physics("liion").feature("pce2").feature("per1").set("i0_ref", "i0_ref_pos");

//    At the boundary between the copper current-collector and the porous negative electrode, define the copper dissolution/deposition reaction. In contrast to the porous electrode, the metallic copper amount can be set as constant.
//    In the Physics toolbar, click Boundaries and choose Internal Electrode Surface.

    model.component("comp1").physics("liion").create("bei1", "InternalElectrodeSurface", 1);

//    In the Settings window for Internal Electrode Surface, type Internal Electrode Surface - Copper in the Label text field.

    model.component("comp1").physics("liion").feature("bei1").label("Internal Electrode Surface - Copper");

//    Locate the Boundary Selection section.
//    From the Selection list, select Copper Current-Collector Boundary.

    model.component("comp1").physics("liion").feature("bei1").selection().named("sel6");

//    In the Model Builder window, click Electrode Reaction 1.
//    In the Settings window for Electrode Reaction, locate the Material section.
//    From the Material list, select Graphite, LixC6 MCMB (Negative, Li-ion Battery) (mat2).

    model.component("comp1").physics("liion").feature("bei1").feature("er1").set("MaterialOption", "mat2");

//    Locate the Equilibrium Potential section.
//    From the \[E_{\textrm{eq}}\] list, select User defined.

    model.component("comp1").physics("liion").feature("bei1").feature("er1").set("Eeq_mat", "userdef");

//    In the associated text field, type Eeq_Cu+delta_phil.

    model.component("comp1").physics("liion").feature("bei1").feature("er1").set("Eeq", "Eeq_Cu+delta_phil");

//    Locate the Electrode Kinetics section.
//    From the Kinetics expression type list, select Concentration-dependent kinetics.

    model.component("comp1").physics("liion").feature("bei1").feature("er1")
         .set("ElectrodeKinetics", "ConcentrationDependentKinetics");

//    In the \[i_0\] text field, type i0_ref_CuMetal.

    model.component("comp1").physics("liion").feature("bei1").feature("er1").set("i0", "i0_ref_CuMetal");

//    In the \[C_{\textrm{O}}\] text field, type cCu/cCu_ref.

    model.component("comp1").physics("liion").feature("bei1").feature("er1").set("CO", "cCu/cCu_ref");

//    In the Physics toolbar, click Boundaries and choose Electric Ground.

    model.component("comp1").physics("liion").create("egnd1", "ElectricGround", 1);

//    Select Boundary 2.

    model.component("comp1").physics("liion").feature("egnd1").selection().set(2);

//    In the Physics toolbar, click Boundaries and choose Electrode Current.

    model.component("comp1").physics("liion").create("ec1", "ElectrodeCurrent", 1);

//    In the Settings window for Electrode Current, locate the Boundary Selection section.
//    From the Selection list, select Aluminum Current-Collector Boundary.

    model.component("comp1").physics("liion").feature("ec1").selection().named("sel7");

//    Locate the Electrode Current section.
//    In the \[I_{\textrm{s,total}}\] text field, type -I_1C_cell.

    model.component("comp1").physics("liion").feature("ec1").set("Its", "-I_1C_cell");

//    To improve the initialization of the computations set the approximate potential (~cell voltage) in the positive electrode. This is necessary due to the highly nonlinear copper reaction kinetics.
//    In the Physics toolbar, click Domains and choose Initial Values.

    model.component("comp1").physics("liion").create("init2", "init", 2);

//    Select Domain 4.

    model.component("comp1").physics("liion").feature("init2").selection().set(4);

//    In the Settings window for Initial Values, locate the Initial Values section.
//    In the \[phis\] text field, type V0.

    model.component("comp1").physics("liion").feature("init2").set("phis", "V0");

//    Continue by defining the Transport of Diluted Species interface that is used to track the cuprous ion movement in the electrolyte. All fluxes due to copper dissolution/deposition needs to be coupled to the Lithium-Ion Battery interface.
//    In the Model Builder window, under Component 1 (comp1), click Transport of Diluted Species (tds).
//    In the Settings window for Transport of Diluted Species, locate the Domain Selection section.
//    In the list, select 1.
//    select 1 in the list.
//    Click Remove from Selection.

    model.component("comp1").physics("tds").selection().set(2, 3, 4, 5);

//    Select Domains 2, 3, 4, 5.
//    Locate the Transport Mechanisms section.
//    Clear the Convection checkbox.

    model.component("comp1").physics("tds").prop("TransportMechanism").set("Convection", false);

//    Select the Migration in electric field checkbox.

    model.component("comp1").physics("tds").prop("TransportMechanism").set("Migration", true);

//    Select the Mass transfer in porous media checkbox.

    model.component("comp1").physics("tds").prop("TransportMechanism").set("MassTransferInPorousMedia", true);

//    Click to expand the Dependent Variables section.
//    In the Concentrations (mol/m³) table, enter the following settings:

    model.component("comp1").physics("tds").field("concentration").component(1, "cCu");

//    In the Model Builder window, under Component 1 (comp1) > Transport of Diluted Species (tds), click Species Charges.
//    In the Settings window for Species Properties, locate the Charge section.
//    In the \[z_{\textrm{cCu}}\] text field, type zCu.

    model.component("comp1").physics("tds").feature("sp1").setIndex("z", "zCu", 0);

//    In the Model Builder window, click Fluid 1.
//    In the Settings window for Fluid, locate the Diffusion section.
//    In the \[D_{\textrm{cCu}}\] text field, type D_Cu.

    model.component("comp1").physics("tds").feature("cdm1")
         .set("D_cCu", new String[]{"D_Cu", "0", "0", "0", "D_Cu", "0", "0", "0", "D_Cu"});

//    Locate the Migration in Electric Field section.
//    In the \[V\] text field, type phil_ps.

    model.component("comp1").physics("tds").feature("cdm1").set("V", "phil_ps");

//    In the Physics toolbar, click Boundaries and choose Electrode Surface Coupling.

    model.component("comp1").physics("tds").create("eeic1", "ElectrodeElectrolyteInterfaceCoupling", 1);

//    In the Settings window for Electrode Surface Coupling, type Electrode Surface Coupling - Copper in the Label text field.

    model.component("comp1").physics("tds").feature("eeic1").label("Electrode Surface Coupling - Copper");

//    Locate the Boundary Selection section.
//    From the Selection list, select Copper Current-Collector Boundary.

    model.component("comp1").physics("tds").feature("eeic1").selection().named("sel6");

//    In the Model Builder window, expand the Electrode Surface Coupling - Copper node, then click Reaction Coefficients 1.
//    In the Settings window for Reaction Coefficients, locate the Reaction Current Density section.
//    From the \[i_{\textrm{loc}}\] list, select Local current density, Electrode Reaction 1 (liion/bei1/er1).

    model.component("comp1").physics("tds").feature("eeic1").feature("rc1")
         .set("iloc_src", "root.comp1.liion.bei1.er1.iloc");

//    Locate the Stoichiometric Coefficients section.
//    In the \[\nu_{\textrm{cCu}}\] text field, type -1.

    model.component("comp1").physics("tds").feature("eeic1").feature("rc1").setIndex("Vib", -1, 0);

//    In the Physics toolbar, click Domains and choose Porous Medium.

    model.component("comp1").physics("tds").create("porous1", "PorousMedium", 2);

//    In the Settings window for Porous Medium, type Porous Electrode - Negative in the Label text field.

    model.component("comp1").physics("tds").feature("porous1").label("Porous Electrode - Negative");

//    Locate the Domain Selection section.
//    From the Selection list, select Negative Electrode.

    model.component("comp1").physics("tds").feature("porous1").selection().named("sel1");

//    In the Model Builder window, click Fluid 1.
//    In the Settings window for Fluid, locate the Diffusion section.
//    In the \[D_{\textrm{F,cCu}}\] text field, type D_Cu.

    model.component("comp1").physics("tds").feature("porous1").feature("fluid1")
         .set("DF_cCu", new String[]{"D_Cu", "0", "0", "0", "D_Cu", "0", "0", "0", "D_Cu"});

//    From the Effective diffusivity model list, select Bruggeman model.

    model.component("comp1").physics("tds").feature("porous1").feature("fluid1")
         .set("FluidDiffusivityModelType", "BruggemanModel");

//    Locate the Migration in Electric Field section.
//    In the \[V\] text field, type phil_ps.

    model.component("comp1").physics("tds").feature("porous1").feature("fluid1").set("V", "phil_ps");

//    In the Model Builder window, click Porous Matrix 1.
//    In the Settings window for Porous Matrix, locate the Matrix Properties section.
//    From the \[\epsilon_{\textrm{p}}\] list, select User defined.

    model.component("comp1").physics("tds").feature("porous1").feature("pm1").set("poro_mat", "userdef");

//    In the associated text field, type epsl_neg.

    model.component("comp1").physics("tds").feature("porous1").feature("pm1").set("poro", "epsl_neg");

//    In the Physics toolbar, click Domains and choose Porous Medium.

    model.component("comp1").physics("tds").create("porous2", "PorousMedium", 2);

//    In the Settings window for Porous Medium, type Porous Electrode - Positive in the Label text field.

    model.component("comp1").physics("tds").feature("porous2").label("Porous Electrode - Positive");

//    Locate the Domain Selection section.
//    From the Selection list, select Positive Electrode.

    model.component("comp1").physics("tds").feature("porous2").selection().named("sel2");

//    In the Model Builder window, click Fluid 1.
//    In the Settings window for Fluid, locate the Diffusion section.
//    In the \[D_{\textrm{F,cCu}}\] text field, type D_Cu.

    model.component("comp1").physics("tds").feature("porous2").feature("fluid1")
         .set("DF_cCu", new String[]{"D_Cu", "0", "0", "0", "D_Cu", "0", "0", "0", "D_Cu"});

//    From the Effective diffusivity model list, select Bruggeman model.

    model.component("comp1").physics("tds").feature("porous2").feature("fluid1")
         .set("FluidDiffusivityModelType", "BruggemanModel");

//    Locate the Migration in Electric Field section.
//    In the \[V\] text field, type phil_ps.

    model.component("comp1").physics("tds").feature("porous2").feature("fluid1").set("V", "phil_ps");

//    In the Model Builder window, click Porous Matrix 1.
//    In the Settings window for Porous Matrix, locate the Matrix Properties section.
//    From the \[\epsilon_{\textrm{p}}\] list, select User defined.

    model.component("comp1").physics("tds").feature("porous2").feature("pm1").set("poro_mat", "userdef");

//    In the associated text field, type epsl_pos.

    model.component("comp1").physics("tds").feature("porous2").feature("pm1").set("poro", "epsl_pos");

//    In the Physics toolbar, click Domains and choose Porous Medium.

    model.component("comp1").physics("tds").create("porous3", "PorousMedium", 2);

//    In the Settings window for Porous Medium, type Separator in the Label text field.

    model.component("comp1").physics("tds").feature("porous3").label("Separator");

//    Locate the Domain Selection section.
//    From the Selection list, select Separator.

    model.component("comp1").physics("tds").feature("porous3").selection().named("sel3");

//    In the Model Builder window, click Fluid 1.
//    In the Settings window for Fluid, locate the Diffusion section.
//    In the \[D_{\textrm{F,cCu}}\] text field, type D_Cu.

    model.component("comp1").physics("tds").feature("porous3").feature("fluid1")
         .set("DF_cCu", new String[]{"D_Cu", "0", "0", "0", "D_Cu", "0", "0", "0", "D_Cu"});

//    From the Effective diffusivity model list, select Bruggeman model.

    model.component("comp1").physics("tds").feature("porous3").feature("fluid1")
         .set("FluidDiffusivityModelType", "BruggemanModel");

//    Locate the Migration in Electric Field section.
//    In the \[V\] text field, type phil_ps.

    model.component("comp1").physics("tds").feature("porous3").feature("fluid1").set("V", "phil_ps");

//    In the Model Builder window, click Porous Matrix 1.
//    In the Settings window for Porous Matrix, locate the Matrix Properties section.
//    From the \[\epsilon_{\textrm{p}}\] list, select User defined.

    model.component("comp1").physics("tds").feature("porous3").feature("pm1").set("poro_mat", "userdef");

//    In the associated text field, type epsl_sep.

    model.component("comp1").physics("tds").feature("porous3").feature("pm1").set("poro", "epsl_sep");

//    In the Physics toolbar, click Domains and choose Porous Electrode Coupling.

    model.component("comp1").physics("tds").create("pec1", "PorousElectrodeCoupling", 2);

//    In the Settings window for Porous Electrode Coupling, type Porous Electrode Coupling - Copper in the Label text field.

    model.component("comp1").physics("tds").feature("pec1").label("Porous Electrode Coupling - Copper");

//    Locate the Domain Selection section.
//    From the Selection list, select Negative Electrode.

    model.component("comp1").physics("tds").feature("pec1").selection().named("sel1");

//    In the Model Builder window, click Reaction Coefficients 1.
//    In the Settings window for Reaction Coefficients, locate the Reaction Current Source section.
//    From the \[i_{v}\] list, select Local current source, Porous Electrode Reaction - Copper (liion/pce1/per2).

    model.component("comp1").physics("tds").feature("pec1").feature("rc1")
         .set("iv_src", "root.comp1.liion.pce1.per2.iv");

//    Locate the Stoichiometric Coefficients section.
//    In the \[\nu_{\textrm{cCu}}\] text field, type -1.

    model.component("comp1").physics("tds").feature("pec1").feature("rc1").setIndex("Vi", -1, 0);

//    The highly nonlinear copper reaction kinetics require the steps in the study to set different initial cuprous ion concentrations to initialize the computations. Use an additional Initial Values node for this purpose.
//    In the Physics toolbar, click Domains and choose Initial Values.

    model.component("comp1").physics("tds").create("init2", "init", 2);

//    In the Settings window for Initial Values, locate the Domain Selection section.
//    From the Selection list, select All domains.

    model.component("comp1").physics("tds").feature("init2").selection().all();

//    Locate the Initial Values section.
//    In the \[cCu\] text field, type cCu0.

    model.component("comp1").physics("tds").feature("init2").setIndex("initc", "cCu0", 0);

//    In the Model Builder window, under Component 1 (comp1), click Mesh 1.
//    In the Settings window for Mesh, locate the Sequence Type section.
//    From the list, select User-controlled mesh.

    model.component("comp1").mesh("mesh1").automatic(false);

//    In the Model Builder window, under Component 1 (comp1) > Mesh 1, click Size 1.
//    In the Settings window for Size, locate the Geometric Entity Selection section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").mesh("mesh1").feature("size1").selection().geom("geom1", 1);

//    Select Boundaries 4, 6, 10, 11, 13, 14.

    model.component("comp1").mesh("mesh1").feature("size1").selection().set(4, 6, 10, 11, 13, 14);

//    Locate the Element Size section.
//    From the Predefined list, select Extremely fine.

    model.component("comp1").mesh("mesh1").feature("size1").set("hauto", 1);

//    In the Model Builder window, click Free Triangular 1.
//    In the Settings window for Free Triangular, click to expand the Scale Geometry section.
//    In the y-direction scale text field, type 50.

    model.component("comp1").mesh("mesh1").feature("ftri1").set("yscale", 50);

//    Click Build All.

    model.component("comp1").mesh("mesh1").run();

//    Use a parametric sweep to study the copper dissolution for two geometrical shapes of dents.
//    In the Study toolbar, click Parametric Sweep.

    model.study("std1").create("param", "Parametric");

//    In the Settings window for Parametric Sweep, locate the Study Settings section.
//    Click Add.

    model.study("std1").feature("param").setIndex("pname", "cCu0", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "mol/m^3", 0);
    model.study("std1").feature("param").setIndex("pname", "cCu0", 0);
    model.study("std1").feature("param").setIndex("plistarr", "", 0);
    model.study("std1").feature("param").setIndex("punit", "mol/m^3", 0);

//    Click Add.

    model.study("std1").feature("param").setIndex("pname", "cCu_ref", 1);
    model.study("std1").feature("param").setIndex("plistarr", "", 1);
    model.study("std1").feature("param").setIndex("punit", "mol/m^3", 1);
    model.study("std1").feature("param").setIndex("pname", "cCu_ref", 1);
    model.study("std1").feature("param").setIndex("plistarr", "", 1);
    model.study("std1").feature("param").setIndex("punit", "mol/m^3", 1);

//    In the table, enter the following settings:

    model.study("std1").feature("param").setIndex("pname", "w_dent", 0);
    model.study("std1").feature("param").setIndex("plistarr", "0.5[mm] 7.5[mm]", 0);
    model.study("std1").feature("param").setIndex("pname", "depth_dent", 1);
    model.study("std1").feature("param").setIndex("plistarr", "50[um] 20[um]/6", 1);

//    The cuprous ion concentration needs to be zero in Step 1. The second step runs smoother with nonzero concentration. Use the Modify model configuration support to achieve this.
//    In the Model Builder window, click Step 1: Current Distribution Initialization.
//    In the Settings window for Current Distribution Initialization, locate the Study Settings section.
//    From the Current distribution type list, select Secondary.

    model.study("std1").feature("cdi").set("initType", "secondary");

//    Locate the Physics and Variables Selection section.
//    Select the Modify model configuration for study step checkbox.

    model.study("std1").feature("cdi").set("useadvanceddisable", true);

//    In the tree, select Component 1 (comp1) > Transport of Diluted Species (tds) > Initial Values 2.
//    Right-click and choose Disable.

    model.study("std1").feature("cdi").set("disabledphysics", new String[]{"tds/init2"});

//    In the Model Builder window, click Step 2: Time Dependent.
//    In the Settings window for Time Dependent, locate the Study Settings section.
//    In the Output times text field, type 0 4000.

    model.study("std1").feature("time").set("tlist", "0 4000");

//    In the Study toolbar, click Show Default Solver.

    model.study("std1").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 1 (sol1) node.
//    In the Model Builder window, under Study 1 > Solver Configurations > Solution 1 (sol1), click Time-Dependent Solver 1.
//    In the Settings window for Time-Dependent Solver, locate the General section.
//    From the Times to store list, select Steps taken by solver.

    model.sol("sol1").feature("t1").set("tout", "tsteps");

//    In the Store every 𝑁th step text field, type 10.

    model.sol("sol1").feature("t1").set("tstepsstore", 10);

//    The following solver settings improve and speed up the computations.
//    Right-click Study 1 > Solver Configurations > Solution 1 (sol1) > Time-Dependent Solver 1 and choose Fully Coupled.

    model.sol("sol1").feature("t1").create("fc1", "FullyCoupled");

//    In the Settings window for Fully Coupled, click to expand the Method and Termination section.
//    From the Nonlinear method list, select Automatic (Newton).

    model.sol("sol1").feature("t1").feature("fc1").set("dtech", "auto");

//    Define a stop condition that terminates the computations at the lower cutoff cell voltage.
//    Right-click Time-Dependent Solver 1 and choose Stop Condition.

    model.sol("sol1").feature("t1").create("st1", "StopCondition");

//    In the Settings window for Stop Condition, locate the Stop Expressions section.
//    Click Add.

    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondarr", "", 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondterminateon", "true", 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondActive", true, 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopconddesc", "Stop expression 1", 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondarr", "", 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondterminateon", "true", 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondActive", true, 0);
    model.sol("sol1").feature("t1").feature("st1").setIndex("stopconddesc", "Stop expression 1", 0);

//    In the table, enter the following settings:

    model.sol("sol1").feature("t1").feature("st1").setIndex("stopcondarr", "-comp1.liion.phis0_ec1>-V_low", 0);

//    Locate the Output at Stop section.
//    From the Add solution list, select Steps before and after stop.

    model.sol("sol1").feature("t1").feature("st1").set("storestopcondsol", "stepbefore_stepafter");

//    Clear the Add information checkbox.

    model.sol("sol1").feature("t1").feature("st1").set("stopcondwarn", false);

//    In the Home toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol().create("sol3");
    model.sol("sol3").study("std1");
    model.sol("sol3").label("Parametric Solutions 1");

    model.batch("p1").feature("so1").set("psol", "sol3");
    model.batch("p1").run("compute");

    model.result().create("pg1", "PlotGroup1D");
    model.result("pg1").set("data", "dset3");
    model.result("pg1").label("Boundary Electrode Potential with Respect to Ground (liion)");
    model.result("pg1").set("titletype", "none");
    model.result("pg1").set("legendpos", "middleright");
    model.result("pg1").create("glob1", "Global");
    model.result("pg1").feature("glob1").set("unit", new String[]{""});
    model.result("pg1").feature("glob1").set("expr", new String[]{"liion.phis0_ec1"});
    model.result("pg1").feature("glob1").set("descr", new String[]{"Electric potential on boundary"});
    model.result("pg1").feature("glob1").set("xdatasolnumtype", "level1");
    model.result("pg1").feature("glob1").set("legend", true);
    model.result("pg1").feature("glob1").set("autosolution", false);
    model.result("pg1").feature("glob1").set("autodescr", true);
    model.result("pg1").set("showlegends", false);
    model.result().create("pg2", "PlotGroup1D");
    model.result("pg2").set("data", "dset3");
    model.result("pg2").set("ylabel", "SOC (1)");
    model.result("pg2").set("titletype", "none");
    model.result("pg2").set("legendpos", "middleleft");
    model.result("pg2").create("glob1", "Global");

    return model;
  }

  public static Model run4(Model model) {
    model.result("pg2").feature("glob1").set("unit", new String[]{"", ""});
    model.result("pg2").feature("glob1")
         .set("expr", new String[]{"liion.soc_average_pce1", "liion.soc_average_pce2"});
    model.result("pg2").feature("glob1")
         .set("descr", new String[]{"Average SOC, Porous Electrode - Negative", "Average SOC, Porous Electrode - Positive"});
    model.result("pg2").feature("glob1").set("xdatasolnumtype", "level1");
    model.result("pg2").feature("glob1").set("legend", true);
    model.result("pg2").feature("glob1").set("autosolution", false);
    model.result("pg2").feature("glob1").set("autodescr", true);
    model.result("pg2").label("Average Electrode State of Charge (liion)");
    model.result().create("pg3", "PlotGroup2D");
    model.result("pg3").set("data", "dset3");
    model.result("pg3").setIndex("looplevel", 2, 1);
    model.result("pg3").label("Electrode Potential with Respect to Ground (liion)");
    model.result("pg3").create("surf1", "Surface");
    model.result("pg3").feature("surf1").set("expr", new String[]{"phis"});
    model.result().create("pg4", "PlotGroup2D");
    model.result("pg4").set("data", "dset3");
    model.result("pg4").setIndex("looplevel", 2, 1);
    model.result("pg4").label("Electrode Potential with Respect to Adjacent Reference (liion)");
    model.result("pg4").create("surf1", "Surface");
    model.result("pg4").feature("surf1").set("expr", new String[]{"liion.Evsref"});
    model.result().create("pg5", "PlotGroup2D");
    model.result("pg5").set("data", "dset3");
    model.result("pg5").setIndex("looplevel", 2, 1);
    model.result("pg5").label("Electrolyte Salt Concentration (liion)");
    model.result("pg5").create("surf1", "Surface");
    model.result("pg5").feature("surf1").set("expr", new String[]{"cl"});
    model.result("pg5").feature("surf1").set("colortable", "RainbowLight");
    model.result().create("pg6", "PlotGroup2D");
    model.result("pg6").set("data", "dset3");
    model.result("pg6").setIndex("looplevel", 2, 1);
    model.result("pg6").label("Separator Current Density Magnitude (liion)");
    model.result("pg6").create("surf1", "Surface");
    model.result("pg6").feature("surf1").set("expr", new String[]{"liion.IlMag"});
    model.result("pg6").feature("surf1").set("colortable", "RainbowLight");
    model.result("pg6").feature("surf1").create("filt1", "Filter");
    model.result("pg6").feature("surf1").feature("filt1").set("expr", "isdefined(root.comp1.liion.isSeparator)");
    model.result().create("pg7", "PlotGroup2D");
    model.result("pg7").set("data", "dset3");
    model.result("pg7").setIndex("looplevel", 2, 1);
    model.result("pg7").label("Particle Surface State of Charge (liion)");
    model.result("pg7").create("surf1", "Surface");
    model.result("pg7").feature("surf1").set("expr", new String[]{"liion.socloc_surface"});
    model.result().create("pg8", "PlotGroup2D");
    model.result("pg8").set("data", "dset3");
    model.result("pg8").setIndex("looplevel", 2, 1);
    model.result("pg8").label("Concentration (tds)");
    model.result("pg8").set("titletype", "custom");
    model.result("pg8").set("prefixintitle", "");
    model.result("pg8").set("expressionintitle", false);
    model.result("pg8").set("typeintitle", false);
    model.result("pg8").create("surf1", "Surface");
    model.result("pg8").feature("surf1").set("expr", new String[]{"cCu"});
    model.result("pg8").feature("surf1").set("colortable", "Prism");
    model.result("pg8").set("typeintitle", true);
    model.result("pg8").create("arws1", "ArrowSurface");
    model.result("pg8").feature("arws1").set("expr", new String[]{"tds.tflux_cCux", "tds.tflux_cCuy"});
    model.result("pg8").feature("arws1").set("xnumber", 10);
    model.result("pg8").feature("arws1").set("ynumber", 10);
    model.result("pg8").feature("arws1").set("color", "black");
    model.result("pg8").feature("arws1").create("sel1", "Selection");
    model.result("pg8").feature("arws1").feature("sel1").selection().set(2, 3, 4, 5);
    model.result("pg1").run();

//    The following steps reproduce the figures found in the documentation and fix the plot groups under the <l>Results</l> node.
//    In the Settings window for 1D Plot Group, type Cell Voltage and Concentration in the Label text field.

    model.result("pg1").label("Cell Voltage and Concentration");

//    Click to expand the Title section.
//    From the Title type list, select None.
//    Locate the Plot Settings section.
//    Select the x-axis label checkbox.

    model.result("pg1").set("xlabelactive", true);

//    In the associated text field, type Discharge time (s).

    model.result("pg1").set("xlabel", "Discharge time (s)");

//    Select the y-axis label checkbox.

    model.result("pg1").set("ylabelactive", true);

//    In the associated text field, type Cell voltage (V).

    model.result("pg1").set("ylabel", "Cell voltage (V)");

//    Select the Two y-axes checkbox.

    model.result("pg1").set("twoyaxes", true);

//    Select the Secondary y-axis label checkbox.

    model.result("pg1").set("yseclabelactive", true);

//    In the associated text field, type Cu<sup>+</sup> concentration in cell (mol/m<sup>3</sup>).

    model.result("pg1").set("yseclabel", "Cu<sup>+</sup> concentration in cell (mol/m<sup>3</sup>)");

//    Locate the Axis section.
//    Select the Manual axis limits checkbox.

    model.result("pg1").set("axislimits", true);

//    In the x minimum text field, type 3500.

    model.result("pg1").set("xmin", 3500);

//    In the x maximum text field, type 3750.

    model.result("pg1").set("xmax", 3750);

//    In the y minimum text field, type -0.25.

    model.result("pg1").set("ymin", -0.25);

//    In the y maximum text field, type 2.

    model.result("pg1").set("ymax", 2);

//    In the Secondary y minimum text field, type -10.

    model.result("pg1").set("yminsec", -10);

//    In the Secondary y maximum text field, type 70.

    model.result("pg1").set("ymaxsec", 70);

//    Locate the Legend section.
//    Select the Show legends checkbox.

    model.result("pg1").set("showlegends", true);

//    From the Position list, select Middle right.

    model.result("pg1").run();

//    In the Model Builder window, expand the Cell Voltage and Concentration node, then click Global 1.
//    In the Settings window for Global, click to expand the Legends section.
//    From the Legends list, select Manual.

    model.result("pg1").feature("glob1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg1").feature("glob1").setIndex("legends", "Deep", 0);
    model.result("pg1").feature("glob1").setIndex("legends", "Shallow", 1);

//    Right-click Results > Cell Voltage and Concentration > Global 1 and choose Duplicate.

    model.result("pg1").feature().duplicate("glob2", "glob1");
    model.result("pg1").run();

//    In the Settings window for Global, locate the y-Axis Data section.
//    In the table, enter the following settings:

    model.result("pg1").feature("glob2").setIndex("expr", "cCu_cell", 0);

//    Locate the y-Axis section.
//    Select the Plot on secondary y-axis checkbox.

    model.result("pg1").feature("glob2").set("plotonsecyaxis", true);

//    Click to expand the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select Dashed.

    model.result("pg1").feature("glob2").set("linestyle", "dashed");

//    From the Color list, select Cycle (reset).

    model.result("pg1").feature("glob2").set("linecolor", "cyclereset");

//    In the Cell Voltage and Concentration toolbar, click Plot.

    model.result("pg1").run();
    model.result("pg8").run();

//    In the Model Builder window, under Results, click Concentration (tds).
//    In the Settings window for 2D Plot Group, type Cuprous Ion Concentration in the Label text field.

    model.result("pg8").label("Cuprous Ion Concentration");

//    Click to expand the Title section.
//    Locate the Data section.
//    From the Dataset list, select None.

    model.result("pg8").set("data", "none");

//    Locate the Title section.
//    From the Title type list, select Manual.

    model.result("pg8").set("titletype", "manual");

//    In the Title text area, type Cu<sup>+</sup> concentration (mol/m<sup>3</sup>).

    model.result("pg8").set("title", "Cu<sup>+</sup> concentration (mol/m<sup>3</sup>)");

//    Clear the Parameter indicator text field.

    model.result("pg8").set("paramindicator", "");

//    Locate the Plot Settings section.
//    From the View list, select View 1.

    model.result("pg8").set("view", "view1");

//    Click to expand the Plot Array section.
//    From the Array type list, select Linear.

    model.result("pg8").set("plotarraytype", "linear");
    model.result("pg8").run();

//    In the Model Builder window, expand the Cuprous Ion Concentration node.
//    Right-click Arrow Surface 1 and choose Delete.

    model.result("pg8").feature().remove("arws1");
    model.result("pg8").run();

//    In the Settings window for Surface, locate the Data section.
//    From the Dataset list, select Study 1/Parametric Solutions 1 (sol3).

    model.result("pg8").feature("surf1").set("data", "dset3");

//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 1: w_dent=5E-4 m, depth_dent=5E-5 m.

    model.result("pg8").feature("surf1").set("looplevel", new String[]{"last", "1"});

//    Locate the Coloring and Style section.
//    From the Color table list, select Lichen.

    model.result("pg8").feature("surf1").set("colortable", "Lichen");
    model.result("pg8").run();

//    In the Model Builder window, right-click Cuprous Ion Concentration and choose Line.

    model.result("pg8").create("line1", "Line");
    model.result("pg8").feature("line1").set("evaluationsettings", "parent");

//    In the Settings window for Line, locate the Data section.
//    From the Dataset list, select Study 1/Parametric Solutions 1 (sol3).

    model.result("pg8").feature("line1").set("data", "dset3");

//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 1: w_dent=5E-4 m, depth_dent=5E-5 m.

    model.result("pg8").feature("line1").set("looplevel", new String[]{"last", "1"});

//    Locate the Expression section.
//    In the Expression text field, type 1.

    model.result("pg8").feature("line1").set("expr", "1");

//    Locate the Coloring and Style section.
//    From the Coloring list, select Uniform.

    model.result("pg8").feature("line1").set("coloring", "uniform");

//    From the Color list, select Black.

    model.result("pg8").feature("line1").set("color", "black");

//    Click to expand the Plot Array section.
//    Select the Manual indexing checkbox.

    model.result("pg8").feature("line1").set("manualindexing", true);

//    Right-click Line 1 and choose Selection.

    model.result("pg8").feature("line1").create("sel1", "Selection");

//    Select Boundaries 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 16, 17, 18.

    model.result("pg8").feature("line1").feature("sel1").selection()
         .set(3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 16, 17, 18);
    model.result("pg8").run();

//    In the Model Builder window, right-click Cuprous Ion Concentration and choose Annotation.

    model.result("pg8").create("ann1", "Annotation");

//    In the Settings window for Annotation, locate the Data section.
//    From the Dataset list, select Study 1/Parametric Solutions 1 (sol3).

    model.result("pg8").feature("ann1").set("data", "dset3");

//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 1: w_dent=5E-4 m, depth_dent=5E-5 m.

    model.result("pg8").feature("ann1").set("looplevel", new String[]{"last", "1"});

//    Locate the Annotation section.
//    In the Text text field, type Deep.

    model.result("pg8").feature("ann1").set("text", "Deep");

//    Locate the Coloring and Style section.
//    Clear the Show point checkbox.

    model.result("pg8").feature("ann1").set("showpoint", false);

//    From the Anchor point list, select Center.

    model.result("pg8").feature("ann1").set("anchorpoint", "center");

//    Click to expand the Plot Array section.
//    Select the Manual indexing checkbox.

    model.result("pg8").feature("ann1").set("manualindexing", true);
    model.result("pg8").run();

//    In the Model Builder window, under Results > Cuprous Ion Concentration, Ctrl-click to select Surface 1, Line 1, Annotation 1.
//    Right-click and choose Duplicate.

    model.result("pg8").feature().duplicate("surf2", "surf1");
    model.result("pg8").feature().duplicate("line2", "line1");
    model.result("pg8").feature().duplicate("ann2", "ann1");
    model.result("pg8").run();

//    In the Settings window for Surface, locate the Data section.
//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 2: w_dent=0.0075 m, depth_dent=3.3333E-6 m.

    model.result("pg8").feature("surf2").set("looplevel", new String[]{"last", "2"});

//    Click to expand the Range section.
//    Locate the Coloring and Style section.
//    Clear the Color legend checkbox.

    model.result("pg8").feature("surf2").set("colorlegend", false);

//    Click to expand the Inherit Style section.
//    From the Plot list, select Surface 1.

    model.result("pg8").feature("surf2").set("inheritplot", "surf1");

//    Click to expand the Plot Array section.
//    Select the Manual indexing checkbox.

    model.result("pg8").feature("surf2").set("manualindexing", true);

//    In the Index text field, type 1.

    model.result("pg8").feature("surf2").set("arrayindex", 1);
    model.result("pg8").run();

//    In the Model Builder window, click Line 2.
//    In the Settings window for Line, locate the Data section.
//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 2: w_dent=0.0075 m, depth_dent=3.3333E-6 m.

    model.result("pg8").feature("line2").set("looplevel", new String[]{"last", "2"});

//    Locate the Plot Array section.
//    In the Index text field, type 1.

    model.result("pg8").feature("line2").set("arrayindex", 1);
    model.result("pg8").run();

//    In the Model Builder window, click Annotation 2.
//    In the Settings window for Annotation, locate the Data section.
//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 2: w_dent=0.0075 m, depth_dent=3.3333E-6 m.

    model.result("pg8").feature("ann2").set("looplevel", new String[]{"last", "2"});

//    Locate the Annotation section.
//    In the Text text field, type Shallow.

    model.result("pg8").feature("ann2").set("text", "Shallow");

//    Locate the Plot Array section.
//    In the Index text field, type 1.

    model.result("pg8").feature("ann2").set("arrayindex", 1);
    model.result("pg8").run();

//    In the Model Builder window, right-click Cuprous Ion Concentration and choose Duplicate.

    model.result().duplicate("pg9", "pg8");
    model.result("pg9").run();

//    In the Model Builder window, click Cuprous Ion Concentration 1.
//    In the Settings window for 2D Plot Group, type Deposited Copper Concentration in the Label text field.

    model.result("pg9").label("Deposited Copper Concentration");

//    Locate the Title section.
//    In the Title text area, type Deposited copper concentration (mol/m<sup>3</sup>).

    model.result("pg9").set("title", "Deposited copper concentration (mol/m<sup>3</sup>)");
    model.result("pg9").run();

//    In the Model Builder window, click Surface 1.
//    In the Settings window for Surface, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > Dissolving–depositing species > liion.c_pce1_CuMetal - Dissolving–depositing species concentration - mol/m³.

    model.result("pg9").feature("surf1").set("expr", "liion.c_pce1_CuMetal");
    model.result("pg9").feature("surf1").set("descr", "Dissolving\u2013depositing species concentration");

//    Locate the Coloring and Style section.
//    From the Color table list, select Caissara.

    model.result("pg9").feature("surf1").set("colortable", "Caissara");
    model.result("pg9").run();

//    In the Model Builder window, click Surface 2.
//    In the Settings window for Surface, click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > Dissolving–depositing species > liion.c_pce1_CuMetal - Dissolving–depositing species concentration - mol/m³.

    model.result("pg9").feature("surf2").set("expr", "liion.c_pce1_CuMetal");
    model.result("pg9").feature("surf2").set("descr", "Dissolving\u2013depositing species concentration");

//    In the Deposited Copper Concentration toolbar, click Plot.

    model.result("pg9").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.result("pg9").run();

//    In the Model Builder window, right-click Deposited Copper Concentration and choose Duplicate.

    model.result().duplicate("pg10", "pg9");
    model.result("pg10").run();

//    In the Settings window for 2D Plot Group, type Electrode Potentials in the Label text field.

    model.result("pg10").label("Electrode Potentials");

//    Locate the Title section.
//    In the Title text area, type Surface: Electrode potential (V) Arrow Surface: Electrode current density vector.

    model.result("pg10")
         .set("title", "Surface: Electrode potential (V)  Arrow Surface: Electrode current density vector");
    model.result("pg10").run();

//    In the Model Builder window, expand the Electrode Potentials node, then click Surface 1.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Interpolation.

    model.result("pg10").feature("surf1").set("looplevel", new String[]{"interp", "1"});

//    In the Time text field, type 3604.7.

    model.result("pg10").feature("surf1").set("interp", new double[]{3604.7});

//    Locate the Expression section.
//    In the Expression text field, type phis-phil.

    model.result("pg10").feature("surf1").set("expr", "phis-phil");

//    Locate the Coloring and Style section.
//    From the Color table list, select MetasepiaBlue.

    model.result("pg10").feature("surf1").set("colortable", "MetasepiaBlue");
    model.result("pg10").run();

//    In the Model Builder window, click Surface 2.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Interpolation.

    model.result("pg10").feature("surf2").set("looplevel", new String[]{"interp", "2"});

//    In the Time text field, type 3604.7.

    model.result("pg10").feature("surf2").set("interp", new double[]{3604.7});

//    Locate the Expression section.
//    In the Expression text field, type phis-phil.

    model.result("pg10").feature("surf2").set("expr", "phis-phil");
    model.result("pg10").run();

//    In the Model Builder window, right-click Electrode Potentials and choose Arrow Surface.

    model.result("pg10").create("arws1", "ArrowSurface");
    model.result("pg10").feature("arws1").set("evaluationsettings", "parent");

//    In the Settings window for Arrow Surface, locate the Data section.
//    From the Dataset list, select Study 1/Parametric Solutions 1 (sol3).

    model.result("pg10").feature("arws1").set("data", "dset3");

//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 1: w_dent=5E-4 m, depth_dent=5E-5 m.

    model.result("pg10").feature("arws1").set("looplevel", new String[]{"last", "1"});

//    From the Time (s) list, select Interpolation.

    model.result("pg10").feature("arws1").set("looplevel", new String[]{"interp", "1"});

//    In the Time text field, type 3604.7.

    model.result("pg10").feature("arws1").set("interp", new double[]{3604.7});

//    Click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > liion.Isx,liion.Isy - Electrode current density vector.

    model.result("pg10").feature("arws1").set("expr", new String[]{"liion.Isx", "liion.Isy"});
    model.result("pg10").feature("arws1").set("descr", "Electrode current density vector");

//    Locate the Coloring and Style section.
//    Select the Scale factor checkbox.

    model.result("pg10").feature("arws1").set("scaleactive", true);

//    In the associated text field, type 5e-5.

    model.result("pg10").feature("arws1").set("scale", "5e-5");

//    From the Color list, select Black.

    model.result("pg10").feature("arws1").set("color", "black");

//    Click to expand the Plot Array section.
//    Select the Manual indexing checkbox.

    model.result("pg10").feature("arws1").set("manualindexing", true);

//    Right-click Arrow Surface 1 and choose Duplicate.

    model.result("pg10").feature().duplicate("arws2", "arws1");
    model.result("pg10").run();

//    In the Settings window for Arrow Surface, locate the Data section.
//    From the Parameter value (w_dent (m),depth_dent (m)) list, select 2: w_dent=0.0075 m, depth_dent=3.3333E-6 m.

    model.result("pg10").feature("arws2").set("looplevel", new String[]{"interp", "2"});

//    Locate the Plot Array section.
//    In the Index text field, type 1.

    model.result("pg10").feature("arws2").set("arrayindex", 1);

//    In the Electrode Potentials toolbar, click Plot.

    model.result("pg10").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.result("pg8").run();

//    In the Model Builder window, under Results > Cuprous Ion Concentration, click Surface 1.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Interpolation.

    model.result("pg8").feature("surf1").set("looplevel", new String[]{"interp", "1"});

//    In the Time text field, type 3604.7.

    model.result("pg8").feature("surf1").set("interp", new double[]{3604.7});
    model.result("pg8").run();

//    In the Model Builder window, click Surface 2.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Interpolation.

    model.result("pg8").feature("surf2").set("looplevel", new String[]{"interp", "2"});

//    In the Time text field, type 3604.7.

    model.result("pg8").feature("surf2").set("interp", new double[]{3604.7});

//    In the Cuprous Ion Concentration toolbar, click Plot.

    model.result("pg8").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.result("pg10").run();

//    In the Model Builder window, right-click Electrode Potentials and choose Duplicate.

    model.result().duplicate("pg11", "pg10");
    model.result("pg11").run();

//    In the Model Builder window, click Electrode Potentials 1.
//    In the Settings window for 2D Plot Group, type Electrolyte Salt Concentration in the Label text field.

    model.result("pg11").label("Electrolyte Salt Concentration");

//    Locate the Title section.
//    In the Title text area, type Surface: c<sub>l</sub> concentration (mol/m<sup>3</sup>) Arrow Surface: Electrolyte current density vector.

    model.result("pg11")
         .set("title", "Surface: c<sub>l</sub> concentration (mol/m<sup>3</sup>)  Arrow Surface: Electrolyte current density vector");
    model.result("pg11").run();

//    In the Model Builder window, click Surface 1.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Last (3753.8).

    model.result("pg11").feature("surf1").set("looplevel", new String[]{"last", "1"});

//    Locate the Expression section.
//    In the Expression text field, type cl-cCu.

    model.result("pg11").feature("surf1").set("expr", "cl-cCu");

//    Locate the Coloring and Style section.
//    From the Color table list, select Prionace.

    model.result("pg11").feature("surf1").set("colortable", "Prionace");
    model.result("pg11").run();

//    In the Model Builder window, click Surface 2.
//    In the Settings window for Surface, locate the Data section.
//    From the Time (s) list, select Last (3736).

    model.result("pg11").feature("surf2").set("looplevel", new String[]{"last", "2"});

//    Locate the Expression section.
//    In the Expression text field, type cl-cCu.

    model.result("pg11").feature("surf2").set("expr", "cl-cCu");
    model.result("pg11").run();

//    In the Model Builder window, click Arrow Surface 1.
//    In the Settings window for Arrow Surface, locate the Data section.
//    From the Time (s) list, select Last (3753.8).

    model.result("pg11").feature("arws1").set("looplevel", new String[]{"last", "1"});

//    Click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > liion.Ilx,liion.Ily - Electrolyte current density vector.

    model.result("pg11").feature("arws1").set("expr", new String[]{"liion.Ilx", "liion.Ily"});
    model.result("pg11").feature("arws1").set("descr", "Electrolyte current density vector");

//    Locate the Coloring and Style section.
//    From the Color list, select Cyan.

    model.result("pg11").feature("arws1").set("color", "cyan");
    model.result("pg11").run();

//    In the Model Builder window, click Arrow Surface 2.
//    In the Settings window for Arrow Surface, locate the Data section.
//    From the Time (s) list, select Last (3736).

    model.result("pg11").feature("arws2").set("looplevel", new String[]{"last", "2"});

//    Click Replace Expression in the upper-right corner of the Expression section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > liion.Ilx,liion.Ily - Electrolyte current density vector.

    model.result("pg11").feature("arws2").set("expr", new String[]{"liion.Ilx", "liion.Ily"});
    model.result("pg11").feature("arws2").set("descr", "Electrolyte current density vector");

//    Locate the Coloring and Style section.
//    From the Color list, select Cyan.

    model.result("pg11").feature("arws2").set("color", "cyan");

//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg12", "PlotGroup1D");
    model.result("pg12").run();

//    In the Settings window for 1D Plot Group, type Current Collector Dissolution Current in the Label text field.

    model.result("pg12").label("Current Collector Dissolution Current");

//    Locate the Data section.
//    From the Dataset list, select None.

    model.result("pg12").set("data", "none");

//    Locate the Title section.
//    From the Title type list, select None.

    model.result("pg12").set("titletype", "none");

//    Right-click Current Collector Dissolution Current and choose Line Graph.

    model.result("pg12").create("lngr1", "LineGraph");
    model.result("pg12").feature("lngr1").set("markerpos", "datapoints");
    model.result("pg12").feature("lngr1").set("linewidth", "preference");
    model.result("pg12").feature("lngr1").set("evaluationsettings", "parent");

//    In the Settings window for Line Graph, locate the Data section.
//    From the Dataset list, select Study 1/Parametric Solutions 1 (sol3).

    model.result("pg12").feature("lngr1").set("data", "dset3");

//    From the Parameter selection (w_dent, depth_dent) list, select First.

    model.result("pg12").feature("lngr1").setIndex("looplevelinput", "first", 1);

//    From the Time selection list, select Interpolated.

    model.result("pg12").feature("lngr1").setIndex("looplevelinput", "interp", 0);

//    In the Times (s) text field, type 3604.7.

    model.result("pg12").feature("lngr1").setIndex("interp", 3604.7, 0);

//    Select Boundary 4.

    model.result("pg12").feature("lngr1").selection().set(4);

//    Click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Lithium-Ion Battery > Electrode kinetics > liion.iloc_er1 - Local current density - A/m².

    model.result("pg12").feature("lngr1").set("expr", "liion.iloc_er1");
    model.result("pg12").feature("lngr1").set("descr", "Local current density");

//    Click to expand the Legends section.
//    Select the Show legends checkbox.

    model.result("pg12").feature("lngr1").set("legend", true);

//    From the Legends list, select Manual.

    model.result("pg12").feature("lngr1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg12").feature("lngr1").setIndex("legends", "Deep, local E<sub>neg</sub> >3.5 V", 0);

//    Right-click Line Graph 1 and choose Duplicate.

    model.result("pg12").feature().duplicate("lngr2", "lngr1");
    model.result("pg12").run();

//    In the Settings window for Line Graph, locate the Data section.
//    From the Time selection list, select Last.

    model.result("pg12").feature("lngr2").setIndex("looplevelinput", "last", 0);

//    Locate the Legends section.
//    In the table, enter the following settings:

    model.result("pg12").feature("lngr2").setIndex("legends", "Deep, E<sub>cell</sub>=-0.05 V", 0);
    model.result("pg12").run();

//    In the Model Builder window, under Results > Current Collector Dissolution Current, Ctrl-click to select Line Graph 1, Line Graph 2.
//    Right-click and choose Duplicate.

    model.result("pg12").feature().duplicate("lngr3", "lngr1");
    model.result("pg12").feature().duplicate("lngr4", "lngr2");
    model.result("pg12").run();

//    In the Settings window for Line Graph, locate the Data section.
//    From the Parameter selection (w_dent, depth_dent) list, select Last.

    model.result("pg12").feature("lngr3").setIndex("looplevelinput", "last", 1);

//    Click to expand the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select Dashed.

    model.result("pg12").feature("lngr3").set("linestyle", "dashed");

//    Locate the Legends section.
//    In the table, enter the following settings:

    model.result("pg12").feature("lngr3").setIndex("legends", "Shallow, local E<sub>neg</sub> >3.5 V", 0);
    model.result("pg12").run();

//    In the Model Builder window, click Line Graph 4.
//    In the Settings window for Line Graph, locate the Data section.
//    From the Parameter selection (w_dent, depth_dent) list, select Last.

    model.result("pg12").feature("lngr4").setIndex("looplevelinput", "last", 1);

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select Dashed.

    model.result("pg12").feature("lngr4").set("linestyle", "dashed");

//    Locate the Legends section.
//    In the table, enter the following settings:

    model.result("pg12").feature("lngr4").setIndex("legends", "Shallow, E<sub>cell</sub>=-0.05 V", 0);

//    In the Current Collector Dissolution Current toolbar, click Plot.

    model.result("pg12").run();

//    Finally, remove redundant plots.

    model.result("pg2").run();

//    In the Model Builder window, under Results, Ctrl-click to select Average Electrode State of Charge (liion), Electrode Potential with Respect to Ground (liion), Electrode Potential with Respect to Adjacent Reference (liion), Electrolyte Salt Concentration (liion), Separator Current Density Magnitude (liion), Particle Surface State of Charge (liion).
//    Right-click and choose Delete.

    model.result().remove("pg2");
    model.result().remove("pg3");
    model.result().remove("pg4");
    model.result().remove("pg5");
    model.result().remove("pg6");
    model.result().remove("pg7");
    model.result("pg8").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.title("Copper Current-Collector Dissolution");

    return model;
  }

  public static Model run5(Model model) {

    model
         .description("This example models dissolution and redeposition of the negative copper current-collector in a lithium-ion battery subjected to overdischarge. A dent is introduced in the model geometry in order to investigate the impact of an uneven coating of the negative graphite electrode.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    model = run2(model);
    model = run3(model);
    model = run4(model);
    run5(model);
  }

}
