A method for constructing an openfoam solver of a transplanting FENE-P model

By porting the FENE-P model to build the OpenFOAM solver, the problem of insufficient user degrees of freedom is solved, rapid constitutive model verification is achieved, laying the foundation for turbulence research and supporting more in-depth fluid dynamics calculations.

CN115374726BActive Publication Date: 2026-01-02GUANGZHOU UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211080190.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-05
Publication Date
2026-01-02
Estimated Expiration
2042-09-05

AI Technical Summary

Technical Problem

Existing open-source CFD software offers limited user freedom in turbulence research, making it difficult to adapt to individual user needs, and there have been few breakthroughs in turbulence research.

Method used

An OpenFOAM solver was built by porting the FENE-P model, including selecting the source code of the FENE-P model, porting the code to rheoTestFoam, defining variables and configuring the environment, forming a solver that meets user needs, and then verifying it.

Benefits of technology

It provides users with a high degree of freedom, enables rapid constitutive model verification, provides a foundation for turbulence research, and supports more in-depth fluid dynamics calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115374726B_ABST
    Figure CN115374726B_ABST
Patent Text Reader

Abstract

The application provides a method for transplanting a FENE-P model to construct an OpenFOAM solver, which comprises the following steps: selecting source code of the FENE-P model, and confirming code corresponding to a constitutive equation of the FENE-P model; modifying TEqn.H of rheoTestFoam, and transplanting the code corresponding to the constitutive equation of the FENE-P model to TEqn.H; modifying creatFields.H of rheoTestFoam, and defining new variables and commenting irrelevant variables; selecting an environment to compile, and determining a position for compiling the OpenFOAM solver; and verifying the OpenFOAM solver after the compilation is completed. The application can help users to construct a solver according to self needs, which is a very important breakthrough for turbulence research.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of turbulence theory and simulation, computational fluid dynamics, and is a method for transplanting FENE-P model to construct OpenFOAM solver. BACKGROUND

[0002] As the last unsolved problem in classical physics, the problem of turbulence has always attracted many researchers. Current turbulence research can be divided into two major directions: numerical simulation calculation and experiment. Numerical simulation can be divided into direct numerical simulation, Reynolds average method and large eddy simulation. For numerical simulation, the current choices can be commercial software (such as Fluent) or open source software (such as OpenFOAM) for scientific calculation.

[0003] Computational fluid dynamics (CFD) is a discipline that obtains discrete quantitative description of flow field by solving fluid mechanics control equation through numerical method, and predicts the law of fluid motion.

[0004] The fine and scalable nonlinear elastic (FENE-P) model is originally developed based on the elastic dumbbell representation of polymer molecules, and the end-to-end vector of each molecule is naturally related to the conformation tensor, so the constitutive equation of this kind of model is often written and processed as a function of the conformation tensor.

[0005] The existing open source CFD software is relatively fixed compared with mature commercial software, and the freedom of users is not high. The construction method of the solver cannot meet the needs of users. At the same time, the existing technology has few breakthroughs in the research on turbulence problem. SUMMARY

[0006] The present application aims to provide a method for transplanting FENE-P model to construct OpenFOAM solver, which summarizes a set of process methods for migrating constitutive model code to rheoTestFoam to construct a new solver and verify the constitutive model, so as to realize the rapid verification of constitutive model and lay the foundation for the next step of fluid mechanics calculation for turbulence research.

[0007] In order to achieve the above purpose, the present application provides a method for transplanting FENE-P model to construct OpenFOAM solver, characterized in that it comprises:

[0008] S1, selecting the source code of FENE-P model, and confirming the code corresponding to the constitutive equation of FENE-P model;

[0009] S2, modifying TEqn.H of rheoTestFoam, and transplanting the code corresponding to the constitutive equation of FENE-P model to TEqn.H;

[0010] S3. Modify rheoTestFoam's creatFields.H to define new variables such as TensorA, lambda1, L_2, etc. from step S13, and comment out irrelevant variables (i.e., variables contained in the source program, such as A, lambda, L, etc.).

[0011] S4. Select the environment for compilation and determine the location where the OpenFOAM solver is compiled;

[0012] S5. After compilation, verify the OpenFOAM solver.

[0013] Further, step S1 specifically includes:

[0014] S11. Determine the constitutive equations of the FENE-P model. The constitutive equations of the FENE-P model are as follows:

[0015]

[0016] in τ is the additional stress, tr(τ) is the trace of stress τ, and L is the maximum tensile strength of the polymer. The material derivative of stress, Then it is the transpose of the velocity divergence, η p It is the polymer viscosity. This represents the matter derivative, where I is the unit tensor;

[0017] S12. Confirm the code corresponding to each term in the equation;

[0018] S13. Combine the constitutive equations of a complete FENE-P model that conforms to the OpenFOAM programming syntax.

[0019] Further, step S2 specifically includes:

[0020] The constitutive equation code of a complete FENE-P model conforming to the OpenFOAM programming syntax is ported to the rheoTestFoam solver and compiled to form a solver.

[0021] Further, step S3 specifically includes the following steps:

[0022] The variables of the constitutive equation code for a complete FENE-P model conforming to the OpenFOAM programming syntax are defined, as well as the velocity field variables involved in the rheoTestFoam original function need to be defined.

[0023] Further, the step S4 specifically comprises: installing an environment adapted to different versions of OpenFOAM, selecting the environment, and constructing a FENE-P solver, for example: gcc, PETSC, slepc, and cmake versions and corresponding positions that need to be called are specified, so as to construct the FENE-P solver.

[0024] Further, the FENE-P solver can only be called in a compiled environment.

[0025] Further, the modification method of the OpenFOAM solver is to edit Make / files, and change the name of the OpenFOAM solver to FENE-P.

[0026] Further, the specific verification method of the S5 is divided into linear and nonlinear, and the corresponding formula is verified under the conditions of tension and shear of the standard field.

[0027] Tension Tension viscosity

[0028] Shear Shear viscosity

[0029] Wherein, the subscripts e and s appearing in the formula respectively represent extend and shear, and epsilon is the strain rate selected during verification. xx And sigma yy Are two elements of the tensor sigma.

[0030] Further, the tensor sigma has 9 elements, and is represented as follows:

[0031]

[0032] Wherein, x, y, and z represent three components of a vector, and sigma here is a tensor with 9 elements, and the components are represented by components such as xx, yy, etc.

[0033] Further, the data graphs generated by rheoTestFoam and the FENE-P solver under the conditions of tension and shear of the standard field are compared, so as to determine whether the FENE-P solver is successfully constructed.

[0034] The beneficial technical effects of the present application are at least the following points:

[0035] (1) The method for transplanting a FENE-P model to construct an OpenFOAM solver of the present application gives users great freedom, and users can construct a solver according to their own needs;

[0036] (2) Through a set of migration constitutive model code to rheoTestFoam, a new solver is constructed, and the flow method of constitutive model verification is carried out, so as to realize the rapid verification of constitutive model, and lay the foundation for the next work of studying turbulent flow and carrying out fluid mechanics calculation. BRIEF DESCRIPTION OF DRAWINGS

[0037] The application is further described with reference to the accompanying drawings, but the embodiments in the drawings do not constitute any limitation on the application, and other drawings can be obtained by those of ordinary skill in the art without creative labor on the basis of the following drawings.

[0038] Figure 1 A flow chart of the method for transplanting the FENE-P model to construct the OpenFOAM solver.

[0039] Figure 2 A comparison and verification embodiment graph of the FENE-P solver constructed by the nonlinear wi=0.1 and the data generated by rheoTestFoam.

[0040] Figure 3 A comparison and verification embodiment graph of the FENE-P solver constructed by the linear wi=10 and the data generated by rheoTestFoam. DETAILED DESCRIPTION

[0041] The specific embodiments of the application are described below to facilitate the understanding of the application by those skilled in the art, but it should be clear that the application is not limited to the scope of the specific embodiments, and for those skilled in the art, it is obvious that various changes are within the spirit and scope of the application as defined in the appended claims, and all the application ideas utilizing the application are included in the protection.

[0042] As Figure 1 shown, the application provides a method for transplanting a FENE-P model to construct an OpenFOAM solver. DETAILED DESCRIPTION

[0044] S1, the source code of the FENE-P model is selected, and the code corresponding to the constitutive equation of the FENE-P model is confirmed;

[0045] S2, the TEqn.H of rheoTestFoam is modified, and the code corresponding to the constitutive equation of the FENE-P model is transplanted to TEqn.H;

[0046] S3, modify rheoTestFoam's creatFields.H, define new variables (such as: variables TensorA, lambda1, L_2 in step S13), and comment on irrelevant variables (i.e. variables contained in the source program, such as: A, lambda, L, etc.);

[0047] S4, select the environment to compile, determine the location of the OpenFOAM solver compilation, and adjust the name of the constructed solver;

[0048] S5, after the compilation, verify the OpenFOAM solver, and compare the generated data with the standard rheoTestFoam data under the same parameters.

[0049] Further, the specific method of S1 is:

[0050] S11, determine the constitutive equation of the FENE-P model, and understand the meaning of each term of the equation;

[0051] S12, finalize the code corresponding to each term of the equation;

[0052] S13, combine into a complete FENE-P constitutive equation code that conforms to the OpenFOAM programming syntax.

[0053] The constitutive equation corresponding to step S11: τ * = τ + τ s .

[0054]

[0055] The specific FENE-P constitutive equation code implemented in step S13:

[0056]

[0057] The specific method of step S2 is:

[0058] Port the constitutive equation code completed by S1 to the rheoTestFoam solver, and form a solver that meets the own scientific research needs through compilation. The key of this work is to transplant the corresponding code of the constitutive model of the OpenFOAM syntax to RheoTool. Due to the differences in some syntax, it is easy to cause errors during compilation. The corresponding code of the constitutive model of the OpenFOAM syntax needs to be written to TEqn.H according to the syntax of RheoTool.

[0059] In addition, attention should be paid to the error of dimension during the compilation of the solver. The source of this error is that the dimension of both ends of the constitutive equation is not considered when constructing the constitutive equation. Therefore, when constructing the code of the constitutive equation, the dimension problem needs to be considered.

[0060] The specific method of step S3 is:

[0061] The constitutive equation code of the appropriate FENE-P model is transplanted to rheotestFoam according to the RheoTool syntax through step S2, but a new solver of the constitutive model is constructed, instead of just modifying the constitutive equation, and the variables required by the constitutive equation also need to be modified accordingly, which includes the addition of missing variables, the annotation or deletion of redundant variables. It should be noted that the class corresponding to each variable is found, some variables are constants, some variables are vectors, some variables are tensors, and some variables are fields. If the class of the variable cannot be found correctly, the data calculated by the successfully compiled solver will also be problematic.

[0062] According to the constitutive equation code of step S13, the variables to be defined are:

[0063]

[0064] The specific method of step S4 is:

[0065] Under the premise of fluid calculation, the environment suitable for different versions of OpenFOAM needs to be installed. Therefore, when compiling and building the FENE-P solver, attention should be paid to the selection of the environment. Once the compilation is successful, the FENE-P solver can only be called in the environment in which it is compiled. In addition, one point that needs to be noted before compilation is that the name of the built solver can be modified by editing Make / files.

[0066] As follows:

[0067] 1 rheoTestFoam.C

[0068] 4 EXE=$(FOAM_USER_APPBIN) / FENE-P_RTF

[0069] FENE-P_RTF here is the name of the FENE-P constitutive model solver I built. In the operation example, you only need to call the environment and input FENE-P_RTF to use the solver.

[0070] The specific method of step S5 is:

[0071] The two parts of linear and nonlinear are calculated under the standard field of tension, shear, and the corresponding formula:

[0072] Tension Tension viscosity

[0073] Shear Shear viscosity

[0074] where ε is the selected strain rate in the verification, σ xx and σ yy are two elements of the tensor σ.

[0075] As Figure 2 and Figure 3 wi = 0.1, the nonlinear data and wi = 10, linear data, by comparing rheoTestFoam and the FENE-P solver built under the conditions of stretching and shearing, whether the generated data graphs are completely coincident, that is, whether the solver is constructed.

[0076] In summary, the present patent proposes a method of transplanting FENE-P model to build OpenFOAM solver, which can create a set of process and method of quickly building OpenFOAM solver based on constitutive equation according to research needs, and includes the verification of the solver, which provides a strong guarantee for further research on turbulent flow problems.

[0077] Although the embodiments of the present application have been shown and described, those skilled in the art can understand that various changes, modifications, replacements and deformations can be made to these embodiments without departing from the principles and purposes of the present application, and the scope of the present application is defined by the claims and their equivalents.

Claims

1. A method for constructing an OpenFOAM solver by porting the FENE-P model, characterized in that, include: S1. Select the source code of the FENE-P model and confirm the code corresponding to the constitutive equation of the FENE-P model; S2. Modify TEqn.H of rheoTestFoam to port the code corresponding to the constitutive equation of the FENE-P model to TEqn.H; S3. Modify rheoTestFoam's creatFields.H to define new variables and comment out irrelevant variables; S4. Select the environment for compilation and determine the location where the OpenFOAM solver is compiled; S5. After compilation, verify the OpenFOAM solver; Step S1 specifically includes: S11. Determine the constitutive equations of the FENE-P model. The constitutive equations of the FENE-P model are as follows: in τ is the additional stress, tr(τ) is the trace of stress τ, and L is the maximum tensile strength of the polymer. The material derivative of stress, Then it is the transpose of the velocity divergence, η p It is the polymer viscosity. This represents the matter derivative, where I is the unit tensor; S12. Confirm the code corresponding to each term in the equation; S13. Combine the constitutive equations of a complete FENE-P model that conforms to the OpenFOAM programming syntax.

2. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 1, characterized in that, Step S2 specifically includes: The constitutive equation code of a complete FENE-P model conforming to the OpenFOAM programming syntax is ported to the rheoTestFoam solver and compiled to form a solver.

3. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 2, characterized in that, Step S3 specifically involves the following steps: The variables of the constitutive equation code for a complete FENE-P model conforming to the OpenFOAM programming syntax are defined, as well as the velocity field variables involved in the rheoTestFoam original function are defined.

4. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 1, characterized in that, Step S4 specifically involves: installing an environment adapted to different versions of OpenFOAM, selecting the environment, and building the FENE-P solver.

5. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 4, characterized in that, The FENE-P solver can only be invoked in a compiled environment.

6. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 1, characterized in that, The OpenFOAM solver can be modified by editing Make / files and changing the name of the OpenFOAM solver to FENE-P.

7. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 1, characterized in that, The specific verification methods for S5 are divided into linear and nonlinear methods. Under the conditions of stretching and shearing of the standard field, the corresponding formulas are as follows: stretching Stretching viscosity Cut Shear viscosity In the formula, the subscripts e and s represent extend and shear, respectively, ε is the strain rate selected during verification, and σ xx and σ yy Let be two elements of the tensor σ.

8. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 7, characterized in that, The tensor σ has 9 elements, represented as follows: Here, x, y, and z represent the three components of a vector, and σ is a tensor with nine elements.

9. The method for constructing an OpenFOAM solver by porting the FENE-P model according to claim 7, characterized in that, By comparing the tensile and shear viscosity data generated by rheoTestFoam and the FENE-P solver under the tensile and shear conditions of the standard field, it can be determined whether the FENE-P solver was successfully constructed.