Skip to content

Instantly share code, notes, and snippets.

View jwpeterson's full-sized avatar

John W. Peterson jwpeterson

View GitHub Profile
// 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>
// 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 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"
@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 / 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 / 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
#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.
#include "libmesh/libmesh.h"
#include "libmesh/dense_vector.h"
#include "libmesh/dense_matrix.h"
#include "libmesh/getpot.h"
#include "libmesh/perf_log.h"
#include <Eigen/SVD>
using namespace libMesh;
@jwpeterson
jwpeterson / write_element_data_test.cc
Created August 6, 2013 20:52
Sample code that demonstrates write_element_data not working with ParallelMesh.
// This utility lists all nodes on a given boundary ID.
#include "libmesh/libmesh.h"
#include "libmesh/serial_mesh.h"
#include "libmesh/parallel_mesh.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/equation_systems.h"
#include "libmesh/explicit_system.h"
#include "libmesh/dof_map.h"
#include "libmesh/numeric_vector.h"
#include "libmesh/exodusII_io.h"
@jwpeterson
jwpeterson / modified_transient_ex1.C
Last active December 24, 2015 12:08
Example demonstrating use of new "append" capability for Exodus files.
/* The libMesh Finite Element Library. */
/* Copyright (C) 2003 Benjamin S. Kirk */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation; either */
/* version 2.1 of the License, or (at your option) any later version. */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */