Exemplo n.º 1
0
def main():
    
    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS         = {'problem_type'          : 'solid',
                         'mesh_domain'           : ''+basepath+'/input/blockshex_domain.xdmf',
                         'mesh_boundary'         : ''+basepath+'/input/blockshex_boundary.xdmf',
                         'fiber_data'            : {'nodal' : [''+basepath+'/input/fib1_blockshex.txt',''+basepath+'/input/fib2_blockshex.txt']},
                         'write_results_every'   : 1,
                         'output_path'           : ''+basepath+'/tmp/',
                         'results_to_write'      : ['displacement','cauchystress','vonmises_cauchystress','pk1stress','pk2stress','glstrain','eastrain','jacobian','fiber1','fiber2'],
                         'simname'               : 'solid_mat_uniax_hex_2field'}

    SOLVER_PARAMS     = {'solve_type'            : 'direct', # direct, iterative
                         'tol_res'               : 1.0e-8,
                         'tol_inc'               : 1.0e-8,
                         'maxiter'               : 25,
                         'divergence_continue'   : None}

    TIME_PARAMS       = {'maxtime'               : 1.0,
                         'numstep'               : 1,
                         'timint'                : 'static'}
    
    FEM_PARAMS        = {'order_disp'            : 2, # hex27 elements
                         'order_pres'            : 1, # hex8 elements
                         'quad_degree'           : 4, # should yield 27 Gauss points
                         'incompressible_2field' : True} # True, False

    MATERIALS         = {'MAT1' : {'neohooke_dev'       : {'mu' : 10.}},
                         'MAT2' : {'mooneyrivlin_dev'   : {'c1' : 2.5, 'c2' : 2.5}},
                         'MAT3' : {'holzapfelogden_dev' : {'a_0' : 0.059, 'b_0' : 8.023, 'a_f' : 18.472, 'b_f' : 16.026, 'a_s' : 2.481, 'b_s' : 11.120, 'a_fs' : 0.216, 'b_fs' : 11.436, 'fiber_comp' : False}}}



    # analytical incompressible P_11 solutions for stretch in 1-direction (= x-direction):
    
    # constraint is lam_1 * lam_2 * lam_3 = 1
    # strain in 1-direction: lam := lam_1 ---> lam_2 = lam_3 = lam_q ---> lam_q = 1 / sqrt(lam)

    # I1 = lam_1^2 + lam_2^2 + lam_3^2 = lam^2 + 2/lam
    # I2 = lam_1^2 * lam_2^2 + lam_1^2 * lam_3^2 + lam_2^2 * lam_3^2 = 2 lam + 1/lam^2

    # NeoHooke
    def P_nh(lam):
        mu = MATERIALS['MAT1']['neohooke_dev']['mu']
        return mu*(lam-1./lam**2.)

    # Mooney Rivlin
    def P_mr(lam):
        c1, c2 = MATERIALS['MAT2']['mooneyrivlin_dev']['c1'], MATERIALS['MAT2']['mooneyrivlin_dev']['c2']
        return 2.*c1*(lam-1./(lam**2.)) + 2.*c2*(1.-1./(lam**3.))

    # Holzapfel-Ogden with fiber f0 in 1-direction, fiber s0 in 2-direction (I8 term cancels!)
    # no fiber compression, so cross-strains are equal (wouldn't be if s0 would constribute in compression!)
    def P_ho(lam):
        a_0, b_0 = MATERIALS['MAT3']['holzapfelogden_dev']['a_0'], MATERIALS['MAT3']['holzapfelogden_dev']['b_0']
        a_f, b_f = MATERIALS['MAT3']['holzapfelogden_dev']['a_f'], MATERIALS['MAT3']['holzapfelogden_dev']['b_f']
        a_s, b_s = MATERIALS['MAT3']['holzapfelogden_dev']['a_s'], MATERIALS['MAT3']['holzapfelogden_dev']['b_s']
        return a_0*(lam-1./lam**2.)*np.exp(b_0*(lam**2. + 2./lam - 3.)) + \
               a_f * 2.*lam*(lam**2.-1)*np.exp(b_f*(lam**2.-1.)**2.)


    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        
        def tc1(self, t):
            umax = 1.0
            return umax*t/TIME_PARAMS['maxtime']

        def tc2(self, t):
            umax = 1.0
            return umax*t/TIME_PARAMS['maxtime']
        
        def tc3(self, t):
            umax = 0.1
            return umax*t/TIME_PARAMS['maxtime']
        
        # PK1 stress that yields to a x-displacement of 1.0 for NH material
        def tc4(self, t):
            tmax = 17.5
            return tmax*t/TIME_PARAMS['maxtime']
        
        # PK1 stress that yields to a x-displacement of 1.0 for MR material
        def tc5(self, t):
            tmax = 13.125
            return tmax*t/TIME_PARAMS['maxtime']
        
        # PK1 stress that yields to a x-displacement of 0.1 for HO material
        def tc6(self, t):
            tmax = 17.32206451195601
            return tmax*t/TIME_PARAMS['maxtime']



    BC_DICT           = { 'dirichlet' : [{'id' : [1], 'dir' : 'x', 'val' : 0.},
                                         {'id' : [2], 'dir' : 'y', 'val' : 0.},
                                         {'id' : [3], 'dir' : 'z', 'val' : 0.},
                                         #{'id' : [4], 'dir' : 'x', 'curve' : [1]},
                                         {'id' : [7], 'dir' : 'x', 'val' : 0.},
                                         {'id' : [8], 'dir' : 'y', 'val' : 0.},
                                         {'id' : [9], 'dir' : 'z', 'val' : 0.},
                                         #{'id' : [10], 'dir' : 'x', 'curve' : [2]},
                                         {'id' : [13], 'dir' : 'x', 'val' : 0.},
                                         {'id' : [14], 'dir' : 'y', 'val' : 0.},
                                         {'id' : [15], 'dir' : 'z', 'val' : 0.}],
                                         #{'id' : [16], 'dir' : 'x', 'curve' : [3]}]}
                            'neumann' : [{'type' : 'pk1', 'id' : [4], 'dir' : 'xyz', 'curve' : [4,0,0]},
                                         {'type' : 'pk1', 'id' : [10], 'dir' : 'xyz', 'curve' : [5,0,0]},
                                         {'type' : 'pk1', 'id' : [16], 'dir' : 'xyz', 'curve' : [6,0,0]}] }


    # problem setup
    problem = ambit.Ambit(IO_PARAMS, TIME_PARAMS, SOLVER_PARAMS, FEM_PARAMS, MATERIALS, BC_DICT, time_curves=time_curves())
    
    # solve time-dependent problem
    problem.solve_problem()

    
    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(np.array([1.0, 1.0, 1.0]))
    check_node.append(np.array([1.0, 3.0, 1.0]))
    check_node.append(np.array([1.0, 5.0, 1.0]))

    u_corr = np.zeros(3*len(check_node))
    
    ## correct results
    u_corr[0] = 1.0 # x
    u_corr[1] = -2.9289321881345320E-01 # y
    u_corr[2] = -2.9289321881345320E-01 # z
    
    u_corr[3] = 1.0 # x
    u_corr[4] = -2.9289321881345320E-01 # y
    u_corr[5] = -2.9289321881345320E-01 # z
    
    u_corr[6] = 0.1 # x
    u_corr[7] = -4.6537410754407753E-02 # y
    u_corr[8] = -4.6537410754407753E-02 # z

    check1 = results_check.results_check_node(problem.mp.u, check_node, u_corr, problem.mp.V_u, problem.mp.comm, tol=tol, nm='u')
    success = results_check.success_check([check1], problem.mp.comm)
    
    return success
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type':
        'solid',  # solid, fluid, flow0d, solid_flow0d, fluid_flow0d
        'mesh_domain': '' + basepath + '/input/block2_domain.xdmf',
        'mesh_boundary': '' + basepath + '/input/block2_boundary.xdmf',
        'write_results_every': -999,
        'output_path': '' + basepath + '/tmp/',
        'results_to_write': [''],
        'simname': 'solid_robin_static_prestress'
    }

    SOLVER_PARAMS = {
        'solve_type': 'direct',  # direct, iterative
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8
    }

    TIME_PARAMS = {'maxtime': 1.0, 'numstep': 1, 'timint': 'static'}

    FEM_PARAMS = {
        'order_disp': 1,
        'order_pres': 1,
        'quad_degree': 1,
        'incompressible_2field': False,
        'prestress_initial': True
    }

    MATERIALS = {'MAT1': {'stvenantkirchhoff': {'Emod': 1000., 'nu': 0.3}}}

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            return 3.

    BC_DICT = {
        'dirichlet': [{
            'id': [1, 2, 3],
            'dir': 'z',
            'val': 0.
        }],
        'neumann': [{
            'type': 'pk1',
            'id': [3],
            'dir': 'xyz',
            'curve': [1, 0, 0]
        }],
        'robin': [{
            'type': 'spring',
            'id': [1, 2],
            'dir': 'normal',
            'stiff': 5.0
        }]
    }

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS,
                          SOLVER_PARAMS,
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves())

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(
        np.array([
            -1.0000000000000000e+00, -1.0000000000000000e+00,
            1.0000000000000000e+01
        ]))

    u_corr = np.zeros(3 * len(check_node))

    ## correct results
    u_corr[0] = 0.0  # x
    u_corr[1] = 0.0  # y
    u_corr[2] = 0.0  # z

    check1 = results_check.results_check_node(problem.mp.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    success = results_check.success_check([check1], problem.mp.comm)

    return success
Exemplo n.º 3
0
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type':
        'solid',  # solid, fluid, flow0d, solid_flow0d, fluid_flow0d
        'mesh_domain': '' + basepath + '/input/heart2D_domain.xdmf',
        'mesh_boundary': '' + basepath + '/input/heart2D_boundary.xdmf',
        'fiber_data': {
            'nodal': ['' + basepath + '/input/fib_fiber_coords_nodal_2D.txt']
        },
        'write_results_every': -999,
        'output_path': '' + basepath + '/tmp/',
        'results_to_write': ['displacement', 'pressure', 'fiberstretch'],
        'simname': 'solid_2Dheart_frankstarling'
    }

    SOLVER_PARAMS_SOLID = {
        'solve_type': 'direct',  # direct, iterative
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8,
        'ptc': False
    }

    TIME_PARAMS_SOLID = {
        'maxtime': 1.0,
        'numstep': 10,
        'numstep_stop': 5,
        'timint': 'genalpha',
        'theta_ost': 1.0,
        'rho_inf_genalpha': 0.8
    }

    FEM_PARAMS = {
        'order_disp': 2,
        'order_pres': 1,
        'quad_degree': 5,
        'incompressible_2field': True
    }

    MATERIALS = {
        'MAT1': {
            'mooneyrivlin_dev': {
                'c1': 60.,
                'c2': -20.
            },
            'active_fiber': {
                'sigma0': 100.0,
                'alpha_max': 15.0,
                'alpha_min': -20.0,
                'activation_curve': 3,
                'frankstarling': True,
                'amp_min': 1.,
                'amp_max': 1.7,
                'lam_threslo': 1.01,
                'lam_maxlo': 1.15,
                'lam_threshi': 999.,
                'lam_maxhi': 9999.
            },
            'inertia': {
                'rho0': 1.0e-5
            },
            'rayleigh_damping': {
                'eta_m': 0.001,
                'eta_k': 0.0001
            }
        }
    }

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            pmax = -16.
            if t <= 0.2:
                return pmax * t / 0.2
            else:
                return pmax

        def tc2(self, t):
            pmax = -4.
            if t <= 0.2:
                return pmax * t / 0.2
            else:
                return pmax

        def tc3(self, t):

            K = 5.
            t_contr, t_relax = 0.2, 1000.

            alpha_max = MATERIALS['MAT1']['active_fiber']['alpha_max']
            alpha_min = MATERIALS['MAT1']['active_fiber']['alpha_min']

            c1 = t_contr + alpha_max / (K * (alpha_max - alpha_min))
            c2 = t_relax - alpha_max / (K * (alpha_max - alpha_min))

            # Diss Hirschvogel eq. 2.101
            return (K * (t - c1) + 1.) * (
                (K * (t - c1) + 1.) > 0.) - K * (t - c1) * (
                    (K * (t - c1)) > 0.) - K * (t - c2) * (
                        (K * (t - c2)) > 0.) + (K * (t - c2) - 1.) * (
                            (K * (t - c2) - 1.) > 0.)

    BC_DICT = {
        'dirichlet': [{
            'dir': '2dimZ',
            'val': 0.
        }],
        'neumann': [{
            'type': 'true',
            'id': [1],
            'dir': 'normal',
            'curve': 1
        }, {
            'type': 'true',
            'id': [2],
            'dir': 'normal',
            'curve': 2
        }],
        'robin': [{
            'type': 'spring',
            'id': [3],
            'dir': 'normal',
            'stiff': 0.075
        }]
    }

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS_SOLID,
                          SOLVER_PARAMS_SOLID,
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves())

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(
        np.array(
            [-21.089852094479845, -26.26308841783208, 9.227760327944651e-16]))

    u_corr = np.zeros(3 * len(check_node))

    ## correct results
    u_corr[0] = 4.9439615617476127E+00  # x
    u_corr[1] = 2.4846265243158223E+00  # y
    u_corr[2] = 0.0  # z

    check1 = results_check.results_check_node(problem.mp.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    success = results_check.success_check([check1], problem.mp.comm)

    return success
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type':
        'solid_constraint',  # solid, fluid, flow0d, solid_flow0d, fluid_flow0d
        'mesh_domain': '' + basepath + '/input/chamber_domain.xdmf',
        'mesh_boundary': '' + basepath + '/input/chamber_boundary.xdmf',
        'write_results_every': -999,
        'output_path': '' + basepath + '/tmp/',
        'results_to_write': ['displacement', 'pressure'],
        'simname': 'solid_constraint_volume_chamber'
    }

    SOLVER_PARAMS_SOLID = {
        'solve_type': 'direct',  # direct, iterative
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8
    }

    SOLVER_PARAMS_CONSTR = {'tol_res': 1.0e-8, 'tol_inc': 1.0e-8}

    TIME_PARAMS_SOLID = {
        'maxtime': 1.0,
        'numstep': 10,
        'numstep_stop': 5,
        'timint': 'ost',
        'theta_ost': 1.0
    }

    FEM_PARAMS = {
        'order_disp': 1,
        'order_pres': 1,
        'quad_degree': 1,
        'incompressible_2field': True
    }  # True, False

    CONSTRAINT_PARAMS = {
        'surface_ids': [[3]],
        'constraint_quantity': 'volume',
        'prescribed_curve': [1]
    }

    MATERIALS = {
        'MAT1': {
            'neohooke_dev': {
                'mu': 100.
            },
            'inertia': {
                'rho0': 1.0e-6
            }
        }
    }

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            vini = 1.
            vmax = 2.0
            return (vmax - vini) * t / TIME_PARAMS_SOLID['maxtime'] + vini

    BC_DICT = {
        'dirichlet': [{
            'id': [1],
            'dir': 'x',
            'val': 0.
        }, {
            'id': [3],
            'dir': 'y',
            'val': 0.
        }, {
            'id': [3],
            'dir': 'z',
            'val': 0.
        }]
    }

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS_SOLID,
                          [SOLVER_PARAMS_SOLID, SOLVER_PARAMS_CONSTR],
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves(),
                          coupling_params=CONSTRAINT_PARAMS)

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(np.array([1.5, 0.75, 0.75]))

    u_corr = np.zeros(3 * len(check_node))

    ## correct results
    u_corr[0] = 7.1440094913591246E-01  # x
    u_corr[1] = -1.1768897247463314E-02  # y
    u_corr[2] = 4.5878411920493023E-03  # z

    check1 = results_check.results_check_node(problem.mp.pbs.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.pbs.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    success = results_check.success_check([check1], problem.mp.comm)

    return success
Exemplo n.º 5
0
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type':
        'solid',
        'mesh_domain':
        '' + basepath + '/input/block_domain.xdmf',
        'mesh_boundary':
        '' + basepath + '/input/block_boundary.xdmf',
        'write_results_every':
        -999,
        'output_path':
        '' + basepath + '/tmp/',
        'results_to_write': [
            'displacement', 'pressure', 'theta', 'trmandelstress',
            'trmandelstress_e'
        ],
        'simname':
        'test_solid_growth_volstressmandel'
    }

    SOLVER_PARAMS = {
        'solve_type': 'direct',
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8
    }

    TIME_PARAMS = {'maxtime': 1.0, 'numstep': 5, 'timint': 'static'}

    FEM_PARAMS = {
        'order_disp': 1,
        'quad_degree': 1,
        'incompressible_2field': False
    }

    MATERIALS = {
        'MAT1': {
            'neohooke_dev': {
                'mu': 10.
            },
            'ogden_vol': {
                'kappa': 10. / (1. - 2. * 0.49)
            },
            'growth': {
                'growth_dir':
                'isotropic',  # isotropic, fiber, crossfiber, radial
                'growth_trig':
                'volstress',  # fibstretch, volstress, prescribed
                'growth_thres': -25.0,
                'thetamax': 3.0,
                'thetamin': 1.0,
                'tau_gr': 20.0,
                'gamma_gr': 2.0,
                'tau_gr_rev': 10000.0,
                'gamma_gr_rev': 2.0
            }
        }
    }

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            pmax = -10.
            return pmax * t / TIME_PARAMS['maxtime']

    BC_DICT = {
        'dirichlet': [{
            'id': [1],
            'dir': 'x',
            'val': 0.
        }, {
            'id': [2],
            'dir': 'y',
            'val': 0.
        }, {
            'id': [3],
            'dir': 'z',
            'val': 0.
        }],
        # hydrostatic Neumann on all faces
        'neumann': [{
            'type': 'true',
            'id': [1, 2, 3, 4, 5, 6],
            'dir': 'normal',
            'curve': 1
        }]
    }

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS,
                          SOLVER_PARAMS,
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves())

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(
        np.array([1.00000000e+00, 1.00000000e+00, 1.00000000e+00]))

    u_corr = np.zeros(3 * len(check_node))

    ## correct results
    u_corr[0] = 1.7091249480527462E-01  # x
    u_corr[1] = 1.7091249480527512E-01  # y
    u_corr[2] = 1.7091249480527512E-01  # z

    check1 = results_check.results_check_node(problem.mp.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    success = results_check.success_check([check1], problem.mp.comm)

    return success
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type':
        'solid',
        'mesh_domain':
        '' + basepath + '/input/blockhex_domain.xdmf',
        'mesh_boundary':
        '' + basepath + '/input/blockhex_boundary.xdmf',
        'fiber_data': {
            'nodal': [
                '' + basepath + '/input/fib1_blockhex.txt',
                '' + basepath + '/input/fib2_blockhex.txt'
            ]
        },
        'write_results_every':
        -999,
        'output_path':
        '' + basepath + '/tmp/',
        'results_to_write': [
            'displacement', 'theta', 'fiberstretch', 'fiberstretch_e',
            'phi_remod'
        ],
        'simname':
        'solid_growthremodeling_fiberstretch'
    }

    SOLVER_PARAMS_SOLID = {
        'solve_type': 'direct',
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8
    }

    TIME_PARAMS_SOLID = {'maxtime': 1.0, 'numstep': 20, 'timint': 'static'}

    FEM_PARAMS = {
        'order_disp': 1,
        'order_pres': 1,
        'quad_degree': 3,
        'incompressible_2field': False
    }

    MATERIALS = {
        'MAT1': {
            'neohooke_dev': {
                'mu': 10.
            },
            'ogden_vol': {
                'kappa': 10. / (1. - 2. * 0.49)
            },
            'growth': {
                'growth_dir':
                'isotropic',  # isotropic, fiber, crossfiber, radial
                'growth_trig':
                'fibstretch',  # fibstretch, volstress, prescribed
                'growth_thres': 1.15,
                'thetamax': 3.0,
                'thetamin': 1.0,
                'tau_gr': 1.0,
                'gamma_gr': 1.72,
                'tau_gr_rev': 10000.0,
                'gamma_gr_rev': 1.0,
                'remodeling_mat': {
                    'neohooke_dev': {
                        'mu': 3.
                    },
                    'ogden_vol': {
                        'kappa': 3. / (1. - 2. * 0.49)
                    }
                }
            }
        }
    }

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            pmax = 10.0
            return pmax * t / TIME_PARAMS_SOLID['maxtime']

    BC_DICT = {
        'dirichlet': [{
            'id': [1],
            'dir': 'x',
            'val': 0.
        }, {
            'id': [2],
            'dir': 'y',
            'val': 0.
        }, {
            'id': [3],
            'dir': 'z',
            'val': 0.
        }],
        'neumann': [{
            'type': 'pk1',
            'id': [4],
            'dir': 'xyz',
            'curve': [1, 0, 0]
        }]
    }

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS_SOLID,
                          SOLVER_PARAMS_SOLID,
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves())

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(np.array([1.0, 1.0, 1.0]))

    u_corr = np.zeros(3 * len(check_node))

    ## correct results
    u_corr[0] = 1.0812823521095760E+00  # x
    u_corr[1] = -1.4360291810029382E-01  # y
    u_corr[2] = -1.4360291810029457E-01  # z

    check1 = results_check.results_check_node(problem.mp.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    success = results_check.success_check([check1], problem.mp.comm)

    return success
def main():

    basepath = str(Path(__file__).parent.absolute())

    IO_PARAMS = {
        'problem_type': 'solid',
        'mesh_domain': '' + basepath + '/input/lv_domain.xdmf',
        'mesh_boundary': '' + basepath + '/input/lv_boundary.xdmf',
        'write_results_every': -999,
        'output_path': '' + basepath + '/tmp/',
        'results_to_write': ['displacement', 'theta'],
        'simname': 'solid_growth_prescribed_iso_lv'
    }

    FEM_PARAMS = {
        'order_disp': 1,
        'order_pres': 1,
        'quad_degree': 1,
        'incompressible_2field': True
    }

    SOLVER_PARAMS_SOLID = {
        'solve_type': 'direct',  # direct, iterative
        'tol_res': 1.0e-8,
        'tol_inc': 1.0e-8
    }

    TIME_PARAMS_SOLID = {'maxtime': 1.0, 'numstep': 10, 'timint': 'static'}

    MATERIALS = {
        'MAT1': {
            'neohooke_dev': {
                'mu': 100.
            },
            'growth': {
                'growth_dir': 'isotropic',
                'growth_trig': 'prescribed',
                'prescribed_curve': 1
            }
        }
    }

    # define your load curves here (syntax: tcX refers to curve X, to be used in BC_DICT key 'curve' : [X,0,0], or 'curve' : X)
    class time_curves():
        def tc1(self, t):
            thetamax = 2.0
            gr = thetamax - 1.
            return 1.0 + gr * t / TIME_PARAMS_SOLID['maxtime']

    BC_DICT = {'dirichlet': [{'id': [2], 'dir': 'all', 'val': 0.}]}

    # problem setup
    problem = ambit.Ambit(IO_PARAMS,
                          TIME_PARAMS_SOLID,
                          SOLVER_PARAMS_SOLID,
                          FEM_PARAMS,
                          MATERIALS,
                          BC_DICT,
                          time_curves=time_curves())

    # solve time-dependent problem
    problem.solve_problem()

    # --- results check
    tol = 1.0e-6

    check_node = []
    check_node.append(
        np.array([3.475149154663086, -3.17646312713623, -74.3183364868164]))

    u_corr, p_corr = np.zeros(3 * len(check_node)), np.zeros(len(check_node))

    ## correct results (apex node)
    u_corr[0] = -9.3743445617845182E+00  # x
    u_corr[1] = 1.0877463102123736E+01  # y
    u_corr[2] = -1.0954897338860498E+02  # z

    p_corr[0] = -9.3006817518134621E+00

    check1 = results_check.results_check_node(problem.mp.u,
                                              check_node,
                                              u_corr,
                                              problem.mp.V_u,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='u')
    check2 = results_check.results_check_node(problem.mp.p,
                                              check_node,
                                              p_corr,
                                              problem.mp.V_p,
                                              problem.mp.comm,
                                              tol=tol,
                                              nm='p')

    success = results_check.success_check([check1, check2], problem.mp.comm)

    return success