## Final Report Summary - DAGON (Developement of an AMR 3D Maxwell-Bloch code and application to coherent femto-nano-imaging)

The main deliverable result of the FP7-PEOPLE-2013-IEF project DAGON (GA 627191) is a 3D Maxwell-Bloch code, fully parallelized and using the Adaptive Mesh Refinement (AMR) paradigm.

This code, DAGON, solves the paraxial Maxwell wave equation in the slowly varying envelope approximation in non-stationary, inhomogeneous media like plasmas. This equation is enhanced with a constitutive relation for the polarization, deduced from Bloch equations, and rate equations for the atomic populations that interact with the electric field (spontaneous emission, stimulated emission and absorption).

The first task of this project, development of the 3D Maxwell-Bloch solver, was carried out having in mind the second task, optimization (i.e. parallelization and using AMR). Since each optimization strategy requires different solvers, we decided to choose first the AMR method. Among the two options described in the project, wavelets and Block-Structured, we chose the latter. The main reasons were the expertise of the host and the existence of libraries (i.e. Boxlib from Lawrence Berkeley National Lab), saving time in both programming tasks and error checking.

Different solvers were explored to choose the most adequate for Block-Structured AMR. DAGON solves an advection-diffussion-reaction equation for the electric field and three ordinary differential equations (ODEs) (polarization and populations). The similarities between this problem and compressible fluid dynamics led us to try a high order Godunov method for the advection of the electric field, since the host has a huge expertise on these methods. The diffusion, source term and remaining ODEs are treated with standard methods. However, the Courant-Friedrichs-Lewy (CFL) imposes a huge restriction in the time step when using a Godunov method for this problem. Since the resulting time steps were considered impractical for the applications of DAGON, a more standard approach (shift and spline interpolation of the electric field) was implemented.

The stochastic ODE for the polarization (that includes the Spontaneous Emission) is solved using methods common to Brownian motion and finances (Black-Scholes equations). The ODEs for the populations of the atomic/ionic levels that interact with the electric field are solved with standard methods, with the particularity that the time dependent rates and plasma related quantities (electron density, temperature) are obtained from hydrodynamic and/or collisional radiative codes (i.e. ARWEN, a 2D radiation hydrodynamics code; OfiKinRad, a 0D collisional radiative code). DAGON reads the data from files with a defined format. In order to use another kind of input, it is only necessary to add a new input method to the corresponding class, easing the coupling of DAGON with different codes.

The correct 3D visualization and manipulation of results is of capital importance. Thus, we decided to use an already tested and powerful visualization tool VisIt (Lawrence Livermore National Lab, https://wci.llnl.gov/simulation/computer-codes/visit). The modularity of DAGON allowed us to add specific methods in the input/output class to format the output of DAGON into files readable by VisIt. In order to use another visualization tool, it is only necessary to add another method to the class (usually by just copying examples provided by the tool's developers), easing the change or update of these tools. Thus, VisIt provides the user with plenty of visualization tools (isovolumes, isocontours, selection, projection tools), data analysis (1D/2D cut, max/min, user provided expressions, etc ...) and the possibility of making movies with the simulation data, very useful for outreach purposes.

The 3D Maxwell-Bloch solver describe above is already fit for applications. However, the multiscale nature of the problem (from plasma lengths of millimetres or even centimetres and nanosecond characteristic times to the micrometric spatial extent and femtosecond characteristic time of the seeded harmonics) makes it very demanding on computational time and memory. Advanced optimization methods like the one chosen for DAGON, block-structured Adaptive Mesh Refinement, are expected to increase the performance of the code in table top computers.

In order to implement the block-structured Adaptive Mesh Refinement, the library BoxLib (Center for Computational Sciences and Engineering, https://ccse.lbl.gov/BoxLib/ , Lawrence Berkeley National Lab) was used. This library was chosen among others because the host had already some expertise in using it (ARWEN, AMREM) and because a FORTRAN version (the programming language chosen for DAGON) was available. Another advantage of BoxLib is that it is already parallelized, saving us programming and debugging time. The parallelization technique used by BoxLib consists on sending to each processor a number of AMR patches. It is worth noting here that the efficiency of the code and the saturation of time savings with the number of processors depend strongly on the particularities of each problem and the parameters of the AMR structure (efficiency of the patches, number of levels, etc ...). However, even in a poorly optimized simulation, the computational time is reduced by 30% by using two processors instead of one. Better performance is expected when choosing the optimal AMR parameters.

In conclusion, while we will continue the development and optimization of DAGON by including further physical models, making parametric studies to optimize the paralellization or improving the interpolation subroutines in the AMR library, we can positively assert that DAGON is ready for users, as the two related deliverables considered within the project have been successfully achieved.

Indeed, DAGON has already been used to model several cases of interest, as it was stated in the third workpackage and deliverable of the project. As the logical continuation of the previous work done with DEEPONE, we have used DAGON to model the amplification of High Order Harmonics in dense Krypton gas amplifiers. These simulations helped us to confirm the previous results and to advance in the understanding of the impact of the plasma inhomogeneities in the temporal profile of the amplified pulse. In addition to this, we are carrying out simulations on the interaction of X-ray pulses with samples in the framework of the H2020 FETOPEN project VOXEL. The objective of this project is to develop an X-ray plenoptic camera capable of obtaining tomographic images of biological samples. With DAGON we are studying the propagation and interaction of the X-rays with transparent and absorbing media and its application to plenoptic imaging.

Thus, DAGON is a 3D time dependent Maxwell-Bloch code, using AMR and parallelized, already available for users (through the webpage of the Instituto de Fusión Nuclear http://www.denim.upm.es/ or contacting the researcher in charge, Dr. Eduardo Oliva, by e-mail eduardo.oliva@upm.es ). This code might interest not only researchers on plasma physics and X-ray radiation but also professors, since it can be used to teach the fundamentals of interaction of radiation with matter, and students doing their end of studies project. In addition to them, DAGON can be used by researchers in outreach activities, as it has been done during this project.

This code, DAGON, solves the paraxial Maxwell wave equation in the slowly varying envelope approximation in non-stationary, inhomogeneous media like plasmas. This equation is enhanced with a constitutive relation for the polarization, deduced from Bloch equations, and rate equations for the atomic populations that interact with the electric field (spontaneous emission, stimulated emission and absorption).

The first task of this project, development of the 3D Maxwell-Bloch solver, was carried out having in mind the second task, optimization (i.e. parallelization and using AMR). Since each optimization strategy requires different solvers, we decided to choose first the AMR method. Among the two options described in the project, wavelets and Block-Structured, we chose the latter. The main reasons were the expertise of the host and the existence of libraries (i.e. Boxlib from Lawrence Berkeley National Lab), saving time in both programming tasks and error checking.

Different solvers were explored to choose the most adequate for Block-Structured AMR. DAGON solves an advection-diffussion-reaction equation for the electric field and three ordinary differential equations (ODEs) (polarization and populations). The similarities between this problem and compressible fluid dynamics led us to try a high order Godunov method for the advection of the electric field, since the host has a huge expertise on these methods. The diffusion, source term and remaining ODEs are treated with standard methods. However, the Courant-Friedrichs-Lewy (CFL) imposes a huge restriction in the time step when using a Godunov method for this problem. Since the resulting time steps were considered impractical for the applications of DAGON, a more standard approach (shift and spline interpolation of the electric field) was implemented.

The stochastic ODE for the polarization (that includes the Spontaneous Emission) is solved using methods common to Brownian motion and finances (Black-Scholes equations). The ODEs for the populations of the atomic/ionic levels that interact with the electric field are solved with standard methods, with the particularity that the time dependent rates and plasma related quantities (electron density, temperature) are obtained from hydrodynamic and/or collisional radiative codes (i.e. ARWEN, a 2D radiation hydrodynamics code; OfiKinRad, a 0D collisional radiative code). DAGON reads the data from files with a defined format. In order to use another kind of input, it is only necessary to add a new input method to the corresponding class, easing the coupling of DAGON with different codes.

The correct 3D visualization and manipulation of results is of capital importance. Thus, we decided to use an already tested and powerful visualization tool VisIt (Lawrence Livermore National Lab, https://wci.llnl.gov/simulation/computer-codes/visit). The modularity of DAGON allowed us to add specific methods in the input/output class to format the output of DAGON into files readable by VisIt. In order to use another visualization tool, it is only necessary to add another method to the class (usually by just copying examples provided by the tool's developers), easing the change or update of these tools. Thus, VisIt provides the user with plenty of visualization tools (isovolumes, isocontours, selection, projection tools), data analysis (1D/2D cut, max/min, user provided expressions, etc ...) and the possibility of making movies with the simulation data, very useful for outreach purposes.

The 3D Maxwell-Bloch solver describe above is already fit for applications. However, the multiscale nature of the problem (from plasma lengths of millimetres or even centimetres and nanosecond characteristic times to the micrometric spatial extent and femtosecond characteristic time of the seeded harmonics) makes it very demanding on computational time and memory. Advanced optimization methods like the one chosen for DAGON, block-structured Adaptive Mesh Refinement, are expected to increase the performance of the code in table top computers.

In order to implement the block-structured Adaptive Mesh Refinement, the library BoxLib (Center for Computational Sciences and Engineering, https://ccse.lbl.gov/BoxLib/ , Lawrence Berkeley National Lab) was used. This library was chosen among others because the host had already some expertise in using it (ARWEN, AMREM) and because a FORTRAN version (the programming language chosen for DAGON) was available. Another advantage of BoxLib is that it is already parallelized, saving us programming and debugging time. The parallelization technique used by BoxLib consists on sending to each processor a number of AMR patches. It is worth noting here that the efficiency of the code and the saturation of time savings with the number of processors depend strongly on the particularities of each problem and the parameters of the AMR structure (efficiency of the patches, number of levels, etc ...). However, even in a poorly optimized simulation, the computational time is reduced by 30% by using two processors instead of one. Better performance is expected when choosing the optimal AMR parameters.

In conclusion, while we will continue the development and optimization of DAGON by including further physical models, making parametric studies to optimize the paralellization or improving the interpolation subroutines in the AMR library, we can positively assert that DAGON is ready for users, as the two related deliverables considered within the project have been successfully achieved.

Indeed, DAGON has already been used to model several cases of interest, as it was stated in the third workpackage and deliverable of the project. As the logical continuation of the previous work done with DEEPONE, we have used DAGON to model the amplification of High Order Harmonics in dense Krypton gas amplifiers. These simulations helped us to confirm the previous results and to advance in the understanding of the impact of the plasma inhomogeneities in the temporal profile of the amplified pulse. In addition to this, we are carrying out simulations on the interaction of X-ray pulses with samples in the framework of the H2020 FETOPEN project VOXEL. The objective of this project is to develop an X-ray plenoptic camera capable of obtaining tomographic images of biological samples. With DAGON we are studying the propagation and interaction of the X-rays with transparent and absorbing media and its application to plenoptic imaging.

Thus, DAGON is a 3D time dependent Maxwell-Bloch code, using AMR and parallelized, already available for users (through the webpage of the Instituto de Fusión Nuclear http://www.denim.upm.es/ or contacting the researcher in charge, Dr. Eduardo Oliva, by e-mail eduardo.oliva@upm.es ). This code might interest not only researchers on plasma physics and X-ray radiation but also professors, since it can be used to teach the fundamentals of interaction of radiation with matter, and students doing their end of studies project. In addition to them, DAGON can be used by researchers in outreach activities, as it has been done during this project.