Skip to content

Instantly share code, notes, and snippets.

View jwpeterson's full-sized avatar

John W. Peterson jwpeterson

View GitHub Profile
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/ucd_io.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/elem.h"
using namespace libMesh;
// Uncomment this or compile with -DOLD_STYLE_BOUNDARY_IDS to test
// old-style boundary_ids() function.
@jwpeterson
jwpeterson / netgen_test_04.cc
Created October 23, 2015 19:19
Small example demonstrating meshing of constructive solid geometry (CSG) with Netgen via libmesh
#include <iostream>
#include <fstream>
#include <map>
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/point.h"
#include "libmesh/cell_tet4.h"
// NOTE: This example only works if you have built and installed
@jwpeterson
jwpeterson / Makefile
Created October 22, 2015 19:49
Simple Makefile that can compile single file libmesh applications.
# This Makefile assumes you have libmesh built and installed in $LIBMESH_DIR.
# If the user has no environment variable
# called METHOD, he gets optimized mode.
ifeq (x$(METHOD),x)
METHOD := opt
endif
# installed libmesh location of libmesh-config script
libmesh_config := $(LIBMESH_DIR)/bin/libmesh-config
@jwpeterson
jwpeterson / andrew_yt.cc
Created October 22, 2015 19:23
Evaluate solution at given point in Hex20 element.
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/elem.h"
#include "libmesh/cell_hex20.h"
#include "libmesh/fe.h"
#include "libmesh/fe_interface.h"
using namespace libMesh;
// This is an example hopfully showing YT people how to evaluate
@jwpeterson
jwpeterson / netgen_test_02.cc
Created October 22, 2015 16:18
Test demonstrating meshing a 2D surface with Netgen from within libmesh
#include <iostream>
#include <fstream>
#include <map>
#include <cstdlib> // std::getenv()
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/point.h"
#include "libmesh/face_tri3.h"
@jwpeterson
jwpeterson / netgen_test_01.cc
Created October 22, 2015 16:16
Simple example code demonstrating calling netgen from libmesh
#include <iostream>
#include <fstream>
#include <map>
#include <cstdlib> // std::getenv()
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/point.h"
#include "libmesh/cell_tet4.h"
// #include "libmesh/exodusII_io.h"
// This utility code is used for generating the embedding matrix for the Prism15 element
#include <iomanip> // std::setw
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/elem.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/mesh_modification.h"
#include "libmesh/getpot.h"
#include "libmesh/fe_interface.h"
// This test code is to investigate David Knezevic's bad Tet10
#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/elem.h"
#include "libmesh/cell_tet10.h"
// Bring in the libmesh namespace
using namespace libMesh;
int main (int argc, char** argv)
// This example tests out the calculation of second derivatives
// Run me with:
// ./second_derivs-opt -d 2 -n 2 -o FIRST -ksp_monitor -pc_type hypre -pc_hypre_type boomeramg > second_derivs.log
// C++ include files that we need
#include <iostream>
#include <algorithm>
#include <math.h>
#include <set>
@jwpeterson
jwpeterson / pyramid13.maple
Created December 8, 2013 04:50
Compute and verify basis functions and derivatives for 13 node pyramid elements.
# "Serendipity" pyramid element functions, as defined in:
#
# G. Bedrosian, "Shape functions and integration formulas for
# three-dimensional finite element analysis", Int. J. Numerical
# Methods Engineering, vol 35, p. 95-108, 1992.
#
# This pyramid has 13 nodes and a "serendipity" quad on the bottom.
# Bedrosian uses the same size reference element as we want to use,
# but a different node numbering. The purpose of this script is to
# make sure his basis functions check out. Bedrosian also uses