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