initial upload
This commit is contained in:
142
PyLaGriT/examples/arctic_2D_new/Topo_Profile_NS_ERT.csv
Executable file
142
PyLaGriT/examples/arctic_2D_new/Topo_Profile_NS_ERT.csv
Executable file
@@ -0,0 +1,142 @@
|
||||
Distance_m,X,Y,Z
|
||||
0,585621.2001,7910271.778,5.380000114
|
||||
0.250210394,585621.192,7910272.028,5.389999866
|
||||
0.500420788,585621.1839,7910272.278,5.429999828
|
||||
0.750631183,585621.1758,7910272.528,5.440000057
|
||||
1.000841577,585621.1677,7910272.778,5.440000057
|
||||
1.251051971,585621.1596,7910273.028,5.449999809
|
||||
1.501262365,585621.1515,7910273.278,5.449999809
|
||||
1.75147276,585621.1435,7910273.528,5.460000038
|
||||
2.001683154,585621.1354,7910273.779,5.440000057
|
||||
2.251893548,585621.1273,7910274.029,5.440000057
|
||||
2.502103942,585621.1192,7910274.279,5.449999809
|
||||
2.752314336,585621.1111,7910274.529,5.449999809
|
||||
3.002524731,585621.103,7910274.779,5.449999809
|
||||
3.252735125,585621.0949,7910275.029,5.440000057
|
||||
3.502945519,585621.0869,7910275.279,5.460000038
|
||||
3.753155913,585621.0788,7910275.529,5.46999979
|
||||
4.003366307,585621.0707,7910275.779,5.46999979
|
||||
4.253576702,585621.0626,7910276.029,5.480000019
|
||||
4.503787096,585621.0545,7910276.279,5.5
|
||||
4.75399749,585621.0464,7910276.529,5.510000229
|
||||
5.004207884,585621.0383,7910276.78,5.510000229
|
||||
5.254418279,585621.0302,7910277.03,5.510000229
|
||||
5.504628673,585621.0222,7910277.28,5.519999981
|
||||
5.754839067,585621.0141,7910277.53,5.559999943
|
||||
6.005049461,585621.006,7910277.78,5.550000191
|
||||
6.255259855,585620.9979,7910278.03,5.550000191
|
||||
6.50547025,585620.9898,7910278.28,5.570000172
|
||||
6.755680644,585620.9817,7910278.53,5.579999924
|
||||
7.005891038,585620.9736,7910278.78,5.570000172
|
||||
7.256101432,585620.9655,7910279.03,5.559999943
|
||||
7.506311826,585620.9575,7910279.28,5.550000191
|
||||
7.756522221,585620.9494,7910279.53,5.550000191
|
||||
8.006732615,585620.9413,7910279.78,5.510000229
|
||||
8.256943009,585620.9332,7910280.031,5.489999771
|
||||
8.507153403,585620.9251,7910280.281,5.480000019
|
||||
8.757363798,585620.917,7910280.531,5.449999809
|
||||
9.007574192,585620.9089,7910280.781,5.400000095
|
||||
9.257784586,585620.9009,7910281.031,5.360000134
|
||||
9.50799498,585620.8928,7910281.281,5.329999924
|
||||
9.758205374,585620.8847,7910281.531,5.309999943
|
||||
10.00841577,585620.8766,7910281.781,5.300000191
|
||||
10.25862616,585620.8685,7910282.031,5.289999962
|
||||
10.50883656,585620.8604,7910282.281,5.289999962
|
||||
10.75904695,585620.8523,7910282.531,5.28000021
|
||||
11.00925735,585620.8442,7910282.781,5.289999962
|
||||
11.25946774,585620.8362,7910283.032,5.300000191
|
||||
11.50967813,585620.8281,7910283.282,5.320000172
|
||||
11.75988853,585620.82,7910283.532,5.329999924
|
||||
12.01009892,585620.8119,7910283.782,5.360000134
|
||||
12.26030932,585620.8038,7910284.032,5.400000095
|
||||
12.51051971,585620.7957,7910284.282,5.400000095
|
||||
12.76073011,585620.7876,7910284.532,5.400000095
|
||||
13.0109405,585620.7795,7910284.782,5.380000114
|
||||
13.26115089,585620.7715,7910285.032,5.380000114
|
||||
13.51136129,585620.7634,7910285.282,5.369999886
|
||||
13.76157168,585620.7553,7910285.532,5.340000153
|
||||
14.01178208,585620.7472,7910285.782,5.329999924
|
||||
14.26199247,585620.7391,7910286.032,5.329999924
|
||||
14.51220286,585620.731,7910286.283,5.320000172
|
||||
14.76241326,585620.7229,7910286.533,5.320000172
|
||||
15.01262365,585620.7148,7910286.783,5.309999943
|
||||
15.26283405,585620.7068,7910287.033,5.289999962
|
||||
15.51304444,585620.6987,7910287.283,5.309999943
|
||||
15.76325484,585620.6906,7910287.533,5.300000191
|
||||
16.01346523,585620.6825,7910287.783,5.289999962
|
||||
16.26367562,585620.6744,7910288.033,5.300000191
|
||||
16.51388602,585620.6663,7910288.283,5.300000191
|
||||
16.76409641,585620.6582,7910288.533,5.289999962
|
||||
17.01430681,585620.6502,7910288.783,5.300000191
|
||||
17.2645172,585620.6421,7910289.033,5.309999943
|
||||
17.5147276,585620.634,7910289.284,5.300000191
|
||||
17.76493799,585620.6259,7910289.534,5.309999943
|
||||
18.01514838,585620.6178,7910289.784,5.329999924
|
||||
18.26535878,585620.6097,7910290.034,5.349999905
|
||||
18.51556917,585620.6016,7910290.284,5.340000153
|
||||
18.76577957,585620.5935,7910290.534,5.340000153
|
||||
19.01598996,585620.5855,7910290.784,5.340000153
|
||||
19.26620035,585620.5774,7910291.034,5.329999924
|
||||
19.51641075,585620.5693,7910291.284,5.329999924
|
||||
19.76662114,585620.5612,7910291.534,5.329999924
|
||||
20.01683154,585620.5531,7910291.784,5.320000172
|
||||
20.26704193,585620.545,7910292.034,5.309999943
|
||||
20.51725233,585620.5369,7910292.284,5.28000021
|
||||
20.76746272,585620.5288,7910292.535,5.269999981
|
||||
21.01767311,585620.5208,7910292.785,5.230000019
|
||||
21.26788351,585620.5127,7910293.035,5.230000019
|
||||
21.5180939,585620.5046,7910293.285,5.210000038
|
||||
21.7683043,585620.4965,7910293.535,5.199999809
|
||||
22.01851469,585620.4884,7910293.785,5.199999809
|
||||
22.26872509,585620.4803,7910294.035,5.190000057
|
||||
22.51893548,585620.4722,7910294.285,5.199999809
|
||||
22.76914587,585620.4642,7910294.535,5.199999809
|
||||
23.01935627,585620.4561,7910294.785,5.210000038
|
||||
23.26956666,585620.448,7910295.035,5.230000019
|
||||
23.51977706,585620.4399,7910295.285,5.239999771
|
||||
23.76998745,585620.4318,7910295.536,5.25
|
||||
24.02019784,585620.4237,7910295.786,5.260000229
|
||||
24.27040824,585620.4156,7910296.036,5.269999981
|
||||
24.52061863,585620.4075,7910296.286,5.269999981
|
||||
24.77082903,585620.3995,7910296.536,5.25
|
||||
25.02103942,585620.3914,7910296.786,5.239999771
|
||||
25.27124982,585620.3833,7910297.036,5.230000019
|
||||
25.52146021,585620.3752,7910297.286,5.21999979
|
||||
25.7716706,585620.3671,7910297.536,5.25
|
||||
26.021881,585620.359,7910297.786,5.230000019
|
||||
26.27209139,585620.3509,7910298.036,5.239999771
|
||||
26.52230179,585620.3428,7910298.286,5.25
|
||||
26.77251218,585620.3348,7910298.536,5.239999771
|
||||
27.02272258,585620.3267,7910298.787,5.239999771
|
||||
27.27293297,585620.3186,7910299.037,5.239999771
|
||||
27.52314336,585620.3105,7910299.287,5.230000019
|
||||
27.77335376,585620.3024,7910299.537,5.239999771
|
||||
28.02356415,585620.2943,7910299.787,5.239999771
|
||||
28.27377455,585620.2862,7910300.037,5.260000229
|
||||
28.52398494,585620.2781,7910300.287,5.25
|
||||
28.77419533,585620.2701,7910300.537,5.269999981
|
||||
29.02440573,585620.262,7910300.787,5.260000229
|
||||
29.27461612,585620.2539,7910301.037,5.269999981
|
||||
29.52482652,585620.2458,7910301.287,5.260000229
|
||||
29.77503691,585620.2377,7910301.537,5.260000229
|
||||
30.02524731,585620.2296,7910301.788,5.260000229
|
||||
30.2754577,585620.2215,7910302.038,5.260000229
|
||||
30.52566809,585620.2135,7910302.288,5.28000021
|
||||
30.77587849,585620.2054,7910302.538,5.289999962
|
||||
31.02608888,585620.1973,7910302.788,5.300000191
|
||||
31.27629928,585620.1892,7910303.038,5.269999981
|
||||
31.52650967,585620.1811,7910303.288,5.289999962
|
||||
31.77672007,585620.173,7910303.538,5.269999981
|
||||
32.02693046,585620.1649,7910303.788,5.269999981
|
||||
32.27714085,585620.1568,7910304.038,5.260000229
|
||||
32.52735125,585620.1488,7910304.288,5.269999981
|
||||
32.77756164,585620.1407,7910304.538,5.269999981
|
||||
33.02777204,585620.1326,7910304.788,5.239999771
|
||||
33.27798243,585620.1245,7910305.039,5.25
|
||||
33.52819283,585620.1164,7910305.289,5.239999771
|
||||
33.77840322,585620.1083,7910305.539,5.230000019
|
||||
34.02861361,585620.1002,7910305.789,5.239999771
|
||||
34.27882401,585620.0921,7910306.039,5.25
|
||||
34.5290344,585620.0841,7910306.289,5.239999771
|
||||
34.7792448,585620.076,7910306.539,5.239999771
|
||||
35.02945519,585620.0679,7910306.789,5.210000038
|
||||
|
118
PyLaGriT/examples/arctic_2D_new/transect.py
Executable file
118
PyLaGriT/examples/arctic_2D_new/transect.py
Executable file
@@ -0,0 +1,118 @@
|
||||
from pylagrit import PyLaGriT
|
||||
import numpy as np
|
||||
|
||||
lg = PyLaGriT()
|
||||
|
||||
# Create base layer from x=10 to x=21 to match bert02 mesh
|
||||
x = np.linspace(10.,21,(21.-10.)/0.25+1)
|
||||
y = [0.,0.25]
|
||||
top = lg.gridder(x,y,elem_type='quad',connect=True)
|
||||
|
||||
# Create top of mesh
|
||||
# Collapse y values
|
||||
top.addatt('y_save',vtype='vdouble',rank='scalar')
|
||||
top.copyatt('yic','y_save')
|
||||
top.setatt('yic',0.)
|
||||
|
||||
# Read in top elevations
|
||||
d = np.genfromtxt("./Topo_Profile_NS_ERT.csv", delimiter=",", names=True)
|
||||
surf_pts = lg.points(x=d['Distance_m'],z=d['Z'],elem_type='quad')
|
||||
surf_pts.addatt('z_save',vtype='vdouble',rank='scalar')
|
||||
surf_pts.copyatt('zic','z_save')
|
||||
surf_pts.setatt('zic',0.)
|
||||
|
||||
# Interpolate surface elevations to top
|
||||
top.addatt('z_val',vtype='vdouble',rank='scalar')
|
||||
top.interpolate_voronoi('z_val',surf_pts,'z_save')
|
||||
top.copyatt('y_save','yic')
|
||||
top.copyatt('z_val','zic')
|
||||
|
||||
# Save top
|
||||
top.setatt('imt',1)
|
||||
top.setatt('itetclr',1)
|
||||
top.dump('tmp_lay_peat_top.inp')
|
||||
surf_pts.delete()
|
||||
|
||||
# Copy top to create intermediate layers
|
||||
layer = top.copy()
|
||||
|
||||
# Begin to construct stacked layer arrays
|
||||
# Names of layer files
|
||||
stack_files = ['tmp_lay_peat_top.inp']
|
||||
# Material id, should be same length as length of stack_files
|
||||
matids = [1]
|
||||
|
||||
# Add (15) 2 cm thick layers
|
||||
layer.math('sub',0.02*15,'zic')
|
||||
layer.dump('tmp_lay1.inp')
|
||||
stack_files.append('tmp_lay1.inp')
|
||||
# Number of layers in between surfaces, should be length of stack_files - 1
|
||||
nlayers = [14]
|
||||
matids.append(1)
|
||||
|
||||
# Add (15) 5 cm thick layers
|
||||
layer.math('sub',0.05*15,'zic')
|
||||
layer.dump('tmp_lay2.inp')
|
||||
stack_files.append('tmp_lay2.inp')
|
||||
# Number of layers in between surfaces, should be length of stack_files - 1
|
||||
nlayers.append(14)
|
||||
matids.append(2)
|
||||
|
||||
# Add (15) 10 cm thick layers
|
||||
layer.math('sub',0.1*15,'zic')
|
||||
layer.dump('tmp_lay3.inp')
|
||||
stack_files.append('tmp_lay3.inp')
|
||||
# Number of layers in between surfaces, should be length of stack_files - 1
|
||||
nlayers.append(14)
|
||||
matids.append(2)
|
||||
|
||||
# Add (15) 1 c thick layers
|
||||
layer.math('sub',1*15,'zic')
|
||||
layer.dump('tmp_lay3.inp')
|
||||
stack_files.append('tmp_lay3.inp')
|
||||
# Number of layers in between surfaces, should be length of stack_files - 1
|
||||
nlayers.append(14)
|
||||
matids.append(2)
|
||||
|
||||
layer.math('sub',2.*15.,'zic')
|
||||
layer.dump('tmp_lay4.inp')
|
||||
stack_files.append('tmp_lay4.inp')
|
||||
nlayers.append(14)
|
||||
matids.append(2)
|
||||
|
||||
layer.setatt('zic',-45.)
|
||||
layer.dump('tmp_lay_bot.inp')
|
||||
stack_files.append('tmp_lay_bot.inp 2')
|
||||
nlayers.append(1)
|
||||
matids.append(2)
|
||||
|
||||
# Create stacked layer mesh and fill
|
||||
# Reverse arrays so that order is from bottom to top!!!
|
||||
stack_files.reverse()
|
||||
nlayers.reverse()
|
||||
matids.reverse()
|
||||
stack = lg.create()
|
||||
stack.stack_layers(stack_files,nlayers=nlayers,matids=matids,flip_opt=True)
|
||||
stack_hex = stack.stack_fill()
|
||||
|
||||
# Create boundary facesets, dictionary of PyLaGriT faceset objects is returned
|
||||
fs = stack_hex.create_boundary_facesets(base_name='faceset_bounds',stacked_layers=True,reorder=True)
|
||||
|
||||
# Should add this to PyLaGriT, but I'm feeling lazy ;-)
|
||||
stack_hex.sendline('quality volume itetclr')
|
||||
|
||||
# Write exo file with boundary facesets
|
||||
stack_hex.dump_exo('arctic_siteb_2d.exo',facesets=fs.values())
|
||||
|
||||
# Write region and faceset identifier file for ats_xml
|
||||
matnames = {10000:'computational domain peat',
|
||||
20000:'computational domain upper mineral'}
|
||||
facenames = {1:'bottom face',
|
||||
2:'surface',
|
||||
3:'front',
|
||||
4:'right',
|
||||
5:'back',
|
||||
6:'left'}
|
||||
|
||||
stack_hex.dump_ats_xml('arctic_siteb_2d_mesh.xml','/scratch/tundra/dharp/arctic/geophysics/mesh/from_lucia/arctic_siteb_2d.exo',matnames=matnames,facenames=facenames)
|
||||
stack_hex.dump_ats_xml('arctic_siteb_2d_par4_mesh.xml','/scratch/tundra/dharp/arctic/geophysics/mesh/from_lucia/arctic_siteb_2d.par',matnames=matnames,facenames=facenames)
|
||||
Reference in New Issue
Block a user