Commit ff873c92 by Jeremy BLEYER

### More work on multiphase model

parent fb4e7fea
 ... @@ -12,7 +12,7 @@ from ufl import diag ... @@ -12,7 +12,7 @@ from ufl import diag width = 1. width = 1. height = 1. height = 1. mesh = RectangleMesh(Point(0., 0.), Point(width, height), 20, 10) mesh = RectangleMesh(Point(0., 0.), Point(width, height), 10, 10) Ve = VectorElement("CG", mesh.ufl_cell(), 1) Ve = VectorElement("CG", mesh.ufl_cell(), 1) V = FunctionSpace(mesh, MixedElement([Ve, Ve])) V = FunctionSpace(mesh, MixedElement([Ve, Ve])) ... @@ -38,9 +38,17 @@ facets = MeshFunction("size_t", mesh, 1) ... @@ -38,9 +38,17 @@ facets = MeshFunction("size_t", mesh, 1) ds = Measure("ds", subdomain_data=facets) ds = Measure("ds", subdomain_data=facets) mat_prop = {"MatrixYoungModulus": 70e3, "MatrixPoissonRatio": 0.2, "FiberYoungModulus": 200e3, "FiberPoissonRatio": 0.3, "FiberVolumeFraction": 0.1, "Size": 0.1} material = mf.MFrontNonlinearMaterial("materials/src/libBehaviour.so", material = mf.MFrontNonlinearMaterial("materials/src/libBehaviour.so", "TwoPhasesGeneralizedElasticity", "MultiphaseModel", hypothesis="plane_strain") hypothesis="plane_strain", material_properties=mat_prop) problem = mf.MFrontNonlinearProblem(u, material, quadrature_degree=0) problem = mf.MFrontNonlinearProblem(u, material, quadrature_degree=0) problem.bc = bc problem.bc = bc ... @@ -50,12 +58,24 @@ problem.register_gradient("RelativeDisplacement", diag(u2-u1), symmetric=True) ... @@ -50,12 +58,24 @@ problem.register_gradient("RelativeDisplacement", diag(u2-u1), symmetric=True) problem.solve(u.vector()) problem.solve(u.vector()) u1 = u.sub(0, True) x = np.linspace(width/2, width, 21) u2 = u.sub(1, True) x = np.linspace(0, width, 100) import matplotlib.pyplot as plt import matplotlib.pyplot as plt plt.figure() plt.figure() plt.plot(x, np.array([u1(xi, height/2)[0] for xi in x]), label=r"\$u_x\$ (matrix)") plt.plot(x, np.array([u(xi, height/2)[0] for xi in x]), "ob", label=r"\$u_x\$ (matrix, size={})".format(mat_prop["Size"])) plt.plot(x, np.array([u2(xi, height/2)[0] for xi in x]), label=r"\$u_x\$ (inclusion)") plt.plot(x, np.array([u(xi, height/2)[2] for xi in x]), "or", label=r"\$u_x\$ (fiber, size={})".format(mat_prop["Size"])) # mat_prop["Size"] = 0.02 # problem2 = mf.MFrontNonlinearProblem(u, material, quadrature_degree=0) # problem2.bc = bc # problem2.register_gradient("MatrixStrain", sym(grad(u1)), symmetric=True) # problem2.register_gradient("InclusionStrain", sym(grad(u2)), symmetric=True) # problem2.register_gradient("RelativeDisplacement", diag(u2-u1), symmetric=True) # u = Function(V) # problem2.solve(u.vector()) # plt.plot(x, np.array([u(xi, height/2)[0] for xi in x]), "sb", markerfacecolor="None", label=r"\$u_x\$ (matrix, size={})".format(mat_prop["Size"])) # plt.plot(x, np.array([u(xi, height/2)[2] for xi in x]), "sr", markerfacecolor="None", label=r"\$u_x\$ (fiber, size={})".format(mat_prop["Size"])) plt.legend() plt.legend() plt.show() plt.show() \ No newline at end of file
 @DSL DefaultGenericBehaviour; @Behaviour MultiPhase; @Author Thomas Helfer; @Date 15/02/2019; @Gradient real eps1; @Flux real sig1; @Gradient real toto; @Flux real sig2; @Gradient real V; @Flux real I; // @AdditionalTangentOperatorBlock dsig1_deps1; @Parameter C11 = 10e3; @Parameter C12 = 5e-4; @Parameter C22 = 2e3; @Parameter kappa = 1e6; @Integrator{ sig1 = C11*(eps1+deps1); sig2 = C22*(toto+dtoto); I = kappa*V } // end of @Integrator @TangentOperator { //dj_ddgT = k * tmatrix::Id(); dsig1_ddeps1 = C11* Stensor4::Id(); } // end of @TangentOperator
 @DSL DefaultGenericBehaviour; @Behaviour MultiphaseModel; @ModellingHypotheses {PlaneStrain}; @Gradient StrainStensor e₁; e₁.setEntryName("MatrixStrain"); @Flux StressStensor σ₁; σ₁.setEntryName("MatrixStress"); @Gradient StrainStensor e₂; e₂.setEntryName("InclusionStrain"); @Flux StressStensor σ₂; σ₂.setEntryName("InclusionStress"); @Gradient StrainStensor V; V.setEntryName("RelativeDisplacement"); @Flux StressStensor I; I.setEntryName("InteractionForce"); @TangentOperatorBlock ∂σ₁∕∂Δe₁; @AdditionalTangentOperatorBlock ∂σ₁∕∂Δe₂; @AdditionalTangentOperatorBlock ∂σ₂∕∂Δe₁; @AdditionalTangentOperatorBlock ∂σ₂∕∂Δe₂; @AdditionalTangentOperatorBlock ∂I∕∂ΔV; @MaterialProperty stress Y1; Y1.setEntryName("MatrixYoungModulus"); @MaterialProperty real nu1; nu1.setEntryName("MatrixPoissonRatio"); @MaterialProperty stress Y2; Y2.setEntryName("FiberYoungModulus"); @MaterialProperty real nu2; nu2.setEntryName("FiberPoissonRatio"); @MaterialProperty real rho; rho.setEntryName("FiberVolumeFraction"); @MaterialProperty real s; s.setEntryName("Size"); @ProvidesTangentOperator; @Integrator { // remove useless warnings, as we always compute the tangent operator static_cast(computeTangentOperator_); const auto λ₁ = computeLambda(Y1,nu1); const auto μ₁ = computeMu(Y1,nu1); const auto λ₂ = rho*computeLambda(Y2,nu2); const auto μ₂ = rho*computeMu(Y2,nu2); constexpr const auto λ₁₂ = 0.; constexpr const auto μ₁₂ = 0.; const auto kappa = μ₁/12/(1-rho)/pow(s,2); ∂σ₁∕∂Δe₁ = λ₁ ⋅ (I₂ ⊗ I₂) + 2 ⋅ μ₁ ⋅ I₄; ∂σ₁∕∂Δe₂ = λ₁₂ ⋅ (I₂ ⊗ I₂) + 2 ⋅ μ₁₂ ⋅ I₄; ∂σ₂∕∂Δe₁ = ∂σ₁∕∂Δe₂; ∂σ₂∕∂Δe₂ = λ₂ ⋅ (I₂⊗I₂) + 2 ⋅ μ₂ ⋅ I₄; σ₁ = ∂σ₁∕∂Δe₁ ⋅ e₁ + ∂σ₁∕∂Δe₂ ⋅ e₂; σ₂ = ∂σ₂∕∂Δe₁ ⋅ e₁ + ∂σ₂∕∂Δe₂ ⋅ e₂; I = kappa*V; ∂I∕∂ΔV = kappa ⋅ I₄; }
 /*! * \file IsotropicLinearHardeningPlasticity-generic.hxx * \brief This file declares the umat interface for the IsotropicLinearHardeningPlasticity behaviour law * \author Thomas Helfer * \date 14 / 10 / 2016 */ #ifndef LIB_GENERIC_ISOTROPICLINEARHARDENINGPLASTICITY_HXX #define LIB_GENERIC_ISOTROPICLINEARHARDENINGPLASTICITY_HXX #include"TFEL/Config/TFELConfig.hxx" #include"MFront/GenericBehaviour/BehaviourData.h" #ifdef _WIN32 #ifndef NOMINMAX #define NOMINMAX #endif /* NOMINMAX */ #include #ifdef small #undef small #endif /* small */ #endif /* _WIN32 */ #ifndef MFRONT_SHAREDOBJ #define MFRONT_SHAREDOBJ TFEL_VISIBILITY_EXPORT #endif /* MFRONT_SHAREDOBJ */ #ifdef __cplusplus extern "C"{ #endif /* __cplusplus */ MFRONT_SHAREDOBJ void IsotropicLinearHardeningPlasticity_setOutOfBoundsPolicy(const int); MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_setParameter(const char *const,const double); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_AxisymmetricalGeneralisedPlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_Axisymmetrical(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_PlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_GeneralisedPlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int IsotropicLinearHardeningPlasticity_Tridimensional(MFront_GB_BehaviourData* const); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* LIB_GENERIC_ISOTROPICLINEARHARDENINGPLASTICITY_HXX */
 /*! * \file StationaryHeatTransfer-generic.hxx * \brief This file declares the umat interface for the StationaryHeatTransfer behaviour law * \author Thomas Helfer * \date 15 / 02 / 2019 */ #ifndef LIB_GENERIC_STATIONARYHEATTRANSFER_HXX #define LIB_GENERIC_STATIONARYHEATTRANSFER_HXX #include"TFEL/Config/TFELConfig.hxx" #include"MFront/GenericBehaviour/BehaviourData.h" #ifdef _WIN32 #ifndef NOMINMAX #define NOMINMAX #endif /* NOMINMAX */ #include #ifdef small #undef small #endif /* small */ #endif /* _WIN32 */ #ifndef MFRONT_SHAREDOBJ #define MFRONT_SHAREDOBJ TFEL_VISIBILITY_EXPORT #endif /* MFRONT_SHAREDOBJ */ #ifdef __cplusplus extern "C"{ #endif /* __cplusplus */ MFRONT_SHAREDOBJ void StationaryHeatTransfer_setOutOfBoundsPolicy(const int); MFRONT_SHAREDOBJ int StationaryHeatTransfer_setParameter(const char *const,const double); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int StationaryHeatTransfer_AxisymmetricalGeneralisedPlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int StationaryHeatTransfer_Axisymmetrical(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int StationaryHeatTransfer_PlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int StationaryHeatTransfer_GeneralisedPlaneStrain(MFront_GB_BehaviourData* const); /*! * \param[in,out] d: material data */ MFRONT_SHAREDOBJ int StationaryHeatTransfer_Tridimensional(MFront_GB_BehaviourData* const); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* LIB_GENERIC_STATIONARYHEATTRANSFER_HXX */