source: issm/trunk-jpl/test/NightlyRun/test437.py@ 25719

Last change on this file since 25719 was 25719, checked in by jdquinn, 4 years ago

CHG: Correcting size retrieval

File size: 4.1 KB
Line 
1#Test Name: ThermalEnthBasalcondsTrans
2import numpy as np
3from model import *
4from socket import gethostname
5from triangle import *
6from setmask import *
7from parameterize import *
8from setflowequation import *
9from solve import *
10
11md = triangle(model(), '../Exp/Square.exp', 300000.)
12md = setmask(md, '', '')
13md = parameterize(md, '../Par/SquareThermal.py')
14
15h = 100.
16md.geometry.thickness = h * np.ones((md.mesh.numberofvertices, ))
17md.geometry.base = -h * np.ones((md.mesh.numberofvertices, ))
18md.geometry.surface = md.geometry.base + md.geometry.thickness
19
20md.extrude(41, 2.)
21md = setflowequation(md, 'HO', 'all')
22md.thermal.isenthalpy = True
23md.thermal.isdynamicbasalspc = True
24
25#Basal forcing
26Ts = 273.15 - 3.
27Tb = 273.15 - 1.
28Tsw = Tb
29qgeo = md.materials.thermalconductivity / max(md.geometry.thickness) * (Tb - Ts) #qgeo = kappa * (Tb - Ts) / H
30md.basalforcings.geothermalflux[np.where(md.mesh.vertexonbase)] = qgeo
31md.initialization.temperature = qgeo / md.materials.thermalconductivity * (md.geometry.surface - md.mesh.z) + Ts
32
33#Surface forcing
34pos = np.where(md.mesh.vertexonsurface)
35SPC_cold = float('NaN') * np.ones((md.mesh.numberofvertices, ))
36SPC_warm = float('NaN') * np.ones((md.mesh.numberofvertices, ))
37SPC_cold[pos] = Ts
38SPC_warm[pos] = Tsw
39md.thermal.spctemperature = SPC_cold
40md.timestepping.time_step = 5.
41t0 = 0.
42t1 = 10.
43t2 = 100.
44md.timestepping.final_time = 400.
45md.thermal.spctemperature = np.array([SPC_cold, SPC_cold, SPC_warm, SPC_warm, SPC_cold]).T
46md.thermal.spctemperature = np.vstack((md.thermal.spctemperature, [t0, t1 - 1, t1, t2 - 1, t2]))
47#print np.shape(md.thermal.spctemperature)
48#print md.thermal.spctemperature
49
50#Additional settings
51md.transient.ismasstransport = False
52md.transient.isstressbalance = False
53md.transient.issmb = True
54md.transient.isthermal = True
55md.thermal.stabilization = False
56
57#Go solve
58md.verbose = verbose(0)
59md.cluster = generic('name', gethostname(), 'np', 3)
60md = solve(md, 'Transient')
61
62#Fields and tolerances to track changes
63field_names = ['Enthalpy1', 'Temperature1', 'Waterfraction1', 'BasalMeltingRate1', 'Watercolumn1',
64 'Enthalpy2', 'Temperature2', 'Waterfraction2', 'BasalMeltingRate2', 'Watercolumn2',
65 'Enthalpy3', 'Temperature3', 'Waterfraction3', 'BasalMeltingRate3', 'Watercolumn3',
66 'Enthalpy4', 'Temperature4', 'Waterfraction4', 'BasalMeltingRate4', 'Watercolumn4']
67field_tolerances = [1.e-10, 1.e-10, 1.e-10, 1.e-9, 1.e-10,
68 1.e-10, 1.e-10, 1.e-10, 2.e-9, 2.e-10,
69 1.e-10, 1.e-10, 1.e-10, 2.e-9, 1.e-10,
70 1.e-10, 1.e-10, 1.e-10, 2.e-9, 1.e-10]
71i1 = 0
72i2 = int(np.ceil(t2 / md.timestepping.time_step) + 2) - 1
73i3 = int(np.ceil(md.timestepping.final_time / (2. * md.timestepping.time_step))) - 1
74i4 = len(md.results.TransientSolution) - 1
75field_values = [md.results.TransientSolution[i1].Enthalpy,
76 md.results.TransientSolution[i1].Temperature,
77 md.results.TransientSolution[i1].Waterfraction,
78 md.results.TransientSolution[i1].BasalforcingsGroundediceMeltingRate,
79 md.results.TransientSolution[i1].Watercolumn,
80 md.results.TransientSolution[i2].Enthalpy,
81 md.results.TransientSolution[i2].Temperature,
82 md.results.TransientSolution[i2].Waterfraction,
83 md.results.TransientSolution[i2].BasalforcingsGroundediceMeltingRate,
84 md.results.TransientSolution[i2].Watercolumn,
85 md.results.TransientSolution[i3].Enthalpy,
86 md.results.TransientSolution[i3].Temperature,
87 md.results.TransientSolution[i3].Waterfraction,
88 md.results.TransientSolution[i3].BasalforcingsGroundediceMeltingRate,
89 md.results.TransientSolution[i3].Watercolumn,
90 md.results.TransientSolution[i4].Enthalpy,
91 md.results.TransientSolution[i4].Temperature,
92 md.results.TransientSolution[i4].Waterfraction,
93 md.results.TransientSolution[i4].BasalforcingsGroundediceMeltingRate,
94 md.results.TransientSolution[i4].Watercolumn]
Note: See TracBrowser for help on using the repository browser.