Just for reference, here’s a script (python) to construct an ascii dataset in the required format, from an old h5 mesh and solution file.
import h5py
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
np.set_printoptions(threshold=np.inf)
mesh = h5py.File(‘mesh-02630.h5’,‘r’)
nodes = mesh[‘nodes’][:]
radius = np.sqrt(nodes[:,0]*nodes[:,0] + nodes[:,1]nodes[:,1])/1e6 #Calculate R, convert to Mm for gridding
phi = np.arctan2(nodes[:,1],nodes[:,0]) #Calculate phi = atan(y/x)
phi[ phi<0 ] += 2np.pi #Convert to be between 0–>2pi
f = h5py.File(‘solution-03148.h5’, ‘r’) #Loading temperature solution data
T = f[‘T’][:]
R2 = np.linspace(3481000,6336000,100)/1e6 #Make sure in Mega-m also.
phi2 = np.linspace(0,2*np.pi,1200)
R,P = np.meshgrid(R2,phi2)
out = griddata((radius, phi), T[:,0], (R,P),method=‘nearest’)
print(".2f .2f %.2f",np.c_[R.ravel(),P.ravel(),out.ravel()])
Haha - note the online editor has formatted my format comments in the above!
np.savetxt(‘interpolated_out3.dat’,np.c_[R.ravel()*1e6,P.ravel(),out.ravel()]) #Ouput R,phi and T data. Convert R to m, ascending R order is correct (ie. same as shell_2d.txt)
fig = plt.figure()
plt.tricontourf(P.ravel(),R.ravel(),out.ravel(),levels=100, cmap=‘RdGy_r’)
plt.colorbar();
plt.show()
#plt.savefig(“mantle_Tinput.png”)
And the a picture of the imported data (regridded to 300x1200 - which seems to capture most of the details):