%% RMT modeling of layered Earth model with anisotropicdielectric permittivity
%

addpath(genpath('D:\em3d_MT\bin'));
addpath D:\em3d_MT\bin\Solver\Pardiso\panua-pardiso-20230718-win\lib ; % Pardiso
addpath D:\em3d_MT\bin\Solver\SuiteSparse-7.0.1\UMFPACK\MATLAB;    % SuiteSparse

%
% solver: 'Paradiso', 'umfpack', 'iluQMR', 'iluBicgstab'

solver = 'Paradiso'; 
Input;
OMP = 2;  % Number of threads in OpenMP
% Set the OMP_NUM_THREADS environment variable
setenv('OMP_NUM_THREADS', num2str(OMP));
% Get the environment variable and verify if it is set successfully
getenv('OMP_NUM_THREADS')
em3d_MT_main;
save("FWD_2layer-sig2000-20000-epsr8-856-aD45.mat",'data','rec','freq') 

%
% Plotting

% Output conductivity model vtk file
% Create_VTK(mesh.node2coord(:,1),mesh.node2coord(:,2),mesh.node2coord(:,3), (P.sig(:,1)),['sigxx.vtk'],'',mesh.elem2node-1);
% plotting the comparison of 1D and 3D forward modeling results.
plot_freq_rho_1dvs3d;