Output of FE solution in 2D hp-adaptive space
Filename |
waveprop/showSol2D.cc |
- Output of a finite element solution in 2D or its gradient to a file format readable by Matlab.
Call |
showSol2D.cc -f <FILE> -v <VFILE> [-c -d] |
Usage
The files for the mesh are expected to have the following specified relation to the input file <FILE>
e.g. for the input file
example.cig
it is searched for:
example_Coord.dat |
File with coordinates of the mesh vertices. |
example_Elms.dat |
File with information of the mesh cells. |
example_Attr.dat |
File with cell, edge and vertex attributes. |
example_EdgRadia.dat |
File with radia of circular edges. |
example_EdgCorr.dat |
File with information about periodic edges. |
Furthermore, semi-infinite rectangles can be defined via the file for the input parameter.
Type |
Name (default value) |
Stands for |
Compulsory |
string array |
InfiniteQuad (empty) |
Array of semi-infinite rectangles, e.g.
string array InfiniteQuad {
1 "2 1 4",
2 "104 103 4"
}
|
No |
The mesh, the refinement information and the boundary condition, given with the input parameters, have to coincide with those which have been used to generate the finite element solution,
i.e. the same finite element space will be generated.
In <VFILE> the coefficient vector of the finite element solution is stored and one of the flags
-c
and
-d
has been used to define the data type (complex double or double).
Type |
Name (default value) |
Stands for |
Compulsory |
string |
dirichl_bdAttrib ( "" ) |
List of attributes of edges with Dirichlet boundary condition, the attributes are separated by spaces, e.g. "1 3 8 7" |
No |
int |
p (1) |
Starting polynomial degree, will be set at least to 1. |
No |
string |
refinement ( "" ) |
Further refinement, e.g. ="p2 in 1, h2 in 2, p2|0 in 3". |
No |
|
|
h -refinement |
"h" - once |
|
|
|
|
"h2" - twice |
|
|
|
|
"h2|1" - twice in local x1-direction and once in x2-direction. |
|
|
|
p -refinement |
"p" - increase polynomial degrees by 1 |
|
|
|
|
"p2" - increase polynomial degrees by 2 |
|
|
|
|
"p2|0" - increase in local x1-direction by 2 |
|
|
|
only in some cells |
"p2|0 in 3" - refinement as above, but only in cells with attribute 3 |
|
|
|
h - or hp -refinement towards vertices or edges |
"hp -> v101" - one step of hp -refinement towards the vertex/vertices with attribute 101 |
|
|
|
|
h2 in 3 -> e20" - twofold h -refinement towards the edge(s) with attribute 20, only in cells with attribute 3 |
|
bool |
trunk ( true ) |
Use of linear trunk space. |
No |
string |
quadrature_type ( "trapeze" ) |
Points on which the solution will be evaluated are quadrature point of some rule. Trapezoidal rule corresponds to uniform points. As also the weights of the quadrature are written it make sense to define other quadrature types. |
No |
|
""trapeze" |
Trapezoidal rule. |
|
|
""gauss_lobatto" |
Gauß-Lobatto rule. |
|
|
""gauss_jacobi" |
Gauß-Jacobi rule. |
|
int |
graphicpoints (12) |
Number of points in each direction of each cell. |
No |
string |
graphicfun |
Function of the solution, by default solution itself. |
No |
|
"" |
The solution itself. |
|
|
"grad" |
The function of the gradient. |
|
string |
outputdirectory (".") |
Directory of the output files, by default the current working directory (where the executable is called from), and related to current the working directory. |
No |
string |
outputprefix (<FILEPRE>) |
Prefix of the output files, for input file example.cig the prefix is by default example . |
No |
bool |
verbose (false) |
Let print more information out. |
No |
Output
Filename |
sol.m in the same directory as <VFILE> |
Type |
Matlab |
Variables |
Attr |
Atributes of the cells. |
|
edgeAttr |
Edge attributes for each cell, i.e. four attributes for each quadrilateral, cell after cell. |
|
edgemsh |
Indices of the points on the edges of the mesh, cell after cell. |
|
msh |
Indices of the points in the cells of the mesh, cell after cell. |
|
p |
Polynomial degrees in each cell (two rows with polynomial degrees). |
|
u |
FE solution or a function of it on the (quadrature) points. Each component is in one row, e.g. the gradient has two rows. |
|
vtxmsh |
Indices of the points on the vertices of the mesh, five for each quadrilateral to form a cycle, cell after cell. |
|
w |
Quadrature weights on the quadrature points. |
|
x |
Physical x-coordinate of the (quadrature) points. |
|
y |
Physical x-coordinate of the (quadrature) points. |
|
U |
Cell arrays where each entrance is row of u . |
The
FE-mesh of triangles or quadrilaterials is given by
edgemsh
, while
vtxmsh
consists of the vertices. For a FE-mesh with cells with only straight edges its more efficient to use
vtxmsh
instead of
edgemesh
. In each column there are the numbers of the vertices of one cell given, and can be plotted by
plot(x(edgemsh),y(edgemsh),'k');
The solution itself can be shown as flat plot with
patch(x(msh), y(msh), u(msh), 'edgecolor', 'none')
or as surface plot
patch(x(msh), y(msh), u(msh), u(msh), 'edgecolor', 'none')
You can plot the gradient of the solution with
quiver(x(msh), y(msh), U{1}(msh), U{2}(msh))