Editing Bim package
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish 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| | {{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>}} | ||
<pre> | |||
epsilon = .1; | epsilon = .1; | ||
phi = xu + yu; | phi = xu + yu; | ||
</ | </pre> | ||
<b> Construct the discretized operators</b> | <b> Construct the discretized operators</b> | ||
Line 137: | Line 136: | ||
<B> Solve for the | <B> Solve for the displacements</B> | ||
{{Code| | {{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| | {{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> | ||
<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); | ||
</ | </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]] | ||
<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); | ||
</ | </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> | ||
<pre> | |||
pdesurf (mesh.p, mesh.t, u) | pdesurf (mesh.p, mesh.t, u) | ||
</ | </pre> | ||
it will look like this | it will look like this |