- 积分
- 3
- 注册时间
- 2004-12-17
- 仿真币
-
- 最后登录
- 1970-1-1
|
转自:http://www.altsoft.co.kr/gbd/bbs/board.php?bo_table=forum_alt_dataroom&wr_id=20&sfl=wr_subject%7C%7Cwr_content&stx=gra&sop=and
About memory monitoring
Especially in 3D modelling, extensive memory usage urges some extra precautions. The "Out of Memory"-problem occurs whenever COMSOL Multiphysics tries to allocate an array which does not fit sequentially in memory. It is common that the amount of available memory seems large enough for the array - but there may exist no continuous block of that size, due to fragmentation. If you for example look in the task manager of Windows, this may have the effect that you can't see any high memory allocation, and get "out of memory" anyway. See more about operating systems below.
In Windows XP, you only have 2 GB of virtual address space available initially for a user process. This memory space is also sometimes fragmented by shared libraries. On Linux, UNIX, and Mac, you typically get between 3-4 GB of virtual address space available for your process. This address space is usually not fragmented. Windows XP Professional x64 edition does not suffer any notable problems from memory fragmentation since the available address space is extremely large. COMSOL Multiphysics supports the option in Windows XP professional and Windows 2003 Server to have 3 GB of virtual address space available user processes. This reduces the available address space for the operating system to 1 GB. To access it you must boot the system using an additional boot parameter. The following example shows how to enable application memory tuning by adding the /3GB parameter in the boot.ini file: [boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT="????" /3GB
The "????" above can be the name of your operating system for example "Microsoft Windows XP Professional". Please note that the file boot.ini is critical to booting your system. The "Memory Usage" column in the Windows task manager can also be misleading, because it only shows the currently swapped portion. A better indicator of total usage can be found like this (Win2000, WinNT, Win XP):
- Press Ctrl-Alt-Del to bring up the Task Manager.
- Go to the "processes" tab.
- From the View menu, choose Select Columns.
- Select the Virtual Memory Size check box.
- Now find the comsol.exe process that corresponds to the COMSOL Multiphysics process in the process list and look in the "VM Size" column. This shows a better value for the actual memory used.
Building memory efficient models in COMSOL Multiphysics
General
It is a delicate task to give a general rule how much memory is needed for a specific problem. It depends on
- Number of nodes in the geometry mesh (base mesh).
- Type of shape function, (for example 2nd order Lagrange elements). The shape function type together with the geometry mesh determines the size of computational mesh (extended mesh).
- Number of dependent and independent variables.
- Sparsity of system matrices. This is in turn governed by the shape of the geometry and mesh. An extended ellipsoid gives sparser matrices than a sphere. Spheres and cubes are the toughest shapes with regards to memory demand. Further, the degree of coupling between different equations affect sparsity.
From the last item above we understand that the amount of memory required to solve a problem depends on the number of non-zero entries in the Jacobian matrix, not the number of degrees of freedom. For example, for a non-isothermal flow problem coupled to the conduction-convection equation and ideal gas law equation of state, all 5 dependent variables (u, v, w, p, T) appear in all 5 equations (in 3D). Hence the Jacobian matrix will be much fuller than a simple heat conduction problem. This is also the reason why solving a thermal radiation problems often uses up a lot of memory. The contribution to the Jacobian matrix from any surface elements creates a block in the matrix which is full. Read more about the definition of Degrees of Freedom (DOF) in COMSOL Multiphysics.
Selecting Proper Solver Type
The solvers in COMSOL Multiphysics always break down each problem into the solution of one or several linear systems of equations. Thus, in all the solvers the choice between direct and iterative solvers for linear systems affects the solution time and memory requirements. The direct solvers solve a linear system by Gaussian elimination. This stable and reliable process is well suited even for for ill-conditioned systems. These solvers require less tuning and are often faster than the iterative solvers in 1D and 2D, where they are the default setting. The elimination process sometimes requires large memory resources and long computing times, an effect particularly noticeable for 3D models. If you have a symmetric system, the first action should be to check the "Symmetric matrices" checkbox in the solver settings. (Note: Symmetric in this case does not mean a symmetric geometry. Rather, it refers to the Jacobian matrix being symmetric along the diagonal.) Then change the linear solver to "Direct (SPOOLES)" or "Direct Cholesky (TAUCS)". Only a simple class of problems like Poisson-type problems have symmetric matrices (see further COMSOL Multiphysics User's Guide, section Solving the Model). The default setting for 3D calls on iterative solvers. They generally use less memory than direct solvers and are often faster in 3D. For optimal performance, though, the iterative solvers need the careful selection of a preconditioner. Some examples of preconditioners are
- Incomplete LU
- Algebraic and Geometric Multigrid
- SSOR Vector
- et.c.
For large problems, it is imperative to choose a proconditioner that is suitable for the problem type at hand. Please refer to the COMSOL Multiphysics 3.2 User's guide, section The Linear System Solver for more information.
Efficient Geometry Modeling
In general, the first step is to try to reduce the model geometry as much as possible. Often you can find symmetry planes and therefore reduce the model to 1/2 or 1/4 or even 1/8 of the original size. The memory usage does not scale linearly, rather polynomially (A*n^k, k>1), where A is a constant, n the number of degrees of freedom, and k a real number describing the polynomial order. The value of k may vary depending on the geometry dimension (1D, 2D, or 3D) and solver settings, but is always greater than one. This means that you save more than half the memory if you find a symmetry plane and cut the geometry size by half.
- Avoid small geometry objects where they are not needed (for curved segments, use one Bézier-curve instead many small line segments, for example)
- Also, the quality of the mesh is important if an iterative solver is used. Convergence will be faster and more robust if the element quality is high. If an angle in a mesh element corner approaches 180 degrees, the quality will be too low. This is often the case for triangular or tetrahedron elements in thin layer regions. Quad and hexahedron elements can also have low quality in some cases. If you select Mesh/Statistics, you will see the Minimum element quality. It should not be lower that 0.01. The problem can be that the triangles get very thin when they approach the sharp corners of the geometry, leading to poor element quality there.
Hardware and software settings
Virtual Memory and Swap Space
Increasing the swap file size on the system is only interesting if you can live with the notable slowness in operation that occurs as soon as the hard disk swapping starts. In many cases, hard disk swapping is not an option.
Concerning virtual memory, a normal 32 bit processor (e.g., Windows platform) can potentially allocate allocate up to 4 GB of memory, but in most practical cases only 1.5 GB due to operating system footprint (see the first paragraph of this article). This is regardless of how high you set the swap space. Some operating systems require special settings to be able to use high amounts of memory. COMSOL Multiphysics comes in an optional 64-bit version. Using a 64-bit processor with a 64-bit operating system enables you to address substantially more RAM memory than 4 GB.
Software Settings
There are several ways of increasing the available memory for the solvers.
Reducing the Java heap size will make more memory available for the solvers. When running COMSOL Multiphysics, you can decrease the maximum Java heap size. On Windows, modify the file COMSOL32/bin/comsol.opts and on UNIX/Linux/Mac OSX, modify the file COMSOL32/bin/comsol. Decrease the value of parameter MAXHEAP=256m from 256MB to a lower value, say 128, by changing to MAXHEAP=128m. By default, you get more memory available in a COMSOL Multiphysics server. Connect to the COMSOL Multiphysics server from a COMSOL Multiphysics client. You can also modify the Java heap size on a COMSOL Multiphysics server: On Windows, modify the file COMSOL32/bin/comsol.opts and on UNIX/Linux/Mac OSX, modify the file COMSOL32/bin/comsol. Decrease the value of parameter MAXHEAPSERVER=128m from 128MB to a lower value, say 64, by changing to MAXHEAPSERVER=64m. A corollary of this is that many users report that they get more free memory by running a COMSOL Multiphysics server and a COMSOL Multiphysics client on the same machine.
If you run out of memory during postprocessing, you can increase the maximum Java heap size. On Windows, modify the file COMSOL32/bin/comsol.opts and on UNIX/Linux/Mac OSX, modify the file COMSOL32/bin/comsol. Increase the value of parameter MAXHEAP=256m from 256MB to a higher value, say 512, by changing to MAXHEAP=512m. To run a COMSOL Multiphysics server and a COMSOL Multiphysics client on different computers, you need a floating network license. All COMSOL Multiphysics licenses allow you to run a COMSOL Multiphysics server and a COMSOL Multiphysics client on the same computer. If you run out of memory when saving an mph-file from the COMSOL Multiphysics graphical user interface when you are running COMSOL Multiphysics with MATLAB you might have to increase the Java heap size within MATLAB. When you are running COMSOL Multiphysics with MATLAB the Java heap within MATLAB will function like the Java heap within the COMSOL Multiphysics server. To set the Java heap size in MATLAB, create a java.opts file with the contents -Xmx256m for example, to set the maximum Java heap to 256MB. Create java.opts either in the current directory or in the directory MATLAB/bin/ARCH, where MATLAB is the MATLAB installation directory, e. g., C:\MATLAB71, and ARCH is the architecture, win32, glnx86, hpux, sol2, or Mac OSX.
[ 本帖最后由 hadrons 于 2008-1-23 08:40 编辑 ] |
评分
-
2
查看全部评分
-
|