⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circle.html

📁 五点差分型多重网格方法:各种插值算子的比较)
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"                "http://www.w3.org/TR/REC-html40/loose.dtd"><html><head>  <title>Description of circle</title>  <meta name="keywords" content="circle">  <meta name="description" content="CIRCLE simulates adaptive grids for a problem with moving circlular">  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">  <meta name="robots" content="index, follow">  <link type="text/css" rel="stylesheet" href="../../m2html.css"></head><body><a name="_top"></a><!-- # AFEM@matlab --><!-- menu.html 1_Example --><h1>circle</h1><h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2><div class="box"><strong>CIRCLE simulates adaptive grids for a problem with moving circlular</strong></div><h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2><div class="box"><strong>function circle </strong></div><h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2><div class="fragment"><pre class="comment"> CIRCLE simulates adaptive grids for a problem with moving circlular singularities.</pre></div><!-- crossreference --><h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>This function calls:<ul style="list-style-image:url(../../matlabicon.gif)"><li><a href="../../AFEM@matlab/3_Estimate/estimate.html" class="code" title="function eta = estimate(mesh)">estimate</a>	ESTIMATE computes ZZ error estimator on each element</li><li><a href="../../AFEM@matlab/4_Refine/bisection.html" class="code" title="function [mesh,eta] = bisection(mesh,eta,theta)">bisection</a>	BISECTION	refines the triangulation using newest vertex bisection</li><li><a href="../../AFEM@matlab/4_Refine/coarsening.html" class="code" title="function [mesh,eta] = coarsening(mesh,eta,theta)">coarsening</a>	COARSENING coarsens the current mesh</li><li><a href="../../AFEM@matlab/5_Mesh/getmesh.html" class="code" title="function mesh = getmesh(node,elem,Dirichlet,Neumann,type,solu)">getmesh</a>	GETMESH generates initial mesh data structure.</li></ul>This function is called by:<ul style="list-style-image:url(../../matlabicon.gif)"><li><a href="demo.html" class="code" title="function varargout = demo(varargin)">demo</a>	DEMO M-file for demo.fig</li></ul><!-- crossreference --><h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2><ul style="list-style-image:url(../../matlabicon.gif)"><li><a href="#_sub1" class="code">function z = u(p,t)</a></li></ul><h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2><div class="fragment"><pre><a name="_sub0" href="#_subfunctions" class="code">function circle</a><span class="comment">% CIRCLE simulates adaptive grids for a problem with moving circlular</span><span class="comment">% singularities.</span><span class="comment">%</span><span class="comment">% L. Chen &amp; C. Zhang 11-15-2006</span><span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% Initialize Figure Window</span><span class="comment">%--------------------------------------------------------------------------</span>figure(1); set(gcf,<span class="string">'Units'</span>,<span class="string">'normal'</span>); set(gcf,<span class="string">'Position'</span>,[0.02,0.1,0.8,0.6]);<span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% Parameters</span><span class="comment">%--------------------------------------------------------------------------</span>theta = 0.3; theta_c = 0.1; t0 = 1.1; <span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% PreStep 0: generate initial mesh</span><span class="comment">%--------------------------------------------------------------------------</span>node = [-1,-1; 0,-1; 1,-1; -1,0; 0,0; 1,0; -1,1; 0,1; 1,1];elem = [2,5,1; 3,6,2; 4,1,5; 5,2,6; 5,8,4; 7,4,8; 6,9,5; 8,5,9];Dirichlet = []; Neumann = [];mesh = <a href="../../AFEM@matlab/5_Mesh/getmesh.html" class="code" title="function mesh = getmesh(node,elem,Dirichlet,Neumann,type,solu)">getmesh</a>(node,elem,Dirichlet,Neumann);<span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% PreStep 1: uniform mesh refinement</span><span class="comment">%--------------------------------------------------------------------------</span><span class="keyword">for</span> i=1:4    mesh = <a href="../../AFEM@matlab/4_Refine/bisection.html" class="code" title="function [mesh,eta] = bisection(mesh,eta,theta)">bisection</a>(mesh,ones(size(mesh.elem,1),1),1);<span class="keyword">end</span>mesh.solu = <a href="#_sub1" class="code" title="subfunction z = u(p,t)">u</a>(mesh.node,t0); <span class="comment">% now we pretent we know exact solution</span><span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% PreStep 2: mesh refinement of initial data</span><span class="comment">%--------------------------------------------------------------------------</span><span class="keyword">for</span> i=1:6    eta = <a href="../../AFEM@matlab/3_Estimate/estimate.html" class="code" title="function eta = estimate(mesh)">estimate</a>(mesh);    [mesh,eta] = <a href="../../AFEM@matlab/4_Refine/bisection.html" class="code" title="function [mesh,eta] = bisection(mesh,eta,theta)">bisection</a>(mesh,eta.^2,theta);<span class="keyword">end</span><span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% AFEM</span><span class="comment">%--------------------------------------------------------------------------</span><span class="keyword">for</span> t = t0:-0.1:0.25        <span class="comment">% Coarsen</span>    <span class="keyword">for</span> i = 1:5,        mesh.solu = <a href="#_sub1" class="code" title="subfunction z = u(p,t)">u</a>(mesh.node,t); <span class="comment">% now we pretent we know exact solution</span>        eta = <a href="../../AFEM@matlab/3_Estimate/estimate.html" class="code" title="function eta = estimate(mesh)">estimate</a>(mesh).^2;        [mesh,eta] = <a href="../../AFEM@matlab/4_Refine/coarsening.html" class="code" title="function [mesh,eta] = coarsening(mesh,eta,theta)">coarsening</a>(mesh,eta,theta_c);    <span class="keyword">end</span>    <span class="comment">% Refine</span>    <span class="keyword">for</span> i = 1:5,        mesh.solu = <a href="#_sub1" class="code" title="subfunction z = u(p,t)">u</a>(mesh.node,t); <span class="comment">% now we pretent we know exact solution</span>        eta = <a href="../../AFEM@matlab/3_Estimate/estimate.html" class="code" title="function eta = estimate(mesh)">estimate</a>(mesh).^2;        [mesh,eta] = <a href="../../AFEM@matlab/4_Refine/bisection.html" class="code" title="function [mesh,eta] = bisection(mesh,eta,theta)">bisection</a>(mesh,eta,theta);    <span class="keyword">end</span>    mesh.solu = <a href="#_sub1" class="code" title="subfunction z = u(p,t)">u</a>(mesh.node,t);    <span class="comment">% Graphic representation</span>    subplot(1,2,2); hold off;     trisurf(mesh.elem,mesh.node(:,1),mesh.node(:,2),zeros(size(mesh.node,1),1));    view(2), axis equal, axis off;    title(sprintf(<span class="string">'Mesh at time %5.4f'</span>,t), <span class="string">'FontSize'</span>, 14)    subplot(1,2,1); hold off;    trisurf(mesh.elem, mesh.node(:,1), mesh.node(:,2), mesh.solu', <span class="keyword">...</span>        <span class="string">'FaceColor'</span>, <span class="string">'interp'</span>, <span class="string">'EdgeColor'</span>, <span class="string">'interp'</span>);    view(60,50), axis equal, axis off;    title(<span class="string">'Solution to the circle problem'</span>, <span class="string">'FontSize'</span>, 14)    pause(0.2)   <span class="keyword">end</span>mesh<span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% End of function CIRCLE</span><span class="comment">%--------------------------------------------------------------------------</span><span class="comment">%--------------------------------------------------------------------------</span><span class="comment">% Sub functions called by CIRCLE</span><span class="comment">%--------------------------------------------------------------------------</span><a name="_sub1" href="#_subfunctions" class="code">function z = u(p,t) </a><span class="comment">% exact solution</span><span class="comment">%</span><span class="comment">% NOTE</span><span class="comment">%    Singularities is on a moving circle</span><span class="comment">%</span><span class="comment">% epsilon is the width of circle</span>epsilon = 0.05;r = max(sum(p.^2,2).^(1/2),eps);z = exp(-((r-0.5*t)/epsilon).^2);<span class="comment">%--------------------------------------------------------------------------</span></pre></div><hr><address>Generated on Fri 17-Nov-2006 11:02:53 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -