This is a demonstration code for the paper Direct Serendipity and Mixed Finite Elements on Convex Polygons.
You should make the files to build an executable file directpoly.$(TARG), where TARG is a variable containing the instruction set architecture of your processor. Note that you need CBLAS and LAPACKE library to successfully build the file.
make
./directpoly.$(TARG)
Nodal basis functions as defined in the paper on each elements, except for that we choose vertex basis functions to be linear on each edge, are constructed in directSerendipityFE.cpp
and assembled in ellipticPDE.cpp
to serve as global basis functions. However, in directSerendipityFE.cpp
, if you do not want to remove cell degrees of freedom, find the following lines at three places and comment them out.
//Deduct value at interior nodes if needed
for (int k=0; k<nCellNodes(); k++) {
phi_pt -= phi_e_at_c[k] * value_n[k + num_vertices*polynomial_degree + pt_index*num_nodes];
gradresult -= phi_e_at_c[k] * gradvalue_n[k + num_vertices*polynomial_degree + pt_index*num_nodes];
}
You can use either hybrid mixed method or H(div)-conforming mixed spaces by setting the corresponding input in infile
.
You could interpolate functions by direct serendipity basis functions and graph the interpolated function as well as its gradient in the following part of ellipticPDE.cpp
. You can also directly modify the coefficients of basis functions for mixed spaces, as well as discrete Galerkin spaces for elements and edges, then graph their sum in the following part of mixedPDEConf.cpp
and mixedPDEHybrid.cpp
.
// TEST BASIS FUNCTIONS //////////////////////////////////////////////////
if(true) {
...
}
Problem formulation is given in the heading comments of main.cpp
. Coefficients a, b, c, D, and all the other related data could be modified in fcns.cpp
. Note that the source function as well as Riemann boundary condition are defaultly calculated by true solution. If in your formulation, analytical solution is unknown, please rewrite these parts.
Basic results of running the codes are printed to the terminal. All the output files would be stored preambly in test/
directory, which could be modified in the first line of infile
.
The development of this code has been supported by the U.S. National Science Foundation.
Copyright (C) 2022 Todd Arbogast and Chuning Wang
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.