from dolfin import*

import numpy as np
from scipy import stats,special
import matplotlib as mp
from scipy.interpolate import griddata
from analytical_solution_sphere import*

import time
start_time = time.time()

#################import#####################################################

parameters["form_compiler"]["cpp_optimize"] = True
parameters["form_compiler"]["optimize"] = True

############################################################################
#Define the parameters for solution
#a=Sphere of the radius
#b=ratio between bulk and shere viscosity
#lam=ratio between the shear viscosity of the sphere and the substrate
#E = applied strain rate, the correlation between the elements of the array
#and the strain rate matrix  components is
#strain matrix E[0]=(1,1),E[1]=(2,2),E[2]=(3,3),E(3)=(1,2),E(4)=(1,3),E(6)=(2,3)

a=1.0
lam=10.0
b=1.0
E=np.array(6)
E=[0.5,0.5,-1.0,0.0,0.0,0.0]

#############################################################################
solution=flow(a,lam,b,E)
# The following function evokes solutions for velocity,
#pressure, compaction, and traction within the sphere
# and ouputs them into vtk files 
solution.calculate_internal_flow()
solution.calculate_external_flow()

print("--- %s seconds ---" % (time.time() - start_time))
