Editing Bim package

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 65: Line 65:
 
to see the mesh you can use functions from the [[fpl_package|fpl package]]
 
to see the mesh you can use functions from the [[fpl_package|fpl package]]
  
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">
+
{{Code|Plot mesh in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">
 
pdemesh (mesh.p, mesh.e, mesh.t)
 
pdemesh (mesh.p, mesh.e, mesh.t)
 
view (2)
 
view (2)
Line 80: Line 80:
 
xu    = mesh.p(1,:).';
 
xu    = mesh.p(1,:).';
 
yu    = mesh.p(2,:).';
 
yu    = mesh.p(2,:).';
</syntaxhighlight>
+
</syntaxhighlight>}}  
}}
 
  
  
Line 91: Line 90:
 
</syntaxhighlight>}}  
 
</syntaxhighlight>}}  
  
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">
+
<pre>
 
epsilon = .1;
 
epsilon = .1;
 
phi    = xu + yu;
 
phi    = xu + yu;
</syntaxhighlight>}}
+
</pre>
  
 
<b> Construct the discretized operators</b>
 
<b> Construct the discretized operators</b>
Line 137: Line 136:
  
  
<B> Solve for the tracer density</B>
+
<B> Solve for the displacements</B>
  
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">  
+
{{Code|Displacement in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">  
 
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];
 
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];
 
u = ud;
 
u = ud;
Line 148: Line 147:
 
<b> Compute the fluxes through Dirichlet sides</b><br>
 
<b> Compute the fluxes through Dirichlet sides</b><br>
  
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">  
+
{{Code|Fluxes at sides in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">  
 
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;
 
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;
 
</syntaxhighlight>}}
 
</syntaxhighlight>}}
Line 161: Line 160:
 
<B> Compute the internal Advection-Diffusion flux</B>
 
<B> Compute the internal Advection-Diffusion flux</B>
  
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">
+
<pre>
 
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);
 
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);
</syntaxhighlight>}}
+
</pre>
  
 
<B> Export data to VTK format</B>
 
<B> Export data to VTK format</B>
Line 170: Line 169:
 
or [[https://wci.llnl.gov/codes/visit/|visit]]
 
or [[https://wci.llnl.gov/codes/visit/|visit]]
  
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px">
+
<pre>
 
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);
 
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);
</syntaxhighlight>}}
+
</pre>
  
 
you can also plot your data directly in Octave using <code> pdesurf </code>
 
you can also plot your data directly in Octave using <code> pdesurf </code>
  
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px">
+
<pre>
 
pdesurf (mesh.p, mesh.t, u)
 
pdesurf (mesh.p, mesh.t, u)
</syntaxhighlight>}}
+
</pre>
  
 
it will look like this
 
it will look like this

Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: