Fast Reconstruction of 3D Density Distribution around the Sun Based on the MAS by Deep Learning

This study is the first attempt to generate a three-dimensional (3D) coronal electron density distribution based on the pix2pixHD model, whose computing time is much shorter than that of the magnetohydrodynamic (MHD) simulation. For this, we consider photospheric solar magnetic fields as input, and electron density distribution simulated with the MHD Algorithm outside a Sphere (MAS) at a given solar radius is taken as output. We consider 155 pairs of Carrington rotations as inputs and outputs from 2010 June to 2022 April for training and testing. We train 152 deep-learning models for 152 solar radii, which are taken up to 30 solar radii. The artificial intelligence (AI) generated 3D electron densities from this study are quite consistent with the simulated ones from lower radii to higher radii, with an average correlation coefficient 0.97. The computing time of testing data sets up to 30 solar radii of 152 deep-learning models is about 45.2 s using the NVIDIA TITAN XP graphics-processing unit, which is much less than the typical simulation time of MAS. We find that the synthetic coronagraphic images estimated from the deep-learning models are similar to the Solar Heliospheric Observatory (SOHO)/Large Angle and Spectroscopic Coronagraph C3 coronagraph data, especially during the solar minimum period. The AI-generated coronal density distribution from this study can be used for space weather models on a near-real-time basis.


Introduction
Knowledge of the coronal electron density distribution can provide a better understanding of the physical dynamics of the solar corona (Gómez 2018) and inner heliosphere.To determine the compression ratio of shocks driven by coronal mass ejection (CME), determine the Alfvén Mach number, and predict the CME total mass and propagation, the ambient coronal electron density should be accurately estimated (Vourlidas et al. 2000;de Patoul et al. 2015;Feng et al. 2015).MHD modeling is the initial approach that can bridge self-consistently thoroughly from the heliocentric distances near the Sun to well beyond Earth's orbit (Usmanov 1998;Usmanov & Goldstein 2003;Hayashi 2005;Detman et al. 2006;Riley et al. 2012;Feng et al. 2021).Furthermore, MHD models obtain a 3D distribution that can provide the distribution of the plasma parameters (i.e., density, temperature, and velocity) and the configuration of the magnetic field of the solar corona, inner heliosphere, and outer heliosphere (de Patoul et al. 2015).The MHD Algorithm outside a Sphere (MAS ;Linker 1999;Mikić & Linker 1999) model is such a 3D MHD model based on the photospheric magnetic field observations that have been developed to study the large-scale structure and dynamics of the solar corona (from 1 to 30 solar radii) and inner heliosphere (from 30 solar radii to 5 au) (Riley et al. 2009).The MAS model considers the coronal heating, anisotropic thermal conduction, and radiative losses to develop a more realistic model of the global coronal plasma density distribution (Lionello & Linker 2009).However, this complex simulation technique demands significant computing time, resources, and effort.The entire simulation process, including the determination of the Sun's position, the gathering of the necessary data for one Carrington rotation (CR) process, the collection of data on the underlying magnetic field, and the computation of the simulation for space weather forecasting, takes at most a few days (Caplan & Linker 2019).
Image-to-image translation is a well-known application in deep-learning-based image processing.It is the process of transforming an input image into a corresponding output image, where the main objective is to know the relationship between input and output data.Recently, several forms of network structure, loss functions, learning principles, and techniques have been employed in image translation.The generative adversarial network (GAN; Goodfellow et al. 2014) models like pix2pix (Isola et al. 2017) and pix2pixHD (Wang et al. 2018) prove to be a well-known deep-learning approach that provides state-of-theart performance in several applications in the field of astronomy and astrophysics, such as reconstruction and synthesis of data (Kim et al. 2019;Park et al. 2019;Jeong et al. 2020;Shin et al. 2020) and denoising (Park & Moon 2019).For high-resolution image translation applications, the pix2pix model (Isola et al. 2017) fails to capture fine details and produces artifacts (Wang et al. 2018).On the other hand, the pix2pixHD model (Wang et al. 2018)  can also increase computational efficiency significantly and minimize computational costs.Jang et al. (2021) generated the 3D coronal electron density from coronagraphic images for one solar rotation period (27 days).They synthesized the input images from the target 3D electron density in their work by applying the Thomson scattering theory and developed their models only for six selected solar radii.According to our knowledge, this study is the first attempt to generate 3D solar coronal density distribution from the photospheric magnetic field using the deep-learning models.The most impressive thing is that the computation time is much faster than those of an MAS simulation.This study is organized as follows.The data are described in Section 2. The methods used for 3D coronal density distribution generation are discussed in Section 3. The results are given in Section 4. A brief summary and discussion are given in Section 5.

Data
The MAS model solves the time-dependent resistive thermodynamic MHD equations in 3D spherical coordinates to study the large-scale structure and dynamics of the solar corona (1 to 30 solar radii) and inner heliosphere (30 Rs to 5 au) (Riley et al. 2009).The MAS model considers a synoptic map of the photospheric magnetic field constructed from a series of observations over 27 days and centered at the central meridian region.The synoptic map is formed by the fundamental boundary condition at the surface of the Sun, which has been described previously in Mikić & Linker (1994), Lionello et al. (1999), Mikić & Linker (1999), Linker et al. (2001), andLionello &Linker (2001).For this work, both the input and target data sets are collected from the MAS thermodynamic model.We consider the synoptic maps of the photospheric magnetic field data as input and the 3D distributions of coronal electron density up to 30 solar radii as the target.We collect the MAS simulation data from the MAS database (http://www.predsci.com/data).
The size of the input (photospheric magnetic field) data is 361 × 182 (longitude and latitude) from 2010 June to 2022 April (CR 2097 to CR 2256).The coronal electron density data of the MAS model have two different sizes for two different time periods: from 2010 June to 2020 May (CR 2097 to CR 2240), the size is 181 × 101 × 151 (longitude, latitude, and altitude from the solar surface, respectively), and from 2020 June to 2022 April (CR 2241 to CR 2256), it is 300 × 143 × 255.Since the size of the coronal electron density data of the MAS model for the two distinct periods is not the same, we align the coronal electron density data of these two different time periods and fix the size of our target data set as 182 × 96 × 151 from 2010 June to 2022 April (CR 2097 to CR 2256).According to the size of the target, the input data (photospheric magnetic field data from MAS) are also aligned at the nearest latitude and longitude position of the target.After the alignment, the photospheric magnetic field data size is 182 × 96.We consider the same alignment process for the photospheric magnetic field data for testing our deep-learning models.
In this study, we consider 155 CRs for training and testing.The deep-learning models are tested using 33 CRs after being trained on 122 CRs.To include the solar maximum and the solar minimum period in training and testing data sets, we consider three consecutive CRs for training and the fourth CR for testing from 2010 June to 2022 April (CR 2097 to CR 2256).Here 26% of the data are used to evaluate the deep-learning models.As the number of our simulation data is not many, we extend the training data set approximately 30 times by flipping (longitude and latitude) and rotating by 10°in the longitudinal direction.Since the photospheric magnetic field data and coronal density map are asymmetric, we can obtain new magnetic field and density structures by flipping and rotating in order to provide a more diverse data set during training (Shorten & Khoshgoftaar 2019).
We normalize input data sets with mean and standard deviation values according to Equation (1).The main goal of the normalization is recentering and rescaling the data.In addition, it increases the efficiency and stability of deeplearning models by allowing them to train the deep-learning models for various data values at the same scale.Since the density data are not limited in their ranges and they decrease rapidly as the altitude increases, we normalize the density data at each solar radius with their mean values and standard deviation according to Equation (2).The formulae of the normalization are as follows: , are the original and normalized input data, respectively. Y Y , i i are the normalized and original electron density data of the ith solar radii, respectively.
Here we apply random noise and Gaussian blur only to the input data of the training data set.When we consider any ground-based photospheric magnetic field observation with artifacts like noise and blurriness as input, our deep-learning models may overcome the artifacts.

Method
The pix2pixHD (Wang et al. 2018) is an improved version of the pix2pix (Isola et al. 2017) algorithm for high-resolution data.It employs conditional GANs (cGANs) with multiscale discriminator and generator architectures, as well as novel adversarial loss function.As the resolution of our data is low, we consider a generator (G) that has U-Net (Ronneberger et al. 2015) architectures and a single discriminator (D), shown in Figure 1.It simultaneously trains D and G during the learning process (Mao et al. 2017).The primary objective of the generator G is to convert the inputs into outputs, and D triggers the generator to create realistic outputs (Wang et al. 2018).
During the training process, the generator extracts features from the input data and reconstructs the outputs from the extracted features.The discriminator works like a classifier to identify whether the output is fake or real.In our training, we apply the Least Squares Generative Adversarial Networks (LSGAN; Mao et al. 2017) instead of GAN to stabilize the training, as followed in Wang et al. (2018).LSGAN penalizes the fake samples and forces the generator to generate outputs closer to the decision boundary.Thus, LSGAN overcomes the vanishing gradients' problem and performs more stably (Mao et al. 2017).
The objective function of LSGAN is as follows: where x and y denote input (photospheric magnetic field) and target (coronal electron density) data, respectively.G(x) means  an output from the generator for a given input x.D(x, y) and D (x, G(x)) are probabilities of the target pairs and AI-generated pairs, respectively.
To enable better learning, an additional loss function FM, known as "feature matching loss," is added to the generator (Wang et al. 2018).FM loss is more effective for large dynamic range data because it reduces the absolute difference between the feature maps of the target data and AI-generated data (Rana et al. 2019;Marnerides et al. 2021).The FM loss function is expressed as follows:  where T denotes the total number of layers in the discriminator and N i is the number of pixels in output feature maps of each layer.
The final objective of the deep-learning model is as follows:

Qualitative and Quantitative Evaluation
A comparison between the results of our deep-learning models and the MAS simulation at 2.004, 3.18, 10.48, and 20.28 solar radii is shown in Figure 2. It seems from the results that our deep-learning models can reliably generate the electron density map of the solar minimum cases (CR 2100 and Figure 3 shows a comparison of electron density maps, density graph in 180°longitude, and 2D histogram plots between the target and the AI-generated ones at 4. 19, 12.63, 25.40, and 30.51 radii, respectively.As shown in Figure 3, both the target and AI-generated density are quite consistent with each other.Even at higher solar radii, the histograms accurately depict pixel distributions around the diagonal.We notice that just a small fraction of points are deviated from the line, while the rest of the points are near the diagonal line.Next, we compare the MAS density maps with the AI-generated density maps at 2. 07, 4.65, 25.40, and 30.51 radii of CR 2186 in Figure 4. From the color bar of both the columns, we can see that the electron density varies with radius.It is impressive that our deep-learning models are able to reproduce the coronal electron density variation over radius.Although the data have a fairly complex structure, the deep-learning models can qualitatively reproduce the overall 3D density structure.Additionally, our AI-generated results can be employed to infer the global coronal magnetic field topology since the density structures, like the heliospheric current sheet, manifest the magnetic structures. In order to evaluate the testing data sets quantitatively, we took two types of objective metrics for solar maximum and solar minimum period separately.The first metric is a pixel-topixel Pearson's correlation coefficient between the target and the generated electron density map.The second metric is the normalized rms error (NRMSE).It is given by


where N, y, and ¢ y are the number of pixels in a single testing data, target, and AI-generated coronal electron density distribution, respectively.Here y max and y min are the maximum and minimum electron density value from the MAS model of the corresponding solar radius, respectively.
Table 1 represents the averaged pixel-to-pixel Pearson's correlation coefficient and NRMSE values between the density distribution obtained from the MAS model and the AI-generated ones at 2.004, 3.18, 10.48, and 20.28 solar radii for the testing data set.As shown in Table 1, the pixel-to-pixel correlation of our deep-learning model is higher during the solar minimum than the solar maximum.However, due to the more complex structure during the solar maximum period, the solar minimum period has better metrics values.

Computational Time
To predict adverse space weather events and their impact on the geospace environment in near real time, high-performance computational and shorter-running time models are needed (Feng et al. 2013).In our study, we use a single NVIDIA TITAN XP graphics-processing unit (GPU), CUDA 11.4, and 12 GB.For the computing time evaluation, an AMD Ryzen 5 3600 6-Core Processor with 16.0 GB RAM CPU is used for loading and preprocessing of inputs, while a single GPU is used for forwarding inference.The most impressive result is that it takes approximately 45.2 s to compute 152 deep-learning models for the test data set with a resolution of 182 × 96 × 152 up to 30 solar radii, which is much faster than a usual computational time on the MAS model (Caplan & Linker 2019).On the other hand, the computing time of the MAS model with a resolution of 101 × 101 × 128 is about several days on a single-CPU machine (Mikić et al. 2018).

Comparison with SOHO/LASCO C3 Data
Figure 5 shows the comparison among the SOHO/LASCO C3 coronagraph image on 2015 May 15 (solar minimum case), the corresponding synthetic image based on the MAS model, and the AI-generated result of our deep-learning models.We construct the synthetic images using the densities near the limb of the solar frontside from 2.004 to 30 solar radii as seen by SOHO/LASCO.The LASCO C3 and synthetic images are processed using the normalizing radial graded filter, as described by Morgan et al. (2006), in order to reveal faint coronal structures.It seems that the AI-generated ones are quite similar to the MAS simulation and the observation in view of the position of polar regions and other structures.configurations are similar but not exactly the same.We found few differences between the observed SOHO/LASCO C3 coronagraph image and AI-generated one.Such differences may be caused by synoptic magnetic fields used as input data of the MAS model.It is noted that these fields had been taken for one solar rotation period.

Conclusion and Summary
Our study is the first attempt to apply 152 deep-learning models to generate the 3D solar coronal electron density distribution up to 30 solar radii, whose computing times are much shorter than the MAS simulation one.For this work, we obtained the input photospheric magnetic field map and target solar coronal density distribution from the MAS simulation model collected from Predictive Science Inc.We used 155 pairs of data from CR 2097 to CR 2256 for training and testing our deep-learning models, which cover the time period from 2010 June to 2022 April.
Based on the outcomes of this study, we conclude that advanced deep-learning models can successfully generate the 3D solar coronal electron density distribution.Those results can be potentially used for specifying the condition on global magnetohydrodynamic models to reproduce large-scale coronal, heliospheric structures and solar wind modeling, such as the MAS heliospheric models (Lionello & Linker 2009) and the Wang−Sheeley−Arge model (Arge et al. 2004).Furthermore, deep-learning models can generate even small-scale density structures for both solar minima and maxima periods.We demonstrate that both solar maxima and minima AIgenerated results are strongly correlated (the average pixel to pixel CC 0.97) with the target MAS-simulated electron density distribution map.In addition, the NRMSE values show that the deep-learning models are quite effective at reconstructing the electron density distribution map.Moreover, the intensity map and the histograms seem to be consistent not only in lower solar radii but also in higher solar radii.The impressive advantage of this work is that the computational time of the deep-learning models is much faster than the MAS simulation one.Finally, the synthetic coronagraphic data estimated from the models matched with the real coronagraph image of SOHO/LASCO data during the solar minimum period.
The deep-learning algorithm can generate complex and higher-radius electron density structures.The obtained AI-generated results can provide valuable insight for investigating and comparing physical aspects of the data from spacecraft in the inner heliosphere like Solar Orbiter (Müller et al. 2020) and Parker Solar Probe (Vourlidas et al. 2016).Furthermore, on a near-real-time basis, the AI-generated coronal density distribution can be used for reliable input for future space weather simulations.We intend to use more improved synchronic magnetic field data from the Solar Dynamics Observatory (SDO; Pesnell et al. 2012)/Helioseismic and Magnetic Imager (HMI; Schou et al. 2012) and AIgenerated farside magnetograms as input data in the future to overcome the limitation of the MAS for the solar maximum period Jeong et al. (2022).In the future, we have plan to generate other parameters of the MAS simulation model, like magnetic fields, temperature, and velocities which can be reproduced using the deep learning algorithm.
This research was supported by the Korea Astronomy and Space Science Institute under the R&D program (Project No. 2023-1-850-07) supervised by the Ministry of Science and ICT and NRF-2020R1C1C1003892 project.We thank the numerous team members who have contributed to the MAS simulation.We acknowledge the community effort devoted to developing the following open-source packages used in this work.We thank the numerous team members who have contributed to the success of the SDO mission.The SDO data were (partly) provided by the Korea Data Center (KDC) for SDO in cooperation with NASA, Stanford University (JSOC), and KISTI (KREONET), which is supported by the "Next Generation Space Weather Observation Network" project of the Korea Astronomy and Space Science Institute (KASI).

Figure 1 .
Figure 1.Architecture of our deep-learning model based on pix2pixHD.

Figure 2 .
Figure 2. Qualitative comparisons between electron density distribution from MAS simulation and AI-generated electron density distribution with deep-learning models of CR 2194, CR 2100, CR 2200, and CR 2174 at 2.004, 3.18, 10.48, and 20.28 solar radii, respectively.Left column: synoptic map of the photospheric magnetic field; middle column: electron density distribution from MAS simulation model; right column: AI-generated electron density distribution.
where G and D denote a generator and a discriminator, respectively, respectively.Here λ is a relative weight that controls  G LSGAN and  FM followingWang et al. (2018).During the learning process, the generator tries to minimize the FM loss, while the discriminator tries to maximize the LSGAN loss.The goal of the loss function is to optimize the deep-learning model parameters.For training and testing, we consider the photospheric magnetic field (x) as input and 3D coronal density distribution (y) as output from the MAS simulation as shown in Figure1.To cover whole coronal regions from 2.004 to 30 solar radii, we consider 152 deeplearning models separately.We compare the AI-generated ones with the MAS-simulated data, as well as SOHO(Domingo et al. 1995)/LASCO(Brueckner et al. 1995) C3 coronagraph data.We employ the Adam (Kingma & Ba 2014) optimizer with momentum β 1 = 0.5 and β 2 = 0.999.The initial learning rate is 2 × 10 −4 .In every 2 × 10 5 iterations of back-propagation, the learning rate is decreased to half from the previous label.

Figure 3 .
Figure 3. Two descriptive comparisons of electron density map, density graph in 180°longitude, and 2D histogram plots between the target and the AI-generated one at 4.19, 12.63, 25.40, and 30.51 radii solar radii of CR 2178, CR 2220, CR 2205, and CR 2228, respectively.Left to right: MAS density map, AI-generated density map, density graph in 0°longitude, and 2D histograms.

Figure 4 .
Figure 4. Comparisons of electron density distribution from the MAS simulation and AI-generated electron density map of CR 2186 at 2.07, 4.65, 25.40, and 30.51 solar radii.The left column represents the MAS density map, and the right column represents the AI-generated one.

Figure 6
Figure5shows the comparison among the SOHO/LASCO C3 coronagraph image on 2015 May 15 (solar minimum case), the corresponding synthetic image based on the MAS model, and the AI-generated result of our deep-learning models.We construct the synthetic images using the densities near the limb of the solar frontside from 2.004 to 30 solar radii as seen by SOHO/LASCO.The LASCO C3 and synthetic images are processed using the normalizing radial graded filter, as described byMorgan et al. (2006), in order to reveal faint coronal structures.It seems that the AI-generated ones are quite similar to the MAS simulation and the observation in view of the position of polar regions and other structures.Figure 6 shows the comparison among the SOHO/LASCO C3 coronagraph image on 2012 March 17, the synthetic image based on the MAS model, and the one AI-generated by our deep-learning models.The figure shows that the global

Figure 5 .
Figure 5.Comparison of (a) SOHO/LASCO C3 coronagraph image observed on 2017 May 13, (b) the synthetic image based on the MAS simulation model, and (c) the AI-generated one.

Figure 6 .
Figure 6.Comparison result with (a) SOHO/LASCO C3 coronagraph observed on 2012 March 17, (b) the synthetic image based on the MAS simulation model, and (c) the one AI generated by our deep-learning models during the solar maximum period.

Table 1
The Averaged Values of Pearson's Correlation Coefficient (CC) and Normalized rms Error (NRMSE) of the Solar Minimum and the Solar Maximum Period at 2.004, 3.12, 10.48, and 20.28 Solar Radii for the Testing Data Set