source: issm/branches/trunk-larour-NatGeoScience2016/test/NightlyRun/test1303.py@ 21759

Last change on this file since 21759 was 21759, checked in by Eric.Larour, 8 years ago

CHG: merged branch back to trunk-jpl 21754.

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#Test Name: ThermalConduction
2import numpy as np
3import sys
4from model import *
5from socket import gethostname
6from triangle import *
7from setmask import *
8from parameterize import *
9from setflowequation import *
10from solve import *
11
12
13"""
14This file can be run to check that the conduction is correctly modeled.
15There is no velocity (no advection) the only thermal boundary conditions are an imposed temperature
16at the lower and upper surface. The result must be a linear temperature from the upper to the lower
17surface. if it is not the case, something is thermal modeling has been changed...
18"""
19
20printingflag=False
21
22md=model()
23md=triangle(md,'../Exp/Square.exp',100000.)
24md=setmask(md,'all','')
25md=parameterize(md,'../Par/SquareThermal.py')
26md.extrude(11,2.)
27md=setflowequation(md,'HO','all')
28
29
30pos1=np.where(np.isnan(md.mesh.lowerelements))[0]
31md.thermal.spctemperature[md.mesh.elements[pos1,0:3]-1]=10.
32pos2=np.where(np.isnan(md.mesh.upperelements))[0]
33md.thermal.spctemperature[md.mesh.elements[pos2,3:6]-1]=0.
34md.initialization.pressure=np.zeros((md.mesh.numberofvertices),int)
35
36#analytical results
37#d2T/dz2=0 T(bed)=10 T(surface)=0 => T=0*(z-bed)/thickness+10*(surface-z)/thickness
38#each layer of the 3d mesh must have a constant value
39md.initialization.temperature=10.*(md.geometry.surface-md.mesh.z)/md.geometry.thickness
40
41#modeled results
42md.cluster=generic('name',gethostname(),'np',2)
43md=solve(md,'Thermal')
44
45#plot results
46comp_temp=md.results.ThermalSolution.Temperature
47relative=np.abs((comp_temp-md.initialization.temperature)/md.initialization.temperature)*100.
48relative[np.nonzero(comp_temp==md.initialization.temperature)[0]]=0.
49#plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
50# 'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,...
51# 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
52# 'figposition','mathieu','FontSize#all',20)
53if printingflag:
54 pass
55# set(gcf,'Color','w')
56# printmodel('thermalconduction','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off')
57# system(['mv thermalconduction.png ' ISSM_DIR '/website/doc_pdf/validation/Images/Thermal '])
58
59#Fields and tolerances to track changes
60field_names =['ConductionTemperature']
61field_tolerances=[1e-13]
62field_values =[comp_temp]
Note: See TracBrowser for help on using the repository browser.