"./Data/neutral_buoyancy")  # the disk address where the files are saved
simulProp.gravity = True  # set up the gravity flag
simulProp.tolFractFront = 3e-3  # increase the tolerance for fracture
# front iteration
simulProp.plotTSJump = 4  # plot every fourth time step
simulProp.saveTSJump = 2  # save every second time step
simulProp.maxSolverItrs = 200  # increase the Anderson iteration limit for the
# elastohydrodynamic solver
simulProp.tmStpPrefactor = np.asarray([[0, 80000], [0.5, 0.1]
                                       ])  # set up the time step prefactor
simulProp.timeStepLimit = 5000  # time step limit
simulProp.plotVar = ['w',
                     'v']  # plot fracture width and fracture front velocity
simulProp.set_mesh_extension_direction(
    ['top', 'horizontal'])  # allow the fracture to extend in positive y and x
simulProp.set_mesh_extension_factor(1.2)  # set the extension factor to 1.4
simulProp.useBlockToeplizCompression = True  # use the Toepliz elasticity matrix to save memory

# initializing a static fracture
C = load_isotropic_elasticity_matrix_toepliz(Mesh, Solid.Eprime)
Fr_geometry = Geometry('radial', radius=300)
init_param = InitializationParameters(Fr_geometry,
                                      regime='static',
                                      net_pressure=0.5e6,
                                      elasticity_matrix=C)

Fr = Fracture(Mesh, init_param, Solid, Fluid, Injection, simulProp)

# create a controller
controller = Controller(Fr, Solid, Fluid, Injection, simulProp)
simulProp.projMethod = 'LS_continousfront'
simulProp.frontAdvancing = 'implicit'
simulProp.useBlockToeplizCompression = True
simulProp.saveToDisk = False
simulProp.bckColor = 'K1c'
simulProp.saveFluidVelAsVector = True

# To decide what you will see when you print:
#simulProp.plotVar = ['ffvf','regime']
#simulProp.plotVar = ['footprint','regime']
#simulProp.plotVar = ['footprint']

# setting up mesh extension options
simulProp.meshExtensionAllDir = True
simulProp.maxElementIn = 10000
simulProp.set_mesh_extension_factor(1.1)
simulProp.set_mesh_extension_direction(['all'])
simulProp.meshReductionPossible = True
simulProp.maxCellSize = 0.1

# initialization parameters
Fr_geometry = Geometry('radial', radius=0.1, center=[0.1, 0.])
init_param = InitializationParameters(Fr_geometry, regime='M')

# creating fracture object
Fr = Fracture(Mesh, init_param, Solid, Fluid, Injection, simulProp)

################################################################################
# the following lines are needed if you want to restart an existing simulation #
################################################################################
# from visualization import *
Injection = InjectionProperties(Q0, Mesh)

# fluid properties
Fluid = FluidProperties(viscosity=1.1e-3)

# simulation properties
simulProp = SimulationProperties()
simulProp.finalTime = 145.  # the time at which the simulation stops
simulProp.bckColor = 'sigma0'  # setting the parameter according to which the mesh is colored
simulProp.set_outputFolder(
    "./Data/height_contained")  # set the directory to save the simulation
simulProp.tmStpPrefactor = 1.0  # decreasing the size of time step
simulProp.plotVar = ['footprint']  # plotting footprint
simulProp.set_mesh_extension_direction(
    ['horizontal'])  # allow the mesh to extend horizontally
simulProp.set_mesh_extension_factor(1.35)  # setting the mesh extension factor
simulProp.useBlockToeplizCompression = True  # use the Toepliz elasticity to save memory

# initializing fracture
Fr_geometry = Geometry(shape='radial', radius=1.)
init_param = InitializationParameters(Fr_geometry, regime='M')

# creating fracture object
Fr = Fracture(Mesh, init_param, Solid, Fluid, Injection, simulProp)

# create a Controller
controller = Controller(Fr, Solid, Fluid, Injection, simulProp)

# run the simulation
controller.run()