Skip to content

Instantly share code, notes, and snippets.

Avatar

Yiannis Simillides ysimillides

View GitHub Profile
View FEniCS.jl docker image
FROM quay.io/fenicsproject/stable:current
LABEL maintainer=" Yiannis Simillides <yiannis.simillides@gmail.com>"
RUN apt-get update -y && apt-get install -y make gcc g++ bzip2 hdf5-tools unzip gfortran curl
WORKDIR /
RUN mkdir -p /opt/julia-0.6.3 && \
curl -s -L https://julialang-s3.julialang.org/bin/linux/x64/0.6/julia-0.6.3-linux-x86_64.tar.gz | tar -C /opt/julia-0.6.3 -x -z --strip-components=1 -f -
View todo list gsoc
Coding
re-evaluate arithmetic operations for Forms in jfem.jl
add integer points (currently only support double) so we can create Points([2,2]) instead of needing to write Points([2.,2.])
set_subdomain and boundary mesh tests
possible create jinterface file?
Blog post on mesh type
@ysimillides
ysimillides / pandaplot.py
Created Apr 29, 2018
Plot a 2d time-domain problem in pandas
View pandaplot.py
#Let solution be our solution array
#with x,y and z being the first, second, and third index respectively.
import pandas as pd
x_pd= solution[0]
y_pd = solution[1]
z_pd = solution[2]
#We assume we already have the array for t, (this can also be created if needed, based on the dims of the previous iterates.
#We create a DataFrame object to store, and display our results if needed
df = pd.DataFrame({"time": t , "x": x_pd.flatten(), "y": y_pd.flatten(), "z": z_pd.flatten()})
#we define the number of iterates we wish to display
@ysimillides
ysimillides / GSOC 2017 : A FEniCS Wrapper for the Julia Language.md
Last active Mar 4, 2020
My documentation for the final evaluation of GSOC 2017
View GSOC 2017 : A FEniCS Wrapper for the Julia Language.md

Introduction

Throughout this Google Summer of Code project I, along with my mentors, aimed to create a Wrapper for the FEniCS Finite Element Toolbox in the Julia Language. Our work done can be found at FEniCS.jl . This would allow users to perform FEM calculations directly in Julia, utilizing our PyCall.jl wrapping functionality. We currently have wrapped the main functionality, along with providing the necessary instructions to add further components when they are deemed necessary. Members of the Julia community not directly related to the project also contributed small fixes and suggestions throughout the project. The majority of the code produced has already been merged to the GitHub repository (which was created specifically for this project). One of the main improvements which would greatly increase its usage would be the further integration with the JuliaDiffEq package.

What is FEniCS?

FEniCS describes itself as a pop

@ysimillides
ysimillides / Helpful Items for FEniCS.jl
Created Aug 23, 2017
a list of helpful gists for usage alongside FEniCS.jl
View Helpful Items for FEniCS.jl
#to add various functionality / extend functions, take a look at https://gist.github.com/ysimillides/160bbf50a7e99d6656398aee48c88ef7
#to see some of the main differences between the julian wrapper and a pythonic FEniCS look at https://gist.github.com/ysimillides/30fdbd71951c5e29e5f999635410b6de
#for a brief overview of its usage take a look at https://gist.github.com/ysimillides/d73c501f7f151c35d5002e8a11908a6e
@ysimillides
ysimillides / init fix
Last active Aug 16, 2017
small example of how to fix precompilation in FEniCS.jl
View init fix
#replace @pyimport fenics with the following code below.
const fenics = PyNULL()
function __init__()
copy!(fenics, pyimport_conda("fenics", "FEniCS", "conda-forge"))
end
#to now call a function we need to change UnitTriangleMesh() = Mesh(fenics.UnitTriangleMesh()) to
UnitTriangleMesh() = Mesh(fenics[:UnitTriangleMesh]())
@ysimillides
ysimillides / differences.jl
Created Aug 14, 2017
fenics.jl differences
View differences.jl
#Throughout the project we have tried to keep the API and the usage the same as direct interfacing with FEniCS.
#Due to some design preferences and technical issues they're may be slight differences in various parts.
#Regarding the Solve Funtion in FEniCS ,depending on the functionality we call
lvsolve , nlvsolve, anlvsolve #depending on what kind of solve we desire.
lvsolve # is the linear variational solver
nlvsolve # is the non-linear variational solver
anlvsolve # corresponds to the adapative non-linear solver.
#For the DirichletBC, whereas in FEniCS we would define a function as
def u0_boundary(x, on_boundary):
return on_boundary
View add_functionality.jl
#The main things needed to wrap and use the FEniCS package are access to
#functions and their attributes. Occasionally *types* may also be defined to allow
#easier use and function overloading. fenicspycall is used to access attributes and fenicsclass is used to define types(classes in FEniCS).
#These can be found in the FEniCS.jl main file.
#Assuming we now want to define the Mesh Class found here https://fenicsproject.org/olddocs/dolfin/1.5.0/python/programmers-reference/cpp/mesh/Mesh.html .
#We simply call @fenicsclass Mesh . If we want to access their attributes we can simply create access to them as follows
#hmin(mesh::Mesh) = fenicspycall(mesh, :hmin)
#Now we may wish to create access to the function https://fenicsproject.org/olddocs/dolfin/1.5.0/python/programmers-reference/cpp/mesh/UnitSquareMesh.html .
@ysimillides
ysimillides / workflow-example.jl
Last active Aug 14, 2017
workflow-example-fenics.jl
View workflow-example.jl
push!(LOAD_PATH,"/home/ysimillides/Downloads/FEniCS.jl-master/src")
using FEniCS
using PyCall
@pyimport fenics
mesh = UnitSquareMesh(8,8)
V = FunctionSpace(mesh,"P",1)
u_D = Expression("1+x[0]*x[0]+2*x[1]*x[1]",degree=2)
bc1 = DirichletBC(V,u_D, "on_boundary")
u=TrialFunction(V)
v=TestFunction(V)