Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions fdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy as np
from copy import copy, deepcopy
import os,time,platform,shutil,sys
from subprocess import Popen, PIPE, CREATE_NEW_CONSOLE
from subprocess import Popen, PIPE
from time import sleep
from collections import Counter
from matplotlib.patches import Rectangle
Expand Down Expand Up @@ -544,7 +544,7 @@ def plot(self,save='',angle=[45,45],color='k',connections=False,equal_axes=True,
plt.clf()
fig = plt.figure(figsize=[8.275,11.7])
ax = plt.axes(projection='3d')
ax.set_aspect('equal', 'datalim')
ax.set_aspect('auto', 'datalim')

ax.set_xlabel(xlabel,size=font_size)
ax.set_ylabel(ylabel,size=font_size)
Expand Down Expand Up @@ -707,7 +707,7 @@ def topo(self,save='',cbar=True,equal_axes=True, method = 'nearest', divisions=[
ax = plt.axes([0.15,0.15,0.7,0.7])
if xlims: ax.set_xlim(xlims)
if ylims: ax.set_ylim(ylims)
if equal_axes: ax.set_aspect('equal', 'datalim')
if equal_axes: ax.set_aspect('auto', 'datalim')
CS = plt.contourf(X,Y,vals,levels)
if clims: CS.vmin=clims[0]; CS.vmax=clims[1]
if xlabel: plt.xlabel(xlabel,size=font_size)
Expand All @@ -722,7 +722,7 @@ def topo(self,save='',cbar=True,equal_axes=True, method = 'nearest', divisions=[
for t in ax.get_yticklabels():
t.set_fontsize(font_size)

ax.set_aspect('equal', 'datalim')
ax.set_aspect('auto', 'datalim')
extension, save_fname, pdf = save_name(save,variable='zone_topo'+str(self.index),time=1)
plt.savefig(save_fname, dpi=200, facecolor='w', edgecolor='w',orientation='portrait',
format=extension,transparent=True, bbox_inches=None, pad_inches=0.1)
Expand Down Expand Up @@ -2936,7 +2936,7 @@ def __setstate__(self, data_dict):
def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dflt.full_connectivity,skip=[]): #Reads data from file.
'''Read FEHM input file and construct fdata object.

:param filename: Name of FEHM input file. Alternatively, supplying 'fehmn.files' will cause PyFEHM to query this file for input, grid and restart file names if they are available.
:param filename: Name of FEHM input *.dat file.
:type filename: str
:param gridfilename: Name of FEHM grid file.
:type gridfilename: str
Expand All @@ -2949,8 +2949,8 @@ def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dfl

# set up paths
if filename: self._path.filename = filename
if gridfilename: self.grid._path.filename = filename
if inconfilename: self.incon._path.filename = filename
if gridfilename: self.grid._path.filename = gridfilename
if inconfilename: self.incon._path.filename = inconfilename

# THERE WILL ALWAYS BE A GRID PATH TO READ - INPUT FILES CANNOT BE READ WITHOUT A GRID
self.grid.read(self.grid._path.full_path,full_connectivity=full_connectivity)
Expand All @@ -2976,7 +2976,7 @@ def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dfl
[self._read_cont,self._read_macro,self._read_zonn,self._read_zonn,self._read_macro,
self._read_time,self._read_ctrl,self._read_iter,self._read_macro,self._read_macro,
self._read_boun,self._read_macro,self._read_strs,self._read_text,self._read_sol,
self._read_nfinv,self._read_hist,self._read_histnode,self._read_carb,self._read_model,
self._read_nfinv,self._read_hist,self._read_histnode,self._read_carb,self._read_model,
self._read_macro,self._read_nobr,self._read_flxz,self._read_rlpm,self._read_macro,
self._read_trac,self._read_model,self._read_model,self._read_vapl,self._read_adif,
self._read_ngas,self._read_flxo,self._read_head,self._read_flxn, self._read_air, self._read_air])))
Expand Down
4 changes: 1 addition & 3 deletions fgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def read(self,gridfilename,full_connectivity=False,octree=False):
elif isAvs:
self._read_avs()
newgridfilename = self._path.full_path.split('.')[:-1]
newgridfilename = string.join(newgridfilename,'.')+'.inp'
newgridfilename = ".".join(newgridfilename)+'.inp'
if os.path.isfile(newgridfilename):
newgridfilename = newgridfilename[:-4] + '_new' + newgridfilename[-4:]
self.write(newgridfilename, 'fehm') # write out equivalent fehm grid
Expand All @@ -548,7 +548,6 @@ def _read_fehm(self): #Read in fehm meshfile for node,element data .
nd = infile.readline().strip().split()
new_node = fnode(index=int(nd[0]),position=np.array([float(nd[1]),float(nd[2]),float(nd[3])]))
self.add_node(new_node)

infile.readline()
infile.readline()
N = infile.readline()
Expand Down Expand Up @@ -612,7 +611,6 @@ def _read_avs(self): #Read in avs meshfile for node, element data.
nd = infile.readline().strip().split() # read line
new_node = fnode(index=int(nd[0]),position=np.array([float(nd[1]),float(nd[2]),float(nd[3])]))
self.add_node(new_node) # add node object

N = N_el
connectivity = None
for i in range(N): # FOR each element
Expand Down
4 changes: 2 additions & 2 deletions tutorials/tutorial1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# 7.1.2 Grid generation
x = np.linspace(0,10,11)
dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x)
dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x)
#dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45])

# 7.1.3 Zone creation
Expand Down Expand Up @@ -67,7 +67,7 @@
#dat.iter['machine_tolerance_TMCH'] = -0.5e-5

dat.files.root = root
dat.run(root+'_INPUT.dat', verbose=True, diagnostic = True) # note, because no executable path is specified, PyFEHM retrieves the executable specified in the default path
dat.run(root+'_INPUT.dat', verbose=True) # note, because no executable path is specified, PyFEHM retrieves the executable specified in the default path

asdf
# 7.1.7 Visualisation
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorial2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

Z = list(np.linspace(Z0,Za_base,5)) + list(np.linspace(Za_base,Za_top,11))[1:] + list(np.linspace(Za_top,Z1,5))[1:]

dat.grid.make('quarterGrid.inp', x= X, y = X, z = Z)
dat.grid.make(gridfilename='quarterGrid.inp', x= X, y = X, z = Z)

dat.grid.plot('quarterGrid.png', angle = [45,45], color = 'b', cutaway = [proX,proY,-1000])

Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorial3.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def simulation(j,param):

# 7.1.2 Grid generation
x = np.linspace(0,10,11)
dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x)
dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x)
dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45])

# 7.1.3 Zone creation
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorial4.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# 7.1.2 Grid generation
x = np.linspace(0,10,11)
dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x)
dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x)
dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45])

# 7.1.3 Zone creation
Expand Down