doc:user:geometry:mesh:1d
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
doc:user:geometry:mesh:1d [2013/07/12 14:09] – external edit 127.0.0.1 | doc:user:geometry:mesh:1d [2016/03/30 15:23] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | | ||
+ | ====== 1D Meshers (Curves) ====== | ||
+ | FIXME __Mesh Elements versus Finite Elements__: these two notions are different and should not be misunderstood. A mesh is made of geometric cells, the mesh elements. A finite element is a physical entity, which is supported by a mesh element. In Metafor, this is a two-steps method: first, the mesh is created, then the finite elements are applied to the mesh (this second step is done once the integration is started and programmed in the '' | ||
+ | |||
+ | Automatic meshers create nodes and mesh cells from the geometry. Metafor meshers are quite basic but still useful to mesh simple geometries, to avoid using external software. | ||
+ | |||
+ | ===== Generating nodes (& cells) ===== | ||
+ | |||
+ | ==== SimpleMesher1D ==== | ||
+ | |||
+ | {{: | ||
+ | Basic meshing of '' | ||
+ | |||
+ | | ||
+ | |||
+ | with | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |||
+ | {{: | ||
+ | Likewise, meshing at a higher degree (second or third): | ||
+ | |||
+ | | ||
+ | |||
+ | Note : The '' | ||
+ | |||
+ | ==== Density mesher - DensityMesher1D ==== | ||
+ | {{: | ||
+ | The density mesher is used to mesh a line while specifying the length of the desired segment as a function of the curvilinear abscissa. This is done in two steps: | ||
+ | |||
+ | First, a function "mesh element length" | ||
+ | |||
+ | < | ||
+ | def ellength(s): | ||
+ | return 0.1+(s-0.5)*(s-0.5) | ||
+ | ellength = PythonOneParameterFunction(ellength) | ||
+ | </ | ||
+ | |||
+ | Second, the density mesher is created on curve #1. | ||
+ | |||
+ | < | ||
+ | mesher = DensityMesher1D(curveset(1), | ||
+ | mesher.setDeltaI(0.001) | ||
+ | mesher.execute(False) | ||
+ | </ | ||
+ | |||
+ | The parameter '' | ||
+ | |||
+ | ==== HybridDensityMesher1D ==== | ||
+ | {{: | ||
+ | The way to create a grid of n intervals on a curve starts with specifying the distribution of points on this curve. This is done by specifying the distribution of the curve parameter u(ξ)0≤ξ≤n+1 in the parametric domain, corresponding to the points of the curve {\boldsymbol{x}(u) \; 0 \leq u \leq 1} in the physical domain. The final task is to specify {u(\xi) \; 0 \leq \xi \leq n+1} such as {\boldsymbol{x}(u(\xi)) \; 0 \leq \xi \leq n+1} is a good parametrization of the curve \boldsymbol{x}(u). | ||
+ | |||
+ | Finding the function u(\xi) is equivalent to finding the function \xi(u). With the definition \rho(u) = \frac{d\xi}{du}, | ||
+ | |||
+ | \xi(u) = \int_0^u \rho(w) dw. | ||
+ | |||
+ | In the hydrid case, the construction of the grid points density function \rho(u) requires more complex physical considerations. Several approaches exist: | ||
+ | |||
+ | * A uniform distribution of the arc length, where grid points are separated by equal distances in the physical domain. In this case, the grid points density function must be proportional to the arc length change rate: \rho(u) \propto \left\| \frac{d\boldsymbol{x}}{du} \right\| | ||
+ | * A uniform distribution of the arc length weighted by the curvature, where grid points are concentrated in areas with greater curvature. In this case, the grid points density function is written as: \rho(u) \propto \kappa(u) \left\| \frac{d\boldsymbol{x}}{du} \right\| where \kappa(u) is the curvature of the curve \boldsymbol{x}, | ||
+ | * An attraction of the grid towards an attraction point u^{*} in the parametric domain (which corresponds to the point \boldsymbol{x}^{*} = \boldsymbol{x}(u^{*}) in the physical domain). A usual possibility is u^{*}=0 or u^{*}=1, when a very small scale is desired at one end of the curve. Alternatively, | ||
+ | |||
+ | In practice, it is likely that the user wishes for an hybrid grid points density function, so a linear combination of several functions described above. These functions \rho_i(u) can be combined, each one being normalized such as \int_0^1 \rho_i(u) \, du = \xi(1)-\xi(0) = m. Introducing the positive constants \lambda_i such as \sum_i \lambda_i=1, | ||
+ | \rho(u) = \sum_i \lambda_i \rho_i(u) | ||
+ | This hybrid density function migrates the grid points towards every area where a function \rho_i(u) requires refining. Using this concept, it is possible to allocate grid points based on hybrid criteria of arc length, curvature and attraction towards a set of distinct points {u_i^*}. | ||
+ | |||
+ | Finally, supplying: | ||
+ | * the weights \lambda_s and \lambda_{\kappa}, | ||
+ | * the points \{u_i^* \; | \; 0 \leq u_i^* \leq 1, \; 1 \leq i \leq p\}, | ||
+ | * the weights \{\lambda_i, \; 1 \leq i \leq p\}, | ||
+ | * the attraction factors \{k_i, \; 1 \leq i \leq p\} | ||
+ | where \lambda_s+\lambda_{\kappa}+\sum_{i=1}^p \lambda_i =1, a distribution of n+1 points u_0, u_1, \ldots, u_{n+1} is generated, where these points are simultaneously: | ||
+ | * of a higher density close to the attraction points \{u_i^*\}, | ||
+ | * positioned in areas where the curvature is large, | ||
+ | * positioned to avoid large differences on the arc length. | ||
+ | |||
+ | In Metafor, the mesher '' | ||
+ | < | ||
+ | Mesher = HybridDensityMesher1D(curveset(number), | ||
+ | Mesher.execute(n, | ||
+ | </ | ||
+ | |||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |||
+ | To concentrate some mesh elements towards an attraction point, the follwoing command can be used before the '' | ||
+ | |||
+ | < | ||
+ | Mesher.pushAttractorPt(uJ) | ||
+ | Mesher.pushWeight(lambdaJ) | ||
+ | Mesher.pushStrength(kJ) | ||
+ | </ | ||
+ | |||
+ | |'' | ||
+ | |'' | ||
+ | |'' | ||
+ | |||
+ | ===== Generating cells alone ===== | ||
+ | |||
+ | Generating cells is only useful if you plan to define 1D elements (such as springs) in your model. | ||
+ | |||
+ | ==== Manual definition ==== | ||
+ | {{: | ||
+ | To manually create a 1D cell based on two mesh points, | ||
+ | |||
+ | mesh.define(no, | ||
+ | |||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | | '' | ||
+ | |||
+ | ==== CellLineMesher ==== | ||
+ | {{: | ||
+ | The '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | __Example: | ||
+ | |||
+ | Generation of '' | ||
+ | |||
+ | mesher = CellLineMesher(groupset(no1), | ||
+ | mesher.execute() | ||
+ | ... | ||
+ | app = FieldApplicator(no) | ||
+ | app.push(groupset(no1)) | ||
+ | # '' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ |