원시데이터 수집 시스템
선정목록으로

JAX-FEM: A differentiable GPU-accelerated 3D finite element solver for automatic inverse design and mechanistic data science

간접 관련 엔지니어링 플라스틱 · (23) 컴파운드 (10) 아라미드(21) 에폭시수지

기본 정보

저자
  1. Tianju Xue — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
  2. Shuheng Liao — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
  3. Zhengtao Gan — Department of Aerospace and Mechanical Engineering, The University of Texas at El Paso, El Paso, 79968, TX, USA
  4. Chanwook Park — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
  5. Xiaoyu Xie — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
  6. Wing Kam Liu — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
  7. Jian Cao — Department of Mechanical Engineering, Northwestern University, Evanston, 60208, IL, USA
DOI
10.1016/j.cpc.2023.108802
저널
Computer Physics Communications
발행년도
2023
발행기관
Elsevier BV
피인용수
51
라이선스
publisher-specific-oa
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1016/j.cpc.2023.108802
토픽
Composite Material Mechanics
OpenAlex ID
W4379196907

평가 내용

관련도
간접 관련
사업분야
엔지니어링 플라스틱 · (23) 컴파운드
부 분야
(10) 아라미드, (21) 에폭시수지
R&D 측면
분석·모델링
확신도
0.80
근거 용어
finite element method, differentiable simulation, composite material, constitutive models, multi-scale computations
판단 근거
이 논문은 미분 가능한 유한요소법(FEM) 라이브러리를 제안하며, 특히 복합재료(composite material)의 다중 스케일 해석 및 데이터 기반 구성 모델링을 다룹니다.
R&D 활용 포인트
코오롱인더스트리의 엔지니어링 플라스틱 컴파운드(23) 및 아라미드(10) 등 고기능성 복합 소재의 미세 구조-거시 물성 간 상관관계 해석 및 최적 설계 공정 가속화에 활용 가능합니다.
평가 입력
섹션 본문 34,853자 중 30,032자 발췌

초록

초록이 없습니다.

본문 36,260자

본문 펼치기
This paper introduces JAX-FEM, an open-source differentiable finite element method (FEM) library.Constructed on top of Google JAX, a rising machine learning library focusing on highperformance numerical computing, JAX-FEM is implemented with pure Python while scalable to efficiently solve problems with moderate to large sizes.For example, in a 3D tensile loading problem with 7.7 million degrees of freedom, JAX-FEM with GPU achieves around 10× acceleration compared to a commercial FEM code depending on platform.Beyond efficiently solving forward problems, JAX-FEM employs the automatic differentiation technique so that inverse problems are solved in a fully automatic manner without the need to manually derive sensitivities.Examples of 3D topology optimization of nonlinear materials are shown to achieve optimal compliance.Finally, JAX-FEM is an integrated platform for machine learning-aided computational mechanics.We show an example of data-driven multi-scale computations of a composite material where JAX-FEM provides an all-in-one solution from microscopic data generation and model training to macroscopic FE computations.The source code of the library and these examples are shared with the community to facilitate computational mechanics research. Introduction Research in computational science and engineering involving partial differential equations (PDEs) has long focused on developing efficient numerical algorithms.Yet the overall efficiency of PDEbased computational analysis depends not only on the smart use of computer hardware, but also on the efficient use of human resources [1]. Introduction The finite element method (FEM) [2] is one of the most powerful approaches for numerical solutions to PDEs that appear in structural analysis, heat transfer, fluid flow, electromagnetic potential, etc.This paper proposes a library called JAX-FEM that aims at automating the finite element analysis workflows and enhancing human productivity.JAX-FEM is built on JAX [3], a library for high-performance numerical computing and machine learning research.Besides its success in machine learning applications, JAX has proven to be a powerful building block for high-performance scientific simulations, including computational fluid dynamics [4,5], structural dynamics of metamaterials [6], molecular dynamics [7], phase-field simulation of microstructure evolution [8], etc.We emphasize the following three features that differentiate JAX-FEM from other FEM libraries: Introduction 1. Efficient solution to forward PDE with GPU acceleration; 2. Differentiable simulation for automatic inverse design; 3. Seamless integration with machine learning. Introduction In the following paragraphs, we introduce the background and motivation for the three features in detail. Introduction Feature 1 Most existing FEM libraries (e.g., the Dealii [9] library) are implemented with compiled languages like C/C++ or Fortran.JAX-FEM is implemented with pure Python, a higherlevel language known for its dynamic nature and flexibility.Due to the XLA (Accelerated Linear Algebra) backend of JAX, JAX-FEM has a highly competitive performance, especially when GPU is available.Therefore, our Python frontend provides both users and developers with fast production experience without condemning them to only small-sized problems.Another benefit of JAX-FEM is automatic linearization for nonlinear problems.Many FEM libraries require users to derive the linearized incremental form in Newton's method as input to the program, while JAX-FEM works directly with the weak form and performs the linearization using automatic differentiation (AD) [10] for the user.While the AD technique is well known to be the workhorse of deep learning [11], its potential in scientific applications has just gained more attention in recent years [12,13,14]. Introduction Feature 2 Inverse design problems are of great interest in various engineering applications.Solving inverse problems are more challenging and computationally demanding due to the need to iteratively solve the forward problems.Mathematically, inverse problems can often be formulated as PDE-constrained optimization problems [15].Successfully computing the "sensitivity" (gradient of the objective function to design parameters) is key to gradient-based optimization algorithms.The derivation of the sensitivity, however, can be quite non-trivial particularly when the forward problem involves complicated nonlinear constitutive relations [16].Based on automatic differentiation, JAX-FEM computes the sensitivity in a fully automatic manner, freeing the users from deriving the sensitivities by hand.The dimension of design parameters is usually much larger than the design objective, hence the the adjoint method [17,18] is used for efficiency. Feature 3 The ever-increasing interest in data-driven computational mechanics in recent years has posed a strong need for an integrated platform with unified solutions.For example, machine learning-based constitutive models have been a rapidly growing research area, including datadriven elasticity [19], plasticity [20], viscoelasticity [21], etc.Yet, the current workflow requires using multiple tools and transferring data back and forth, which is cumbersome.For instance, simulation data is first generated with certain FEM software, models are then trained using a machine learning library, and finally the trained model is implemented back into the FEM software, often in a hard-coded way.Built on JAX and having access to all its machine learning functionalities, JAX-FEM provides an ideal platform to solve the sub-problems all in the same ecosystem with high efficiency. Feature 3 The paper is organized as follows.Section 2 solves several representative forward problems and the computational performance of JAX-FEM is compared to an open-source FEM software FEniCSx [22] and a commercial software Abaqus.Section 3 introduces the formulation of solving inverse problems.Two applications are presented: full-field reconstruction from sparse observations and structural topology optimization.Section 4 discusses the role of JAX-FEM as an integrated platform for machine learning-enabled computational mechanics.One numerical example of data-driven multi-scale computations of composite material is presented.The three sections correspond to the three features discussed previously.We then conclude in Section 5 with possible future improvement. Feature 3 Standard notation is used throughout the paper.Normal fonts are used for scalars, and boldface fonts for vectors (lower-case) and second-order tensors (upper-case).All tensor and vector components are written with respect to a fixed Cartesian coordinate system with orthonormal basis {e i }.We denote by I the second-order identity tensor.The prefixes tr and det indicate the trace and the determinant.The superscript means the transpose of a second-order tensor.Let (a, b) be vectors, (A, B) be second-order tensors and ∇ the gradient operator; we define the following: Feature 3 (Ω, R dim ) and the squareintegrable function space L 2 = H 0 .Norm is denoted by for a function while | | for a finitedimensional vector (Euclidean norm).Note that boldface font is also used for large matrix/vector assembled by FEM, e.g., a vector of nodal degrees of freedom (DOF) U or a matrix K.We use K * to denote the adjoint of K. Feature 3 Our code is continuously being developed and available at https://github.com/tianjuxue/jaxam/tree/main/jaxam/fem. Solving forward problems In this section, we first define the class of problems to solve.Then we discuss several key features of JAX-FEM that are distinguished from the classic implementation of FEM, including array programming style and the use of automatic differentiation technique.By solving typical solid mechanics problems of linear elasticity, hyperelasticity, and plasticity with both JAX-FEM and FEniCSx and comparing their results, we ensure the correctness of JAX-FEM.Finally, we conduct a performance test to show the scalability of JAX-FEM for efficiently solving large-size problems of DOF around 7.7 million. Problem statement: nonlinear FEM For illustration purposes, let us consider second-order elliptic partial differential equations with the following form: Find u : Problem statement: nonlinear FEM where Ω ⊂ R dim is the problem domain, b is the source term, u D is the Dirichlet boundary condition defined on Γ D ⊂ ∂Ω, n is the outward normal, t prescribes Neumann boundary condition on Problem statement: nonlinear FEM , and f : R vec×dim → R vec×dim is a general tensorvalued function that governs the physics of the problem.Here, "vec" is the number of vector variable components, and "dim" is the spatial dimension.In this work, we only consider threedimensional problems with dim = 3.The weak form of Eq. (1) reads the following: Find u ∈ U such that ∀v ∈ V Problem statement: nonlinear FEM where the trial and test function spaces are Problem statement: nonlinear FEM Newton's method for solving the nonlinear problem (2) yields the following linearized incremental problem: Find the incremental solution δu ∈ V such that Problem statement: nonlinear FEM where the Gateaux derivative is defined as Problem statement: nonlinear FEM where C is the fourth-order tangent tensor with C ijkl = f ij,kl .The Galerkin finite element method discretizes Eq. ( 4) so that the following finite-dimensional linear system is solved: Problem statement: nonlinear FEM where u h ∈ U h ⊂ U is the current solution, δu h ∈ V h ⊂ V is the incremental solution we need to solve for, and v h ∈ V h is the test function.Here, U h and V h are the finite element function spaces. Array programming and automatic differentiation Central to FEM implementation is to assemble the linear system corresponding to Eq. ( 6).The procedure is shown in Alg.Add K e to K Return K When implementing Alg. 1, there are two features that fundamentally distinguish JAX-FEM from traditional approaches: array programming and automatic differentiation. Array programming and automatic differentiation Array programming While for-loops exist in the conceptual illustration of Alg. 1, we never explicitly write any of these for-loops as common practice in Fortran or C/C++ implementation.Instead, array programming style [23] (in the same spirit of NumPy [24]) is used for fully utilizing the power of GPU acceleration.The implementation makes use of jax.vmap, a core function of JAX for vectorized operations. Array programming and automatic differentiation Automatic differentiation Classic FEM implementation requires computing explicitly the entries of the element stiffness matrix K e such that K e [i, j] = Ω e ∇φ i : C : ∇φ j dΩ, (7) where φ i is the ith FEM basis function restricted to the element domain Ω e .JAX-FEM does not require explicitly deriving the linearized form as in Eq. ( 5).Instead, the program works directly with the weak form defined in Eq. ( 2).We define the element residual vector function r e as Array programming and automatic differentiation where U e is the vector of nodal DOF defined in the element, R e is the residual vector, and Array programming and automatic differentiation is the FEM solution field.To obtain K e [i, j], we simply compute the Jacobian matrix of r e at U e such that Array programming and automatic differentiation We use automatic differentiation provided by JAX to compute this Jacobian matrix.In many applications, e.g., plasticity, the fourth-order tangent tensor C is nontrivial to derive, and JAX-FEM frees developers from this tedious procedure. Linear elasticity, hyperelasticity, and plasticity To verify the correctness of JAX-FEM, we consider three typical solid mechanics problems, i.e., linear elasticity, hyperelasticity, and plasticity.Specifically, we impose uniaxial tensile loadings on a cylinder (see Fig. 1 (a)) where the bottom boundary is fixed and the top boundary is subject to fixed displacement conditions.The height of the cylinder is 10 mm and the radius is 5 mm.For simplicity, we assume zero body force and free traction force for all three problems.We solve the problems with both JAX-FEM and FEniCSx and compare the results. Linear elasticity We replace the tensor function f in Eq. ( 1) with the Cauchy stress σ so that the governing equation is Linear elasticity where we have Linear elasticity where I is the identity tensor and λ and µ are the Lamé parameters.We assume quasi-static incremental loadings from 0 to 0.1 mm with 10 steps, and show the plot of force versus displacement in Fig. 1 (b), where the results agree well between JAX-FEM and FEniCSx. Linear elasticity Hyperelasticity For a typical neo-Hookean solid, the governing equation is Linear elasticity where P is the first Piola-Kirchhoff stress.Eq. ( 12) is simply a specific form of Eq. ( 1) in the sense that f can be defined through Linear elasticity where F is the deformation gradient, W is the strain energy density function, J = det(F), I 1 = tr(C); G = E 2(1+ν) and κ = E 3(1−2ν) denote the initial shear and bulk moduli, respectively, with E being the Young's modulus and and ν the Poisson's ratio of the material.The above W is commonly used to model isotropic elastomers that are almost incompressible [25].We assume quasi-static incremental loadings from 0 to 2 mm with 10 steps.We show the plot of force versus displacement in Fig. 1 (c), where the results agree well between JAX-FEM and FEniCSx. Linear elasticity Plasticity For perfect J2-plasticity model [26], we assume that the total strain ε k−1 and stress σ k−1 from the previous loading step are known, and the problem states that find the displacement field u k at the current loading step such that Linear elasticity Eq. ( 14) is a specific form of Eq. ( 1), where the function f is defined with the following plasticityrelated equations Linear elasticity where σ trial is the elastic trial stress, s is the devitoric part of σ trial , f yield is the yield function, σ yeild is the yield strength, x + := 1 2 (x + |x|) is the ramp function, and σ k is the stress at the currently loading step.Deriving the four-order elastoplastic tangent moduli tensor C is usually required by traditional FEM implementation, but is not needed by JAX-FEM due to automatic differentiation.We assume quasi-static loadings from 0 to 0.1 mm and then unload from 0.1 mm to 0. We show the plot of the z-z component of volume-averaged stress versus displacement of the top surface in Fig. 1 (d), where the path-dependent results match exactly between JAX-FEM and FEniCSx.Besides the comparison results above, we have maintained a test suite in our open source repository for more tests like body force, Neumann boundary conditions, etc., so that each new version of JAX-FEM must pass these tests. A sample user program The interface of JAX-FEM for users is succinct.Here, we revisit the tensile problem for the cylinder with linear elastic material.As shown in the code snippet below, users first create the cylinder mesh.Dirichlet boundary conditions are imposed component-wisely, i.e., we need to specify conditions for bottom-x, bottom-y, bottom-z, top-x, top-y, and top-z separately.Then, mesh and dirichlet bc info are passed to the FEM model LinearElasticity and the solver solves the problem import jax.numpy as np from jax_am.fem.modelsimport LinearElasticity from jax_am.fem.solverimport solver from jax_am.fem.generate_meshimport cylinder_mesh mesh = cylinder_mesh() bottom = lambda point: np.isclose(point [2], 0.) top = lambda point: np.isclose(point [2] Performance and scalability JAX-FEM is based on JAX and uses just-in-time compilation for high performance.Therefore, the fact that JAX-FEM is written in pure Python does not limit us to only small problems.For benchmarking the performance, we solve a standard uniaxial tensile loading problem on an ASTM D638 Type 1 specimen (see Fig. 2) assuming linear elastic material.The same problem with different levels of mesh resolution is solved using JAX-FEM with CPUonly mode and with GPU, FEniCSx with MPI for parallel programming, and Abaqus running on CPU with/without MPI.The wall time measurements with respect to the number of DOF are shown in Fig. 3. JAX-FEM shows a predominant advantage when GPU is used.The largest problem has 7,703,841 DOF and takes 8409 s and 4769 s for Abaqus with CPU and MPI (24 cores), respectively, and 523 s for JAX-FEM on GPU.JAX-FEM on GPU achieves 16.1× and 9.1× acceleration compared to Abaqus on CPU and with MPI, respectively.The problem in Fig. 2 has 10,224 DOF and corresponds to the first column of data points in Fig. 3. Performance and scalability Note that for Abaqus the MPI acceleration is not significant as the number of DOF becomes larger.For example, the Abaqus MPI speedup compared with Abaqus CPU is 9.1× for 2,344,230 DOF but 1.8× for 7,703,841 DOF.This decreased performance in Abaqus as DOF increases is attributed to the severe message passing delay for large DOF problems.In Abaqus, if the size of transient variables (mainly the global stiffness matrix) exceeds CPU memory limit, they are stored on local storage where most of the delay takes place.It is also worth mentioning that with 24 cores, we need 19 paid tokens.Compared to this, JAX-FEM is an open-source software and faster than Abaqus with an extended license for tokens. Performance and scalability We report the platforms for those numerical experiments.JAX-FEM runs on 2.3 GHz Intel(R) Xeon(R) W-2195 CPU (18 cores) with NVIDIA Quadro RTX 8000 GPU (48 GB Graphics memory) on Ubuntu 20.04.5 LTS.FEniCSx runs on 2.4 GHz Intel i9 CPU (8 cores) on macOS Big Sur 11.6.5. Performance and scalability Abaqus CPU runs on Intel(R) Core(TM) i7-4790 CPU @ 3.60 GHz under Windows operating system.Abaqus CPU with MPI runs on Intel(R) Xeon (R) CPU E5-2680 v3 @ 2.50 GHz (total 24 cores) with 19 tokens under CentOS 6.9 operating system. Solving inverse problems We formulate inverse problems as PDE-constrained optimization (PDE-CO) problems.There are in general two strategies for solving PDE-CO problems: optimize-then-discretize and discretizethen-optimize [28,29].We follow the discretize-then-optimize approach.The discretized PDE-CO problem is formulated as min Solving inverse problems where U is the finite element solution vector of DOF, θ is the parameter vector, and J (•, Solving inverse problems represents the discretized governing PDE and should be regarded as the direct consequence of discretizing the weak form in Eq. ( 2) and imposing Dirichlet boundary conditions.A reduced formulation is used to embed the PDE constraint so that the problem posed in ( 16) is re-formulated as Solving inverse problems where J (θ) := J (U(θ), θ) and U(θ) is the implicit function that arises from solving the PDE.For efficient optimization algorithms, gradient information is necessary.The total derivative of J with respect to parameters θ is computed with chain rules Solving inverse problems where the existence of the derivative dU dθ is justified by the implicit function theorem [30] under certain mild conditions.We then take the derivative of the constraint function in Eq. ( 16) with respect to θ so that the following relations are obtained Solving inverse problems Hence, Solving inverse problems Substitute Eq. ( 20) to Eq. ( 18), we obtain Solving inverse problems where the first term can be evaluated either from left to right (solving the adjoint PDE first) or from right to left (solving the tangent linear PDE first).When the size of the parameter vector θ is larger than that of the objective (e.g., M 1 in our case), it is more efficient to solve the adjoint PDE first, giving the name adjoint method [18].For interested readers, Xu and Darve [31] recently presented a detailed discussion on the cost comparison of the adjoint method and the tangent linear approach.We continue the discussion by adopting the adjoint method.The adjoint PDE is Solving inverse problems where λ ∈ R N is the adjoint variable.Substitute λ to Eq. ( 21) we have Solving inverse problems Note that Eq. ( 22) is a linear PDE to solve, but it relies on the Jacobian matrix ∂C ∂U , which requires the solution vector U. Therefore, the computational cost is largely dominated by solving the forward problem, not the adjoint PDE, especially when the forward PDE is nonlinear. Solving inverse problems The derivations above are abstract and problem independent.When solving specific problems, one typically needs to further derive the concrete expressions of those derivatives, e.g., ∂C ∂θ , which is often tedious and error-prone.In JAX-FEM, we use automatic differentiation to compute these derivatives, which greatly enhances productivity.The following code snippet demonstrates an example of given C(•, θ) (partial constraint fn) and computing λ * ∂C ∂θ (result) using JAX function jax.vjp, which stands for vector-Jacobian product.Similar approaches are applied to other derivative-related computations like ∂C ∂U * λ in Eq. ( 22) so that the entire workflow of computing the total derivative d J dθ is fully automatic.For general information about automatic differentiation involving implicit functions, we refer to the recent work by Blondel et al. [32].As a summary, we show the overall workflow of solving PDE-CO problems in Alg. 2. In general, the "optimizer" in the algorithm can use any off-the-shelf gradient-based optimization algorithms.The simplest one is the gradient descent method, but more sophisticated algorithms are usually required given the complexity of the specific problem. Algorithm 2: PDE-constrained optimization with the adjoint method Input: θ ini , i max // Initial parameter and maximum iteration number θ ← θ ini , i ← 0 while i < i max do U ← ForwardPDESolver(θ) // See constraint function in Eq. ( 16) Algorithm 2: PDE-constrained optimization with the adjoint method dθ ← AdjointMethod(U, θ) // See Eq. ( 17) to Eq. ( 23) Algorithm 2: PDE-constrained optimization with the adjoint method In the next two subsections, we pose specific PDE-CO problems in the form of Eq. ( 16) and use JAX-FEM for solutions. Full field inference from sparse observations In this numerical example, we consider predicting the full scalar field with sparse observations at certain randomly picked points.The forward governing PDE is a linear Poisson's equation: Full field inference from sparse observations where α is a constant coefficient and b is the source function that we can control.The weak form states that find the solution u so that for any test function v we have Full field inference from sparse observations The PDE-CO problem states that min Full field inference from sparse observations where U is the DOF vector of u, θ is the discretized version of b, U[i] is the ith component of U, U i,obs is the ith observed value, I obs is the index set of observations, and the constraint equation Full field inference from sparse observations is the discretized version of the weak form (25). Full field inference from sparse observations The problem domain Ω is a 1 × 1 × 0.2 rectangular box discretized with 50 × 50 × 10 linear hexahedral elements.We randomly pick 250 points for observing the true solution values, as shown in the top panel of Fig. 4. The ground truth solution obtained from solving Eq. ( 24) is shown in the lower left panel of Fig.We show the optimization iterations of the PDE-CO problem in Fig. 5 (a).In the plot, the objective value (y-axis) is defined in Eq. ( 26) and the optimization step (x-axis) is defined as each time the gradient information is queried by the optimizer (see Alg. 2).In this problem, the limitedmemory BFGS algorithm [33] provided by the SciPy [34] package is used as the optimizer.As shown, the objective value quickly drops to nearly zero within only 20 steps.To quantitatively show the error of the predicted full field solution u pred compared with the ground truth u true , we define the relative L 2 norm error Observed points and show this inference error in Fig. 5 (b).As seen, the error is about 12.0% when the optimization is over.Note that this is the result of observing only 250 points, which is less than 1% of the total points, and we anticipate the error to decrease if more points are observed.For example, with 2500 observed points, the error is decreased to about 1.4%.In this PDE-CO problem, the total derivative d J dθ is computed automatically by JAX-FEM.We perform a sanity test here to ensure that this derivative is computed correctly.Following the works of [35,36], Taylor test can be used to check the accuracy of the computed gradient.Given a perturbation δθ, the convergence rate of the residual should be 1 using a zeroth-order expansion: Observed points and the convergence rate should be 2 by a first-order expansion: Observed points The results above are the direct consequence of Taylor's theorem [30].We set the step size h to be h = 10 −4 , 10 −3 , 10 −2 , 10 −1 and calculate r zeroth and r first , and show the results in Fig. 6.As expected, the r zeroth ∝ h and the r first ∝ h 2 , which demonstrates the correct computation of the gradient by JAM-FEM.As expected, the zeroth-order expansion of the residual achieves a first order convergence, and the first-order expansion achieves a second order convergence. Topology optimization As the second numerical example of PDE-CO, we consider topology optimization [37], an important field that is well-received and developed.We first study compliance minimization of a thin plate made of a hyperelastic material, as shown in the left panel of Fig. 7. Following the classic Solid Isotropic Material with Penalization (SIMP) [37] method, the governing PDE is Topology optimization which is similar to Eq. ( 12), except that θ(x) ∈ [0, 1] is the continuous design density field and p is the penalty exponent.The weak form states that find the solution u so that for any test function v we have Topology optimization The compliance minimization problem states that min Topology optimization where Topology optimization is the finite element solution field constructed with U, θ is the discretized version of θ, and the constraint equation C(U, θ) = 0 matches the discretized version of Eq. ( 30).With JAX-FEM, we bypass the need to further perform sensitivity analysis, which is usually required in topology optimization.The sensitivity information is computed by the program automatically.The optimized topological structure of this thin plate is shown in the right panel of Fig. 7.The optimizer used in this example is the method of moving asymptotes (MMA) [38].We have also passed a constraint that requires to only use 50% of the material, i.e., Topology optimization Ω θdΩ/ Ω dΩ = 0.5 to the optimizer.To avoid checkerboard patterns [39], a convolution filter is used to blur the calculated sensitivities.The implementation of MMA in Python is borrowed from the work of Chandrasekhar et al. [40]. Initial configuration Topology optimization The compliance versus optimization step is shown in Fig. 8, where the final structure has a compliance value of 15.63 µJ.As a reminder, the original solid plate with full material has the compliance to be 9.46 µJ.As a more realistic case with more complex geometry, we use topology optimization for the lightweight design of a bracket with three screw holes.The bracket is assumed to be made of a linear elastic material and the boundary conditions are shown in the upper panel of Fig. 9.We limit the design space to the blue box region (see Fig. 9), and prohibit any material change outside of the blue box.A reasonable human design is shown in the lower left panel that uses 45% material of the blue box region, and the compliance is 3.07 µJ.The deign out of topology optimization that uses the same amount of material is shown in the lower right panel of Fig. 9, whose compliance is 1.10 µJ, achieving a reduction of 64.2% compared with the human design.The optimization iterations are shown in Fig. 10 where the compliance value is plotted against the optimization step. Integration with machine learning In this section, we show one numerical example of solving a data-driven multi-scale computation problem.JAX-FEM provides an all-in-one solution to problems of this kind. Data-driven homogenization of composite material We consider a composite material whose representative volume element (RVE) is a 1 mm cube of the mixture of a soft material (E =100 MPa; ν = 0.4) and a hard material (E =1000 MPa; ν = 0.3), as shown in the left panel of Fig. 12.Both soft and hard materials are assumed to be nearly incompressible neo-Hookean solids (similar to Eq. ( 13)).The multi-scale computational scheme follows our previous work [41] on data-driven homogenization of mechanical meta-materials.The basic workflow involves three major steps: Data-driven homogenization of composite material 1. Performing RVE-level FEM computations and collecting data; The three steps are described in Fig. 11, where C is the macroscopic right Cauchy-Green tensor and W is the macroscopic strain energy density function.For usual workflows, one needs to conduct step 1 with FEM software such as Abaqus, conduct step 2 with a machine learning library such as PyTorch [42] and then perhaps most tediously in step 3 get back to the FEM software so that the trained neural network parameters are hard-coded in the user-defined material model program.In our work, all these three steps are performed in JAX-FEM, which is efficient and convenient.In the next three subsections, we introduce the three steps in more detail. RVE database construction For each RVE problem, we prescribe a macroscopic deformation gradient F and use FEM to solve for the displacement field u(X), where X is the material point.As for the boundary condition, the solution u(X) is decomposed into a macroscopic (overall) part u = (F − I) • X and a microscopic (fluctuating) part u such that u(X) = (F − I) • X + u (X), (32) where the fluctuating part u satisfies periodic boundary conditions.Then the macroscopic energy density W is calculated as a volume averaged quantity: RVE database construction where W is the strain energy density that depends on u and V is the RVE volume.Due to material frame indifference [43], W is a function of the macroscopic right Cauchy-Green tensor C = F F and that W(C) is the nonlinear constitutive relation we want to approximate with a data-driven approach.The RVE computation is repeated with different C so that a database {(C, W)} N s i=1 is constructed for supervised learning.Each data point contains the feature vector C and the scalar label W. Sobol sequence [44] method is used to generate around 1000 random data points for training. Macroscopic problem The trained MLP2 represents the homogenized constitutive relationship and is deployed to solve a macroscopic problem.We consider a uni-axial tensile loading on a 10 × 2 × 10 mm 3 (consisting of 10 × 2 × 10 RVEs) sample.The problem setup is shown in Fig. 14, where quasi-static loading up to 1 mm (10% of the y-axis sample size) is applied. Initial configuration Solution Displacement control B.C. Figure 1 : Figure 1: Testing JAX-FEM with FEniCSx being the ground truth, where (a) is the problem mesh, (b) considers a linear elastic material, (c) considers a hyperelastic material, and (d) considers an elasto-plastic material. Figure 2 : Figure 2: The dog bone shaped ASTM D638 Type 1 specimen, which is a standard test specimen for tensile properties of polymers [27].The tensile experiment fixes the left side and pulls the right side with a prescribed displacement condition. Figure 3 : Figure 3: Performance report.Here, "FEniCSx CPU MPI 4" means FEniCSx runs with 4 processes of MPI parallel programming. # params: JAX array of shape (M,) # adjoint: JAX array of shape (N,) def vec_jac_prod_fn(v):primals, vec_jac_prod = jax.vjp(partial_constraint_fn,params) val, = vec_jac_prod(v) return val result = vec_jac_prod_fn(adjoint) 4 . The source term function b is set to have a bimodal shape such that b(x) = 10 • exp(−10 • |x − (2.5, 2.5, 5.0)| 2 ) + 10 • exp(−10 • |x − (7.5, 7.5, 5.0)| 2 ).The predicted solution by solving the PDE-CO problem is shown in the lower right panel Fig. 4. Figure 4 : Figure 4: Configurations and results of the full field prediction example.The top panel shows the 250 points where the solution value can be observed.The left panel shows the ground truth solution.The right panel shows the predicted solution field with PDE-CO. Figure 5 : Figure 5: Optimization results of the full field prediction example.Subfigure (a) shows the optimization objective converging to zero, and subfigure (b) shows the relative inference error of the predicted solution to the true solution. Figure 6 : Figure6: Taylor test results.As expected, the zeroth-order expansion of the residual achieves a first order convergence, and the first-order expansion achieves a second order convergence. Figure 7 : Figure 7: Topology optimization of a thin plate. Figure 8 : Figure 8: Objective value versus optimization step for the thin plate example. Figure 9 : Figure 9: Topology optimization of a three-hole bracket.As shown in the top panel, fixed boundary conditions are applied on the inner walls of the two holes, and uniform loading condition along the positive y-axis is applied on the inner wall of the upper hole.The lower left panel shows a human design while the lower right panel shows the result of topology optimization that uses the same amount of material. Figure 10 : Figure 10: Objective value versus optimization step for the bracket example. 2 . Training the neural network that represents the homogenized constitutive relationship; 3. Deploying the trained model to solve a macroscopic problem. Step 1 : RVE database construction Step 2: Training neural network MLP < l a t e x i t s h a 1 _ b a s e 6 4 = " p 1 T l 3 y 3 W D D v 6 7 w G B p S W B r T l D g o M = " > A A A B 8 3 i c b V D L S g M x F L 1 T X 7 W + q i 7 d B I v g q s x I U Z c F N y 4 r 2 A d 0 h p J J M 2 1 o J h m S j F C G + Q 0 3 L h R x 6 8 + 4 8 2 / M t L P Q 1 g O B w z n 3 c G 9 O m H C m j e t + O 5 W N z a 3 t n e p u b W / / 4 P C o f n z S 0 z Step 1 : 6 3 k c 2 s k Y m 6 l e 9 Q r x P 2 + Y m u g 2 y J h I U k M F W S 6 K U o 6 M R E U B a M w U J Y b P L c F E M X s r I l O s M D G 2 p p o t w V v 9 8 j r p X T W 9 6 6 b 3 0 G q 0 W 2 U d V T i D c 7 g E D 2 6 g D f f Q g S 4 Q S O A Z X u H N S Z 0 X 5 9 3 5 W I 5 W n D J z C n / g f P 4 A i x e R + Q = = < / l a t e x i t > W < l a t e x i t s h a 1 _ b a s e 6 4 = " a B s o 9 0 9 1 z C g i / X N a 6 O z 3 5 C Step 1 : 0 w m e E T 7 B s Y 4 o s r P 5 h f M 0 L l h Q j Q U 0 r x Y o z n 7 2 5 H h S O W r m c 4 I 6 7 F a 1 n L y P 6 2 f 6 u G N n 7 E 4 S T W N y W L Q M O V I C 5 T H g U I m K d F 8 a g A m k p l d E R l j i Y k 2 o V V M C O 7 y y a u g c 1 l z r 2 r u X b 3 a q B d x l O E U z u A C X L i G B t x C C 9 p A 4 B G e 4 R X e r C f r x X q 3 P h a t J a v w H M O f s j 5 / A B j F l 0 E = < / l a t e x i t > C < l a t e x i t s h a 1 _ b a s e 6 4 = " 5 i K W a 5 7 H 5 l 3 2 b 3 h w b h A 7 p P 7 w y 3 8 = " > A A A C G 3 i c b V D L S g M x F M 3 U V 6 2 v U Z d u g k V w V W Z K U Z e F b l x W s A / o l J L J Z N r Q T D I k G a U M 8 x 9 u / B U 3 L h R x J b j w b 8 y 0 s 6 i t F 0 I O 5 9 z D v f f 4 M a N K O 8 6 P V d r Y 3 N r e K e 9 W 9 v Y P D o / s 4 5 O u E o n E p I M F E 7 L v I 0 U Y 5 a S j q W a k H 0 u C I p + R n j 9 t 5 X r v g U h F B b / X s 5 g M I z T m N K Q Y a U O N 7 D r 0 h N F z e + r 5 g g V q F p k P t j L o S T q e a C S l e F x q 6 m U j u + r U n H n B d e A W o A q K a o / s L y 8 Q O Figure 11 : Figure 11: Workflow of the data-driven multi-scale computational scheme."MLP" stands for multi-layer perceptron. Figure 13 : Figure 13: Training, validation, and testing of the models.In (a), training and validation errors are shown for all three MLPs.The black star shows the lowest validation error.In (b), we show the test result for the selected MLP2. Figure 14 : Figure 14: Problem setup.The left panel shows the boundary condition such that the bottom surface is fixed and the top surface is subject to a prescribed y-axis displacement.The right penal shows the deformed configuration.

섹션 본문 98문단 · 33,740자

(제목 없음)

1This paper introduces JAX-FEM, an open-source differentiable finite element method (FEM) library.Constructed on top of Google JAX, a rising machine learning library focusing on highperformance numerical computing, JAX-FEM is implemented with pure Python while scalable to efficiently solve problems with moderate to large sizes.For example, in a 3D tensile loading problem with 7.7 million degrees of freedom, JAX-FEM with GPU achieves around 10× acceleration compared to a commercial FEM code depending on platform.Beyond efficiently solving forward problems, JAX-FEM employs the automatic differentiation technique so that inverse problems are solved in a fully automatic manner without the need to manually derive sensitivities.Examples of 3D topology optimization of nonlinear materials are shown to achieve optimal compliance.Finally, JAX-FEM is an integrated platform for machine learning-aided computational mechanics.We show an example of data-driven multi-scale computations of a composite material where JAX-FEM provides an all-in-one solution from microscopic data generation and model training to macroscopic FE computations.The source code of the library and these examples are shared with the community to facilitate computational mechanics research.

Introduction

2Research in computational science and engineering involving partial differential equations (PDEs) has long focused on developing efficient numerical algorithms.Yet the overall efficiency of PDEbased computational analysis depends not only on the smart use of computer hardware, but also on the efficient use of human resources [1].

3The finite element method (FEM) [2] is one of the most powerful approaches for numerical solutions to PDEs that appear in structural analysis, heat transfer, fluid flow, electromagnetic potential, etc.This paper proposes a library called JAX-FEM that aims at automating the finite element analysis workflows and enhancing human productivity.JAX-FEM is built on JAX [3], a library for high-performance numerical computing and machine learning research.Besides its success in machine learning applications, JAX has proven to be a powerful building block for high-performance scientific simulations, including computational fluid dynamics [4,5], structural dynamics of metamaterials [6], molecular dynamics [7], phase-field simulation of microstructure evolution [8], etc.We emphasize the following three features that differentiate JAX-FEM from other FEM libraries:

41. Efficient solution to forward PDE with GPU acceleration; 2. Differentiable simulation for automatic inverse design; 3. Seamless integration with machine learning.

5In the following paragraphs, we introduce the background and motivation for the three features in detail.

6Feature 1 Most existing FEM libraries (e.g., the Dealii [9] library) are implemented with compiled languages like C/C++ or Fortran.JAX-FEM is implemented with pure Python, a higherlevel language known for its dynamic nature and flexibility.Due to the XLA (Accelerated Linear Algebra) backend of JAX, JAX-FEM has a highly competitive performance, especially when GPU is available.Therefore, our Python frontend provides both users and developers with fast production experience without condemning them to only small-sized problems.Another benefit of JAX-FEM is automatic linearization for nonlinear problems.Many FEM libraries require users to derive the linearized incremental form in Newton's method as input to the program, while JAX-FEM works directly with the weak form and performs the linearization using automatic differentiation (AD) [10] for the user.While the AD technique is well known to be the workhorse of deep learning [11], its potential in scientific applications has just gained more attention in recent years [12,13,14].

7Feature 2 Inverse design problems are of great interest in various engineering applications.Solving inverse problems are more challenging and computationally demanding due to the need to iteratively solve the forward problems.Mathematically, inverse problems can often be formulated as PDE-constrained optimization problems [15].Successfully computing the "sensitivity" (gradient of the objective function to design parameters) is key to gradient-based optimization algorithms.The derivation of the sensitivity, however, can be quite non-trivial particularly when the forward problem involves complicated nonlinear constitutive relations [16].Based on automatic differentiation, JAX-FEM computes the sensitivity in a fully automatic manner, freeing the users from deriving the sensitivities by hand.The dimension of design parameters is usually much larger than the design objective, hence the the adjoint method [17,18] is used for efficiency.

Feature 3

8The ever-increasing interest in data-driven computational mechanics in recent years has posed a strong need for an integrated platform with unified solutions.For example, machine learning-based constitutive models have been a rapidly growing research area, including datadriven elasticity [19], plasticity [20], viscoelasticity [21], etc.Yet, the current workflow requires using multiple tools and transferring data back and forth, which is cumbersome.For instance, simulation data is first generated with certain FEM software, models are then trained using a machine learning library, and finally the trained model is implemented back into the FEM software, often in a hard-coded way.Built on JAX and having access to all its machine learning functionalities, JAX-FEM provides an ideal platform to solve the sub-problems all in the same ecosystem with high efficiency.

9The paper is organized as follows.Section 2 solves several representative forward problems and the computational performance of JAX-FEM is compared to an open-source FEM software FEniCSx [22] and a commercial software Abaqus.Section 3 introduces the formulation of solving inverse problems.Two applications are presented: full-field reconstruction from sparse observations and structural topology optimization.Section 4 discusses the role of JAX-FEM as an integrated platform for machine learning-enabled computational mechanics.One numerical example of data-driven multi-scale computations of composite material is presented.The three sections correspond to the three features discussed previously.We then conclude in Section 5 with possible future improvement.

10Standard notation is used throughout the paper.Normal fonts are used for scalars, and boldface fonts for vectors (lower-case) and second-order tensors (upper-case).All tensor and vector components are written with respect to a fixed Cartesian coordinate system with orthonormal basis {e i }.We denote by I the second-order identity tensor.The prefixes tr and det indicate the trace and the determinant.The superscript means the transpose of a second-order tensor.Let (a, b) be vectors, (A, B) be second-order tensors and ∇ the gradient operator; we define the following:

11(Ω, R dim ) and the squareintegrable function space L 2 = H 0 .Norm is denoted by for a function while | | for a finitedimensional vector (Euclidean norm).Note that boldface font is also used for large matrix/vector assembled by FEM, e.g., a vector of nodal degrees of freedom (DOF) U or a matrix K.We use K * to denote the adjoint of K.

12Our code is continuously being developed and available at https://github.com/tianjuxue/jaxam/tree/main/jaxam/fem.

Solving forward problems

13In this section, we first define the class of problems to solve.Then we discuss several key features of JAX-FEM that are distinguished from the classic implementation of FEM, including array programming style and the use of automatic differentiation technique.By solving typical solid mechanics problems of linear elasticity, hyperelasticity, and plasticity with both JAX-FEM and FEniCSx and comparing their results, we ensure the correctness of JAX-FEM.Finally, we conduct a performance test to show the scalability of JAX-FEM for efficiently solving large-size problems of DOF around 7.7 million.

Problem statement: nonlinear FEM

14For illustration purposes, let us consider second-order elliptic partial differential equations with the following form: Find u :

15where Ω ⊂ R dim is the problem domain, b is the source term, u D is the Dirichlet boundary condition defined on Γ D ⊂ ∂Ω, n is the outward normal, t prescribes Neumann boundary condition on

16, and f : R vec×dim → R vec×dim is a general tensorvalued function that governs the physics of the problem.Here, "vec" is the number of vector variable components, and "dim" is the spatial dimension.In this work, we only consider threedimensional problems with dim = 3.The weak form of Eq. (1) reads the following: Find u ∈ U such that ∀v ∈ V

17where the trial and test function spaces are

18Newton's method for solving the nonlinear problem (2) yields the following linearized incremental problem: Find the incremental solution δu ∈ V such that

19where the Gateaux derivative is defined as

20where C is the fourth-order tangent tensor with C ijkl = f ij,kl .The Galerkin finite element method discretizes Eq. ( 4) so that the following finite-dimensional linear system is solved:

21where u h ∈ U h ⊂ U is the current solution, δu h ∈ V h ⊂ V is the incremental solution we need to solve for, and v h ∈ V h is the test function.Here, U h and V h are the finite element function spaces.

Array programming and automatic differentiation

22Central to FEM implementation is to assemble the linear system corresponding to Eq. ( 6).The procedure is shown in Alg.Add K e to K Return K When implementing Alg. 1, there are two features that fundamentally distinguish JAX-FEM from traditional approaches: array programming and automatic differentiation.

23Array programming While for-loops exist in the conceptual illustration of Alg. 1, we never explicitly write any of these for-loops as common practice in Fortran or C/C++ implementation.Instead, array programming style [23] (in the same spirit of NumPy [24]) is used for fully utilizing the power of GPU acceleration.The implementation makes use of jax.vmap, a core function of JAX for vectorized operations.

24Automatic differentiation Classic FEM implementation requires computing explicitly the entries of the element stiffness matrix K e such that K e [i, j] = Ω e ∇φ i : C : ∇φ j dΩ, (7) where φ i is the ith FEM basis function restricted to the element domain Ω e .JAX-FEM does not require explicitly deriving the linearized form as in Eq. ( 5).Instead, the program works directly with the weak form defined in Eq. ( 2).We define the element residual vector function r e as

25where U e is the vector of nodal DOF defined in the element, R e is the residual vector, and

26is the FEM solution field.To obtain K e [i, j], we simply compute the Jacobian matrix of r e at U e such that

27We use automatic differentiation provided by JAX to compute this Jacobian matrix.In many applications, e.g., plasticity, the fourth-order tangent tensor C is nontrivial to derive, and JAX-FEM frees developers from this tedious procedure.

Linear elasticity, hyperelasticity, and plasticity

28To verify the correctness of JAX-FEM, we consider three typical solid mechanics problems, i.e., linear elasticity, hyperelasticity, and plasticity.Specifically, we impose uniaxial tensile loadings on a cylinder (see Fig. 1 (a)) where the bottom boundary is fixed and the top boundary is subject to fixed displacement conditions.The height of the cylinder is 10 mm and the radius is 5 mm.For simplicity, we assume zero body force and free traction force for all three problems.We solve the problems with both JAX-FEM and FEniCSx and compare the results.

Linear elasticity

29We replace the tensor function f in Eq. ( 1) with the Cauchy stress σ so that the governing equation is

30where we have

31where I is the identity tensor and λ and µ are the Lamé parameters.We assume quasi-static incremental loadings from 0 to 0.1 mm with 10 steps, and show the plot of force versus displacement in Fig. 1 (b), where the results agree well between JAX-FEM and FEniCSx.

32Hyperelasticity For a typical neo-Hookean solid, the governing equation is

33where P is the first Piola-Kirchhoff stress.Eq. ( 12) is simply a specific form of Eq. ( 1) in the sense that f can be defined through

34where F is the deformation gradient, W is the strain energy density function, J = det(F), I 1 = tr(C); G = E 2(1+ν) and κ = E 3(1−2ν) denote the initial shear and bulk moduli, respectively, with E being the Young's modulus and and ν the Poisson's ratio of the material.The above W is commonly used to model isotropic elastomers that are almost incompressible [25].We assume quasi-static incremental loadings from 0 to 2 mm with 10 steps.We show the plot of force versus displacement in Fig. 1 (c), where the results agree well between JAX-FEM and FEniCSx.

35Plasticity For perfect J2-plasticity model [26], we assume that the total strain ε k−1 and stress σ k−1 from the previous loading step are known, and the problem states that find the displacement field u k at the current loading step such that

36Eq. ( 14) is a specific form of Eq. ( 1), where the function f is defined with the following plasticityrelated equations

37where σ trial is the elastic trial stress, s is the devitoric part of σ trial , f yield is the yield function, σ yeild is the yield strength, x + := 1 2 (x + |x|) is the ramp function, and σ k is the stress at the currently loading step.Deriving the four-order elastoplastic tangent moduli tensor C is usually required by traditional FEM implementation, but is not needed by JAX-FEM due to automatic differentiation.We assume quasi-static loadings from 0 to 0.1 mm and then unload from 0.1 mm to 0. We show the plot of the z-z component of volume-averaged stress versus displacement of the top surface in Fig. 1 (d), where the path-dependent results match exactly between JAX-FEM and FEniCSx.Besides the comparison results above, we have maintained a test suite in our open source repository for more tests like body force, Neumann boundary conditions, etc., so that each new version of JAX-FEM must pass these tests.

A sample user program

38The interface of JAX-FEM for users is succinct.Here, we revisit the tensile problem for the cylinder with linear elastic material.As shown in the code snippet below, users first create the cylinder mesh.Dirichlet boundary conditions are imposed component-wisely, i.e., we need to specify conditions for bottom-x, bottom-y, bottom-z, top-x, top-y, and top-z separately.Then, mesh and dirichlet bc info are passed to the FEM model LinearElasticity and the solver solves the problem import jax.numpy as np from jax_am.fem.modelsimport LinearElasticity from jax_am.fem.solverimport solver from jax_am.fem.generate_meshimport cylinder_mesh mesh = cylinder_mesh() bottom = lambda point: np.isclose(point [2], 0.) top = lambda point: np.isclose(point [2]

Performance and scalability

39JAX-FEM is based on JAX and uses just-in-time compilation for high performance.Therefore, the fact that JAX-FEM is written in pure Python does not limit us to only small problems.For benchmarking the performance, we solve a standard uniaxial tensile loading problem on an ASTM D638 Type 1 specimen (see Fig. 2) assuming linear elastic material.The same problem with different levels of mesh resolution is solved using JAX-FEM with CPUonly mode and with GPU, FEniCSx with MPI for parallel programming, and Abaqus running on CPU with/without MPI.The wall time measurements with respect to the number of DOF are shown in Fig. 3. JAX-FEM shows a predominant advantage when GPU is used.The largest problem has 7,703,841 DOF and takes 8409 s and 4769 s for Abaqus with CPU and MPI (24 cores), respectively, and 523 s for JAX-FEM on GPU.JAX-FEM on GPU achieves 16.1× and 9.1× acceleration compared to Abaqus on CPU and with MPI, respectively.The problem in Fig. 2 has 10,224 DOF and corresponds to the first column of data points in Fig. 3.

40Note that for Abaqus the MPI acceleration is not significant as the number of DOF becomes larger.For example, the Abaqus MPI speedup compared with Abaqus CPU is 9.1× for 2,344,230 DOF but 1.8× for 7,703,841 DOF.This decreased performance in Abaqus as DOF increases is attributed to the severe message passing delay for large DOF problems.In Abaqus, if the size of transient variables (mainly the global stiffness matrix) exceeds CPU memory limit, they are stored on local storage where most of the delay takes place.It is also worth mentioning that with 24 cores, we need 19 paid tokens.Compared to this, JAX-FEM is an open-source software and faster than Abaqus with an extended license for tokens.

41We report the platforms for those numerical experiments.JAX-FEM runs on 2.3 GHz Intel(R) Xeon(R) W-2195 CPU (18 cores) with NVIDIA Quadro RTX 8000 GPU (48 GB Graphics memory) on Ubuntu 20.04.5 LTS.FEniCSx runs on 2.4 GHz Intel i9 CPU (8 cores) on macOS Big Sur 11.6.5.

42Abaqus CPU runs on Intel(R) Core(TM) i7-4790 CPU @ 3.60 GHz under Windows operating system.Abaqus CPU with MPI runs on Intel(R) Xeon (R) CPU E5-2680 v3 @ 2.50 GHz (total 24 cores) with 19 tokens under CentOS 6.9 operating system.

Solving inverse problems

43We formulate inverse problems as PDE-constrained optimization (PDE-CO) problems.There are in general two strategies for solving PDE-CO problems: optimize-then-discretize and discretizethen-optimize [28,29].We follow the discretize-then-optimize approach.The discretized PDE-CO problem is formulated as min

44where U is the finite element solution vector of DOF, θ is the parameter vector, and J (•,

45represents the discretized governing PDE and should be regarded as the direct consequence of discretizing the weak form in Eq. ( 2) and imposing Dirichlet boundary conditions.A reduced formulation is used to embed the PDE constraint so that the problem posed in ( 16) is re-formulated as

46where J (θ) := J (U(θ), θ) and U(θ) is the implicit function that arises from solving the PDE.For efficient optimization algorithms, gradient information is necessary.The total derivative of J with respect to parameters θ is computed with chain rules

47where the existence of the derivative dU dθ is justified by the implicit function theorem [30] under certain mild conditions.We then take the derivative of the constraint function in Eq. ( 16) with respect to θ so that the following relations are obtained

48Hence,

49Substitute Eq. ( 20) to Eq. ( 18), we obtain

50where the first term can be evaluated either from left to right (solving the adjoint PDE first) or from right to left (solving the tangent linear PDE first).When the size of the parameter vector θ is larger than that of the objective (e.g., M 1 in our case), it is more efficient to solve the adjoint PDE first, giving the name adjoint method [18].For interested readers, Xu and Darve [31] recently presented a detailed discussion on the cost comparison of the adjoint method and the tangent linear approach.We continue the discussion by adopting the adjoint method.The adjoint PDE is

51where λ ∈ R N is the adjoint variable.Substitute λ to Eq. ( 21) we have

52Note that Eq. ( 22) is a linear PDE to solve, but it relies on the Jacobian matrix ∂C ∂U , which requires the solution vector U. Therefore, the computational cost is largely dominated by solving the forward problem, not the adjoint PDE, especially when the forward PDE is nonlinear.

53The derivations above are abstract and problem independent.When solving specific problems, one typically needs to further derive the concrete expressions of those derivatives, e.g., ∂C ∂θ , which is often tedious and error-prone.In JAX-FEM, we use automatic differentiation to compute these derivatives, which greatly enhances productivity.The following code snippet demonstrates an example of given C(•, θ) (partial constraint fn) and computing λ * ∂C ∂θ (result) using JAX function jax.vjp, which stands for vector-Jacobian product.Similar approaches are applied to other derivative-related computations like ∂C ∂U * λ in Eq. ( 22) so that the entire workflow of computing the total derivative d J dθ is fully automatic.For general information about automatic differentiation involving implicit functions, we refer to the recent work by Blondel et al. [32].As a summary, we show the overall workflow of solving PDE-CO problems in Alg. 2. In general, the "optimizer" in the algorithm can use any off-the-shelf gradient-based optimization algorithms.The simplest one is the gradient descent method, but more sophisticated algorithms are usually required given the complexity of the specific problem.

Algorithm 2: PDE-constrained optimization with the adjoint method

54Input: θ ini , i max // Initial parameter and maximum iteration number θ ← θ ini , i ← 0 while i < i max do U ← ForwardPDESolver(θ) // See constraint function in Eq. ( 16)

55dθ ← AdjointMethod(U, θ) // See Eq. ( 17) to Eq. ( 23)

56In the next two subsections, we pose specific PDE-CO problems in the form of Eq. ( 16) and use JAX-FEM for solutions.

Full field inference from sparse observations

57In this numerical example, we consider predicting the full scalar field with sparse observations at certain randomly picked points.The forward governing PDE is a linear Poisson's equation:

58where α is a constant coefficient and b is the source function that we can control.The weak form states that find the solution u so that for any test function v we have

59The PDE-CO problem states that min

60where U is the DOF vector of u, θ is the discretized version of b, U[i] is the ith component of U, U i,obs is the ith observed value, I obs is the index set of observations, and the constraint equation

61is the discretized version of the weak form (25).

62The problem domain Ω is a 1 × 1 × 0.2 rectangular box discretized with 50 × 50 × 10 linear hexahedral elements.We randomly pick 250 points for observing the true solution values, as shown in the top panel of Fig. 4. The ground truth solution obtained from solving Eq. ( 24) is shown in the lower left panel of Fig.We show the optimization iterations of the PDE-CO problem in Fig. 5 (a).In the plot, the objective value (y-axis) is defined in Eq. ( 26) and the optimization step (x-axis) is defined as each time the gradient information is queried by the optimizer (see Alg. 2).In this problem, the limitedmemory BFGS algorithm [33] provided by the SciPy [34] package is used as the optimizer.As shown, the objective value quickly drops to nearly zero within only 20 steps.To quantitatively show the error of the predicted full field solution u pred compared with the ground truth u true , we define the relative L 2 norm error

Observed points

63and show this inference error in Fig. 5 (b).As seen, the error is about 12.0% when the optimization is over.Note that this is the result of observing only 250 points, which is less than 1% of the total points, and we anticipate the error to decrease if more points are observed.For example, with 2500 observed points, the error is decreased to about 1.4%.In this PDE-CO problem, the total derivative d J dθ is computed automatically by JAX-FEM.We perform a sanity test here to ensure that this derivative is computed correctly.Following the works of [35,36], Taylor test can be used to check the accuracy of the computed gradient.Given a perturbation δθ, the convergence rate of the residual should be 1 using a zeroth-order expansion:

64and the convergence rate should be 2 by a first-order expansion:

65The results above are the direct consequence of Taylor's theorem [30].We set the step size h to be h = 10 −4 , 10 −3 , 10 −2 , 10 −1 and calculate r zeroth and r first , and show the results in Fig. 6.As expected, the r zeroth ∝ h and the r first ∝ h 2 , which demonstrates the correct computation of the gradient by JAM-FEM.As expected, the zeroth-order expansion of the residual achieves a first order convergence, and the first-order expansion achieves a second order convergence.

Topology optimization

66As the second numerical example of PDE-CO, we consider topology optimization [37], an important field that is well-received and developed.We first study compliance minimization of a thin plate made of a hyperelastic material, as shown in the left panel of Fig. 7. Following the classic Solid Isotropic Material with Penalization (SIMP) [37] method, the governing PDE is

67which is similar to Eq. ( 12), except that θ(x) ∈ [0, 1] is the continuous design density field and p is the penalty exponent.The weak form states that find the solution u so that for any test function v we have

68The compliance minimization problem states that min

69where

70is the finite element solution field constructed with U, θ is the discretized version of θ, and the constraint equation C(U, θ) = 0 matches the discretized version of Eq. ( 30).With JAX-FEM, we bypass the need to further perform sensitivity analysis, which is usually required in topology optimization.The sensitivity information is computed by the program automatically.The optimized topological structure of this thin plate is shown in the right panel of Fig. 7.The optimizer used in this example is the method of moving asymptotes (MMA) [38].We have also passed a constraint that requires to only use 50% of the material, i.e.,

71Ω θdΩ/ Ω dΩ = 0.5 to the optimizer.To avoid checkerboard patterns [39], a convolution filter is used to blur the calculated sensitivities.The implementation of MMA in Python is borrowed from the work of Chandrasekhar et al. [40].

Initial configuration

72Topology optimization The compliance versus optimization step is shown in Fig. 8, where the final structure has a compliance value of 15.63 µJ.As a reminder, the original solid plate with full material has the compliance to be 9.46 µJ.As a more realistic case with more complex geometry, we use topology optimization for the lightweight design of a bracket with three screw holes.The bracket is assumed to be made of a linear elastic material and the boundary conditions are shown in the upper panel of Fig. 9.We limit the design space to the blue box region (see Fig. 9), and prohibit any material change outside of the blue box.A reasonable human design is shown in the lower left panel that uses 45% material of the blue box region, and the compliance is 3.07 µJ.The deign out of topology optimization that uses the same amount of material is shown in the lower right panel of Fig. 9, whose compliance is 1.10 µJ, achieving a reduction of 64.2% compared with the human design.The optimization iterations are shown in Fig. 10 where the compliance value is plotted against the optimization step.

Integration with machine learning

73In this section, we show one numerical example of solving a data-driven multi-scale computation problem.JAX-FEM provides an all-in-one solution to problems of this kind.

Data-driven homogenization of composite material

74We consider a composite material whose representative volume element (RVE) is a 1 mm cube of the mixture of a soft material (E =100 MPa; ν = 0.4) and a hard material (E =1000 MPa; ν = 0.3), as shown in the left panel of Fig. 12.Both soft and hard materials are assumed to be nearly incompressible neo-Hookean solids (similar to Eq. ( 13)).The multi-scale computational scheme follows our previous work [41] on data-driven homogenization of mechanical meta-materials.The basic workflow involves three major steps:

751. Performing RVE-level FEM computations and collecting data; The three steps are described in Fig. 11, where C is the macroscopic right Cauchy-Green tensor and W is the macroscopic strain energy density function.For usual workflows, one needs to conduct step 1 with FEM software such as Abaqus, conduct step 2 with a machine learning library such as PyTorch [42] and then perhaps most tediously in step 3 get back to the FEM software so that the trained neural network parameters are hard-coded in the user-defined material model program.In our work, all these three steps are performed in JAX-FEM, which is efficient and convenient.In the next three subsections, we introduce the three steps in more detail.

RVE database construction

76For each RVE problem, we prescribe a macroscopic deformation gradient F and use FEM to solve for the displacement field u(X), where X is the material point.As for the boundary condition, the solution u(X) is decomposed into a macroscopic (overall) part u = (F − I) • X and a microscopic (fluctuating) part u such that u(X) = (F − I) • X + u (X), (32) where the fluctuating part u satisfies periodic boundary conditions.Then the macroscopic energy density W is calculated as a volume averaged quantity:

77where W is the strain energy density that depends on u and V is the RVE volume.Due to material frame indifference [43], W is a function of the macroscopic right Cauchy-Green tensor C = F F and that W(C) is the nonlinear constitutive relation we want to approximate with a data-driven approach.The RVE computation is repeated with different C so that a database {(C, W)} N s i=1 is constructed for supervised learning.Each data point contains the feature vector C and the scalar label W. Sobol sequence [44] method is used to generate around 1000 random data points for training.

Macroscopic problem

78The trained MLP2 represents the homogenized constitutive relationship and is deployed to solve a macroscopic problem.We consider a uni-axial tensile loading on a 10 × 2 × 10 mm 3 (consisting of 10 × 2 × 10 RVEs) sample.The problem setup is shown in Fig. 14, where quasi-static loading up to 1 mm (10% of the y-axis sample size) is applied.

Initial configuration Solution

79Displacement control B.C.

Figure 1 :

80Figure 1: Testing JAX-FEM with FEniCSx being the ground truth, where (a) is the problem mesh, (b) considers a linear elastic material, (c) considers a hyperelastic material, and (d) considers an elasto-plastic material.

Figure 2 :

81Figure 2: The dog bone shaped ASTM D638 Type 1 specimen, which is a standard test specimen for tensile properties of polymers [27].The tensile experiment fixes the left side and pulls the right side with a prescribed displacement condition.

Figure 3 :

82Figure 3: Performance report.Here, "FEniCSx CPU MPI 4" means FEniCSx runs with 4 processes of MPI parallel programming.

#

83params: JAX array of shape (M,) # adjoint: JAX array of shape (N,) def vec_jac_prod_fn(v):primals, vec_jac_prod = jax.vjp(partial_constraint_fn,params) val, = vec_jac_prod(v) return val result = vec_jac_prod_fn(adjoint)

4 .

84The source term function b is set to have a bimodal shape such that b(x) = 10 • exp(−10 • |x − (2.5, 2.5, 5.0)| 2 ) + 10 • exp(−10 • |x − (7.5, 7.5, 5.0)| 2 ).The predicted solution by solving the PDE-CO problem is shown in the lower right panel Fig. 4.

Figure 4 :

85Figure 4: Configurations and results of the full field prediction example.The top panel shows the 250 points where the solution value can be observed.The left panel shows the ground truth solution.The right panel shows the predicted solution field with PDE-CO.

Figure 5 :

86Figure 5: Optimization results of the full field prediction example.Subfigure (a) shows the optimization objective converging to zero, and subfigure (b) shows the relative inference error of the predicted solution to the true solution.

Figure 6 :

87Figure6: Taylor test results.As expected, the zeroth-order expansion of the residual achieves a first order convergence, and the first-order expansion achieves a second order convergence.

Figure 7 :

88Figure 7: Topology optimization of a thin plate.

Figure 8 :

89Figure 8: Objective value versus optimization step for the thin plate example.

Figure 9 :

90Figure 9: Topology optimization of a three-hole bracket.As shown in the top panel, fixed boundary conditions are applied on the inner walls of the two holes, and uniform loading condition along the positive y-axis is applied on the inner wall of the upper hole.The lower left panel shows a human design while the lower right panel shows the result of topology optimization that uses the same amount of material.

Figure 10 :

91Figure 10: Objective value versus optimization step for the bracket example.

2 .

92Training the neural network that represents the homogenized constitutive relationship; 3. Deploying the trained model to solve a macroscopic problem.

Step 1 :

93RVE database construction Step 2: Training neural network MLP < l a t e x i t s h a 1 _ b a s e 6 4 = " p 1 T l 3 y 3 W D D v 6 7 w G B p S W B r T l D g o M = " > A A A B 8 3 i c b V D L S g M x F L 1 T X 7 W + q i 7 d B I v g q s x I U Z c F N y 4 r 2 A d 0 h p J J M 2 1 o J h m S j F C G + Q 0 3 L h R x 6 8 + 4 8 2 / M t L P Q 1 g O B w z n 3 c G 9 O m H C m j e t + O 5 W N z a 3 t n e p u b W / / 4 P C o f n z S 0 z

946 3 k c 2 s k Y m 6 l e 9 Q r x P 2 + Y m u g 2 y J h I U k M F W S 6 K U o 6 M R E U B a M w U J Y b P L c F E M X s r I l O s M D G 2 p p o t w V v 9 8 j r p X T W 9 6 6 b 3 0 G q 0 W 2 U d V T i D c 7 g E D 2 6 g D f f Q g S 4 Q S O A Z X u H N S Z 0 X 5 9 3 5 W I 5 W n D J z C n / g f P 4 A i x e R + Q = = < / l a t e x i t > W < l a t e x i t s h a 1 _ b a s e 6 4 = " a B s o 9 0 9 1 z C g i / X N a 6 O z 3 5 C

950 w m e E T 7 B s Y 4 o s r P 5 h f M 0 L l h Q j Q U 0 r x Y o z n 7 2 5 H h S O W r m c 4 I 6 7 F a 1 n L y P 6 2 f 6 u G N n 7 E 4 S T W N y W L Q M O V I C 5 T H g U I m K d F 8 a g A m k p l d E R l j i Y k 2 o V V M C O 7 y y a u g c 1 l z r 2 r u X b 3 a q B d x l O E U z u A C X L i G B t x C C 9 p A 4 B G e 4 R X e r C f r x X q 3 P h a t J a v w H M O f s j 5 / A B j F l 0 E = < / l a t e x i t > C < l a t e x i t s h a 1 _ b a s e 6 4 = " 5 i K W a 5 7 H 5 l 3 2 b 3 h w b h A 7 p P 7 w y 3 8 = " > A A A C G 3 i c b V D L S g M x F M 3 U V 6 2 v U Z d u g k V w V W Z K U Z e F b l x W s A / o l J L J Z N r Q T D I k G a U M 8 x 9 u / B U 3 L h R x J b j w b 8 y 0 s 6 i t F 0 I O 5 9 z D v f f 4 M a N K O 8 6 P V d r Y 3 N r e K e 9 W 9 v Y P D o / s 4 5 O u E o n E p I M F E 7 L v I 0 U Y 5 a S j q W a k H 0 u C I p + R n j 9 t 5 X r v g U h F B b / X s 5 g M I z T m N K Q Y a U O N 7 D r 0 h N F z e + r 5 g g V q F p k P t j L o S T q e a C S l e F x q 6 m U j u + r U n H n B d e A W o A q K a o / s L y 8 Q O

Figure 11 :

96Figure 11: Workflow of the data-driven multi-scale computational scheme."MLP" stands for multi-layer perceptron.

Figure 13 :

97Figure 13: Training, validation, and testing of the models.In (a), training and validation errors are shown for all three MLPs.The black star shows the lowest validation error.In (b), we show the test result for the selected MLP2.

Figure 14 :

98Figure 14: Problem setup.The left panel shows the boundary condition such that the bottom surface is fixed and the top surface is subject to a prescribed y-axis displacement.The right penal shows the deformed configuration.

참고문헌 44건

  1. Topology Optimization: Theory, Methods, and Applications 2011
  2. Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation 1987
  3. Nonlinear finite elements for continua and structures Choice Reviews Online · Association of College and Research Libraries · 2001 10.5860/choice.38-3926
  4. An incremental approach to the solution of snapping and buckling problems International Journal of Solids and Structures · Elsevier BV · 1979 10.1016/0020-7683(79)90081-7
  5. Review of options for structural design sensitivity analysis. Part 1: Linear systems Computer Methods in Applied Mechanics and Engineering · Elsevier BV · 2005 10.1016/j.cma.2005.02.002
  6. A Limited Memory Algorithm for Bound Constrained Optimization SIAM Journal on Scientific Computing · Society for Industrial and Applied Mathematics · 1995 10.1137/0916069
  7. On eigenvalues of matrices dependent on a parameter Numerische Mathematik · Springer Science+Business Media · 1964 10.1007/bf01386087
  8. Adjoint Sensitivity Analysis for Differential-Algebraic Equations: The Adjoint DAE System and Its Numerical Solution SIAM Journal on Scientific Computing · Society for Industrial and Applied Mathematics · 2003 10.1137/s1064827501380630
  9. The method of moving asymptotes—a new method for structural optimization International Journal for Numerical Methods in Engineering · Wiley · 1987 10.1002/nme.1620240207
  10. deal.II—A general-purpose object-oriented finite element library ACM Transactions on Mathematical Software · Association for Computing Machinery · 2007 10.1145/1268776.1268779
  11. Form Finding and Analysis of Tension Structures by Dynamic Relaxation International Journal of Space Structures · SAGE Publishing · 1999 10.1260/0266351991494722
  12. The NumPy Array: A Structure for Efficient Numerical Computation Computing in Science & Engineering · AIP Publishing · 2011 10.1109/mcse.2011.37
  13. Inverse problems: A Bayesian perspective Acta Numerica · Cambridge University Press · 2010 10.1017/s0962492910000061
  14. Bi-CGSTAB: A Fast and Smoothly Converging Variant of Bi-CG for the Solution of Nonsymmetric Linear Systems SIAM Journal on Scientific and Statistical Computing · Society for Industrial and Applied Mathematics · 1992 10.1137/0913035
  15. Numerical instabilities in topology optimization: A survey on procedures dealing with checkerboards, mesh-dependencies and local minima Structural Optimization · Springer Nature · 1998 10.1007/bf01214002
  16. Optimal Solvers for PDE-Constrained Optimization SIAM Journal on Scientific Computing · Society for Industrial and Applied Mathematics · 2010 10.1137/080727154
  17. What Is an Adjoint Model? Bulletin of the American Meteorological Society · American Meteorological Society · 1997 10.1175/1520-0477(1997)078<2577:wiaam>2.0.co;2
  18. The finite element method. Linear static and dynamic finite element analysis Computer Methods in Applied Mechanics and Engineering · Elsevier BV · 1987 10.1016/0045-7825(87)90013-2
  19. Principles of mathematical analysis Journal of the Franklin Institute · Elsevier BV · 1953 10.1016/0016-0032(53)90617-6
  20. Stress-constrained topology optimization based on maximum stress measures Computers & Structures · Elsevier BV · 2018 10.1016/j.compstruc.2018.01.008
  21. Non-linear elastic deformations Acta Applicandae Mathematicae · Springer Science+Business Media · 1988 10.1007/bf00047287
  22. tIGAr: Automating isogeometric analysis with FEniCS Computer Methods in Applied Mechanics and Engineering · Elsevier BV · 2018 10.1016/j.cma.2018.10.002
  23. Deep learning Nature · Nature Portfolio · 2015 10.1038/nature14539
  24. Non-commutative discretize-then-optimize algorithms for elliptic PDE-constrained optimal control problems Journal of Computational and Applied Mathematics · Elsevier BV · 2018 10.1016/j.cam.2018.07.028
  25. Deep learning predicts path-dependent plasticity Proceedings of the National Academy of Sciences · National Academy of Sciences · 2019 10.1073/pnas.1911815116
  26. Automatic Differentiation for Solid Mechanics Archives of Computational Methods in Engineering · Springer Science+Business Media · 2020 10.1007/s11831-019-09396-y
  27. SciPy 1.0: fundamental algorithms for scientific computing in Python Nature Methods · Nature Portfolio · 2020 10.1038/s41592-019-0686-2
  28. A kernel method for learning constitutive relation in data-driven computational elasticity Japan Journal of Industrial and Applied Mathematics · Springer Science+Business Media · 2020 10.1007/s13160-020-00423-1
  29. A data-driven computational scheme for the nonlinear mechanical properties of cellular mechanical metamaterials under large deformation Soft Matter · Royal Society of Chemistry · 2020 10.1039/d0sm00488j
  30. Adjoint optimization of pressurized membrane structures using automatic differentiation tools Computer Methods in Applied Mechanics and Engineering · Elsevier BV · 2020 10.1016/j.cma.2020.113393
  31. Array programming with NumPy Nature · Nature Portfolio · 2020 10.1038/s41586-020-2649-2
  32. Automatic Differentiation in MetaPhysicL and Its Applications in MOOSE Nuclear Technology · Taylor & Francis · 2021 10.1080/00295450.2020.1838877
  33. Machine learning–accelerated computational fluid dynamics Proceedings of the National Academy of Sciences · National Academy of Sciences · 2021 10.1073/pnas.2101784118
  34. AuTO: a framework for Automatic differentiation in Topology Optimization Structural and Multidisciplinary Optimization · Springer Science+Business Media · 2021 10.1007/s00158-021-03025-8
  35. Mechanistic Data Science for STEM Education and Applications Springer eBooks · Springer Nature · 2021 10.1007/978-3-030-87832-0
  36. Two-dimensional Stiefel-Whitney insulators in liganded Xenes npj Computational Materials · Nature Portfolio · 2022 10.1038/s41524-021-00695-2
  37. Mapped shape optimization method for the rational design of cellular mechanical metamaterials under large deformation International Journal for Numerical Methods in Engineering · Wiley · 2022 10.1002/nme.6941
  38. Mechanistically informed data-driven modeling of cyclic plasticity via artificial neural networks Computer Methods in Applied Mechanics and Engineering · Elsevier BV · 2022 10.1016/j.cma.2022.114766
  39. Physics constrained learning for data-driven inverse modeling from sparse observations Journal of Computational Physics · Elsevier BV · 2022 10.1016/j.jcp.2021.110938
  40. ASTM D638 Springer eBooks · Springer Nature · 2011 10.1007/978-1-4419-6247-8_856
  41. Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC 2015 10.1145/2833157
  42. JAX-Fluids: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows Computer Physics Communications · Elsevier BV · 2022 10.1016/j.cpc.2022.108527
  43. Special issue of computational mechanics on machine learning theories, modeling, and applications to computational materials science, additive manufacturing, mechanics of materials, design and optimization Computational Mechanics · Springer Science+Business Media · 2023 10.1007/s00466-023-02337-4
  44. Nonlinear Solid Mechanics: A Continuum Approach for Engineering Science Meccanica · Springer Science+Business Media · 2002 10.1023/a:1020843529530