1 | % This file can be run to check that the conduction is correctly modeled.
|
---|
2 | % There is no velocity (no advection) the only thermal boundary conditions are an imposed temperature
|
---|
3 | % at the lower and upper surface. The result must be a linear temperature from the upper to the lower
|
---|
4 | % surface. if it is not the case, something is thermal modeling has been changed...
|
---|
5 | printingflag=false;
|
---|
6 |
|
---|
7 | md=model;
|
---|
8 | md=setmesh(md,'../Exp/Square.exp',100000);
|
---|
9 | md=setmask(md,'all','');
|
---|
10 | md=parameterize(md,'../Par/SquareThermal.par');
|
---|
11 | md=extrude(md,11,2);
|
---|
12 | md=setflowequation(md,'Pattyn','all');
|
---|
13 | pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10;
|
---|
14 | pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0;
|
---|
15 | md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
|
---|
16 |
|
---|
17 | %analytical results
|
---|
18 | %d2T/dz2=0 T(bed)=10 T(surface)=0 => T=0*(z-bed)/thickness+10*(surface-z)/thickness
|
---|
19 | %each layer of the 3d mesh must have a constant value
|
---|
20 | md.initialization.temperature=10*(md.geometry.surface-md.mesh.z)./md.geometry.thickness;
|
---|
21 |
|
---|
22 | %modeled results
|
---|
23 | md.cluster=generic('name',oshostname(),'np',2);
|
---|
24 | md=solve(md,ThermalSolutionEnum);
|
---|
25 |
|
---|
26 | %plot results
|
---|
27 | comp_temp=zeros(md.mesh.numberofvertices,1);
|
---|
28 | comp_temp(md.results.ThermalSolution.Temperature.index)=md.results.ThermalSolution.Temperature.value;
|
---|
29 | relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100;
|
---|
30 | relative(find(comp_temp==md.initialization.temperature))=0;
|
---|
31 | plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
|
---|
32 | 'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,...
|
---|
33 | 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
|
---|
34 | 'figposition','mathieu','FontSize#all',20)
|
---|
35 | if printingflag,
|
---|
36 | set(gcf,'Color','w')
|
---|
37 | printmodel('thermalconduction','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
|
---|
38 | system(['mv thermalconduction.png ' ISSM_DIR '/website/doc_pdf/validation/Images/Thermal ']);
|
---|
39 | end
|
---|
40 |
|
---|
41 | %Fields and tolerances to track changes
|
---|
42 | field_names ={'ConductionTemperature'};
|
---|
43 | field_tolerances={1e-13};
|
---|
44 | field_values ={comp_temp};
|
---|