\section{Introduction}
\label{sec:Introduction}

Dealing with renewable energy sources requires internalizing their stochasticity into optimization and market-clearing tools used in power system operations.
To this end,  stochastic  \cite{shiina2004stochastic}  and robust  \cite{jabr2013adjustable} optimization methods have been employed and demonstrated to improve power system cost efficiency and reliability.
Consider a decision-making problem, such as an optimal power flow or unit commitment problem $\min_{\substack{x\in\set{X}(\omega)}} {C}(x,\omega)$, where $C(\cdot)$ and $x$ are the objective (cost) function and the vector of decision variables (e.g. generator outputs) constrained by feasible solution space $\set{X}$ and $\omega \in \Omega$ is a vector of uncertain parameters (e.g. net load or renewable injections) affecting both the objective function and the feasible region.
In stochastic approaches, this problem is often solved by representing $\Omega$ as a set of discrete scenarios $\{\omega_s\}$ with probability $\pi_s$ and minimizing the expected cost across all scenarios, i.e., $\min_{\substack{x\in\set{X}(\omega_s)}} \sum_s \pi_s C(x,\omega_s)$.
However, besides high computational requirements that limit the number of scenarios that can be considered \cite{dupavcova2003scenario}, the accuracy of the scenario-based method highly depends on how well the chosen scenarios can capture both the range and  correlation structures of  uncertain parameters.
Ideally, the used scenarios are historical realizations of  uncertain parameters, which will ensure the most accurate representation.
However, relying on historical samples raises two  challenges.
First, the number of historical samples may be scarce. For example, if a power system operator wants to analyze the impact of a wind farm that is under construction, there are no historical data points available to use as scenarios. Thus scenarios with credible statistical properties need to be \textit{synthesized}.
Second, historical samples may not include events that are relevant in the future, i.e., considering the most adversarial historic event to ensure system reliability may not be sufficient if a new and worse event materializes.

The first challenge can be addressed through novel data-driven approaches that are powerful in catering to specific requirements based on the underlying patterns they learned from historical data.
Specifically, a machine learning framework named \textit{generative adversarial network} (GAN) proposed by Goodfellow \textit{et al.} \cite{goodfellow2014generative} has been shown to efficiently synthesize data samples that fit to a given empirical distribution with very high credibility.
Further, a modification of GANs introduced by Mirza and Osindero \cite{mirza2014conditional}, called conditional GAN (cGAN), allows to \textit{condition} the generated data sets based on predefined labels, thus allowing to tune the generated synthetic scenarios to the specific needs of their applications.
GANs and cGANs have been successfully applied to power system problems.
For example, Chen \textit{et al.} \cite{chen2018model} used cGAN to generate scenarios for wind and solar injections.
Further power system applications of (c)GANs include Wang \textit{et al.} \cite{wang2020modeling} who applied cGANs to generate load scenarios, Zhang \textit{et al.} \cite{zhang2020typical} who studied wind power injection scenarios with focus on the spatio-temporal correlation between multiple wind farms in the system, and Wang \textit{et al.} \cite{wang2019generative} who used GANs to improve short-term forecasting of renewable injections.
While the approaches in \cite{chen2018model,wang2020modeling,zhang2020typical,wang2019generative} can successfully synthesize the statistical properties of the historical data they do \textit{not} consider the impact of a  (c)GAN-generated data sample on the decision making problem $\min_{\substack{x\in\set{X}(\omega)}} {C}(x,\omega)$ at hand, thus they do not address the second challenge of scenario generation.
Traditionally, this challenge has been addressed by generating robust scenarios that may not be statistically credible but constitute a worst-case outcome for decision-making task, i.e., $  \min_{\substack{x\in\set{X}(\omega)}} \sup_{\substack{\omega \in \set{U}}} {C}(x,\omega)$, where $\set{U}$ is a predefined uncertainty set.
Such robust decisions are usually overly conservative and, therefore, costly. Additionally, an analytic and/or computationally tractable solutions to the inner maximization problem may be difficult to obtain for some $\set{U}$ and, thus, often require approximations that further add to the solution conservatism.

To address these two scenario generation challenges simultaneously, we propose a modified cGAN that can generate scenarios that are adversarial for the decision-making task, but, at the same time, remain statistically credible.
Unlike the previous work in
\cite{chen2018model,wang2020modeling,zhang2020typical,wang2019generative},
we internalize the decision-making task, in our case a DC optimal power flow (DC-OPF) problem, into the cGAN training phase, thus rendering it \textit{operation adversarial} (OA-cGAN).
We use the proposed OA-cGAN to generate forecast errors of the real-time net load (i.e., demand minus renewable injections)  considered during a day-ahead planning stage.
We derive the necessary training method and demonstrate that the ability of the proposed OA-cGAN to generate statistically credible forecast errors that, at the same time, improve system reliability.
Our implementation and experiments use real-world data from the NYISO system.

\section{Preliminaries}
\label{sec:Basic_model}

\subsection{Conditional generative adversarial networks (cGANs)}
\label{subsec:cGANs}

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/cGAN.png}
    \caption{A typical structure of the cGAN model.}
    \label{fig:cGAN}
\end{figure}

Fig.~\ref{fig:cGAN} illustrates a basic cGAN model with one generator ($G$) and one discriminator ($D$), both of which are non-linear mapping functions, such as neural networks. Generator $G$ and discriminator $D$ are defined by a set of parameters $\theta_g$ and $\theta_d$, respectively, which must be trained. Specifically, $G$ and $D$ are trained alternately in a zero-sum game process. The training objective  is to tune $\theta_g$ such that $G$ transforms data samples drawn from some distribution $\mathbb{P}_z$ into new data points that follow a target data distribution $\mathbb{P}_{data}$.
The training objective of  $D$, on the other hand, is to tune $\theta_d$ such that $D$ can distinguish real data samples drawn from $\mathbb{P}_{data}$ and synthetic data points generated by $G$ with high accuracy.
The additional input is label $y$, which conditions the training of $G$ and $D$ to specific data features, hence the naming convention ``conditional'' GAN.
The \textit{adversarial} competition between the objectives of $G$ and $D$ will push each model to improve its performance until a Nash equilibrium is reached, i.e., the samples produced by $G$ cannot be distinguished from the original data by $D$.
The full training objective function of cGANs can then be formalized as:
\begin{align}
    \min_{\substack{\theta_g}}\max_{\substack{\theta_d}}\ &\mathbb{E}_{x \sim \mathbb{P}_{data}}[\log \left( D(x,{\theta_d}|y) \right)] \nonumber \\
    &+ \mathbb{E}_{z \sim \mathbb{P}_z}[\log \left(1 - D(G(z,{\theta_g}|y),{\theta_d}|y)\right)],  \label{cGAN}
\end{align}
where $x\sim{\mathbb{P}_{data}}$ is data from the real distribution, $z\sim{\mathbb{P}_z}$ is randomly generated data (e.g. from a Gaussian distribution), $G(z,{\theta_g}|y)$ is the output of $G$, i.e., the generated data based on the noise input (denoted as $z$) and label $y$, and $D(x,{\theta_d}|y)$ is the output of $D$, i.e., the probability that $x$ is from real data distribution $\mathbb{P}_{data}$ conditioned by label $y$ ($D(x,{\theta_d}|y) \in [0,1]$).
Operators $\mathbb{E}_{x \sim \mathbb{P}_{data}}$ and $\mathbb{E}_{z \sim \mathbb{P}_z}$ compute the expectation with respect to distributions $\mathbb{P}_{data}$ and $\mathbb{P}_z$, respectively.

Training objective \eqref{cGAN} is achieved by alternately tuning $\theta_g$ such that $G$ maximizes the probability that the currently trained $D$ identifies its synthetic data $G(z,{\theta_g}|y)$ as real:
\begin{align}
    \max_{\substack{\theta_g}}\ \mathbb{E}_{z \sim \mathbb{P}_z}\left[ {\log \left( {D(G(z,{\theta_g}|y), {\theta_d}|y)} \right)} \right], \label{GAN_G}
\end{align}%
and tuning $\theta_d$ such that $D$ maximizes its judgement accuracy, i.e., achieving high values $D(x,{\theta_d}|y)$ for real data and low values $D(G(z,{\theta_g}|y),{\theta_d}|y)$ for synthetic data:
\begin{align}
    \max_{\substack{\theta_d}}\ &\mathbb{E}_{x \sim \mathbb{P}_{data}}\left[ {\log \left(D(x,{\theta_d}|y) \right)} \right]  \nonumber \\  &+\mathbb{E}_{z \sim \mathbb{P}_z}\left[ {\log \left( {1-D(G(z,{\theta_g}|y), {\theta_d}|y)} \right)} \right]. \label{GAN_D}
\end{align}%

\subsection{Power system operation model}
\label{subsec:DCOPF}

We consider a standard DC optimal power flow (DC-OPF) problem to model power system operations. The DC-OPF minimizes the operating cost of supplying the system net load (i.e., load minus renewable injections) with respect to physical limits of generators and transmission lines:
\allowdisplaybreaks
\begin{subequations}
\begin{align}
&\min_{\substack{\{P_{g,t}\}_{g\in \set{G}, t\in \set{T}},\\ \{\theta_{i,t}\}_{i\in \set{I}, t\in \set{T}}}}\
    C = \sum\limits_{t\in \set{T}} \sum\limits_{g\in \set{G}} {(c_{0g} + c_{1g}P_{g,t} + c_{2g}P_{g,t}^2)} \label{DCOPF_objective}\\
    & \text{s.t. } \nonumber \\
    &(\lambda_{i,t}):\sum\nolimits_{g\in \set{G}_i}P_{g,t} - \sum\nolimits_{j \in \mathcal{N}_i } B_{i,j} (\theta_{i,t} - \theta_{j,t}) = d_{i,t} \nonumber \\
    & \hspace{1.1cm}
     \forall{i}\in\set{I},\ \forall{t}\in\set{T} \label{DCOPF_power_balance}\\
    &(\rho_{g,t}^{-},\rho_{g,t}^{+}): 0 \le P_{g,t} \le P_{g}^{\max} \quad \forall{g}\in\set{G} \label{DCOPF_Pmax}\\
    & (\beta_{i,j,t}^{-},\beta_{i,j,t}^{+}): -S_{i,j} \le B_{i,j} (\theta_{i,t}-\theta_{j,t}) \le S_{i,j}  \nonumber \\
    & \hspace{1cm}\forall{i}\in\set{I},\ \forall{j}\in \mathcal{N}_i,\ \forall{t}\in\set{T}  \label{DCOPF_power_flow}\\
    & (\eta_t): \theta_{ref,t} = 0 \quad \forall{t}\in\set{T}, \label{DCOPF_ref}
\end{align}%
\label{DCOPF}%
\end{subequations}%
\allowdisplaybreaks[0]%
where $\set{I}$ is the set of nodes in the transmission network indexed by $i$, $\set{T}$ is the set of time steps in the planing horizon indexed by $t$, $d_{i,t}$ is the net load at node $i$ and time $t$, $P_{g,t}$ is the (active) power output of generator $g$ at time $t$, $\set{G}_i$ is the set of generators connected to node $i$, $\mathcal{N}_i $ is the set of nodes adjacent to $i$, $\theta_{i,t}$ is the voltage angle at node $i$ at time $t$, $B_{i,j}$ is the susceptance of the line between node $i$ and $j$, and $S_{i,j}$ is the thermal capacity of the line between node $i$ and $j$.
Objective~\eqref{DCOPF_objective} minimizes system cost using a quadratic cost model of each generator given by parameters $c_{0g}$, $c_{1g}$, $c_{2g}$.
Eq.~\cref{DCOPF_power_balance} enforces the nodal power balance at each node. Eqs.~\cref{DCOPF_Pmax} and \cref{DCOPF_power_flow} limit the output of generators and the power flow on each line to their technical limits. Eq.~\cref{DCOPF_ref} sets the voltage angle at the reference node ($i=ref$) to 0.
Greek letters in parentheses in \cref{DCOPF_power_balance,DCOPF_Pmax,DCOPF_power_flow,DCOPF_ref} denote dual multipliers of the respective constraints.

\section{Operation-Adversarial cGAN model}
\label{sec:Proposed_model}

\subsection{Training objective}
\label{subsec:Objective}

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/operation_adversarial_cGAN.png}
    \caption{The proposed structure of the OA-cGAN model.}
    \label{fig:operation_adversarial_cGAN}
\end{figure}
The structure of the proposed operation-adversarial cGAN model (OA-cGAN) is shown in Fig.~\ref{fig:operation_adversarial_cGAN}. Compared with the traditional cGAN in Fig.~\ref{fig:cGAN}, another player (i.e., the DC-OPF model) joins the game between $G$ and $D$ and becomes part of the training process of $G$. Note that the training process of $D$ remains the same as in the traditional cGAN model. Thus, the objective of $D$ in the OA-cGAN model is still maximizing its judgment accuracy as shown in \cref{GAN_D}.
As the first step, we formulate the training objectives of $G$ and $D$ as an equivalent minimization problem to achieve consistency with the cost-minimizing DC-OPF formulation:
\begin{align}
\min_{\substack{\theta_d}}\ loss_D &= \mathbb{E}_{x \sim \mathbb{P}_{data}}\left[ {\log \left(1-D(x,{\theta_d}|y) \right)} \right] \nonumber \\ &+\mathbb{E}_{z \sim \mathbb{P}_z}\left[ {\log \left( {D(G(z,{\theta_g}|y), {\theta_d}|y)} \right)} \right] \label{model_D}.
\end{align}%

Next, the training objective of generator $G$ receives an additional component to capture the operational model:
\begin{align}
\min_{\substack{\theta_g}}\
    loss_G =& k \overbrace{ \mathbb{E}_{z \sim \mathbb{P}_z}\left[ {\log \left( {1-D(G(z,{\theta_g}|y), {\theta_d}|y)} \right)} \right]}^{loss_{G1}} \nonumber \\
    & +(1-k) \underbrace{ \mathbb{E}_{z \sim \mathbb{P}_z}\left[ -{C^{*} \left( G(z,{\theta_g}|y) \right)} \right]}_{loss_{G2}}. \label{objective_G}
\end{align}%
The first part of \cref{objective_G} (denoted as $loss_{G1}$) maximizes the probability that the generated data is recognized as real data by $D$, i.e. playing against $D$ as in \eqref{GAN_G}, and the second part (denoted as $loss_{G2}$) maximizes the expected operating cost based on the generated net load, i.e. playing against the DC-OPF.
The two objectives are weighted against each other using factor $k\in[0,1]$. When $k=1$, the OA-cGAN becomes a traditional cGAN. Term $C^{*} \left( G(z,{\theta_g}|y) \right)$ in \cref{objective_G} is interpreted as the scaled optimal operating cost based on  generated load $G(z,{\theta_g}|y)$, i.e.:
\begin{align}
    C^*=  \sum\limits_{t\in \set{T}} \sum\limits_{g\in \set{G}} \frac {(c_{0g} + c_{1g}P_{g,t}^* + c_{2g}{P_{g,t}^*}^2)-\delta_{shift}} {\delta_{scale}} \label{C_star}
\end{align}
where $P_{g,t}^*$ is the optimal power output of generator $g$ at time $t$ obtained by solving the DC-OPF based on generated load $G(z,{\theta_g}|y)$. Since $loss_{G1}$ represents a \textit{probability} and therefore will always take values between 0 and 1, we use constants $\delta_{shift}$ and $\delta_{scale}$ to project operating the cost into a comparable interval. This will allow for trading off the two parts of the objective using weight $k$.

Fig.~\ref{fig:three_players} illustrates the relationship between the three objectives ($\min \ loss_{D}$, $ \min \ loss_{G1}$, and $\min \ loss_{G2}$) of the OA-cGAN. First, objectives $loss_{G1}$ and $loss_{D}$ capture the competition between the credibility of scenario generation from $G$ and the detection accuracy of $D$. Second, objective $loss_{G1}$ and $loss_{G2}$ determine the success of $G$ to either work against $D$ or the DC-OPF, respectively. Depending on weight $k$, $G$ prioritizes the former or  latter objective.
Specifically, by focusing on minimizing $loss_{G1}$, the generated data becomes more statistically credible, while by minimizing $loss_{G2}$, the generated data become operational-adversarial.

\begin{figure}[!t]
    \centering
    \includegraphics[width=0.9\linewidth]{figures/three_players.png}
    \caption{Relationships between three objectives in OA-cGAN.}
    \label{fig:three_players}
\end{figure}

\subsection{Training data preparation}
\label{subsec:Training}

In this paper, we describe the training process for operation-adversarial scenarios on the \textit{net load forecasts}, i.e., the difference between the forecast net load during a day-ahead (DA) planning stage and the realized net load in real-time (RT).
We note that the proposed OA-cGAN can be adapted to other scenario parameters, e.g., renewable injections.
It is also assumed the planning horizon is one day and has a resolution of 1 hour, i.e., $\mathcal{T}=\{1,...,24\}$.

The training process requires a suitably prepared training data set, which we create as follows:

\noindent
\underline{\textit{Step 1}}: Obtain historical data for DA and RT net loads for each sample day $s$ in the training and testing data sets defined as $\{DA^{real}_s, RT^{real}_s\}_{\ s \in \set{S}_{train} \cup \set{S}_{test}}$, where $DA^{real}_{i,t,s}$ and $RT^{real}_{i,t,s}$ are DA load forecast and RT actual loads for each node $i\in\set{I}$ and $t\in\set{T}$ in sample day $s$. Each sample $s$ receives label $y_s$, which denotes attributes of interest such as the day of the week, month, season, and weather conditions in that day

\noindent
\underline{\textit{Step 2}}:  For each $s$ and $i$, calculate the minimum, average and maximums denoted as $DA^{\min}_{i,s}$, $DA^{ave}_{i,s}$ and  $DA^{\max}_{i,s}$.

\noindent
\underline{\textit{Step 3}}: For each $s$, $i$ and $t$, calculate a normalized DA and RT load ($DA^{norm}_{i,t,s}$ and $RT^{norm}_{i,t,s}$) as:
\begin{align}
    DA^{norm}_{i,t,s} &= \left({DA^{real}_{i,t,s} {\rm{-}} DA^{ave}_{i,s}}\right)/ \left({DA^{\max}_{i,s} {\rm{-}} DA^{\min}_{i,s}}\right) \label{normalize_DA}\\
    RT^{norm}_{i,t,s} & = \left({RT^{real}_{i,t,s} {\rm{-}} DA^{ave}_{i,s}}\right) /\left({DA^{\max}_{i,s} {\rm{-}} DA^{\min}_{i,s}}\right). \label{normalize_RT}
\end{align}

\noindent
\underline{\textit{Step 4}}: For each $s$, $i$ and $t$, calculate normalized net load forecast error $\varepsilon^{norm}_{i,t,s}$ as
\begin{align}
    \varepsilon^{norm}_{i,t,s} = DA^{norm}_{i,t,s}-RT^{norm}_{i,t,s}. \label{normalize_error}
\end{align}

The normalization in \textit{Step 3} is to ensure $\varepsilon^{norm}$ have a statistically significant pattern. Using $\varepsilon^{norm}$ as training data, the OA-cGAN will generate data ($\varepsilon^{gen}$) that follows the statistical characteristics of $\varepsilon^{norm}$, while maximizing the operating cost in the DC-OPF model.
Note that the synthetic errors $\varepsilon^{gen}$ have to be transformed into a RT load value (``denormalized'') as:
\begin{align}
    d_{i,t,s} = \varepsilon^{gen}_{i,t,s} \left(DA^{\max}_{i,s} - DA^{\min}_{i,s} \right)+ DA^{real}_{i,t,s},  \label{denormalize}
\end{align}
where $d_{i,t,s}$ is the generated RT net load based on the generated forecast error and the real DA net load forecast.

\subsection{Training process}
\label{subsec:Gradient}
\begin{algorithm}[t]
    \small
    \SetAlgoLined
    \SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
    \Input{$\{\varepsilon^{norm}_s\}_{s \in \set{S}_{train}}$\\
    }
    \Output{$\{\varepsilon^{gen}_s\}_{s \in \set{S}_{test}}$, $\theta_g$, $\theta_d$\\
    }
    \Begin{
      Initialize $\theta_g$ and $\theta_d$; $epoch \leftarrow 0$\\
      \While{$epoch < epoch^{\max}$ }{
      \For{$\set{B} \in \set{S}_{train}$}
      {Input $\{\varepsilon^{norm}_s\}_{s \in \set{B}}$ to OA-cGAN;\\
      Obtain output of $G$ as $\{\varepsilon^{gen}_s\}_{s \in \set{B}}$;\\
      Calculate $\{loss_{D,s}\}_{s \in \set{B}}$ with $\{\varepsilon^{gen}_s\}_{s \in \set{B}}$;\\
      Update $\theta_d$ with $\{loss_{D,s}\}_{s \in \set{B}}$ using SGD; \\
      Calculate $\{loss_{G1,s}\}_{s \in \set{B}}$ with $\{\varepsilon^{gen}_s\}_{s \in \set{B}}$;\\
      Update $\theta_g$ with $\{loss_{G1,s}\}_{s \in \set{B}}$ using SGD; \\
      \For{$s \in \set{B}$}
      {Run DC-OPF \cref{DCOPF} based on $\varepsilon^{gen}_s$;\\
       Obtain $C^*_s$ based on \cref{C_star};\\
       Calculate $loss_{G2,s}$ based on \cref{objective_G};\\
      }
       Update $\theta_g$ with $\{loss_{G2,s}\}_{s \in \set{B}}$ using SGD based on the gradient in \cref{gradient_final} ; \\
      }
      $epoch \leftarrow epoch+1$
      }
      Obtain $\{\varepsilon^{gen}_s\}_{s \in \set{S}_{test}}$ based on fully-trained $G$\\
      \KwRet{$\{\varepsilon^{gen}_s\}_{s \in \set{S}_{test}}$, $\theta_g$, $\theta_d$}
     }
    \caption{Training process of OA-cGAN}
    \label{alg:OA_cGAN}
\end{algorithm}

Standard cGANs are trained using gradient-based methods.
In particular, the stochastic gradient descent (SGD), which uses an estimated gradient calculated from a randomly selected subset of the training data (so called ``mini-batch''), is the most common one because it facilitates training over very large training data sets and exhibits superior convergence properties \cite{pmlr-v97-qian19b}.
Hence, the OA-cGAN can also rely on SGD to iteratively update (``train'') parameters $\theta_g$ and $\theta_d$. Nevertheless, the additional term of $loss_{G1}$ in \cref{objective_G}, which is related to the solutions to another optimization problem (i.e. DC-OPF), bring challenges to the direct use of SGD in the OA-cGAN. Thus, a suitable training method for the OA-GAN needs to be designed.

Since the training process of $D$ is the same as it in traditional cGANs, it can be achieved by off-the-shelf functions that are readily implemented in many machine learning packages (e.g., TensorFlow, PyTorch, or Flux). Therefore, this section focuses on the parameter update method for the parameters of $G$ ($\theta_g$).
Since the two components of $loss_G$ are linearly additive, the gradient of $loss_G$ can be calculated by combining the gradient of $loss_{G1}$ and $loss_{G2}$. Thus, the resulting update rule for $\theta_g$ is:
\begin{align}
    \theta_g^{r+1} & {\rm{=}} \theta_g^r {\rm{-}} \frac {\alpha}{N_b} \sum\limits_{s \in \set{B}} \left( k \frac{{\partial loss_{G1,s}}}{{\partial \theta_g}} +  (1{\rm{-}}k) \frac{{\partial loss_{G2,s}}}{{\partial \theta_g}} \right), \label{SGD}
\end{align}
where $r$ denotes the training iteration, $\alpha$ is the learning rate, $\set{B}$ is the mini-batch of data from the training data set $\set{S}_{train}$, $N_b$ is the number of samples in mini-batch $\set{B}$, $loss_{G1,s}$ and $loss_{G2,s}$ are the losses of $G$ associated with sample $s$ in $\set{B}$. The progress of training in the SGD is measured by epochs, where one epoch means one complete pass of the training data set through the parameter update process.
The gradient of $loss_{G1,s}$ is the same as the loss gradient of $G$ in traditional cGANs and, as for $D$, can be inferred using off-the-shelf implementations.

Since $loss_{G2}$ does not explicitly contain $\theta_g$, to calculate the ${\partial loss_{G2,s}}/{\partial {\theta_g}}$, we need to find the relationship between $loss_{G2}$ and $\theta_g$ using intermediate variables. Analytically, for each sample $s$, $\theta_g$ decides the output of $G$ ($\{\varepsilon^{gen}_{i,t,s}\}_{i \in \set{I}, t \in \set{T}}$) which will affect the generated net load ($\{d_{i,t,s}\}_{i \in \set{I}, t \in \set{T}}$). Then, $\{d_{i,t,s}\}_{i \in \set{I}, t \in \set{T}}$ will affect the optimal output of generators ($\{p_{g,t,s}^*\}_{g \in \set{G}, t \in \set{T}}$) which will directly affect the optimal operating cost $C^*_s$ and thus $loss_{G2,s}$. Therefore, we can derive the gradient of $loss_{G2,s}$ using the chain rule as:
\begin{align}
    \frac{{\partial loss_{G2,s}}}{{\partial {\theta_g}}} = - \sum\limits_{t \in \set{T}} \sum\limits_{g \in \set{G}}  {\frac{{\partial {C_s^*}}} {\partial P_{g,t,s}^*} \sum\limits_{i \in \set{I}} \frac{\partial P_{g,t,s}^*}{\partial  d_{i,t,s}} \frac{\partial d_{i,t,s}}{\partial \varepsilon^{gen}_{i,t,s}} \frac{\partial  \varepsilon^{gen}_{i,t,s}}{\partial \theta_g}}. \label{gradient_loss2}
\end{align}
In the following, we derive each term in \cref{gradient_loss2}.

Term ${\partial {C_s^*}}/{\partial P_{g,t,s}^*}$ captures the marginal change of cost when changing the output of generator $g$ in the optimal solution of the DC-OPF at time $t$ in sample $s$.
For generators with binding constraints \cref{DCOPF_Pmax} we have ${{\partial {C_s^*}}} /{\partial P_{g,t,s}^*} = 0$.
For generators with non-binding constraints \cref{DCOPF_Pmax} (i.e., marginal generators) ${{\partial {C_s^*}}} /{\partial P_{g,t,s}^*} = \lambda_{i,t,s}/ {\delta_{scale}}$, where $\lambda_{i,t,s}$ is the locational marginal price at node $i$ and time $t$ in sample day $s$, i.e., the dual multiplier of \cref{DCOPF_power_balance}, and ${\delta_{scale}}$ is a constant value introduced in \cref{C_star}.
Note that $\lambda_{i,t,s}$ can be obtained directly from most numerical solvers after solving \cref{DCOPF}.
Therefore, we obtain:
\begin{align}
    \sum\limits_{g \in \set{G}} \frac{{\partial {C_s^*}}} {\partial P_{g,t,s}^*} =\sum\limits_{i \in \set{I}} \sum\limits_{g \in \set{G}_i} \frac{{\partial {C_s^*}}} {\partial P_{g,t,s}^*} = \sum\limits_{i \in \set{I}} \frac{\lambda_{i,t,s}}{{\delta_{scale}}}. \label{gradient_c_g}
\end{align}
Next, as per \cref{DCOPF_power_balance}, it follows:
\begin{align}
    \frac {\partial P_{g,t,s}^*}{\partial  d_{i,t,s}} = -1. \label{gradient_g_d}
\end{align}
Similarly, according to \cref{denormalize}, we obtain:
\begin{align}
    \frac{\partial d_{i,t,s}}{\partial \varepsilon^{gen}_{i,t,s}} = DA^{\max}_{i,s} - DA^{\min}_{i,s}. \label{gradient_d_e}
\end{align}
Finally, since $\varepsilon^{gen}_{i,t}$ is the output of $G$, ${\partial \varepsilon^{gen}_{i,t}}/{\partial \theta_g}$ can, again, be calculated by off-the-shelf implementations.

As a result, we can recast \cref{gradient_loss2} for SGD training as:
\begin{align}
    \frac{{\partial loss_{G2,s}}}{{\partial {\theta_g}}} = \sum\limits_{t \in \set{T}} \sum\limits_{i \in \set{I}} \frac{\lambda_{i,t,s} (DA^{\max}_{i,s} - DA^{\min}_{i,s})}{{\delta_{scale}}} \frac{\partial  \varepsilon^{gen}_{i,t,s}}{\partial \theta_g}. \label{gradient_final}
\end{align}
Algorithm~\ref{alg:OA_cGAN} summarizes the  OA-cGAN training process.

\section{Numerical Experiments}
\label{sec:Case_study}

We apply the proposed OA-cGAN to improve power system reliability through more accurate DA decisions.

\subsection{Reserve in the DA model}
\label{ssec:reserve_testing}

To accommodate changes between the DA load forecast  and the actual RT load, some generators need to provide reserves that are sufficient to offset the forecast error and that are deliverable through the transmission network, i.e. can be deployed without violating transmission constraints.
At the same time, these reserves should be allocated in the least-cost  manner. Assume a set of given forecast error $\{\varepsilon_{i,t}\}_{i\in \set{I}, t\in \set{T}}$. The optimal reserve allocation can be calculated through the following modified DC-OPF formulation:
\allowdisplaybreaks
\begin{subequations}
\begin{align}
&\min_{\substack{\{P_{g,t}^{DA}\}_{g\in \set{G}, t\in \set{T}}, \\ \{r_{g,t}^{+},r_{g,t}^{-}\}_{g\in \set{G}, t\in \set{T}}, \\  \{\theta_{i,t}\}_{i\in \set{I}, t\in \set{T}}}}\
    C = \sum\limits_{t\in \set{T}} \sum\limits_{g\in \set{G}} {(c_{0g} + c_{1g}P_{g,t}^{DA} + c_{2g}{P_{g,t}^{DA}}^2)} \label{reserve_DCOPF_objective}\\
    &\text{s.t. } \sum\nolimits_{g\in \set{G}_i} P_{g,t}^{DA} - \sum\nolimits_{j \in \mathcal{N}_i} B_{i,j} (\theta_{i,t} - \theta_{j,t}) = DA^{real}_{i,t} \nonumber \\
    & \hspace{0.5cm}
     \forall{i}\in\set{I},\ \forall{t}\in\set{T} \label{reserve_DCOPF_power_balance}\\
    &\hspace{0.5cm}\sum\nolimits_{g\in \set{G}_i}(r_{g,t}^{+}-r_{g,t}^{-}) - \sum\nolimits_{j \in \mathcal{N}_i} B_{i,j} (\bar \theta_{i,t} - \bar \theta_{j,t}) =  \varepsilon_{i,t} \nonumber \\
    & \hspace{0.5cm} \forall{i}\in\set{I},\ \forall{t}\in\set{T} \label{reserve_DCOPF_reserve_balance}\\
    & \hspace{0.5cm} P_{g,t}^{DA} + r_{g,t}^{+} - r_{g,t}^{-} \le P_{g}^{\max} \quad \forall{g}\in\set{G} \label{reserve_DCOPF_Pmax}\\
    & \hspace{0.5cm} -S_{i,j} \le B_{i,j} (\theta_{i,t} + \bar \theta_{i,t} - \theta_{j,t} - \bar \theta_{j,t}) \le S_{i,j}  \nonumber \\
    & \hspace{0.5cm}\forall{i}\in\set{I},\ \forall{j}\in \mathcal{N}_i,\ \forall{t}\in\set{T}  \label{reserve_DCOPF_power_flow}\\
    &\hspace{0.5cm} \theta_{ref,t} = 0, \ \bar \theta_{ref,t} = 0 \quad \forall{t}\in\set{T} \label{reserve_DCOPF_ref} \\
    & \hspace{0.5cm} P_{g,t}^{DA} \ge 0, \ r_{g,t}^{+} \ge 0, \ r_{g,t}^{-} \ge 0 \quad \forall{g}\in\set{G},\ \forall{t}\in\set{T},
\end{align}%
\label{reserve_DCOPF}%
\end{subequations}%
\allowdisplaybreaks[0]%
where $r_{g,t}^{+}$ and $r_{g,t}^{-}$ are the upward and downward reserve provided by generator $g$ at time $t$, $\theta_{i,t}$ and $\bar \theta_{i,t}$ are the voltage angle at node $i$ and time $t$ considering only $DA^{real}_{i,t}$ and $\varepsilon_{i,t}$, respectively. Since the DC-OPF is a linear model, the voltage angles can be superimposed such that $\theta_{i,t} + \bar \theta_{i,t}$ is the voltage angle at node $i$ and time $t$ considering both $DA^{real}_{i,t}$ and $\varepsilon_{i,t}$.
Objective \cref{reserve_DCOPF} minimizes the operating cost using the same quadratic cost model as in \cref{DCOPF}. Eqs.~\cref{reserve_DCOPF_power_balance} and \cref{reserve_DCOPF_reserve_balance} are the nodal power balance constraint, where  \cref{reserve_DCOPF_power_balance} ensures the DA forecast net load is served by the active output power of generators, and \cref{reserve_DCOPF_reserve_balance} ensures the DA net load forecast error is compensated for by the reserve provided by generators.
Constraints \cref{reserve_DCOPF_Pmax}-\cref{reserve_DCOPF_ref} ensure deliverability of  both scheduled generation $P_{g,t}^{DA}$ and reserves $r_{g,t}^{+}$, $r_{g,t}^{-}$.

If forecast error $\varepsilon$ was known exactly, then \cref{reserve_DCOPF} would yield the optimal least-cost dispatch and reserve allocation.
In practice, however, $\varepsilon$ is unknown and must be estimated.
Hence, we can use the OA-cGAN to estimate forecast errors that are statistically credible but particularly ``stressful'', i.e. corresponding to a relatively large operating cost for the system.

In the experiments below, we evaluate the generated forecast errors using two metrics. The first evaluation metric is the total DA operating cost $C_{total}$ for all sample days in the testing set $\set{S}_{test}$, and the second evaluation metric is the RT upward (or downward) security level $I^+$ (or $I^-$), which determines the percent of cases in which the error $\varepsilon$ considered in the DA stage induced the procurement of sufficient upward (or downward) reserves to balance the \textit{actual} RT net load ($I^+, I^- \in [0, 100\%]$).

Algorithm~\ref{alg:evaluation} summarizes the proposed evaluation method.

\begin{algorithm}[t]
    \small
    \SetAlgoLined
    \SetKwInOut{Input}{input}\SetKwInOut{Output}{output}
    \Input{$\{DA^{real}_s, RT^{real}_s, \varepsilon_s\}_{s \in \set{S}_{test} }$;\\
    number of samples in $\set{S}_{test}$ ($N_{test}$)
    }
    \Output{$C_{total}$, $I^+$, $I^-$

    }
    \Begin{
      $C_{total} \leftarrow 0$, $I^+ \leftarrow 0$, $I^-\leftarrow 0$; \\
      \For{$s \in \set{S}_{test}$}
      {Run DC-OPF \cref{reserve_DCOPF} with $DA^{real}_s$ and $\varepsilon_s$, obtain $C_s$, $\{P_{g,t,s}^{DA}, r_{g,t,s}^{+}, r_{g,t,s}^{-}\}_{ g \in\set{G}, \ t\in\set{T}}$;
      $C_{total} \leftarrow C_{total} + C_s$;\\
      Run DC-OPF \cref{DCOPF} with $RT^{real}_s$ and obtain $\{P_{g,t,s}\}_{g \in\set{G}, \ t\in\set{T}}$;\\
      Calculate the reserve required in RT operation $R_{g,t,s} \leftarrow P_{g,t,s} - P_{g,t,s}^{DA} \quad \forall{g}\in\set{G}, \ \forall{t}\in\set{T}$; \\
      \If{$R_{g,t,s} \le r_{g,t,s}^{+} \ \forall{g}\in\set{G}, \ \forall{t}\in\set{T}$}
        {$I^+ \leftarrow I^+ +1/N_{test}$}
      \If{$R_{g,t,s} \ge r_{g,t,s}^{-} \ \forall{g}\in\set{G}, \ \forall{t}\in\set{T}$}
        {$I^- \leftarrow I^- +1/N_{test}$}
      }
      \KwRet{$C_{total}$, $I^+$, $I^-$}
     }
    \caption{Evaluation of Given Error $\varepsilon$}
    \label{alg:evaluation}
\end{algorithm}

\subsection{Test system and data}
\label{subsec:System}

We conduct our numerical experiments using a zonal representation of the New York Independent System Operator (NYISO) system, as shown in Fig.~\ref{fig:zones}.
Following the NYISO market structure, the full system is aggregated into an 11-zone system. (We note that this 11-zone representation is used in real-world operations for computing locational marginal prices for load charges).
The hourly DA net load forecasts and actual RT net loads for each zone are available from NYISO in \cite{NYISO_load}.
The system is populated with 362 generators and 33 wind farms, whose locations and parameters have been estimated from publicly available data bases \cite{NYISO_Gold_Book, Wind_Turbine_Database}.
All computations were carried out in Julia v1.5 \cite{Julia-2017}. The neural networks in the OA-cGAN were built and trained using the Flux package \cite{innes2018}, and the DC-OPF problems were implemented in JuMP \cite{DunningHuchetteLubin2017} and solved using the Gurobi solver \cite{gurobi}.
Our implementation and data is publicly available at \cite{oacgan_code}.

\begin{figure}[!t]
    \centering
    \includegraphics[width=0.7\linewidth]{figures/11_zones.png}
    \caption{11-zone representation of the NYISO system \cite{NYISO_zone_map}.}
    \label{fig:zones}
\end{figure}

We obtained the hourly DA and RT net load from January 1st, 2018 to January 4th, 2021 (1100 days in total) from  NYISO  and randomly split the data in 1000 days for training the OA-cGAN, as described in Sections~\ref{subsec:Training} and \ref{subsec:Gradient}, and 100 days for testing as described in Section~\ref{ssec:reserve_testing}.
Fig.~\ref{fig:real_load} shows the DA and RT load profiles for four selected days (Jan. 1st, Apr. 10th, Jul. 20th, Oct. 30th 2018) in each zone drawn from each quarter of the year.
It can be seen that for each zone and each quarter the forecast errors exhibit distinct seasonal characteristics. Thus, we decide to use quarters at labels in the OA-cGAN training, i.e. the load in the first (Jan.--Mar.), second (Apr.--Jun.), third (Jul.--Sep.) and fourth (Oct.--Dec.) quarter are labeled as 0, 1, 2, and 3 respectively.
Note that this labeling system is used in this paper for the simplicity of illustration. To generate errors with more specific properties, one can use more complicated labeling systems, which include more information of the target day, such as the daily temperature or the precipitation.

The normalized errors in the 11 zones and the whole NYISO system with the same label (label=0) are shown in Fig.~\ref{fig:error_12_zones}, where the blue lines are the real normalized errors in year 2018, the red line in the middle of each sub-figure is the average of the blue lines in the same sub-figure, and the light blue areas indicate the possible distribution area of the errors according to historical data. Fig.~\ref{fig:error_12_zones} displays differences among the normalized errors in 11 zones. For example, in Zone 3, the errors approximately evenly distribute between $-0.5$ and $0.5$ and have an average value close to 0, while in Zone 3, all the errors are positive and the maximum error is around 2.

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/real_load.png}
    \caption{Day-ahead and real-time loads in   11  NYISO zones. ``Total'' shows the sum over all 11 zones.}
    \label{fig:real_load}
\end{figure}

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/Normalized_error_12_zones.png}
    \caption{Historical normalized errors in  11 NYISO zones and the total sum for Label=0.}
    \label{fig:error_12_zones}
\end{figure}

\subsection{Training Results}
\label{subsec:Training_Results}

We test the OA-cGAN using seven different values of $k$ between $0.5$ and $1$. Recall that $k$ determines the weight between the two objectives of $G$ in Eq.~\cref{objective_G}, i.e., the objective of $G$ is to generate statistically credible errors (minimizing $loss_{G1}$) that are also operational-adversarial (minimizing $loss_{G2}$). The greater the $k$ is, the more important the first objective is.

Both $G$ and $D$ in the OA-cGAN in this numerical experiment are three-layer convolutional neural networks which use rectified linear units (ReLU) as the activation function. The size of the mini-batch during the training process is 100, and the reference cost for scaling in \cref{C_star} are $\delta_{shift}=2 \cdot 10^8$ and $\delta_{scale}=8\cdot 10^5$. The loss of $G$ and $D$ during the first 30 epochs of the training process is shown in Fig.~\ref{fig:loss_G_D}. According to Fig.~\ref{fig:loss_G_D}(a), the overall trend of $loss_D$ during training process is rapidly decreasing at the first 10 epochs and then gradually stabilizes. On the contrary, according to Fig.~\ref{fig:loss_G_D} (b), the overall trend of $loss_G$ during the training process is slowly increasing at first and then gradually stabilizes.

Based on the pattern of each curve in Fig.~\ref{fig:loss_G_D}, we can divide the seven cases with the seven different values of $k$ into two groups, i.e. the three cases when $k \ge 0.9$ are in one group and the four cases when $k \le 0.8$ are in another group. When $k \ge 0.9$, $loss_D$ converges to 1, indicating that the discriminator cannot identify whether the input data are original or generated very well; while when $k \le 0.8$, $loss_D$ converges to $0$, indicating that the discriminator can almost completely distinguish the generated and the original data and the credibility of the generated data is poor. With $k=0.9$, $0.95$ and $1$, $loss_G$ converges to three close positive values between $1$ and $1.5$. However, if $k \le 0.8$, $loss_G$ converges to four equally spaced negative values.

To further explain the results of $loss_G$, we plot the value of $loss_{G1}$ and $loss_{G2}$ during the training process separately in Fig.~\ref{fig:G_loss_epoch}(a) and (b). According to Fig.~\ref{fig:G_loss_epoch}(b), when $k=1$, $loss_{G2}$ oscillates between $-0.5$ and $0$. When $k<1$, $loss_{G2}$ at the beginning of the training process is around $-0.7$, and only in the cases when $k \ge 0.9$, $loss_{G2}$ deviates from the initial value during the training process and starts to oscillates. When $k \le 0.8$, $loss_{G2}$ will not change during the training process.

Moreover, in the cases when $k=0.9$ (or $0.95$), there is an obvious turning point at epoch 10 (or epoch 7) on the curves of $loss_{G1}$, $loss_{G2}$, and $loss_D$, but there is no turning point on the curve of $loss_{G}$. These turning points reflect the changes in the relative influence of the two objective of $G$ during the training process. For example, when $k=0.9$, the objective of minimizing $loss_{G2}$ controls the training of $G$ before epoch 10. Thus, during this period, $loss_{G2}$ remains at a low level, while $loss_{G1}$ keeps increasing and $loss_{D}$ keeps decreasing because $D$ can recognize generated data better and better. After the turning point, the influence of minimizing $loss_{G1}$ exceeds the influence of minimizing $loss_{G2}$, so $loss_{G1}$ starts to decrease and $loss_{G2}$ starts to increase. In the cases when $k \le 0.8$, $loss_{G1}$ keeps increasing during the whole training process, which means that the objective of minimizing $loss_{G2}$ is always more influential than minimizing $loss_{G1}$.

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/loss_G_D.png}
    \caption{Values of loss function terms $loss_{G}$ (a) and $loss_{D}$ (b) during the training process.}
    \label{fig:loss_G_D}
\end{figure}

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/G_loss_epoch.png}
    \caption{Values of loss function terms $loss_{G1}$ (a) and $loss_{G2}$ (b) during the  training process.}
    \label{fig:G_loss_epoch}
\end{figure}

\subsection{Testing Results}
\label{subsec:Testing_Results}

In this section, we present the testing results of the fully trained OA-cGAN. According to the training results in Section \ref{subsec:Training_Results}, the generated data of OA-cGAN when $k \le 0.8$ have similar characteristics. Thus, we will only study the testing results when $k$ is equal to $0.8$, $0.9$ or $1$.

Errors generated by the trained OA-cGAN are shown in Fig.~\ref{fig:generated_error}. We notice that the greater the $k$, the greater the variance of the generated errors. Specifically, the generated errors for 11 zones and the whole system when $k=0.8$ are always straight lines, which corresponds to the most costly cases in each zone. Note that the maximum values of the generated errors in 11 zones are different, which corresponds to the historical error distributions of each zone shown in Fig.~\ref{fig:error_12_zones}.

\begin{figure}[!t]
    \centering
    \includegraphics[width=1\linewidth]{figures/generated_error.png}
    \caption{Selected generated errors for the fully trained OA-cGAN for all zones and label=0.}
    \label{fig:generated_error}
\end{figure}

Then, we will evaluate the performance of the generated errors using Algorithm~\ref{alg:evaluation}. We compare the evaluation results of the generated errors ($\varepsilon^{gen}$) by the OA-cGAN and the robust errors ($\varepsilon^{robust}$), which are assumed to be proportional to the real DA load ($DA^{real}$) as:
\begin{align}
    \varepsilon^{robust}_{i,t} = r DA_{i,t}^{real}, \quad \forall{i}\in\set{I},\ \forall{t}\in\set{T} \label{robust_error}
\end{align}
where $r$ is the robust level.

We evaluate the performance of errors in nine cases and summarize the results in Table~\ref{tab:evaluation}. In Case 1, we do not consider any errors in DA scheduling, so no reserve will be provided in RT operation. In Cases 2-4, we consider errors generated by the OA-cGAN with different values of $k$. In Cases 5-9, we consider robust errors generated as \cref{robust_error} with different $r$. It can be seen from Table~\ref{tab:evaluation} that from Case 1 to Case 9, the total operating cost $C_{total}$ and the upward security level ($I^+$) monotonically increases, while the downward security level ($I^-$) monotonically decreases. Meanwhile, the overall security level ($I^+ + I^-$) basically remains the same in Cases 2-9. Thus, we can conclude that the error generated by the OA-cGAN leads to a more economical dispatch and reserve schedule, while maintaining the same high level of reliability.

\begin{table}[!t]
  \centering
  \caption{Evaluation results of each testing case}
    \begin{tabular}{ccccc}
    \toprule
    No. & Error & $C_{total}$ (million \$) & $I^{+}$ & $ I^{-}$ \\
    \midrule
    1 &No error  & 470.16 & 0	& 0\\
    2 &Generated ($k=1$) & 470.71  &53.45\%	&67.88\% \\
    3 &Generated ($k=0.9$) & 475.56  &54.37\%	&67.00\%\\
    4 &Generated ($k=0.8$) & 480.17  &56.36\%	&63.61\% \\
    5 &Robust ($r=0.1$) & 482.68   &56.86\%	&64.22\%\\
    6 &Robust ($r=0.3$) & 512.06   &62.62\%	&58.11\%\\
    7 &Robust ($r=0.5$) & 545.59   &64.05\%	&56.18\% \\
    8 &Robust ($r=0.7$) & 590.82   &65.83\%	&55.23\% \\
    9 &Robust ($r=0.9$) & 648.71   &66.16\%	&53.83\%\\
    \bottomrule
    \end{tabular}%
  \label{tab:evaluation}
\end{table}

\section{Conclusion}

In this paper we developed a modified conditional generative adversarial network (cGAN) that internalizes a DC optimal power flow model to generate statistically credible net load scenarios that are particularly stressful, i.e., expensive, to the system operation.
We derived the necessary training objectives and methods using stochastic gradient descent (SGD) and tested the proposed operation-adversarial cGAN (OA-cGAN) on a realistic zonal model of NYSIO.
The numerical experiments illustrated the proposed training method and demonstrated that net load forecast errors produced by the OA-cGAN lead to generator dispatch and reserve allocation decisions that are more cost effect, but as reliable as a robust benchmark.

\bibliographystyle{IEEEtran}

\section{Test}

\newcommand{\set}[1]{\mathcal{#1}}
\newcommand{\un}[1]{\mathbf{#1}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\bm{\epsilon}}{\bm{\epsilon}}
\newcommand{\bm{\omega}}{\bm{\omega}}
\newcommand{\bm{\Omega}}{\bm{\Omega}}
\newcommand{\bm{\kappa}}{\bm{\kappa}}
\newcommand{\tilde{\bm{\epsilon}}}{\tilde{\bm{\epsilon}}}

\newcommand{\alpha^{\text{ne}}}{\alpha^{\text{ne}}}
\newcommand{\alpha^{\text{no}}}{\alpha^{\text{no}}}

\newcommand{\Sigma^{\nicefrac{1}{2}}}{\Sigma^{\nicefrac{1}{2}}}
\newcommand{\Sigma_k^{\nicefrac{1}{2}}}{\Sigma_k^{\nicefrac{1}{2}}}

\DeclareMathOperator{\Ploss}{Ploss}
\DeclareMathOperator{\Qloss}{Qloss}
\DeclareMathOperator{\LP}{LP}
\DeclareMathOperator{\LQ}{LQ}
\DeclareMathOperator{\Var}{Var}
\DeclareMathOperator{\Skew}{Skew}
\DeclareMathOperator{\Kurt}{Kurt}
\DeclareMathOperator{\Cov}{Cov}
\DeclareMathOperator{\Stdv}{Stdv}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\Rest}{Rest}
\DeclareMathOperator{\Eptn}{\mathbb{E}}
\DeclareMathOperator{\RM}{\mathbb{F}}
\DeclareMathOperator{\Prb}{\mathbb{P}}
\DeclarePairedDelimiter{\ceil}{\lceil}{\rceil}
\DeclarePairedDelimiter{\floor}{\lfloor}{\rfloor}
\DeclarePairedDelimiter{\scal}{\langle}{\rangle}
\DeclareMathOperator{\vect}{vec}
\DeclareMathOperator{\cvar}{CVaR}
\DeclareMathOperator{\var}{VaR}
\DeclareMathOperator{\conv}{conv}
\DeclareMathOperator{\orr}{ORR}
\DeclareMathOperator{\for}{FOR}
\DeclareMathOperator{\ptdf}{PTDF}
\DeclareMathOperator{\lodf}{LODF}
\DeclareMathOperator{\eens}{EENS}

\def\noindent\textit{Proof. }{\noindent\textit{Proof. }}
\def\hspace*{\fill} $\square${\hspace*{\fill} $\square$ \vspace{0.3\baselineskip}}

\makeatletter
\newcommand{\pushright}[1]{\ifmeasuring@#1\else\omit\hfill$\displaystyle#1$\fi\ignorespaces}
\newcommand{\pushleft}[1]{\ifmeasuring@#1\else\omit$\displaystyle#1$\hfill\fi\ignorespaces}
\makeatother

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}


\section{Introduction}

Following the isolation of single layer graphene,~\cite{NovoselovNat2007} studies on the electrical,~\cite{RevModPhys.81.109,Novoselov10222004,ISI:000248194700033,ISI:000233133500043,cresti} optical,~\cite{ISI:000274338800035,ISI:000256441100035} thermal,~\cite{Seol04092010, doi:10.1021/nl0731872,ISI:000279014300016, ISI:000277444900021, geim_acsnano,Balandin-NM-Rev} and mechanical~\cite{ISI:000257713900044, ISI:000253764000041}  properties of this low-dimensional material have revealed their potential for many technological applications.~\cite{doi:10.1021/nl070133j,PhysRevLett.100.206802, ISI:000244558400015,PhysRevLett.98.206805}
This in turn has triggered interest in isomorphs of graphene, namely \textit{h}-BN~\cite{PhysRevB.49.5081,ISI:000278888600004, ISI:000275858200036, ISI:000282727600056, ISI:000254669900075, ISI:000284990900046, ISI:000268652700007, ISI:000276905600060} and hybrid \textit{h}-BN/graphene structures.
Recently, fabrication of both random immersions of \textit{h}-BN in graphene~\cite{C1NR11387A,han:203112} and well-defined clusters of \textit{h}-BN in graphene with possible kinetically controllable domain sizes~\cite{ISI:000276953500024} has intensified this interest.
In particular, such hybrid systems have a considerable compositional and structural diversity that translates into greater freedom for tuning the physical properties.
Both experimental and density functional theory (DFT) studies have shown that the physical properties of these materials can be significantly modified by simply varying the relative amount of \textit{h}-BN to graphene.~\cite{doi:10.1021/nl2011142,lam:022101,qiu:064319}
For instance, Ci~\textit{et al.}~\cite{ISI:000276953500024} have experimentally shown that decreasing the relative amount of ~\textit{h}-BN to graphene increases the electrical conductivity, which has been supported by DFT studies where increasing BN concentration and cluster size results in band gap opening.~\cite{xu:073711,PhysRevB.84.125401}
It is recently shown that the details of the bonding at the \textit{h}-BN/graphene interface can change the type of intrinsic doping of the system.~\cite{PhysRevB.84.205412}
Just to name a few other examples of how this chemical and structural diversity in this low dimensional hybrid system enable control over magnetic properties; zigzag-edges in ribbons have been suggested to lead to ferromagnetic behavior~\cite{PhysRevLett.87.146803} while more complex interfaces, like those present in \textit{h}-BN clusters embedded in graphene, can be antiferromagnetic ~\cite{PhysRevB.84.075405}  may also be mentioned.

Thermal transport in graphene with embedded \textit{h}-BN quantum dots has been studied recently using real-space Kubo approach.~\cite{PhysRevB.84.205444}
This study has shown that the decreasing dot size decreases the phonon mean free path (MFP) of both in-plane and out-of-plane modes considerably.
However, limited variation in MFP has been observed by changing the dot concentration at the smallest dot sizes.
In another study, the effect of BN nanodots on the heat current in graphene nanoribbons has been investigated by using non-equilibrium Green's functions and nonequilibrium (direct method) molecular dynamics.~\cite{refId0}
The authors claimed that there is a linear inverse relationship between the number of atoms at the interface and the heat current.
Although these studies provide valuable insight about the thermal transport, the thermal conductivity of graphene/\textit{h}-BN nanostructured systems has not been investigated systematically by considering superlattices with different nano-morphologies.
The objective of this study is to investigate the influence of the chemical and structural diversity present in hexagonal boron nitride ((h-BN) and graphene hybrid nanostructures on thermal transport and test possible pathways for tuning the thermal conductivity of these low dimensional hybrid structures. In this paper, we investigate the variation of thermal conductivity of hybrid graphene/h-BN nanostructures in particular: 1) stripe superlattice geometries while varying geometric parameters and composition and 2) BN (graphene) dots embedded in graphene (BN) as a function of dot-diameter and composition. The theoretical findings aim at providing  basis for potential thermal management applications in miniaturized devices.

We have previously calculated the lattice thermal conductivities of nanotubes, graphene and \textit{h}-BN based nanostructures~\cite{Che_2000_2,JustinACS,Cem-BN-PRB,cem-bn-szotop,doi:10.1021/nl2029333} with considerable accuracy and compared the results with available experimental data.~\cite{Balandin-NM-Rev}
In this study, we implement an accurate model for C-B and C-N interactions by employing DFT calculations in addition to our previous \textit{h}-BN potential. Using these Tersoff interatomic potentials, we calculated the lattice thermal conductivity of several possible graphene/\textit{h}-BN hybrid structures.
The rest of the report is organized as follows: First, the model utilized to develop the potential and the calculation methods for thermal conductivity are described.
Then, the validity of our potentials for studying hybrid nanostructures is demonstrated.
This is followed by a detailed description of the considered hybrid nanostructures and a discussion of the effect of structure and composition on lattice thermal transport properties.

\section{Method}

Equilibrium molecular dynamics simulations can be utilized to obtain instantaneous heat current ($\bm{J}$) or energy moment ($\bm{R}$) as a function of time.
Subsequently, thermal conductivity, $\kappa$ can be evaluated by using either the heat current autocorrelation function (Green-Kubo method)~\cite{Green_1954,Kubo_1957,Zwanzig_1965} or mean square displacement of the energy moment (Einstein relation)~\cite{Zwanzig_1965} as discussed in detail in our earlier studies.~\cite{JustinACS,Cem-BN-PRB,cem-bn-szotop,Alper,JustinNanotech}
Here, the thermal conductivity is evaluated from the Einstein relation (the mean square displacement of energy moment, named \emph{h}MSD) as given by~\cite{Weitz_1989}

\begin{equation}
\frac{\big\langle[R_\mu(t)-R_\mu(0)]^2\big\rangle}{2V k_BT^2} = \kappa_{\mu\mu} [t+\tau(e^{-t/\tau}-1)].
\label{eq:Reinstein}
\end{equation}

Here, $V$ is the volume, $T$ is the temperature and $k_B$ is the Boltzmann constant.
The energy moment through direction $\mu$ is defined by $R_\mu$.
The right hand side of Eq.~\ref{eq:Reinstein} represents a linear change in Einstein relation for the time ($t$) much larger than the decay time ($\tau$).
The long-time behavior corresponds to diffusive regime in transport of heat.
For short-times, on the other hand, the average energy propagation is ballistic and results in a non-linear relation between $\kappa$ and \emph{h}MSD.
Given the time, a bulk system assumes a diffusive behavior at elevated temperatures and thus we are more interested in this regime.
Computationally, we eliminate the non-linear portion of the relationship by discarding the first 100 ps of \emph{h}MSD then fit the rest to a linear function, i.e., \emph{h}MSD $=2V k_BT^2\kappa_{\mu\mu}t$, in order to obtain thermal conductivity.

In this study, we investigate the thermal conductivity of graphene/\textit{h}-BN superlattices in the form of stripes and dots/``anti"dots, see Fig.~\ref{fig1}.
The stripe superlattices are discussed in two general categories. In the first case, equal periods ($l_{\mathrm{G}}$ = $l_{\mathrm{BN}}$), and in the second unequal periods ($l_{\mathrm{G}}$ $\neq$ $l_{\mathrm{BN}}$) of graphene and \textit{h}-BN stripes are simulated.
The stripes of graphene and \textit{h}-BN sublattices are connected \textit{via} two different orientations namely, resulting in a zigzag or an armchair interface.
For all structures, approximately 60$\times$60~$nm^2$ periodic domains are considered.
Previously, we showed that such large systems are required for the proper convergence of thermal conductivity in equilibrium MD calculations of ribbon like systems.~\cite{JustinACS}
For the equal period simulations, in each orientation, five different period thicknesses ranging from $\sim$1.25 to $\sim$30 $nm$ are constructed.
The atomistic details of these systems are given in Table~\ref{table1} in the Appendix.
For the unequal period simulations, again five different configurations are created for the armchair and zigzag interface systems where the thicknesses of BN sublattices change from $\sim$3 to $\sim$57 $nm$ and the sum of $l_{\mathrm{BN}}$ and $l_{\mathrm{G}}$ is set to $\sim$60 $nm$, see Table~\ref{table2} in the Appendix for details.

As a second type of nanostructure, dots of~\textit{h}-BN are embedded in graphene with a close-packed arrangement as shown in Fig.\ref{fig1}.
We select three different radii (4.95 \AA, 12.38 \AA, and 24.76 \AA) for these ordered dots.
Ordered graphene dots in~\textit{h}-BN, so called anti-dots, are created with radius of 12.38 \AA. Random configuration of antidots are also considered with radii of 6.19 and 12.38 \AA.
The details of these structures are provided in Table~\ref{table3} in the Appendix.

\begin{figure}[!h]
\includegraphics[width=14.0cm]{fig1.ps
\caption{\label{fig1}(Color online) The hybrid structures structures considered in this work \emph{viz.}: stripe superlattices and dots embedded in sheet matrix.}
\end{figure}

Molecular dynamics simulations are performed in the microcanonical (NVE) ensemble with a time step of 1.0~fs to conserve energy and a simulation length of 5~ns to obtain an acceptable ensemble average of \textit{h}MSD.
Each data point for $\kappa$ is therefore obtained by averaging the results of a minimum of five distinct simulations with different initial velocity distributions.
The error in $\kappa$ value is calculated from the standard deviation of these independent calculations.
The volumes of the two-dimensional structures are defined as $lw\Delta$, where $w$ and $l$ are the width and the length of simulated structures, and $\Delta$ (0.335 $nm$) is the mean Van der Waals thickness for \textit{h}-BN and graphene.
Finally, we did not consider isotopic disorder explicitly in thermal conductivity calculations.
Instead, a single mass of natural abundance is used for all elements.

We have previously developed a Tersoff-type potential for \textit{h}-BN systems.~\cite{Cem-BN-PRB}
Also, a Tersoff parametrization for graphene is given by Lindsay and Broido.~\cite{PhysRevB.81.205441}
Both potentials have been optimized to reproduce the DFT phonon dispersions for their respective material, necessary for ensuring accurate lattice thermal conductivities.
In order to simulate the interfaces, one needs to further develop interaction potentials for all possible element pairs coupling at the interface.
We have used DFT calculations to generate the data needed for the interfaces.
These calculations have been performed with Vienna \textit{ab initio} simulation package (VASP)~\cite{vasp1,vasp2} which is based on density functional theory.
Projector augmented wave (PAW)~\cite{PAW1, PAW2} pseudo potential formalism was imposed with Perdew-Burke-Ernzerhof (PBE)~\cite{GGA1} form of generalized gradient approximations (GGA).
Using DFT energetics to condition empirical potentials has been previously motivated for both pure graphene and \textit{h}-BN.
The PAW-PBE formalism, in particular, produces accurate structures for our systems of interest, with the calculated lattice parameters for graphene and \textit{h}-BN being 2.45\AA{} and 2.51\AA{}, respectively.
Long horizontal strips of the structures in Fig.~\ref{fig2} are used in periodic-boundary conditions in order to avoid spurious interface-interface interactions.
Depending on the basic repeating unit of the given structures, in-plane dimensions of 29.95~\AA{} $\times$2.47~\AA{} (structures 2 and 3), 30.22~\AA{} $\times$2.49~\AA{} (structures 1 and 4), or 24.8~\AA{} $\times$4.30~\AA{} (structure 5)  were used with 2$\times$16$\times$1, 2$\times$16$\times$1, and 2$\times$10$\times$1 Monkhorst-Pack $k$ point grids, respectively.
400~eV is selected for the plane wave energy cut-off to achieve the energy convergence.

\section{Results and Discussions}

\subsection{Optimization of C-BN Parameters}

\begin{figure}[!h]
\includegraphics[width=12.0cm]{fig2.ps
\caption{\label{fig2}(Color online) The change in the total energy, as given by both the Tersoff potential and DFT, per interface area as a function of interface separation, d. The corresponding structures for the interfaces are given with ball-and-stick representations (C = yellow, N = small blue, B = big red atom).}
\end{figure}

As pointed put in the previous section, reliable potentials for C-C and B-N interactions have appeared in the literature.
To simulate the hybrid structures of interest, we must then only define the interactions between B-C and N-C.
Since the structure and vibrational spectrum of \textit{h}-BN and graphene are similar, we opt to employ the mixing rules and fitting procedure put forth by Tersoff for Si-Ge and Si-C,~\cite{PhysRevB.39.5566} which approximates the parameters as a mixture of the existing BN and C parameters modified by two arbitrary values, $\chi_{\mathrm{B-C}}$ and $\chi_{\mathrm{N-C}}$.
These parameters adjust the contribution from the attractive term to the potential.
We have obtained $\chi_{\mathrm{B-C}}$ and $\chi_{\mathrm{N-C}}$  by imposing the requirement on the potential to reproduce DFT energetics of all probable \textit{h}-BN/graphene interfaces shown in Fig.~\ref{fig2}.
In these graphs, $\Delta\gamma$ is the change in total energy per interface area (width $\times$ Van der Waals thickness) as the interface separation, d, changes from the equilibrium value, d$_0$, under the condition that the bond lengths in the graphene and \textit{h}-BN regions are held fixed.
The corresponding interfaces are also shown in Fig.~\ref{fig2}.
Note that the interface separation parameter, d, accounts for both bond length and angle variations.
Parameter fitting is accomplished by minimizing the differences between the DFT and the force field derived $\Delta\gamma$ values for each displacement for each structure simultaneously by updating the force field parameters using a genetic algorithm.
The fitted parameters for $\chi_{B-C}$ and $\chi_{N-C}$ (0.886777 and 1.013636 respectively) along with the parameters obtained from the mixing rule have produced MD energies in good agreement with DFT results.
Moreover, the error in the calculated equilibrium B-C and N-C bond lengths of all structures is no larger than 1.5\%.
A full list of parameters along with the description of interaction potential function and the mixing rules are given in Table~\ref{table4} of the Appendix.

\subsection{Stripe Superlattices with Equal Periods}

In all striped superlattice structures, we calculated the lattice thermal conductivities parallel, $\kappa_{\shortparallel}$, and perpendicular, $\kappa_{\perp}$, to the superlattice orientation.
The chosen interfaces are shown in Fig.~\ref{fig3} and~\ref{fig4} with the associated thermal conductivity values.
The ball-and-stick structure in Fig.~\ref{fig3}a and in Fig.~\ref{fig4}a is the same interface given in Fig.~\ref{fig2} as structure 5, essentially one armchair ribbon connected to the other two in a symmetrical fashion though forming B-C and N-C bonds.
Whereas the structure represented as Fig.~\ref{fig3}b and Fig.~\ref{fig4}b can be thought of as one zigzag ribbon connected to two others on one side by B-C bonds and on the other by N-C bonds. These interfaces correspond to structures 2 and 3 in Fig.~\ref{fig2}.
The effective stiffness at the interface, obtained by fitting the $\Delta\gamma$ to a quadratic function, shows that the C-N bond is stronger than C-B bond.
This is expected considering that both interactions are mainly covalent and as more electrons are involved in the bonding, the strength of the bond increases.

Fig.~\ref{fig3} shows how the thermal conductivity of the aforementioned superlattice interfaces behave when the periods, constrained by $l_{\mathrm{G}}$ = $l_{\mathrm{BN}}$, are varied. The transport coefficients in the parallel direction, however, behave differently, depending on the type of interface. The superlattice with armchair interface has smaller thermal conductivity compared to the one with zigzag interface in the studied period range. As the period thickness increases, the stripe structures appear to become less sensitive to interface effects on  parallel thermal conductivity for both interfaces approaching ~1050-1200 $W/mK$. This is close to the midpoint of the thermal conductivity values of pristine \textit{h}-BN, 450 $W/mK$, and graphene, 2300 $W/mK$. This behavior agrees quantitatively with what is expected from treating the striped structure as the combination of two independent nanoribbons.
Previously, it was shown that zigzag ribbons have better thermal transport properties than armchair ribbons at small widths because of the latter having higher atomic line density on the edge.~\cite{JustinACS,Cem-BN-PRB} Thicker ribbons have more transport channels and difference in scattering behavior at the edges become less significant. Thus, it is sensible for striped structures combined through zigzag interfaces to have larger transport coefficients in smaller periods.
Another apparent observation is that the thermal transport coefficients perpendicular to the different interfaces behave similarly, gradually increasing from 200-250 $W/mK$ at $l = 1.5~nm$ to 350-400 $W/mK$ at $l = 30~nm$. The perpendicular thermal transport is strongly controlled by the lower thermal conductivity component (\textit{h}-BN) and the interface phonon scattering even at a 30~nm thickness. If one assumes that the periods of the stripes are longer than the phonon mean free path and the boundary resistance is negligible, then $\kappa_{\perp}$ of the stripe system of equal periods is bounded by $2(\kappa_{\mathrm{graphene}}\times\kappa_{\mathrm{\textit{h}-BN}})/(\kappa_{\mathrm{graphene}}+\kappa_{\mathrm{\textit{h}-BN}})$.
For the calculated superlattices this equation give 752.7 $W/mK$.
The actual physics of the simulated systems, on the other hand, will not resemble to the idealized picture.
First, the system has a finite thermal boundary resistance that depends on the acoustic mismatch of the stripes and the intrinsic properties of the boundary. The effect of boundary structure on $\kappa_{\perp}$ is less pronounced when the results from Fig.~\ref{fig3} a) and b) compared, and it is almost independent for zigzag and armchair interfaces.
Second, some of the systems have period lengths of only few nanometers which is very short compared to the MFP of the relevant phonons.
Thermal conductivity perpendicular to the interface increases slowly as the period size grows; however, the ideal value will not be reached because of the limiting effect of thermal boundary resistance, which will be present even in systems with period sizes longer than the characteristic MFP.

\begin{figure}[!h]
\includegraphics[width=14.0cm]{fig3.ps
\caption{\label{fig3}(Color online) The thermal transport coefficients parallel and perpendicular to the two different graphene/\textit{h}-BN interfaces are shown in (a) and (b). The period lengths of both graphene and \textit{h}-BN are constrained to be equal. The atomistic details for the calculated structures are given in Table~\ref{table1} in Appendix.}
\end{figure}

\subsection{Stripe Superlattices with Unequal Periods}

Using the same interfaces, we remove the constraint of equal size periods and only require the sum of $l_{\mathrm{BN}}$ and $l_{\mathrm{G}}$ to be 60 $nm$.
We note here that the variation of the period lengths also enables us to see the influence of concentration.
When \textit{h}-BN has a small concentration (or a small period), the parallel component of thermal transport increases toward the limiting value of graphene as seen in Fig.~\ref{fig4}.
On the other hand, the perpendicular component does not exceed 700 $W/mK$.
Again, the zigzag interfaces have higher parallel thermal transport coefficients (35\% larger) than the armchair interfaces in almost all configurations.
When the period of BN is small, the reduction in $\kappa_{\perp}$ from the pristine graphene value is mainly due to interfacial phonon scattering; systems with larger $l_{BN}$ drive $\kappa_{\perp}$ toward the pure BN values but are still limited by the influence of interfacial scattering. The effect of atomic bonding at the interface on conduction is most clearly seen when $l_{BN}/l_{Total}$=0.05. Conductivity perpendicular to the boundary in armchair interfaced sample is noticeably higher than zigzag sample. This is most probably caused by enhanced scattering from alternating types of interface bonding in zigzag boundaries.

\begin{figure}[!h]
\includegraphics[width=14.0cm]{fig4.ps
\caption{\label{fig4}(Color online) The thermal transport coefficients parallel and perpendicular to the two different graphene/\textit{h}-BN interfaces are shown in (a) and (b). The sum of period lengths of graphene and \textit{h}-BN are constrained to be 60 nm. The atomistic details for the calculated structures are given in Table~\ref{table2} in Appendix.}
\end{figure}

\subsection{Dot and Anti-dot Superlattices}

We now turn to the investigation of the thermal conductivity of ordered and random distributions of~\textit{h}-BN dots embedded in graphene.
Fig.~\ref{fig5} shows the influence of dot size and concentration on the $\kappa$.
From Fig.~\ref{fig5} we see that larger dot sizes lead to higher thermal transport coefficients.
At the lowest BN concentration (2\%) the system with the largest dot has a 20\% larger transport coefficient than the other sizes.
This could be understood by the fact that larger dots have a smaller boundary to bulk ratio at the same concentration.
As more dots are introduced, this interface effect is suppressed and the $\kappa$ of all systems converge to 250 $W/mK$ at 40\% \textit{h}-BN.
Interestingly, this large concentration limit is similar to the perpendicular conductivity of stripe superlattices with periods similar to the diameter of the dots, see Fig.~\ref{fig3}.
It is likely that at large concentrations the \textit{h}-BN dots can isotropically limit the thermal transport in the same manner that the stripes limit the transport perpendicular to the boundary.

In addition to ordered BN dots, we have modeled ordered and random distributions of graphene dots in \textit{h}-BN.
The thermal conductivity values of these systems are also presented in Fig.~\ref{fig5}.
A decreasing behavior in thermal conductivity is also observed in these systems as the number of graphene dots increases.
It is surprising to see graphene, as the higher $\kappa$ component, does not enhance the thermal conductivity of ~\textit{h}-BN.
This can be attributed to the relatively small size of the dots and the large \textit{h}-BN/graphene interface to area ratio, leading to interfacial phonon scattering events dominating $\kappa$.
At the lowest C concentration, the ordered dot system has higher thermal conductivity than the bulk value of \textit{h}-BN.
It is not clear whether this is an actual physical phenomena or an averaging problem since the error bars are large enough to include the bulk value.
In creating the random dot configurations, we maintain the mean dot separation similar to the one in the ordered configurations with same concentration.
For each concentration, the initial conditions of the simulations are not only varied by atom velocities but the also the distribution of the dots.
The thermal conductivities of the structures, having ordered and random dots, are not significantly different for the same dot sizes and concentrations (see the inset of Fig.~\ref{fig5}).
Again, the smaller dots lead to lower $\kappa$ when the concentration of C is kept constant.

\section{Summary and Concluding Remarks}

We have characterized the lattice thermal transport properties of hybrid graphene and \textit{h}-BN structures: graphene-white graphene stripes and dot/antidot superlattices.
The $\kappa_{\perp}$ of striped nanostructures with large periods is limited by the less conductive component, \textit{h}-BN.
The parallel transport, on the other hand, attains a value close to the average of the two components.
As the periods of the stripes are reduced, interface scattering effects become more prevalent with zigzag interfaces resulting in higher $\kappa$ than the armchair interfaces.
The thermal conductivity of the dot systems can be tailored by both dot diameter and concentration.
Small dot concentration and large dot diameter leading to larger conductivities.
Moreover, the transport properties of nanosystems with high dot concentrations are independent of size, approaching the $\kappa_{\perp}$ of the small period striped superlattices.

\begin{figure}[!h]
\includegraphics[width=14.0cm]{fig5.ps
\caption{\label{fig5}(Color online) The thermal transport properties of graphene with embedded \textit{h}-BN dots and \textit{h}-BN with embedded graphene. Three different radii, 4.95 \AA, 12.38 \AA, and 24.76 \AA~are used for \textit{h}-BN dots. The number of dots in the systems are varied such that the BN concentration ranges from ~2-98\%. Two different radii, 6.19 \AA, 12.38 \AA~are employed for graphene dots. The superscript ``d'' indicates the disordered dot arrangement. BN concentration on the horizontal axis is calculated as the percent ratio of the total number of boron and nitrogen atoms to the total number of atoms. The inset graph has the same axis units as the outer graph. The atomistic details for these systems are given in Table~\ref{table3} in Appendix.}
\end{figure}

\section{Acknowledgements}
We acknowledge support from NSF (DMR 0844082) to the International Institute of
Materials for Energy Conversion at Texas A\&M University as well as AFRL. Parts
of computations were carried out by the Laboratory of Computational Engineering
of Nanomaterials, supported by ARO, ONR and DOE grants. We would also like to
thank the Supercomputing Center of Texas A\&M University for a generous time
allocation for this project. CS acknowledges the support from The
Scientific and Technological Research Council of Turkey (TUBITAK) to his
research at Anadolu University.

\clearpage

\section{Appendix}

Structural details of stripe and dot superlattices are given in Table~\ref{table1}, Table~\ref{table2} and Table~\ref{table3}.

\begin{scriptsize}\begin{table}[!h]
\caption{\label{table1} Simulation details for the stripe superlattices where graphene and \textit{h}-BN have equal period thicknesses. Thermal conductivities of these structures are given in Fig.~\ref{fig3}. The total size of the systems are given by Length$_{arm}$ and Length$_{zig}$ where the subscripts define whether the length is measured along the armchair or the zigzag configuration.}
\begin{ruledtabular}
\begin{tabular}{lccccc}
Boundary $\backslash$ Period ($nm$) & \# of B & \# of N & \# of C & Length$_{arm}$ ($nm$)& Length$_{zig}$ ($nm$)\\\hline
Armchair $\backslash$ $l=1.246854$ & 33600 & 33600  & 67200 & 60.46925 &  59.84897 \\
Armchair $\backslash$ $l=7.481121$ & 33600 & 33600 & 67200 & 60.46925 & 59.84897  \\
Armchair $\backslash$ $l=9.974828$ & 33600 & 33600 & 67200 & 60.46925 & 59.84897 \\
Armchair $\backslash$ $l=14.9622$ & 33600  & 33600 & 67200 & 60.46925 &  59.84897 \\
Armchair $\backslash$ $l=29.92449$ & 33600  & 33600 & 67200 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ $l=1.2957698$  & 32982 & 32982 & 65964 & 59.60541 & 59.59960 \\
Zigzag $\backslash$ $l=5.1830792$  & 34560 & 34560 & 69120 & 62.19695 & 59.84897 \\
Zigzag $\backslash$ $l=9.934235$ & 32982 & 32982 & 65964 & 59.60541 & 59.59960  \\
Zigzag $\backslash$ $l=15.1173$ & 33600 & 33600 & 67200 & 60.46925 & 59.84897  \\
Zigzag $\backslash$ $l=30.234625$ & 33600 & 33600 & 67200 & 60.46925 & 59.84897 \\\hline
\end{tabular}
\end{ruledtabular}
\end{table}\end{scriptsize}

\newpage

\begin{scriptsize}\begin{table}[!h]
\caption{\label{table2} Simulation details for the stripe superlattices where graphene and \textit{h}-BN have different period thicknesses. Thermal conductivities of these structures are given in Fig.~\ref{fig4}. The total size of the systems are given by Length$_{arm}$ and Length$_{zig}$ where the subscripts define whether the length is measured along the armchair or the zigzag configuration.}
\begin{ruledtabular}
\begin{tabular}{lccccc}
Boundary $\backslash$ $l_{\mathrm{BN}}/l_{\mathrm{total}}$  & \# of B & \# of N & \# of C & Length$_{arm}$ ($nm$)& Length$_{zig}$ ($nm$)\\\hline
Armchair $\backslash$ 0.05 & 3360 & 3360 & 127680 & 60.46925 & 59.84897 \\
Armchair $\backslash$ 0.25 & 16800 & 16801 & 100800 & 60.46925 & 59.84897 \\
Armchair $\backslash$ 0.50 & 33600 & 33600 & 67200 & 60.46925 & 59.84897 \\
Armchair $\backslash$ 0.75 & 50400 & 50400 & 33600 & 60.46925 & 59.84897 \\
Armchair $\backslash$ 0.95 & 63840 & 63840 & 6720 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ 0.05 & 3360 & 3360 & 127680 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ 0.25 & 16800 & 16800 & 100800 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ 0.50 & 33600 & 33600 & 67200 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ 0.75 & 50400 & 50400 & 33600 & 60.46925 & 59.84897 \\
Zigzag $\backslash$ 0.95 & 63840 & 63840 & 6720 & 60.46925 & 59.84897 \\\hline
\end{tabular}
\end{ruledtabular}
\end{table}\end{scriptsize}

\newpage

\begin{scriptsize}\begin{table}[!h]
\caption{\label{table3} Simulation details for graphene with embedded \textit{h}-BN dots and \textit{h}-BN with embedded graphene anti-dots. Thermal conductivities of these structures are given in Fig.~\ref{fig5}.}
\begin{ruledtabular}
\begin{tabular}{lccccc}
Radius ($nm$) & \# of B & \# of N & \# of C & Length$_{X}$ ($nm$)& Length$_{Y}$ ($nm$)\\\hline
& 6000 & 4800 & 18000 & 29.71200 & 25.73130\\
& 3840 & 3072 & 25856 & 31.69280 & 27.44680\\
r$_{\mathrm{BN}}=$ 0.495& 2016 & 1728 & 31104 & 32.68320 & 28.30446\\
& 960 & 768 & 31040 & 31.69280 & 27.44676\\
& 540 & 432 & 44028 & 37.14000 & 32.16417\\\hline
& 12384 & 12960 & 39456 & 44.56800 & 38.59704\\
& 5504 & 5760 & 45184 & 41.59680 & 36.02388\\
r$_{\mathrm{BN}}=$ 1.238& 3096 & 3240 & 58464 & 44.56800 & 38.59701\\
& 1376 & 1440 & 53632 & 41.59680 & 36.02388\\
& 348 & 360 & 34140 & 32.68320 & 28.30448\\\hline
& 13032 & 12744 & 39024 & 44.56800 & 38.59701\\
& 5792 & 5664 & 44992 & 41.59680 & 36.02388\\
r$_{\mathrm{BN}}=$ 2.476& 1448 & 1416 & 25936 & 29.71200 & 25.73135\\
& 1448 & 1416 & 53584 & 41.59680 & 36.02389\\
& 1448 & 1416 & 136528 & 65.36640& 56.60896\\\hline
& 14000 & 13500 & 17500 & 37.14000 &32.16420 \\
& 22784 & 22464 & 11200 & 41.59680 & 36.02388 \\
r$_{\mathrm{C}}=$ 1.238& 29340 & 29160 & 6300 & 44.56800 & 38.59701 \\
& 26864 & 26784 & 2800 & 41.59680 & 36.02388 \\
& 68320 & 68256 & 2816 & 65.36640 & 56.60896 \\\hline
r$^{\mathrm{d}}_{\mathrm{C}}=$ 1.238 & 26750 & 26820 & 5950 & 39.88552 & 40.15493 \\
& 29150 & 29145 & 1225 & 39.87575 & 40.14509 \\\hline
r$^{\mathrm{d}}_{\mathrm{C}}=$ 0.619 & 26795 & 26765 & 5960 & 39.89808  & 40.16757 \\
& 29160 & 29160 & 1200 & 39.88407 & 40.15347 \\\hline
\end{tabular}
\end{ruledtabular}
\end{table}\end{scriptsize}

\newpage

The potential used in this study is developed by Tersoff.~\cite{PhysRevB.39.5566}

\begin{eqnarray}
V_{ij} &=& f_{C}(r_{ij})\left[f_{R}(r_{ij})+b_{ij}f_{A}(r_{ij})\right]\nonumber\\
f_{C}(r_{ij}) &=& \left\{\begin{array}{rcl}
 1 & : &r_{ij} < R_{ij} \\
\frac{1}{2}+\frac{1}{2}\cos\left(\pi\frac{r_{ij}-R_{ij}}{S_{ij}-R_{ij}}\right) & :
&R_{ij} < r_{ij} < S_{ij} \\ 0 & : &r_{ij} > S_{ij}
\end{array}\right. \nonumber\\
f_{R}(r_{ij}) &=& A_{ij} \exp\left(-\lambda^{I}_{ij}r_{ij}\right) \nonumber\\
f_{A}(r_{ij}) &=& -B^{'}_{ij} \exp\left(-\lambda^{II}_{ij}r_{ij}\right) ,\;\;\;\;\;\; B^{'}_{ij} = B_{ij}\chi_{ij} \nonumber\\
b_{ij} &=&\left(1+\beta_{i}^{n_{i}}\zeta_{ij}^{n_{i}}\right)^{-\frac{1}{2n_{i}}} \nonumber\\
\zeta_{ij} &=& \sum_{k\neq i,j} f_{C}(r_{ik}) g(\theta_{ijk}) \nonumber \\
g(\theta_{ijk}) &=& \left(1+\frac{c_{i}^{2}}{d_{i}^{2}}-\frac{c_{i}^{2}}{\left[d_{i}^{2}+(\cos\theta_{ijk}-h_{i})^{2}\right]}\right)\nonumber
\end{eqnarray}

In this description the lower indices $i$, $j$ and $k$ mark the atoms where $i$-$j$ bond is modified by a third atom $k$. The potential parameters and their corresponding values are given in Table~\ref{table4}. The parameter $\chi_{ij}$ was used as a fitting parameter in our study. For the mixing of parameters, the geometric mean is calculated for the multiplier parameters and arithmetic mean is calculated for the exponential parameters. These rules are given below.

\begin{eqnarray}
\lambda^{I}_{ij} &=& \left(\lambda^{I}_{i}+\lambda^{I}_{j}\right)/2,\;\;\;\;  \lambda^{II}_{ij} \;=\;
\left(\lambda^{II}_{i}+\lambda^{II}_{j}\right)/2,\;\;\;\; A_{ij} \;=\;\left(A_{i}A_{j}\right)^{(1/2)}\nonumber\\
B_{ij} &=& \left(B_{i}B_{j}\right)^{(1/2)},\;\;\;\; R_{ij} \;=\;\left(R_{i}R_{j}\right)^{(1/2)},\;\;\;\; S_{ij} \;=\;\left(S_{i}S_{j}\right)^{(1/2)}\nonumber
\end{eqnarray}

It should be mentioned that $\chi_{ij}$ modifies $B_{ij}$ which is obtained as a result of the mixing procedure. Here, we also note that the developed potential is not parameterized to represent N-N or B-B interactions as can be seen from Table~\ref{table4}.

\newpage
\begin{scriptsize}\begin{table}[!h]
\caption{\label{table4} The parameters of Tersoff potential optimized for C-BN interactions. The atom X represent the bond modifying element where all parameters are exactly the same whether it is C, B or N.}
\begin{ruledtabular}
\begin{tabular}{lccccccc}
Parameters& C B X & C C X & C N X & B C X & B N X & N B X & N C X\\\hline
$A$ (eV)&1386.78&1393.6 &1386.78 &1386.78 & 1380.0  & 1380.0 & 1386.78 \\
$B^{'}$ (eV)&339.06891&430.0  &387.575152 &339.068910 & 340.0 & 340.0 & 387.575152  \\
$\lambda^{I}$ (\AA$^{-1}$)&3.5279   &3.4879 &3.5279 & 3.5279 & 3.568 & 3.568 & 3.5279 \\
$\lambda^{II}$ (\AA$^{-1}$)&2.2054   &2.2119 &2.2054 & 2.2054 & 2.199 & 2.199 & 2.2054 \\
$n$&0.72751&0.72751 &0.72751&0.72751&0.72751&0.72751&0.72751 \\
$\beta$ (10$^{-7}$)&1.5724   &1.5724  &1.5724 & 1.25724 & 1.25724 & 1.25724 & 1.25724 \\
$c$&38049&38049 &38049 &25000 & 25000 & 25000 & 25000 \\
$d$&4.3484&4.3484 &4.3484 &4.3484 &4.3484 &4.3484 &4.3484 \\
$h$&-0.93&-0.93 &-0.93 & -0.89 & -0.89 & -0.89 & -0.89 \\
$R$ (\AA)&1.85&1.80 &1.85 &1.85 & 1.90 & 1.90 & 1.85 \\
$S$ (\AA)&2.05&2.10 &2.05 &2.05 & 2.00 & 2.00 & 2.05 \\\hline
\end{tabular}
\end{ruledtabular}
\end{table}\end{scriptsize}

\clearpage