Skip to content

Instantly share code, notes, and snippets.

View cpraveen's full-sized avatar

Praveen C cpraveen

View GitHub Profile
/* ---------------------------------------------------------------------
*
* Copyright (C) 2013 - 2020 by the deal.II authors
*
* This file is part of the deal.II library.
*
* The deal.II library is free software; you can use it, 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.
@cpraveen
cpraveen / test_adapt.py
Last active April 27, 2019 21:09
Testing adapt in Fenics
"""
-Laplace(u) = 0 in [-1/2,+1/2] x [0,1]
u = (1/pi)*atan2(y,x) on boundary
Experiments to try:
0) Run test_adapt.py to see the effect of refining a triangle
1) Set nstep=5 and refine_type='uniform' and run the code. See the solution
using paraview. Copy conv.dat to conv1.dat
2) Set nstep=20 and refine_type='adaptive' and run the code. See the solution
using paraview. Copy conv.dat to conv2.dat
3) Start matlab and run the matlab code conv.m to see the convergence of L2
@cpraveen
cpraveen / demo.py
Created May 31, 2017 01:29
Computing flux for a dirichlet problem using lagrange multipliers
"""
Solve
Laplace(u) = 0 in unit circle
with
u = -y on the boundary
We use Lagrange multipliers to implement dirichlet bc. The stress on the boundary is computed by a post-processing step in the end. The scheme is explained in
Gunzburger and Hou
TREATING INHOMOGENEOUS ESSENTIAL BOUNDARY CONDITIONS IN FINITE ELEMENT METHODS AND THE CALCULATION OF BOUNDARY STRESSES
SIAM J. Num. Anal., vol. 20, no. 2, pp. 390-424, April 1992
@cpraveen
cpraveen / surface_quad.cc
Last active September 23, 2016 06:14
Testing sphere surface quadrature
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_in.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/tria_boundary_lib.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_tools.h>
@cpraveen
cpraveen / problem.h
Last active August 11, 2016 03:37
MappingQ + SphericalManifold
#ifndef __PROBLEM_H__
#define __PROBLEM_H__
namespace SWM
{
using namespace dealii;
// Base class to define problem initial condition, etc.
template <int dim>