source: issm/trunk/test/NightlyRun/test1302.m@ 13975

Last change on this file since 13975 was 13975, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13974

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1% This file can be run to check that the advection-diffusion is correctly modeled.
2% There is u=v=0 and w=cst everywhere the only thermal boundary conditions are an imposed temperature
3% at upper surface and an impose flux at its base.
4printingflag=false;
5
6md=model();
7md=triangle(md,'../Exp/Square.exp',100000.);
8md=setmask(md,'','');
9md=parameterize(md,'../Par/SquareThermal.par');
10md=extrude(md,30,1.); %NB: the more one extrudes, the better (10-> relative~0.35%, 20->0.1%, 30->0.05%)
11md=setflowequation(md,'Pattyn','all');
12
13%Thermal boundary conditions
14pos1=find(md.mesh.elementonbed); md.thermal.spctemperature(md.mesh.elements(pos1,1:3))=10;
15pos2=find(md.mesh.elementonsurface); md.thermal.spctemperature(md.mesh.elements(pos2,4:6))=0;
16md.initialization.vz=0.1*ones(md.mesh.numberofvertices,1);
17md.initialization.vel=sqrt( md.initialization.vx.^2+ md.initialization.vy.^2+ md.initialization.vz.^2);
18md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
19
20md.thermal.stabilization=2;
21%analytical results
22%d2T/dz2-w*rho_ice*c/k*dT/dz=0 T(surface)=0 T(bed)=10 => T=A exp(alpha z)+B
23alpha=0.1/md.constants.yts*md.materials.rho_ice*md.materials.heatcapacity/md.materials.thermalconductivity; %alpha=w rho_ice c /k and w=0.1m/an
24A=10/(exp(alpha*(-1000))-1); %A=T(bed)/(exp(alpha*bed)-1) with bed=-1000 T(bed)=10
25B=-A;
26md.initialization.temperature=A*exp(alpha*md.mesh.z)+B;
27
28%modeled results
29md.cluster=generic('name',oshostname(),'np',2);
30md=solve(md,ThermalSolutionEnum());
31
32%plot results
33comp_temp=md.results.ThermalSolution.Temperature;
34relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100;
35relative(find(comp_temp==md.initialization.temperature))=0;
36plotmodel(md,'data',comp_temp,'title','Modeled temperature [K]','data',md.initialization.temperature,'view',3,...
37 'title','Analytical temperature [K]','view',3,'data',comp_temp-md.initialization.temperature,...
38 'title','Absolute error [K]','view',3,'data',relative,'title','Relative error [%]','view',3,...
39 'figposition','mathieu','FontSize#all',20)
40if printingflag,
41 set(gcf,'Color','w')
42 printmodel('thermaladvection','png','margin','on','marginsize',25,'frame','off','resolution',0.7,'hardcopy','off');
43 system(['mv thermaladvection.png ' ISSM_DIR '/website/doc_pdf/validation/Images/EISMINT ']);
44end
45
46%Fields and tolerances to track changes
47field_names ={'AdvectionTemperature'};
48field_tolerances={1e-13};
49field_values ={comp_temp};
Note: See TracBrowser for help on using the repository browser.