diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..8fded63 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,38 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 22, + "patch": 0 + }, + "configurePresets": [ + { + "name": "hopr_config_debug_nohdf5_nocgns", + "displayName": "hopr configure: default debug build no cgns no hdf5", + "hidden": false, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "LIBS_BUILD_HDF5": "Off", + "LIBS_USE_CGNS": "Off" + } + }, + { + "name": "hopr_config_release_nohdf5_nocgns", + "displayName": "hopr configure: default release build no cgns no hdf5", + "hidden": false, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "LIBS_BUILD_HDF5": "Off", + "LIBS_USE_CGNS": "Off" + } + } + ], + "testPresets": [ + { + "name": "HOPR_ctest", + "displayName": "Test HOPR running ctest ", + "configurePreset": "HOPR_config_release", + "output": {"outputOnFailure": true} + } + ] +} diff --git a/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.jpg b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.jpg new file mode 100644 index 0000000..e4c7a52 Binary files /dev/null and b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.jpg differ diff --git a/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.odg b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.odg new file mode 100644 index 0000000..edef23e Binary files /dev/null and b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.odg differ diff --git a/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.pdf b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.pdf new file mode 100644 index 0000000..46f4c30 Binary files /dev/null and b/docs/documentation/userguide/figures/2d_edge_vertex_connectivity_example.pdf differ diff --git a/docs/documentation/userguide/figures/CGNS_edges.jpg b/docs/documentation/userguide/figures/CGNS_edges.jpg new file mode 100644 index 0000000..90c6114 Binary files /dev/null and b/docs/documentation/userguide/figures/CGNS_edges.jpg differ diff --git a/docs/documentation/userguide/figures/CGNS_edges.odg b/docs/documentation/userguide/figures/CGNS_edges.odg new file mode 100644 index 0000000..692b9ca Binary files /dev/null and b/docs/documentation/userguide/figures/CGNS_edges.odg differ diff --git a/docs/documentation/userguide/figures/CGNS_edges.pdf b/docs/documentation/userguide/figures/CGNS_edges.pdf new file mode 100644 index 0000000..76a8445 Binary files /dev/null and b/docs/documentation/userguide/figures/CGNS_edges.pdf differ diff --git a/docs/documentation/userguide/meshformat.md b/docs/documentation/userguide/meshformat.md index 3e21bfa..8be22ca 100644 --- a/docs/documentation/userguide/meshformat.md +++ b/docs/documentation/userguide/meshformat.md @@ -1,12 +1,11 @@ # HOPR HDF5 Curved Mesh Format -Authors: Florian Hindenlang, Thomas Bolemann +Authors: Florian Hindenlang, Thomas Bolemann, Tobias Ott, Stephen Copplestone, Marcel Pfeiffer, Patrick Kopper -Last modified: September 4, 2019 +Last modified: November 23, 2023 -## Introduction -### Main Idea Behind the Mesh Format +## Introduction and Main Idea Behind the Mesh Format The High Order Preprocessor (HOPR) is able to generate high order unstructured 3D meshes, including tetrahedra, pyramids, prisms and hexahedra. @@ -35,13 +34,10 @@ Notes: - Data types: we use 32bit INTEGER and 64bit REAL (double precision), if not stated differently. -## File Description - - HOPR generates *\*\_mesh.h5* files. You can find examples of the mesh file by executing the tutorials in HOPR, and you can browse the files using *HDFView*. -### Global Attributes +## Global Attributes These attributes are defined globally for the whole mesh as given in table {numref}`tab:mesh_file_attributes`. For a mesh with elements having only straight edges, the polynomial degree of the element mapping is *Ngeo*$=N_{geo}=1$. @@ -51,40 +47,66 @@ A mesh with curved elements has a fixed polynomial degree $N_{geo}>1$ for all el --- name: tab:mesh_file_attributes --- - | **Attribute** | **Data type** | **Description | + | **Attribute** | **Data type** | **Description** | | :-------------------------- | :-----------------------: | :------------------------------------------------------------------------------------ | | Version | REAL | Mesh File Version | | Ngeo $\geq 1$ | INTEGER | Polynomial degree $N_{geo}$ of element mapping, used to determine the number of nodes per element | | nElems | INTEGER | Total number of elements in mesh | - | nSides | INTEGER | Total number of sides (or element faces) in file | - | nNodes | INTEGER | Total number of nodes in file | + | nSides | INTEGER | Total number of sides (or element faces) in mesh | + | nNodes | INTEGER | Total number of nodes in mesh | | nUniqueSides | INTEGER | Total number of geometrically unique sides in the mesh | | nUniqueNodes | INTEGER | Total number of geometrically unique nodes in the mesh | | nBCs | INTEGER | Size of the Boundary Condition list | -``` + | FEMconnect | STRING "ON"/"OFF" | "ON" if FEM edge and vertex connection have been built and written to file. + | only for **FEMconnect="ON"**: | | | + | ⮡ nEdges | INTEGER | Total number of entries in the EdgeInfo array (=sum over elements of nEdge(ElemType)) | + | ⮡ nVertices | INTEGER | Total number of entries in the VertexInfo array (=sum over elements of nVertices(ElemType)) | + | ⮡ nUniqueEdges | INTEGER | Total number of geometrically unique edges in the mesh | + | ⮡ nFEMSides | INTEGER | Total number of topologically (includes periodicity) unique sides in the mes (needed for a FEM solver) | + | ⮡ nFEMEdges | INTEGER | Total number of topologically (includes periodicity) unique edges in the mesh (needed for a FEM solver) | + | ⮡ nFEMEdgeConnections | INTEGER | Size of **EdgeConnectInfo** | + | ⮡ nFEMVertices | INTEGER | Total number of topologically (includes periodicity) unique vertices in the mesh (needed for a FEM solver) | + | ⮡ nFEMVertexConnections | INTEGER | Size of **VertexConnectInfo** | +``` + +## Data Arrays + +The mesh information is organized in arrays. +The data is always stored in blocks for each element, which results in storing it multiple times. +However, this way, each processor has a defined, non overlapping, range of **geometry and connectivity information**, where it can perform IO +operations, minimizing the need of communication between processors. -### Data Arrays -The mesh information is organized in arrays. The **ElemInfo** array is the first to read, since it contains the data range of each -element in the **SideInfo** and **NodeCoords** / **GlobalNodeIDs** arrays. + + The **ElemInfo** array is the first to read, since it contains the data range of each +element in the **SideInfo**, **EdgeInfo**, **VertexInfo** and **NodeCoords** / **GlobalNodeIDs** arrays. ```{table} List of all data arrays in mesh file. Dimensions marked with $^*$ will be distributed in parallel read mode. --- name: tab:mesh_data_arrays --- - | **Array Name** | **Description** | **Type** | **Size** | - | :-------------------------- | :----------------------- | :--------------- | :--------------- | - | **ElemInfo** | Start \ | End positions of element data in SideInfo / NodeCoords | INTEGER & (1:6,1:**nElems**$^*$) | - | **SideInfo** | Side Data / Connectivity information | INTEGER | (1:5,1:**nSides**$^*$) | - | **NodeCoords** | Node Coordinates | REAL | (1:3,1:**nNodes**$^*$) | - | **GlobalNodeIDs** | Globally unique node index | INTEGER | (1:**nNodes**$^*$) | - | BCNames | List of user-defined boundary condition names (max. 255 Characters) | STRING | (1:**nBCs**) | - | BCType | Four digit boundary condition code | INTEGER | (1:4,1:**nBCs**) | - | ElemBarycenters | Barycenter location of each element | REAL | (1:3,1:**nElems**$^*$) | - | ElemWeight | Element Weights for domain decomposition (=1 by default) | REAL | (1:**nElems**$^*$) | - | ElemCounter | mesh statistics (no. of elements of each element type) | INTEGER | (1:2,1:11) | + | **Array Name** | **Description** | **Type** | **Size** | + | :-------------------------- | :----------------------- | :------------ | :--------------- | + | **ElemInfo** | Start\End positions of element data in **SideInfo** /**NodeCoords** | INTEGER | (1:6,1:**nElems**$^*$) | + | **SideInfo** | Side Data / Connectivity information | INTEGER | (1:5,1:**nSides**$^*$) | + | **EdgeInfo** | Element Edge information and offsets in **EdgeConnectInfo** | INTEGER | (1:3,1:**nEdges**$^*$) | + | **NodeCoords** | Node Coordinates | REAL | (1:3,1:**nNodes**$^*$) | + | **GlobalNodeIDs** | Globally unique node index | INTEGER | (1:**nNodes**$^*$) | + | BCNames | List of user-defined boundary condition names (max. 255 Characters) | STRING | (1:**nBCs**) | + | BCType | Four digit boundary condition code | INTEGER | (1:4,1:**nBCs**) | + | ElemBarycenters | Barycenter location of each element | REAL | (1:3,1:**nElems**$^*$) | + | ElemWeight | Element Weights for domain decomposition (=1 by default) | REAL | (1:**nElems**$^*$) | + | ElemCounter | mesh statistics (no. of elements of each element type) | INTEGER | (1:2,1:11) | + | only for **FEMconnect="ON"**: | | | | + | ⮡ **FEMElemInfo** | Start\End positions of element data in **EdgeInfo**/**VertexInfo** | INTEGER | (1:4,1:**nElems**$^*$) | + | ⮡ **EdgeConnectInfo** | Connectivity information for each element edge (needed for a FEM solver) | INTEGER | (1:2,1:nFEMEdgeConnections) | + | ⮡ **VertexInfo** | Element Vertex Data information and and offsets in **VertexConnectInfo** | INTEGER | (1:3,1:**nVertices**$^*$) | + | ⮡ **VertexConnectInfo** | Connectivity information for each element vertex (needed for a FEM solver) | INTEGER | (1:2,1:nFEMVertexConnections) | ``` -### Example Mesh + + +### Example 3D Mesh + In the following sections, we explain the array definitions and show an example, which refers to the mesh in {numref}`fig:exmesh` with straight-edges, so $N_{geo}=1$. There is one element of each type, a tetrahedron, a pyramid, a prism and a hexahedron, four elements in total. Corner nodes and element sides have unique indices. @@ -96,26 +118,28 @@ width: 400px align: center --- -Example mesh with unique node IDs (circles) and unique side IDs (underline) and element-local coordinate system. +Example 3D mesh with unique node IDs (circles) and unique side IDs (underline) and element-local coordinate system. ``` -The global attributes of the mesh are -```{table} Global attributes for example mesh. +The global attributes of the mesh are shown in {numref}`tab:global_attributes`. + +```{table} Global attributes for example 3D mesh with 4 elements. --- name: tab:global_attributes --- -| | | | | -| --- | --- | --- | --- | -| Ngeo | 1 | nElems | 4 (Prism,Hex,Tet,Pyra) | -| nSides | 20 (=5+6+4+5) | nNodes | 23 (=6+8+4+5) | -| nUniqueSides | 16 | nUniqueNodes | 11 | -| nBCs | 4 | | | +| | | | | | | +| --- | --- | --- | --- | --- | --- | +| Ngeo | 1 | nElems | 4 (Prism,Hex,Tet,Pyra) | nBCs | 4 | +| nSides | 20 (=5+6+4+5) | nUniqueSides | 16 | nFEMSides | 16 | +| nEdges | 35 | nUniqueEdges | 22 | nFEMEdges | 22 | +| nNodes | 23 (=6+8+4+5) | nUniqueNodes | 11 | nFEMVertices | 11 | ``` -### Array Definitions -#### Element Information (ElemInfo) + +### Element Information (ElemInfo) + ```{table} Element Information --- name: tab:elem_info @@ -123,43 +147,92 @@ name: tab:elem_info | | | | :--- | :--- | | Name in file: | **ElemInfo** | -| Type: | INTEGER, Size: Array(1:6,1:**nElems**$^*$) | +| Type: | INTEGER, Size: Array(1:6,1:**nElems**$^*$) | | Description: | Array containing elements, one element per row, **row number is elemID**. | ``` -The data is always stored element wise, which results in storing it multiple times. -However, this way, each processor has a defined, non overlapping, range of side **node** information, where it can perform IO -operations, minimizing the need of communication between processors. + +The example mesh {numref}`fig:exmesh` with 4 elements is summarized in table {numref}`tab:elem_info_array`. +The example shows the four different elements (prism/hexahedron/tetrahedra/pyramid), the prism and hexa are in zone $1$ and the tet +and the pyramid in zone $2$. A detailed list of the element type encoding is found in Section {ref}`userguide/meshformat:Element Types`. +```{table} **ElemInfo** array for example 3D mesh with 4 elements. +--- +name: tab:elem_info_array +--- | | *Element Type* | *Zone* | *offsetIndSIDE* | *lastIndSIDE* | *offsetIndNODE* | *lastIndNODE* | | - | - | - | - | - | - | - | | 1 | 116 | 1 | 0 | 5 | 0 | 6 | | 2 | 118 | 1 | 5 | 11 | 6 | 14 | | 3 | 104 | 2 | 11 | 15 | 14 | 18 | | 4 | 115 | 2 | 15 | 20 | 18 | 23 | +``` -The example mesh {numref}`fig:exmesh` with 4 elements is summarized in table {numref}`tab:elem_info_array`. -```{table} **ElemInfo** array for example mesh with 4 elements. +```{table} **ElemInfo** definitions. --- -name: tab:elem_info_array +name: tab:elem_info_def --- -| | | -| - | - | -| *Element Type*: | Encoding for element type, see Section {ref}`userguide/meshformat:Element Types`. | -| *Zone*: | Element group number. | -| *offsetIndSIDE/lastIndSIDE*: | Each element has a range of sides in the **SideInfo** array. | -| *offsetIndNODE/lastIndNODE*: | Each element has a range of node coordinates in the **NodeCoords** array and **GlobalNodeIDs** array for unique indices. | +| | | +| - | - | +| *Element Type*: | Encoding for element type, see Section {ref}`userguide/meshformat:Element Types`. | +| *Zone*: | Element group number. | +| *offsetIndSIDE/lastIndSIDE*: | Each element has a range of sides in the **SideInfo** array. | +| *offsetIndNODE/lastIndNODE*: | Each element has a range of node coordinates in the **NodeCoords** array and **GlobalNodeIDs** array for unique indices. | ``` The range and the size are always defined as: *Range=[offset+1,last], Size=last-offset* +### FEM Element Information (FEMElemInfo) + +This array will only exist if `FEMConnect="ON"` (hopr parameterfile flag `generateFEMconnectivity=T`). + +```{table} FEM Element Information +--- +name: tab:femelem_info +--- +| | | +| :--- | :--- | +| Name in file: | **FEMElemInfo** | +| Type: | INTEGER, Size: Array(1:4,1:**nElems**$^*$) | +| Description: | Array containing elements, one element per row, **row number is elemID**. | +``` + + +The example mesh {numref}`fig:exmesh` with 4 elements is summarized in table {numref}`tab:elem_info_array`. The example shows the four different elements (prism/hexahedron/tetrahedra/pyramid), the prism and hexa are in zone $1$ and the tet and the pyramid in zone $2$. A detailed list of the element type encoding is found in Section {ref}`userguide/meshformat:Element Types`. -#### Side Information (SideInfo) +```{table} **FEMElemInfo** array for example 3D mesh with 4 elements. +--- +name: tab:femelem_info_array +--- +| |*offsetIndEDGE* | *lastIndEDGE* |*offsetIndVERTEX* | *lastIndVERTEX* | +| - | - | - | - | - | +| 1 | 0 | 9 | 0 | 6 | +| 2 | 9 | 21 | 6 | 14 | +| 3 | 21 | 27 | 14 | 18 | +| 4 | 27 | 35 | 18 | 23 | +``` + + +```{table} **FEMElemInfo** definitions. +--- +name: tab:femelem_info_def +--- +| | | +| - | - | +| *offsetIndEDGE/lastIndEDGE*: | Each element has a range of edges in the **EdgeInfo** array. | +| *offsetIndVERTEX/lastIndVERTEX*: | Each element has a range of edges in the **VertexInfo** array. | +``` + +The range and the size are always defined as: *Range=[offset+1,last], Size=last-offset* + + +### Side Information (SideInfo) + ```{table} Side Information --- name: tab:side_info @@ -168,51 +241,272 @@ name: tab:side_info | :--- | :--- | | Name in file: | **SideInfo** | | Type: | INTEGER, Size: Array(1:6,1:**nSides**$^*$) | -| Description: | Side array, all information of one element is a set of all element sides (CGNS ordering, \rf{fig:CGNS}). | -| | *offsetIndSIDE/lastIndSIDE*in **ElemInfo** refers to the row index of one set of element sides. | -``` - -| | SideType | GlobalSideID | nbElemID | 10*nbLocSide+Flip | BCID | in **ElemInfo** | -| - | - | - | - | - | - | - | -| 1 | 3 | 1 | 0 | 0 | 1 | (offsetIndSIDE+1,1) | -| 2 | 14 | 2 | 2 | 43 | 0 | | -| 3 | 14 | 3 | 0 | 0 | 3 | | -| 4 | 14 | 4 | 0 | 0 | 4 | | -| 5 | 3 | 5 | 3 | 12 | 0 | (lastIndSIDE,1) | -| 6 | 14 | 6 | 0 | 0 | 1 | (offsetIndSIDE+1,2) | -| 7 | 14 | 7 | 0 | 0 | 2 | | -| 8 | 14 | 8 | 2 | 50 | 3 | | -| 9 | 14 | -2 | 1 | 23 | 0 | | -| 10 | 14 | 9 | 2 | 30 | 4 | | -| 11 | 14 | 10 | 4 | 14 | 0 | (lastIndSIDE,2) | -| 12 | 3 | -5 | 1 | 52 | 0 | (offsetIndSIDE+1,3) | -| 13 | 3 | 11 | 4 | 42 | 0 | | -| 14 | 3 | 12 | 0 | 0 | 3 | | -| 15 | 3 | 13 | 0 | 0 | 4 | (lastIndSIDE,3) | -| 16 | 14 | -10 | 2 | 61 | 0 | (offsetIndSIDE+1,4) | -| 17 | 3 | 15 | 0 | 0 | 2 | | -| 18 | 3 | 16 | 0 | 0 | 3 | | -| 19 | 3 | -11 | 3 | 22 | 0 | | -| 20 | 3 | 14 | 0 | 0 | 4 | (lastIndSIDE,4) | - - - -The **SideInfo** array for the example mesh {numref}`fig:exmesh` with 4 elements is given in table {numref}`tab:elem_info_array`. - -```{table} **SideInfo** array for example mesh +| Description: | Side array, all information of one element is stored continuously (CGNS ordering, \rf{fig:CGNS}) | +| | in range 'offsetIndSIDE+1:lastIndSIDE' from **ElemInfo**. | +``` + + + + +The **SideInfo** array for the example mesh {numref}`fig:exmesh` with 4 elements is given in table {numref}`tab:side_info_array`. + +```{table} **SideInfo** array for example 3D mesh with 4 elements. --- name: tab:side_info_array --- -| | | -| :----------- | :--- | -| *SideType*: | Side type encoding, the number of corner nodes is the last digit (triangle/quadrangle), more details see Section {ref}`userguide/meshformat:Element Types`. | -| *GlobalSideID*: | unique global side identifier, can be directly used as MPI tag: it is negative if the side is a slave side (a master and a slave side is defined for side connections). | -| *nbElemID*: | ElemID of neighbor element ($=0$ for no connection). This helps to quickly build up element connections, for local (inside local element range) as well as inter-processor element connections. | -| 10*nbLocSide+Flip*: | first digit : local side of the connected neighbor element$\in[1,\dots,6]$, last digit: Orientation between the sides (flip $\in [0,\dots,4]$), see Section {ref}`userguide/meshformat:Element Connectivity`. | +| | SideType | GlobalSideID | nbElemID | 10*nbLocSide+Flip | BCID | [#ElemID,locSideID]| in **ElemInfo** | +| - | - | - | - | - | - | - | - | +| 1 | 3 | 1 | 0 | 0 | 1 | [#1,1] | [(offsetIndSIDE,1)+1] | +| 2 | 14 | 2 | 2 | 43 | 0 | [#1,2] | | +| 3 | 14 | 3 | 0 | 0 | 3 | [#1,3] | | +| 4 | 14 | 4 | 0 | 0 | 4 | [#1,4] | | +| 5 | 3 | 5 | 3 | 12 | 0 | [#1,5] | [(lastIndSIDE,1)] | +| 6 | 14 | 6 | 0 | 0 | 1 | [#2,1] | [(offsetIndSIDE,2)+1] | +| 7 | 14 | 7 | 0 | 0 | 2 | [#2,2] | | +| 8 | 14 | 8 | 2 | 50 | 3 | [#2,3] | | +| 9 | 14 | -2 | 1 | 23 | 0 | [#2,4] | | +| 10 | 14 | 9 | 2 | 30 | 4 | [#2,5] | | +| 11 | 14 | 10 | 4 | 14 | 0 | [#2,6] | [(lastIndSIDE,2)] | +| 12 | 3 | -5 | 1 | 52 | 0 | [#3,1] | [(offsetIndSIDE,3)+1] | +| 13 | 3 | 11 | 4 | 42 | 0 | [#3,2] | | +| 14 | 3 | 12 | 0 | 0 | 3 | [#3,3] | | +| 15 | 3 | 13 | 0 | 0 | 4 | [#3,4] | [(lastIndSIDE,3)] | +| 16 | 14 | -10 | 2 | 61 | 0 | [#4,1] | [(offsetIndSIDE,4)+1] | +| 17 | 3 | 15 | 0 | 0 | 2 | [#4,2] | | +| 18 | 3 | 16 | 0 | 0 | 3 | [#4,3] | | +| 19 | 3 | -11 | 3 | 22 | 0 | [#4,4] | | +| 20 | 3 | 14 | 0 | 0 | 4 | [#4,5] | [(lastIndSIDE,4) ] | +``` + +```{table} **SideInfo** definitions +--- +name: tab:side_info_def +--- +| | | +| :--- | :--- | +| *SideType*: | Side type encoding, the number of corner nodes is the last digit (triangle/quadrangle), more details see Section {ref}`userguide/meshformat:Element Types`. | +| *GlobalSideID*: | Unique global side identifier, can be directly used as MPI tag: it is negative if the side is a slave side (a master and a slave side is defined for side connections). | +| *nbElemID*: | ElemID of neighbor element ($=0$ for no connection). This helps to quickly build up element connections, for local (inside local element range) as well as inter-processor element connections. | +| 10*nbLocSide+Flip*: | first digit : local side of the connected neighbor element$\in[1,\dots,6]$, last digit: Orientation between the sides (flip $\in [0,\dots,4]$), see Section {ref}`userguide/meshformat:Element Connectivity`. | | *BCID*: | Refers to the row index of the Boundary Condition List in **BCNames**/**BCType** array ($\in[1,\dots\text{\texttt{nBCs}}]$). $=0$ for inner sides. Note that $\neq 0$ for periodic and inner boundary conditions, while nbElemID and nbLocSide+Flip are given, see Section {ref}`userguide/meshformat:Boundary Conditions`. | ``` -#### Node Coordinates and Global Index +### Edge Information (EdgeInfo) + +These arrays will only exist if `FEMConnect="ON"` (hopr parameterfile flag `generateFEMconnectivity=T`). + +```{figure} figures/2d_edge_vertex_connectivity_example.jpg +--- +name: fig:exmesh2d +width: 800px +align: center +--- +Example 2D mesh with periodic BC, local, unique node IDs and **FEMVertexID** (circles,ellipses) and local, unique edge IDs and their FEMEdgeIDs (trapezoid) Arrows for edge orientation +``` + + +The **EdgeInfo** array includes the `FEMEdgeID` of each local element edge in the same order as the CGNS edges as well as the `offsetIndEDGEConnect` and the `lastIndEDGEConnect` which refer to the corresponding position on the additional `EdgeConnectInfo` array. Here, the `nbElemID` as well as the `localEdgeID` in the corresponding `nbElemID` are saved. + +Therefore, the multiplicity is given as `multiplicity=lastEdgeConnect - offSetEdgeConnect+1`. + +```{table} Edge Information +--- +name: tab:edge_info +--- +| | | +| :--- | :--- | +| Name in file: | **EdgeInfo** | +| Type: | INTEGER, Size: Array(1:3,1:**nEdges**$^*$) | +| Description: | Edge array, all information of one element is stored continuously (CGNS ordering, \rf{fig:CGNS}) | +| | in the range 'offsetIndEDGE+1:lastIndEDGE' from **FEMElemInfo**. | +``` + + +The **EdgeInfo** array for the example mesh {numref}`fig:exmesh2d` with 4 elements is given in table {numref}`tab:edge_info_array`. + +```{table} **EdgeInfo** array for example 2D mesh with 4 elements. +--- +name: tab:edge_info_array +--- +| | (+/- orientation)FEMEdgeID | offsetIndEDGEConnect | LastIndEDGEConnect | [#ElemID,locEdgeID] | [in **FEMElemInfo**] | +| - | - | - | - | - | - | +| 1 | - 6 | 0 | 1 | [#1,1] | [(offsetIndEDGE,1)+1] | +| 2 | - 10 | 1 | 2 | [#1,2] | | +| 3 | + 2 | 2 | 2 | [#1,3] | | +| 4 | + 11 | 2 | 3 | [#1,4] | [(lastIndEDGE,1)] | +| 5 | + 7 | 3 | 3 | [#2,1] | [(offsetIndEDGE,2)+1] | +| 6 | - 8 | 3 | 4 | [#2,2] | | +| 7 | + 6 | 4 | 5 | [#2,3] | | +| 8 | - 9 | 5 | 6 | [#2,4] | [(lastIndEDGE,2)] | +| 9 | + 3 | 6 | 6 | [#3,1] | [(offsetIndEDGE,3)+1] | +| 10 | + 10 | 6 | 7 | [#3,2] | | +| 11 | + 8 | 7 | 8 | [#3,3] | | +| 12 | - 5 | 8 | 9 | [#3,4] | [(lastIndEDGE,3)] | +| 13 | + 1 | 9 | 9 | [#4,1] | [(offsetIndEDGE,4)+1] | +| 14 | + 5 | 9 | 10 | [#4,2] | | +| 15 | + 9 | 10 | 11 | [#4,3] | | +| 16 | - 11 | 11 | 12 | [#4,4] | [(lastIndEDGE,4)] | +``` + +```{table} **EdgeInfo** definitions +--- +name: tab:edge_info_def +--- +| | | +| :--- | :--- | +| *FEMEdgeID*: | Topologically unique global edge ID, includes periodicity. Sign refers to the local to global edge orientation (`+` is same / `-` is opposite) | +| *offsetIndEDGEConnect/lastIndEDGEConnect*: | Each local element edge has a range of neighbor element edges in the **EdgeConnectInfo** array | +``` + +```{table} **EdgeConnectInfo** array for example 2D mesh with 4 elements. +--- +name: tab:edge_conn_info +--- +| | (+/- master/slave) nbElemID | (+/- orientation)nbLocEdgeID | [#ElemID,locEdgeID,FEMEdgeID] | [in **EdgeInfo**] | +| - | - | - | - | - | +| 1 | + 2 | + 3 | [#1,1,6 ] | [(offsetIndEDGEConnect, 1)+1] | +| 2 | - 3 | + 2 | [#1,2,10] | [(offsetIndEDGEConnect, 2)+1] | +| 3 | + 4 | - 4 | [#1,4,11] | [(offsetIndEDGEConnect, 4)+1] | +| 4 | - 3 | + 3 | [#2,2,8 ] | [(offsetIndEDGEConnect, 6)+1] | +| 5 | - 1 | - 1 | [#2,3,6 ] | [(offsetIndEDGEConnect, 7)+1] | +| 6 | - 4 | + 3 | [#2,4,9 ] | [(offsetIndEDGEConnect, 8)+1] | +| 7 | + 1 | - 2 | [#3,2,10] | [(offsetIndEDGEConnect,10)+1] | +| 8 | + 2 | - 2 | [#3,3,8 ] | [(offsetIndEDGEConnect,11)+1] | +| 9 | - 4 | + 2 | [#3,4,5 ] | [(offsetIndEDGEConnect,12)+1] | +| 10 | + 3 | - 4 | [#4,2,5 ] | [(offsetIndEDGEConnect,14)+1] | +| 11 | + 2 | - 4 | [#4,3,9 ] | [(offsetIndEDGEConnect,15)+1] | +| 12 | - 1 | + 4 | [#4,4,11] | [(offsetIndEDGEConnect,16)+1] | +``` +```{table} **EdgeConnectInfo** definitions +--- +name: tab:edge_conn_info_def +--- +| | | +| :--- | :--- | +| *nbElemID*: | element ID of connected element via the edge. Sign refers if the neighbor edge is master or slave (`+` master / `-` slave) | +| | from the master slave information, the master/slave of the elements' edge can be deduced | +| *nbLocEdgeID*: | local Edge ID in neighbor element. Sign refers to the local to global edge orientation of neighbor edge (`+` is same / `-` is opposite) | +``` + + +### Vertex Information (VertexInfo) + +These arrays will only exist if `FEMConnect="ON"` (hopr parameterfile flag `generateFEMconnectivity=T`). + +The **VertexInfo** array includes the `FEMVertexID` of each local element vertex in the same order as the CGNS corners as well as the `offsetIndVERTEXConnect` and the `lastIndVERTEXConnect` +which refer to the corresponding position in the additional **VertexConnectInfo** array. Here, the `nbElemID` as well as the `localNodeID` in the corresponding `nbElemID` are saved. + +Therefore, the multiplicity is given as `multiplicity = lastIndVERTEXConnect- offsetIndVERTEXConnect + 1.` + +``` +{table} Vertex Information +--- +name: tab:vertex_info +--- +| | | +| :--- | :--- | +| Name in file: | **VertexInfo** | +| Type: | INTEGER, Size: Array(1:3,1:**nVertices**$^*$) | +| Description: | Vertex array, all information of one element is a stored continuously (CGNS ordering, \rf{fig:CGNS}) | +| | in the range 'offsetIndVERTEX+1:lastIndVERTEX' from **FEMElemInfo**. | +``` + +```{table} **VertexInfo** array for example 2D mesh with 4 elements. +--- +name: tab:vertex_info_array +--- +| | FEMVertexID | offsetIndVERTEXConnect | lastIndVERTEXConnect | [#ElemID,locVertexID] | [ *in FEMElemInfo* ]| +| - | - | - | - | - | - | +| 1 | 5 | 0 | 2 | [#1,1] | [(offsetIndVERTEX,1)+1 ]| +| 2 | 6 | 2 | 4 | [#1,2] | | +| 3 | 3 | 4 | 5 | [#1,3] | | +| 4 | 4 | 5 | 6 | [#1,4] | [ (lastIndVERTEX,1) ]| +| 5 | 2 | 6 | 9 | [#2,1] | [(offsetIndVERTEX,2)+1 ]| +| 6 | 2 | 9 | 12 | [#2,2] | | +| 7 | 6 | 12 | 14 | [#2,3] | | +| 8 | 5 | 14 | 16 | [#2,4] | [ (lastIndVERTEX,2) ]| +| 9 | 1 | 16 | 17 | [#3,1] | [(offsetIndVERTEX,3)+1 ]| +| 10 | 3 | 17 | 18 | [#3,2] | | +| 11 | 6 | 18 | 20 | [#3,3] | | +| 12 | 2 | 20 | 23 | [#3,4] | [ (lastIndVERTEX,3) ]| +| 13 | 4 | 23 | 24 | [#4,1] | [(offsetIndVERTEX,4)+1 ]| +| 14 | 1 | 24 | 25 | [#4,2] | | +| 15 | 2 | 25 | 28 | [#4,3] | | +| 16 | 5 | 28 | 30 | [#4,4] | [ (lastIndVERTEX,4) ]| +``` + +```{table} **VertexInfo** definitions +--- +name: tab:vertex_info_def +--- +| | | +| :--- | :--- | +| *FEMVertexID*: | Topologically unique global vertex ID, includes periodicity (needed for a FEM solver) | +| *offsetIndVERTEXConnect/lastIndVERTEXConnect*: | Each local element vertex has a range of neighbor element edgvertices in the **VertexConnectInfo** array. | +``` + +```{table} VertexConnect Information +--- +name: tab:vertex_connect_info +--- +| | | +| :--- | :--- | +| Name in file: | **VertexConnectInfo** | +| Type: | INTEGER, Size: Array(1:2,1:nFEMVertexConnections)| +| Description: | Array of connected vertices, all information of one vertex is stored continuously | +| | in the range `offsetIndVERTEXConnect+1:lastIndVERTEXConnect` in **VertexInfo** | +``` + +```{table} **VertexConnecInfo** array for example mesh with 4 elements. +--- +name: tab:vertex_connect_info_array +--- +| | (+/- master/slave) nbElemID | localNodeID | [#ElemID,locVertexID,FEMVertexID] | [in **VertexInfo**] | +| - | - | - | - | - | +| 1 | - 4 | 4 | [#1,1,5] | [(offsetIndVERTEXConnect,1)+1] | +| 2 | - 2 | 4 | [#1,1,5] | [ (lastIndVERTEXConnect,1) ] | +| 3 | - 2 | 3 | [#1,2,6] | [(offsetIndVERTEXConnect,2)+1] | +| 4 | - 3 | 3 | [#1,2,6] | [ (lastIndVERTEXConnect,2) ] | +| 5 | - 3 | 2 | [#1,3,3] | [(offsetIndVERTEXConnect,3)+1] | +| 6 | - 4 | 1 | [#1,4,4] | [(offsetIndVERTEXConnect,4)+1] | +| 7 | - 4 | 3 | [#2,1,2] | [(offsetIndVERTEXConnect,5)+1] | +| 8 | - 3 | 4 | [#2,1,2] | | +| 9 | - 2 | 2 | [#2,1,2] | [ (lastIndVERTEXConnect,5) ] | +| 10 | - 4 | 3 | [#2,2,2] | [(offsetIndVERTEXConnect,6)+1] | +| 11 | - 3 | 4 | [#2,2,2] | | +| 12 | + 2 | 1 | [#2,2,2] | [ (lastIndVERTEXConnect,6) ] | +| 13 | + 1 | 2 | [#2,3,6] | [ (offsetIndVERTEXConnect,7)+1] | +| 14 | - 3 | 3 | [#2,3,6] | [ (lastIndVERTEXConnect,7) ] | +| 15 | + 1 | 1 | [#2,4,5] | [ (offsetIndVERTEXConnect,8)+1] | +| 16 | - 4 | 4 | [#2,4,5] | [ (lastIndVERTEXConnect,8) ] | +| 17 | + 4 | 2 | [#3,1,1] | [ (offsetIndVERTEXConnect,9)+1] | +| 18 | + 1 | 3 | [#3,2,3] | [(offsetIndVERTEXConnect,10)+1] | +| 19 | + 1 | 2 | [#3,3,6] | [(offsetIndVERTEXConnect,11)+1] | +| 20 | - 2 | 3 | [#3,3,6] | [ (lastIndVERTEXConnect,11) ] | +| 21 | - 2 | 2 | [#3,4,2] | [(offsetIndVERTEXConnect,12)+1] | +| 22 | + 2 | 1 | [#3,4,2] | | +| 23 | - 4 | 3 | [#3,4,2] | [ (lastIndVERTEXConnect,12) ] | +| 24 | + 1 | 4 | [#4,1,4] | [(offsetIndVERTEXConnect,13)+1] | +| 25 | - 3 | 1 | [#4,2,1] | [(offsetIndVERTEXConnect,14)+1] | +| 26 | + 2 | 1 | [#4,3,2] | [(offsetIndVERTEXConnect,15)+1] | +| 27 | - 2 | 2 | [#4,3,2] | | +| 28 | - 3 | 4 | [#4,3,2] | [ (lastIndVERTEXConnect,15) ] | +| 29 | + 1 | 1 | [#4,4,5] | [(offsetIndVERTEXConnect,16)+1] | +| 30 | - 2 | 4 | [#4,4,5] | [ (lastIndVERTEXConnect,16) ] | +``` + +```{table} **VertexConnectInfo** definitions +--- +name: tab:vertex_conn_info_def +--- +| | | +| :--- | :--- | +| *nbElemID*: | element ID of connected element via the vertex. Sign refers if the neighbor vertex is master or slave (`+` master / `-` slave) | +| | from the master slave information, the master/slave of the elements' vertex can be deduced | +| *nbLocVertexID*: | local vertex ID in neighbor element. | +``` + +### Node Coordinates and Global Index ```{table} NodeCoords --- @@ -253,13 +547,13 @@ name: tab:NodeCoordsGlobalNodeIDs --- | **NodeCoords** | | **GlobalNodeIDs** | in **ElemInfo** | | :--- | - | ---: | -- | -| $(x,y,z)_{ 5}$ | | 5 | (offsetIndNODE+1,1) | +| $(x,y,z)_{ 5}$ | | 5 | (offsetIndNODE,1)+1 | | $(x,y,z)_{ 3}$ | | 3 | | | $(x,y,z)_{ 4}$ | | 4 | | | $(x,y,z)_{11}$ | | 11 | | | $(x,y,z)_{ 9}$ | | 9 | | | $(x,y,z)_{ 6}$ | | 6 | (lastIndNODE,1) | -| $(x,y,z)_{ 1}$ | | 1 | (offsetIndNODE+1,2) | +| $(x,y,z)_{ 1}$ | | 1 | (offsetIndNODE,2)+1 | | $(x,y,z)_{ 2}$ | | 2 | | | $(x,y,z)_{ 5}$ | | 5 | | | $(x,y,z)_{ 3}$ | | 3 | | @@ -267,18 +561,18 @@ name: tab:NodeCoordsGlobalNodeIDs | $(x,y,z)_{ 8}$ | | 8 | | | $(x,y,z)_{11}$ | | 11 | | | $(x,y,z)_{ 9}$ | | 9 | (lastIndNODE,2) | -| $(x,y,z)_{11}$ | | 11 | (offsetIndNODE+1,3) | +| $(x,y,z)_{11}$ | | 11 | (offsetIndNODE,3)+1 | | $(x,y,z)_{ 9}$ | | 9 | | | $(x,y,z)_{ 6}$ | | 6 | | | $(x,y,z)_{10}$ | | 10 | (lastIndNODE,3) | -| $(x,y,z)_{ 7}$ | | 7 | (offsetIndNODE+1,4) | +| $(x,y,z)_{ 7}$ | | 7 | (offsetIndNODE,4)+1 | | $(x,y,z)_{ 8}$ | | 8 | | | $(x,y,z)_{11}$ | | 11 | | | $(x,y,z)_{ 9}$ | | 9 | | | $(x,y,z)_{10}$ | | 10 | (lastIndNODE,4) | ``` -#### Boundary Conditions +### Boundary Conditions ```{table} BCNames --- name: tab:BCNames @@ -356,7 +650,7 @@ node data (**NodeCoords**), by computing | *lastElem =* | *offsetElem(myDom+1)* | | *firstSide =* | **ElemInfo** *(offsetIndSIDE,firstElem)+1* | | *lastSide =* | **ElemInfo** *(lastIndSIDE,lastElem)* | -| *firstNode =* | **ElemInfo** *(offsetIndNode,firstElem)+1* | +| *firstNode =* | **ElemInfo** *(offsetIndNODE,firstElem)+1* | | *lastNode =* | **ElemInfo** *(lastIndNODE,lastElem)* | and again read the non-overlapping sub-arrays in parallel. @@ -460,10 +754,10 @@ The classification of the element types is given in {numref}`tab:elemtype`. The last digit is always the number of corner nodes. The classification is geometrically motivated. The element has a linear mapping if $N_{geo}=1$ and the corner nodes are an affine transformation of the reference element corner nodes, whereas bilinear stands for the general straight-edged element with $N_{geo}=1$, and non-linear for the high order case -$N_{geo} \ge 1$. +$N_{geo} \ge 1$. For mesh file read-in, only the number of element corner nodes is important to distinguish the 3D elements, since the polynomial -degree $N_{geo}$ is globally defined. +degree $N_{geo}$ is globally defined. ```{table} Element type encoding. --- @@ -548,7 +842,7 @@ Especially, the CGNS standard defines a local coordinate system of each element the remaining nodes are ordered in the direction of the outward pointing normal. -```{figure} figures/CGNS.jpg +```{figure} figures/CGNS_edges.jpg --- name: fig:CGNS width: 500px @@ -636,7 +930,7 @@ The following differences are present for the **ElemInfo** and the **SideInfo** ### Changes to Existing Data Format -- **ElemInfo**: The range of sides defined by *offsetIndSide* and *lastIndSide* now includes the small mortar master sides for the element that owns the big mortar side. +- **ElemInfo**: The range of sides defined by *offsetIndSIDE* and *lastIndSIDE* now includes the small mortar master sides for the element that owns the big mortar side. - **SideInfo**: The field *nbElemID* of the big mortar side defines no connection to the neighbor element, but contains the type of the mortar interface (=1/2/3) from {numref}`fig:mortartypes` **with negative sign**, to mark that the following sides belong to a mortar interface. The type of the interface defines the number of the small mortar master sides (Type 1 has 4 and Type 2\&3 have 2 small master sides). - **SideInfo**: The list of sides belonging to an element includes the small mortar master sides sorted as exemplified in {numref}`tab:mortarsorting` and {numref}`fig:mortarinterface`. - **SideInfo**: Only the small mortar masters have a valid *nbElemID*, defining the connection to the adjacent small elements. diff --git a/src/basis/basis.f90 b/src/basis/basis.f90 index 3ffc4b1..af66153 100644 --- a/src/basis/basis.f90 +++ b/src/basis/basis.f90 @@ -78,8 +78,7 @@ SUBROUTINE InitBasis() WRITE(UNIT_StdOut,'(132("-"))') WRITE(UNIT_stdOut,'(A)') ' INIT BASIS...' IF(.NOT.MeshInitDone)THEN - CALL abort(__STAMP__, & - 'ERROR: InitMesh has to be called before InitBasis!',999,999.) + CALL abort(__STAMP__,'ERROR: InitMesh has to be called before InitBasis!',999,999.) END IF WRITE(tmpstr,'(I4)')N nVisu=GETINT('nVisu',tmpstr) @@ -284,8 +283,7 @@ SUBROUTINE GetNodesAndWeights(N_in,NodeType_in,xIP,wIP,wIPBary) ! first order intergration !!! wIP=2./REAL(N_in+1) CASE DEFAULT - CALL Abort(__STAMP__,& - 'NodeType "'//TRIM(NodeType_in)//'" in GetNodesAndWeights not found!') + CALL Abort(__STAMP__,'NodeType "'//TRIM(NodeType_in)//'" in GetNodesAndWeights not found!') END SELECT ELSE SELECT CASE(TRIM(NodeType_in)) @@ -306,8 +304,7 @@ SUBROUTINE GetNodesAndWeights(N_in,NodeType_in,xIP,wIP,wIPBary) xIP(i) = 1./REAL(N_in+1)+2.*REAL(i)/REAL(N_in+1) - 1. END DO CASE DEFAULT - CALL Abort(__STAMP__,& - 'NodeType "'//TRIM(NodeType_in)//'" in GetNodesAndWeights not found!') + CALL Abort(__STAMP__,'NodeType "'//TRIM(NodeType_in)//'" in GetNodesAndWeights not found!') END SELECT END IF !present wIP IF(PRESENT(wIPBary)) CALL BarycentricWeights(N_in,xIP,wIPBary) diff --git a/src/basis/basis1D.f90 b/src/basis/basis1D.f90 index 1733ab2..0a2420e 100644 --- a/src/basis/basis1D.f90 +++ b/src/basis/basis1D.f90 @@ -12,7 +12,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -30,7 +30,7 @@ MODULE MOD_Basis1D IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! Private Part --------------------------------------------------------------------------------------------------------------------- ! Public Part ---------------------------------------------------------------------------------------------------------------------- @@ -74,11 +74,11 @@ MODULE MOD_Basis1D MODULE PROCEDURE PolynomialDerivativeMatrix END INTERFACE -INTERFACE BarycentricWeights - MODULE PROCEDURE BarycentricWeights +INTERFACE BarycentricWeights + MODULE PROCEDURE BarycentricWeights END INTERFACE -INTERFACE InitializeVandermonde +INTERFACE InitializeVandermonde MODULE PROCEDURE InitializeVandermonde END INTERFACE @@ -128,14 +128,14 @@ SUBROUTINE JacobiP(nNodes,x,alpha,beta,Deg,P) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: P(nNodes) ! value of Jacobi polynomial N at all positions x !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES REAL,DIMENSION(nNodes) :: P_0,P_1 ! ? REAL :: gamma0,gamma1,gammaf(1:alpha+beta+2) ! ? REAL :: aold,anew,bnew ! ? REAL :: ri,ralpha,rbeta !temp INTEGER :: i,h1,h2 ! ? !=================================================================================================================================== -!fill gamma function, only for integer values, replace by real gamma function, if needed. Intrinsic gamma function only with GNU +!fill gamma function, only for integer values, replace by real gamma function, if needed. Intrinsic gamma function only with GNU ralpha=REAL(alpha) rbeta=REAL(beta) gammaf(1:2)=1 @@ -179,7 +179,7 @@ END SUBROUTINE JacobiP SUBROUTINE GradJacobiP(nNodes,x,alpha,beta,Deg,GradP) !=================================================================================================================================== -! evaluates the first derivative of the Nth Jacobi-polynomial at position xi, +! evaluates the first derivative of the Nth Jacobi-polynomial at position xi, ! Algorithm in book of hesthaven and found in his matlab code ! The Jacobi Polynomials P_i^{(alpha,beta)}(x) are orthonormal with respect to the weighting function in the interval [-1,1] ! w(x)=(1-x)^alpha(1+x)^beta @@ -196,7 +196,7 @@ SUBROUTINE GradJacobiP(nNodes,x,alpha,beta,Deg,GradP) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: GradP(nNodes) ! value of the gradient of Jacobi polynomial N at all positions x !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES REAL,DIMENSION(nNodes) :: P ! ? !=================================================================================================================================== IF(Deg.EQ.0)THEN @@ -226,13 +226,13 @@ SUBROUTINE JacobiP_all(nNodes,x,alpha,beta,Deg,P) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: P(nNodes,0:Deg) ! value of Jacobi polynomial N at all positions x !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES REAL :: gamma0,gamma1,gammaf(1:alpha+beta+2) ! ? REAL :: aold,anew,bnew ! ? REAL :: ri,ralpha,rbeta !temp INTEGER :: i,h1,h2 ! ? !=================================================================================================================================== -!fill gamma function, only for integer values, replace by real gamma function, if needed. Intrinsic gamma function only with GNU +!fill gamma function, only for integer values, replace by real gamma function, if needed. Intrinsic gamma function only with GNU ralpha=REAL(alpha) rbeta=REAL(beta) gammaf(1:2)=1 @@ -272,7 +272,7 @@ END SUBROUTINE JacobiP_all SUBROUTINE GradJacobiP_all(nNodes,x,alpha,beta,Deg,GradP) !=================================================================================================================================== -! evaluates the first derivative of the Nth Jacobi-polynomial at position xi, +! evaluates the first derivative of the Nth Jacobi-polynomial at position xi, ! Algorithm in book of hesthaven and found in his matlab code ! The Jacobi Polynomials P_i^{(alpha,beta)}(x) are orthonormal with respect to the weighting function in the interval [-1,1] ! w(x)=(1-x)^alpha(1+x)^beta @@ -289,7 +289,7 @@ SUBROUTINE GradJacobiP_all(nNodes,x,alpha,beta,Deg,GradP) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: GradP(nNodes,0:Deg) ! value of the gradient of Jacobi polynomial N at all positions x !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES REAL,DIMENSION(nNodes,0:Deg) :: P ! ? INTEGER :: i ! ? !=================================================================================================================================== @@ -318,7 +318,7 @@ SUBROUTINE Vandermonde1D(nNodes1D,Deg,r1D,VdM1D) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: VdM1D(0:nNodes1D-1,0:Deg) ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== CALL JacobiP_all(nNodes1D,r1D, 0, 0, Deg,Vdm1D(:,:)) END SUBROUTINE Vandermonde1D @@ -338,7 +338,7 @@ SUBROUTINE GradVandermonde1D(nNodes1D,Deg,r1D,gradVdM1D) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: gradVdM1D(0:nNodes1D-1,0:Deg) ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== CALL GradJacobiP_all(nNodes1D,r1D, 0, 0,Deg,gradVdM1D(:,:)) END SUBROUTINE GradVandermonde1D @@ -432,8 +432,7 @@ SUBROUTINE buildLegendreVdm(N_In,xi_In,Vdm_Leg,sVdm_Leg) sVdm_Leg=INV(Vdm_Leg) !check (Vdm_Leg)^(-1)*Vdm_Leg := I dummy=ABS(SUM(ABS(MATMUL(sVdm_Leg,Vdm_Leg)))/(N_In+1.)-1.) -IF(dummy.GT.10.*PP_RealTolerance) CALL abort(__STAMP__,& - 'problems in MODAL<->NODAL Vandermonde ',999,dummy) +IF(dummy.GT.10.*PP_RealTolerance) CALL abort(__STAMP__,'problems in MODAL<->NODAL Vandermonde ',999,dummy) END SUBROUTINE buildLegendreVdm @@ -445,7 +444,7 @@ SUBROUTINE ChebyshevGaussNodesAndWeights(N_in,xGP,wGP) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- !input parameters -INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) CLpoints +INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) CLpoints !----------------------------------------------------------------------------------------------------------------------------------- !output parameters REAL,INTENT(OUT) :: xGP(0:N_in) ! Gausspoint positions for the reference interval [-1,1] @@ -473,13 +472,13 @@ SUBROUTINE ChebyGaussLobNodesAndWeights(N_in,xGP,wGP) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES -INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) CLpoints +INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) CLpoints !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL,INTENT(OUT) :: xGP(0:N_in) ! Gausspoint positions for the reference interval [-1,1] REAL,INTENT(OUT),OPTIONAL :: wGP(0:N_in) ! Gausspoint weights !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iGP ! ? !=================================================================================================================================== DO iGP=0,N_in @@ -499,14 +498,15 @@ END SUBROUTINE ChebyGaussLobNodesAndWeights SUBROUTINE LegendreGaussNodesAndWeights(N_in,xGP,wGP) !=================================================================================================================================== ! algorithm 23, Kopriva -! starting with Chebychev point positions, a Newton method is used to find the roots +! starting with Chebychev point positions, a Newton method is used to find the roots ! of the Legendre Polynomial L_(N_in+1), which are the positions of Gausspoints ! uses LegendrePolynomialAndDerivative subroutine !=================================================================================================================================== +USE MOD_Globals, ONLY: abort IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- !input parameters -INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) Gausspoints +INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N_in+1) Gausspoints !----------------------------------------------------------------------------------------------------------------------------------- !output parameters REAL,INTENT(OUT) :: xGP(0:N_in) ! Gausspoint positions for the reference interval [-1,1] @@ -545,13 +545,13 @@ SUBROUTINE LegendreGaussNodesAndWeights(N_in,xGP,wGP) xGP(iGP)=-cos(cheb_tmp*REAL(2*iGP+1)) !initial guess ! Newton iteration DO iter=0,nIter - WRITE(*,*)iter,xGP(iGP) !DEBUG + WRITE(*,*)iter,xGP(iGP) !DEBUG CALL LegendrePolynomialAndDerivative(N_in+1,xGP(iGP),L_Np1,Lder_Np1) dx=-L_Np1/Lder_Np1 xGP(iGP)=xGP(iGP)+dx IF(abs(dx).LT.Tol*abs(xGP(iGP))) EXIT END DO !iter - STOP + CALL abort(__STAMP__,'Maximum iteration steps >10 in Newton iteration for Legendre Gausspoint!') END IF ! (iter.GT.nIter) CALL LegendrePolynomialAndDerivative(N_in+1,xGP(iGP),L_Np1,Lder_Np1) xGP(N_in-iGP)=-xGP(iGP) @@ -575,7 +575,7 @@ END SUBROUTINE LegendreGaussNodesAndWeights SUBROUTINE qAndLEvaluation(N_in,x,q,qder,L) !=================================================================================================================================== ! algorithm 24, Kopriva -! evaluate the polynomial q=L_{N_in+1}-L_{N_in-1} and its derivative at position x[-1,1] +! evaluate the polynomial q=L_{N_in+1}-L_{N_in-1} and its derivative at position x[-1,1] ! recursive algorithm using the N_in-1 N_in-2 Legendre polynomials !=================================================================================================================================== IMPLICIT NONE @@ -605,7 +605,7 @@ SUBROUTINE qAndLEvaluation(N_in,x,q,qder,L) Lder_Nm1=Lder END DO ! iLegendre q=REAL(2*N_in+1)/REAL(N_in+1)*(x*L -L_Nm2) !L_{N_in+1}-L_{N_in-1} !L_Nm2 is L_Nm1, L_Nm1 was overwritten! -qder= REAL(2*N_in+1)*L !Lder_{N_in+1}-Lder_{N_in-1} +qder= REAL(2*N_in+1)*L !Lder_{N_in+1}-Lder_{N_in-1} END SUBROUTINE qAndLEvaluation @@ -613,14 +613,15 @@ END SUBROUTINE qAndLEvaluation SUBROUTINE LegGaussLobNodesAndWeights(N_in,xGP,wGP) !=================================================================================================================================== ! algorithm 25, Kopriva -! starting with initial guess by Parter Relation, a Newton method is used to find the roots +! starting with initial guess by Parter Relation, a Newton method is used to find the roots ! of the Legendre Polynomial Lder_(N_in), which are the positions of Gausspoints ! uses qAndLEvaluation subroutine !=================================================================================================================================== +USE MOD_Globals, ONLY: abort IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- !input parameters -INTEGER,INTENT(IN) :: N_in ! polynomial degree (N_in+1) Gausspoints +INTEGER,INTENT(IN) :: N_in ! polynomial degree (N_in+1) Gausspoints !----------------------------------------------------------------------------------------------------------------------------------- !output parameters REAL,INTENT(OUT) :: xGP(0:N_in) ! Gausspoint positions for the reference interval [-1,1] @@ -658,13 +659,13 @@ SUBROUTINE LegGaussLobNodesAndWeights(N_in,xGP,wGP) xGP(iGP)=-cos(cont1*(REAL(iGP)+0.25)-cont2/(REAL(iGP)+0.25)) !initial guess ! Newton iteration DO iter=0,nIter - WRITE(*,*)'iter,x^i',iter,xGP(iGP) !DEBUG + WRITE(*,*)'iter,x^i',iter,xGP(iGP) !DEBUG CALL qAndLEvaluation(N_in,xGP(iGP),q,qder,L) dx=-q/qder xGP(iGP)=xGP(iGP)+dx IF(abs(dx).LT.Tol*abs(xGP(iGP))) EXIT END DO ! iter - STOP + CALL abort(__STAMP__,'Maximum iteration steps >10 in Newton iteration for LGL point') END IF ! (iter.GT.nIter) CALL qAndLEvaluation(N_in,xGP(iGP),q,qder,L) xGP(N_in-iGP)=-xGP(iGP) @@ -690,13 +691,13 @@ SUBROUTINE BarycentricWeights(N_in,xGP,wBary) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES -INTEGER,INTENT(IN) :: N_in ! polynomial degree +INTEGER,INTENT(IN) :: N_in ! polynomial degree REAL,INTENT(IN) :: xGP(0:N_in) ! Gausspoint positions for the reference interval [-1,1] !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL,INTENT(OUT) :: wBary(0:N_in) ! barycentric weights !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iGP,jGP ! ? !=================================================================================================================================== wBary(:)=1. @@ -723,7 +724,7 @@ SUBROUTINE PolynomialDerivativeMatrix(N_in,xGP,D) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: D(0:N_in,0:N_in) ! differentiation Matrix !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iGP,iLagrange ! ? REAL :: wBary(0:N_in) ! ? !=================================================================================================================================== @@ -757,7 +758,7 @@ SUBROUTINE LagrangeInterpolationPolys(x,N_in,xGP,wBary,L) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: L(0:N_in) ! Lagrange basis functions evaluated at x !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iGP ! ? LOGICAL :: xEqualGP ! is x equal to a Gauss Point REAL :: DummySum ! ? @@ -801,7 +802,7 @@ SUBROUTINE InitializeVandermonde(N_In,N_Out,wBary_In,xi_In,xi_Out,Vdm) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: Vdm(0:N_Out,0:N_In) ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iXi ! ? !=================================================================================================================================== DO iXi=0,N_Out @@ -814,13 +815,13 @@ END SUBROUTINE InitializeVandermonde SUBROUTINE LegendrePolynomialAndDerivative(N_in,x,L,Lder) !=================================================================================================================================== ! algorithm 22, Kopriva -! evaluate the Legendre polynomial L_N and its derivative at position x[-1,1] +! evaluate the Legendre polynomial L_N and its derivative at position x[-1,1] ! recursive algorithm using the N_in-1 N_in-2 Legendre polynomials !=================================================================================================================================== IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- !input parameters -INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N+1) CLpoints +INTEGER,INTENT(IN) :: N_in ! polynomial degree, (N+1) CLpoints REAL,INTENT(IN) :: x ! coordinate value in the interval [-1,1] !----------------------------------------------------------------------------------------------------------------------------------- !output parameters @@ -883,7 +884,7 @@ FUNCTION ALMOSTEQUAL(x,y) END IF ! x,y zero END FUNCTION ALMOSTEQUAL -SUBROUTINE GetMortarVandermonde(Ngeo, M_0_1, M_0_2) +SUBROUTINE GetMortarVandermonde(Ngeo, M_0_1, M_0_2) !----------------------------------------------------------------------------------------------------------------------------------! ! description !----------------------------------------------------------------------------------------------------------------------------------! @@ -892,7 +893,7 @@ SUBROUTINE GetMortarVandermonde(Ngeo, M_0_1, M_0_2) ! insert modules here !----------------------------------------------------------------------------------------------------------------------------------! IMPLICIT NONE -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo REAL,INTENT(OUT) :: M_0_1(0:Ngeo,0:Ngeo), M_0_2(0:Ngeo,0:Ngeo) !----------------------------------------------------------------------------------------------------------------------------------- @@ -902,8 +903,8 @@ SUBROUTINE GetMortarVandermonde(Ngeo, M_0_1, M_0_2) REAL,DIMENSION(0:Ngeo) :: x,wBary !=================================================================================================================================== DO i=0,Ngeo - x(i) = -1 + i*2./Ngeo -END DO + x(i) = -1 + i*2./Ngeo +END DO CALL BarycentricWeights(Ngeo,x,wBary) !build interpolation operators M 0->1,M 0->2 diff --git a/src/commandlinearguments.f90 b/src/commandlinearguments.f90 index a43dd97..cc97eb1 100644 --- a/src/commandlinearguments.f90 +++ b/src/commandlinearguments.f90 @@ -83,14 +83,14 @@ SUBROUTINE ParseCommandlineArguments() ! Print version and exit WRITE(UNIT_stdOut,'(A)')"hopr version "& //TRIM(int2strf(MajorVersion))//"."//TRIM(int2strf(MinorVersion))//"."//TRIM(int2strf(PatchVersion)) - STOP + STOP 0 CASE DEFAULT ! 2+ ! Print extended version and exit WRITE(UNIT_stdOut,'(A)')"hopr version "& //TRIM(int2strf(MajorVersion))//"."//TRIM(int2strf(MinorVersion))//"."//TRIM(int2strf(PatchVersion))& //" ("//TRIM(GIT_CURRENT_COMMIT)//", "//TRIM(BUILD_DATE) //")" & //" ["//TRIM(BUILD_VERSION_GCC) //", "//TRIM(BUILD_VERSION_MPI)//"]" - STOP + STOP 0 END SELECT ! Get all remaining parameters @@ -163,7 +163,7 @@ SUBROUTINE PrintHelp() WRITE(UNIT_stdOut,'(A)') ' -V, --version display the version number and exit' WRITE(UNIT_stdOut,'(A)') ' when given twice, print more information about the build' ! CALL Abort(__STAMP__,'Parameter file not specified!') -STOP +STOP 0 END SUBROUTINE PrintHelp END MODULE MOD_Commandline_Arguments diff --git a/src/globals.f90 b/src/globals.f90 index 1445072..2967230 100644 --- a/src/globals.f90 +++ b/src/globals.f90 @@ -9,6 +9,8 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx +! Copyright (C) 2023 Florian Hindenlang +! Copyright (C) 2023 Tobias Ott ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -55,8 +57,8 @@ MODULE MOD_Globals LOGICAL :: Logging ! Set .TRUE. to activate logging function for each processor INTEGER,PARAMETER :: MajorVersion = 1 !> HoprVersion saved in each hdf5 file with hdf5 header -INTEGER,PARAMETER :: MinorVersion = 2 !> HoprVersion saved in each hdf5 file with hdf5 header -INTEGER,PARAMETER :: PatchVersion = 1 !> HoprVersion saved in each hdf5 file with hdf5 header +INTEGER,PARAMETER :: MinorVersion = 3 !> HoprVersion saved in each hdf5 file with hdf5 header +INTEGER,PARAMETER :: PatchVersion = 0 !> HoprVersion saved in each hdf5 file with hdf5 header INTEGER,PARAMETER :: HoprVersionInt = PatchVersion+MinorVersion*100+MajorVersion*10000 !> Hopr version number saved in each hdf5 file with hdf5 header CHARACTER(LEN=10) :: HoprVersionStr !> Hopr version string saved in each hdf5 file with hdf5 header @@ -405,8 +407,7 @@ SUBROUTINE SolveLinSys(dim1,nRHS,A,B) !----------------------------------------------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: IPIV(dim1),INFO,lwork ! ? -REAL :: WORK(dim1*dim1) ! ? +INTEGER :: IPIV(dim1),INFO ! ? !=================================================================================================================================== ! DGETRF computes an LU factorization of a general M-by-N matrix A ! using partial pivoting with row interchanges. A will be overwritten with LU factorization. diff --git a/src/hopr.f90 b/src/hopr.f90 index ac425e3..353ad7c 100644 --- a/src/hopr.f90 +++ b/src/hopr.f90 @@ -33,7 +33,7 @@ PROGRAM HOPR USE MOD_Mesh, ONLY: InitMesh,FillMesh USE MOD_Mesh_Vars, ONLY: negativeJacobians,jacobianTolerance USE MOD_Output, ONLY: InitOutput -USE MOD_ReadInTools, ONLY: IgnoredStrings +USE MOD_ReadInTools, ONLY: IgnoredStrings,FinalizeStrings USE MOD_Search, ONLY: InitSearch #ifdef _OPENMP USE omp_lib @@ -78,6 +78,9 @@ PROGRAM HOPR CALL IgnoredStrings() ! Now build mesh! CALL FillMesh() +! Finalization +CALL FinalizeStrings() +! Output WRITE(UNIT_stdOut,'(132("="))') IF(negativeJacobians.GT.0) THEN WRITE(UNIT_stdOut,'(A,A,A)')' HOPR finished: Mesh "',TRIM(ProjectName)//'_mesh.h5','" written to HDF5 file.' diff --git a/src/io_hdf5.f90 b/src/io_hdf5.f90 index c7cb724..6862b76 100644 --- a/src/io_hdf5.f90 +++ b/src/io_hdf5.f90 @@ -9,10 +9,12 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx +! Copyright (C) 2023 Florian Hindenlang +! Copyright (C) 2023 Tobias Ott ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -33,7 +35,7 @@ MODULE MOD_IO_HDF5 IMPLICIT NONE PUBLIC !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- INTEGER, ALLOCATABLE :: BCType(:,:) @@ -50,7 +52,7 @@ MODULE MOD_IO_HDF5 INTEGER,PARAMETER :: ElemInfoSize=6 !number of entry in each line of ElemInfo INTEGER,PARAMETER :: ELEM_Type=1 !entry position in ElemInfo -INTEGER,PARAMETER :: ELEM_Zone=2 +INTEGER,PARAMETER :: ELEM_Zone=2 INTEGER,PARAMETER :: ELEM_FirstSideInd=3 INTEGER,PARAMETER :: ELEM_LastSideInd=4 INTEGER,PARAMETER :: ELEM_FirstNodeInd=5 @@ -64,15 +66,40 @@ MODULE MOD_IO_HDF5 INTEGER,PARAMETER :: SIDE_BCID=5 INTEGER,PARAMETER :: nSidesElem(3:8)= & ! number of sides of an element nSides=nSidesElem(Elem%nNodes) (/3,4,5,5,0,6/) !tria,quad/tetra,pyra,prism,hex -INTEGER,PARAMETER :: LinMap(1:8,4:8)=RESHAPE( & !CGNS -> IJK ordering for element corner nodes +INTEGER,PARAMETER :: LinMap(1:8,4:8)=RESHAPE( & !CGNS -> IJK ordering for element corner nodes !jNode=LinMap(iNode,Elem%nNodes) (/1,2,3,4,0,0,0,0, & !Tet, one-to-one - 1,2,4,3,5,0,0,0, & !Pyra + 1,2,4,3,5,0,0,0, & !Pyra 1,2,3,4,5,6,0,0, & !Prism one-to-one 0,0,0,0,0,0,0,0, & !nothing 1,2,4,3,5,6,8,7/),(/8,5/)) !Hex +INTEGER,PARAMETER :: FEMElemInfoSize=4 !number of entry in each line of ElemInfo +INTEGER,PARAMETER :: FEMELEM_FirstEdgeInd=1 +INTEGER,PARAMETER :: FEMELEM_LastEdgeInd=2 +INTEGER,PARAMETER :: FEMELEM_FirstVertexInd=3 +INTEGER,PARAMETER :: FEMELEM_LastVertexInd=4 + +INTEGER,PARAMETER :: EDGEInfoSize=3 +INTEGER,PARAMETER :: EDGE_FEMEdgeID=1 +INTEGER,PARAMETER :: EDGE_offsetIndEdgeConnect=2 !entry position in EdgeConnectInfo +INTEGER,PARAMETER :: EDGE_lastIndEdgeConnect=3 + +INTEGER,PARAMETER :: EDGEConnectInfoSize=2 +INTEGER,PARAMETER :: EDGEConnect_nbElemID=1 +INTEGER,PARAMETER :: EDGEConnect_nbLocEdgeID=2 + +INTEGER,PARAMETER :: VERTEXInfoSize=3 +INTEGER,PARAMETER :: VERTEX_FEMVertexID=1 +INTEGER,PARAMETER :: VERTEX_offsetIndVertexConnect=2 !entry position in VertexConnectInfo +INTEGER,PARAMETER :: VERTEX_lastIndVertexConnect=3 + +INTEGER,PARAMETER :: VERTEXConnectInfoSize=2 +INTEGER,PARAMETER :: VERTEXConnect_nbElemID=1 +INTEGER,PARAMETER :: VERTEXConnect_nbLocVertexID=2 + INTEGER,ALLOCATABLE :: ElemInfo(:,:),SideInfo(:,:) +INTEGER,ALLOCATABLE :: FEMElemInfo(:,:), EdgeInfo(:,:),EdgeConnectInfo(:,:), VertexInfo(:,:),VertexConnectInfo(:,:) REAL,ALLOCATABLE :: ElemWeight(:) REAL,ALLOCATABLE :: ElemBarycenters(:,:) INTEGER,ALLOCATABLE :: GlobalNodeIDs(:) @@ -80,12 +107,13 @@ MODULE MOD_IO_HDF5 INTEGER,ALLOCATABLE :: Elem_IJK(:,:) INTEGER :: nElems_IJK(3) INTEGER :: nGlobalElems -INTEGER :: nElems,nSides,nNodes +INTEGER :: nElems,nSides,nNodes,nEdges,nVertices INTEGER :: ElemCounter(2,11) -INTEGER :: nSideIDs,nNodeIDs +INTEGER :: nSideIDs,nNodeIDs,nEdgeIDs +INTEGER :: nFEMEdgeIDs,nFEMEdgeConnections,nFEMVertexIDs,nFEMVertexConnections INTEGER :: nBCs LOGICAL :: curvedfound -LOGICAL :: initMesh=.FALSE. +LOGICAL :: initMesh=.FALSE. INTERFACE INVMAP MODULE PROCEDURE INVMAP @@ -106,7 +134,7 @@ MODULE MOD_IO_HDF5 FUNCTION INVMAP(ID,nIDs,ArrID) !=================================================================================================================================== -! find the inverse Mapping p.e. NodeID-> entry in NodeMap (a sorted array of unique NodeIDs), using bisection +! find the inverse Mapping p.e. NodeID-> entry in NodeMap (a sorted array of unique NodeIDs), using bisection ! if Index is not in the range, -1 will be returned, if it is in the range, but is not found, 0 will be returned!! !=================================================================================================================================== ! MODULES @@ -132,7 +160,7 @@ FUNCTION INVMAP(ID,nIDs,ArrID) !WRITE(*,*)'WARNING, Node Index Not in local range -> set to -1' INVMAP=-1 ! not in the range! RETURN -END IF +END IF IF(ID.EQ.ArrID(low))THEN INVMAP=low ELSEIF(ID.EQ.ArrID(up))THEN @@ -151,7 +179,7 @@ FUNCTION INVMAP(ID,nIDs,ArrID) END IF END DO END IF -END FUNCTION INVMAP +END FUNCTION INVMAP ! HFD5 STUFF SUBROUTINE OpenHDF5File(FileString,create) @@ -189,7 +217,7 @@ END SUBROUTINE OpenHDF5File SUBROUTINE CloseHDF5File() !=================================================================================================================================== -! Close HDF5 file and groups +! Close HDF5 file and groups !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING diff --git a/src/mesh/cartmesh.f90 b/src/mesh/cartmesh.f90 index 535d8d8..96fa658 100644 --- a/src/mesh/cartmesh.f90 +++ b/src/mesh/cartmesh.f90 @@ -191,7 +191,7 @@ SUBROUTINE GetNewTetrahedron(CornerNode,cartMesh,l,m,n,ind) tetMap(:,3)=(/5,6,7,2/) tetMap(:,4)=(/7,8,5,4/) tetMap(:,5)=(/2,4,5,7/) - IF(ANY(cartmesh%nElems.GT.1)) STOP 'The selected mesh template is not periodic and can only be used for a single element.' + IF(ANY(cartmesh%nElems.GT.1)) CALL abort(__STAMP__,'The selected mesh template is not periodic and can only be used for a single element.') CASE(5) nTets=12 !Center node of box is required @@ -219,7 +219,7 @@ SUBROUTINE GetNewTetrahedron(CornerNode,cartMesh,l,m,n,ind) CASE DEFAULT - STOP 'The selected mesh template does not exist for tetrahedra.' + CALL abort(__STAMP__,'The selected mesh template does not exist for tetrahedra.') END SELECT DO i=1,nTets @@ -540,8 +540,7 @@ SUBROUTINE CartesianMesh() ELSE !l0 active dx(i_Dim)=e1(i_Dim)/ABS(cartMesh%l0(i_Dim)) ! l/l0 IF(dx(i_Dim) .LT. (1.-PP_RealTolerance)) THEN ! l0 > l - !CALL abort(__STAMP__, & - stop 'stretching error, length l0 longer than grid region, in direction ' !,i_Dim,999.) + CALL abort(__STAMP__,'Stretching error, length l0 longer than grid region, in direction') END IF IF(ABS(CartMesh%factor(i_Dim)) .LT. PP_RealTolerance ) THEN ! fac=0 , (nElem,l0) given, fac calculated ! @@ -573,16 +572,14 @@ SUBROUTINE CartesianMesh() fac(i_Dim)= fac(i_Dim) - F/dF iter=iter+1 END DO - IF(iter.GT.1000) STOP 'Newton iteration for computing the stretching function has failed.' + IF(iter.GT.1000) CALL abort(__STAMP__,'Newton iteration for computing the stretching function has failed.') fac(i_Dim)=fac(i_Dim)**SIGN(1.,CartMesh%l0(i_Dim)) ! sign for direction END IF END IF WRITE(UNIT_stdOut,*)' -stretching factor in dir',i_Dim,'is now', fac(i_Dim) END IF - IF( ABS((nElems(i_Dim)-1.)*LOG(fac(i_Dim))/LOG(10.)) .GE. 4. ) & - !CALL abort(__STAMP__, & - stop 'stretching error, length ratio > 1.0E4 in direction ' !,i_Dim,999.) + IF( ABS((nElems(i_Dim)-1.)*LOG(fac(i_Dim))/LOG(10.)) .GE. 4. )CALL abort(__STAMP__,'Stretching error, length ratio > 1.0E4 in direction') IF(ABS(fac(i_Dim)-1.) .GT. PP_RealTolerance ) THEN dx(i_Dim)=(1.-fac(i_Dim))/(1.-fac(i_Dim)**nElems(i_Dim)) ! first length to start ELSE !equidistant case @@ -677,8 +674,7 @@ SUBROUTINE CartesianMesh() CALL GetNewHexahedron(CornerNode) END IF CASE DEFAULT - CALL abort(__STAMP__,& - 'The specified element type is not known. Valid types: 104,105,106,108',CartMesh%ElemType) + CALL abort(__STAMP__,'The specified element type is not known. Valid types: 104,105,106,108',CartMesh%ElemType) END SELECT END DO !n END DO !m diff --git a/src/mesh/curved.f90 b/src/mesh/curved.f90 index aafdab5..1e04be7 100644 --- a/src/mesh/curved.f90 +++ b/src/mesh/curved.f90 @@ -179,8 +179,7 @@ SUBROUTINE readNormals() faceConnectivity(1,nFaces+1+k)=k !actual Face ID READ(150,*) faceConnectivity(2:j,nFaces+1+k) !Neighbor Face IDs of actual Face ELSEIF (k .EQ. 0) THEN - CALL abort(__STAMP__, & - 'ERROR: CAD-face connectivity invalid',999,999.) + CALL abort(__STAMP__,'ERROR: CAD-face connectivity invalid',999,999.) ELSE faceConnectivity(1,k)=k READ(150,*) faceConnectivity(2:j,k) @@ -188,8 +187,7 @@ SUBROUTINE readNormals() END DO DO i=1,nFaces !all entries have to be filled IF (faceConnectivity(1,i) .EQ. 0) THEN - CALL abort(__STAMP__, & - 'ERROR: CAD-face connectivity invalid',999,999.) + CALL abort(__STAMP__,'ERROR: CAD-face connectivity invalid',999,999.) END IF END DO @@ -282,8 +280,7 @@ SUBROUTINE readNormals() END DO !nTotalNodes CLOSE(150) IF (countAssignedNodes .NE. searchMeshNodes) THEN - CALL abort(__STAMP__, & - 'ERROR: not all normals are assigned to local nodes in searchmesh',countAssignedNodes,REAL(searchMeshNodes)) + CALL abort(__STAMP__,'ERROR: not all normals are assigned to local nodes in searchmesh',countAssignedNodes,REAL(searchMeshNodes)) END IF CALL deleteDuplicateNormals CALL checkNormals @@ -595,7 +592,7 @@ SUBROUTINE checkNormals() aNormal=>aElem%node(j)%np%firstNormal DO WHILE (ASSOCIATED(aNormal)) nFaceID=min(5,SIZE(aNormal%FaceID)) - IF(nFaceID.LT.1) STOP 'nFaceID<1' + IF(nFaceID.LT.1) CALL abort(__STAMP__,'nFaceID<1') nFaceIDs(nFaceID) = nFaceIDs(nFaceID)+1 aNormal=>aNormal%nextNormal END DO @@ -1330,8 +1327,7 @@ SUBROUTINE exactNormalFunction(xpos,exactIndex,normal) normal(2)=xpos(2) normal(3)=0 CASE DEFAULT - CALL abort(__STAMP__, & - 'Exact normal function with specified index does not exist. Index:',exactIndex,999.) + CALL abort(__STAMP__,'Exact normal function with specified index does not exist. Index:',exactIndex,999.) END SELECT normal(:)=normal(:)/SQRT(SUM(normal(:)*normal(:))) END SUBROUTINE exactNormalFunction @@ -1500,8 +1496,7 @@ SUBROUTINE exactSurfaceFunction(xold,exactFunction,xnew) WRITE(UNIT_stdOut,'(A,3E21.11)')' new position',xnew END IF CASE DEFAULT - CALL abort(__STAMP__, & - 'Exact surface function with specified index does not exist. Index:',exactFunction,999.) + CALL abort(__STAMP__,'Exact surface function with specified index does not exist. Index:',exactFunction,999.) END SELECT END SUBROUTINE exactSurfaceFunction @@ -2473,8 +2468,7 @@ SUBROUTINE SplitToSpline() DO i=1,aSide%nNodes ERRWRITE(*,'(A,I3,3E21.10)')'side corner node',i,aSide%OrientedNode(i)%np%x END DO - CALL abort(__STAMP__, & - 'No associated side found for boundary order=',N+1) + CALL abort(__STAMP__,'No associated side found for boundary order=',N+1) ELSE !convert to curvedNode pointers IF(aSide%nNodes.EQ.3) THEN @@ -2821,7 +2815,7 @@ RECURSIVE SUBROUTINE MapBigEdgeToSmall(edge) XGeo1Dsmall(:,N-l,p)=XGeo1DTmp(:,l) END DO ELSE - STOP "Error: Edges of mortar master and slave do not conform!" + CALL abort(__STAMP__,'Error: Edges of mortar master and slave do not conform!') END IF CALL UnpackGeo(N,XGeo1DSmall(:,:,p),smallEdge) IF(ASSOCIATED(smallEdge%MortarEdge)) & diff --git a/src/mesh/globaluniquenodes.f90 b/src/mesh/globaluniquenodes.f90 index 4adf237..2becb58 100644 --- a/src/mesh/globaluniquenodes.f90 +++ b/src/mesh/globaluniquenodes.f90 @@ -12,7 +12,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,7 +31,7 @@ MODULE MOD_GlobalUniqueNodes IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! Private Part --------------------------------------------------------------------------------------------------------------------- ! Public Part ---------------------------------------------------------------------------------------------------------------------- @@ -55,7 +55,7 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) USE MOD_Mesh_Tools,ONLY:SetTempMarker USE MOD_Mesh_Tolerances,ONLY:COMPAREPOINT USE MOD_SpaceFillingCurve,ONLY:EVAL_MORTON,EVAL_MORTON_ARR -USE MOD_SortingTools,ONLY: Qsort1DoubleInt1Pint +USE MOD_SortingTools,ONLY: Qsort1DoubleInt1Pint ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -64,7 +64,7 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tElem),POINTER :: Elem ! ? TYPE(tSide),POINTER :: Side ! ? TYPE(tEdge),POINTER :: Edge ! ? @@ -95,14 +95,14 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) withOriented=.FALSE. IF(PRESENT(withOrientedOpt)) withOriented=withOrientedOpt -! First step: set node marker=0 +! First step: set node marker=0 Elem=>FirstElem DO WHILE(ASSOCIATED(Elem)) CALL SetTempMarker(Elem,0,(/T,T,T,T,T,T,withOriented,T/)) Elem=>Elem%nextElem END DO -! Second step: set unique node marker and count +! Second step: set unique node marker and count NodeID=0 Elem=>FirstElem DO WHILE(ASSOCIATED(Elem)) @@ -206,7 +206,7 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) END DO !iNode box_min=box_min-PP_MeshTolerance box_max=box_max+PP_MeshTolerance -box_nbits = (bit_size(maxIJK)-1) / 3 +box_nbits = (bit_size(maxIJK)-1) / 3 maxIJK = 2**box_nbits-1 ![0,2**box_nBits-1] box_sdx = REAL(maxIJK)/(box_max-box_min) @@ -288,8 +288,8 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) tol=SpaceQuandt*PP_MeshTolerance ! Size of tolerance gives a box_di for bisection (could be computed for each node seperately !!!) -!box_di =MAX(0,box_nBits-FLOOR(LOG((box_max-box_min)/tol)*sLog2)) ! tol=2^x L=2^n => x=n-LOG(L/tol)/LOG(2) -box_di =MAX(0,CEILING(LOG(tol*box_sdx)*sLog2)) +!box_di =MAX(0,box_nBits-FLOOR(LOG((box_max-box_min)/tol)*sLog2)) ! tol=2^x L=2^n => x=n-LOG(L/tol)/LOG(2) +box_di =MAX(0,CEILING(LOG(tol*box_sdx)*sLog2)) box_di=2**box_di WRITE(*,*)' size of tolerance box:',box_di s_offset=box_di**3-1 !offset inside one box of size box_di, from the lower sfc index to to highest @@ -315,20 +315,20 @@ SUBROUTINE GlobalUniqueNodes(withOrientedOpt) CALL FindBoxes(NodesIJK(:,iNode),box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges) !next higher neighbor on SFC lastNode=nextNode - DO nextNode=lastNode+1,nTotalNodes + DO nextNode=lastNode+1,nTotalNodes IF(Nodes(nextNode)%np%tmp.EQ.0) EXIT ! not yet treated END DO nextNode=MIN(nextNode,nTotalNodes) - IF(SFCID(nextNode).GT.smax) CYCLE - + IF(SFCID(nextNode).GT.smax) CYCLE + DO i=1,nRanges IF(s_minmax(i,1).EQ.-1)CYCLE - IF(SFCID(iNode).GT.s_minmax(i,2)) CYCLE - IF(SFCID(nextNode).GT.s_minmax(i,2)) CYCLE + IF(SFCID(iNode).GT.s_minmax(i,2)) CYCLE + IF(SFCID(nextNode).GT.s_minmax(i,2)) CYCLE NodeID=INVMAP(s_minmax(i,1),nTotalNodes-(iNode-1),SFCID(iNode:nTotalNodes)) IF(NodeID.EQ.-1) CYCLE !nothing found inside the box NodeID=MAX(nextNode,NodeID+iNode) - DO jNode=NodeID,nTotalNodes + DO jNode=NodeID,nTotalNodes IF(SFCID(jNode).GT.s_minmax(i,2)) EXIT ! check if > s_max IF(Nodes(jNode)%np%tmp.GT.0) CYCLE ! was already treated @@ -402,13 +402,13 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges !=================================================================================================================================== ! finds the ranges of the spacefilling curve which correspond to a maximum of 8 boxes with a box size of 2*box_id, ! box_di (from node merging tolerance) defines the smallest box size. We now look at two levels below the octree (4x4x4 box size) -! where node lies inside. We need a tolerance of one box to find all possible nodes(makes 3x3x3 boxes), -! but due to the octree, we always choose a 4x4x4 region, allowing a maximum of only 8 search boxes of size 2x2x2. +! where node lies inside. We need a tolerance of one box to find all possible nodes(makes 3x3x3 boxes), +! but due to the octree, we always choose a 4x4x4 region, allowing a maximum of only 8 search boxes of size 2x2x2. ! Due to the nature of the morton spacefilling curve, some boxes have contiguous ranges and are merged. There are three cases: ! 1 box of 4x4x4 is used if the node is inside -! -! z x0 x1 x2 x3 -! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ +! +! z x0 x1 x2 x3 +! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ! | | | | | | | | | | | | | | | | | | | | | ! | |___|___|___|___| |___|___|___|___| |___|___|___|___| |___|___|___|___| ! | | | | | | | | . | . | | | | . | . | | | | | | | @@ -418,10 +418,10 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges ! | | | | | | | | | | | | | | | | | | | | | ! | |___|___|___|___| |___|___|___|___| |___|___|___|___| |___|___|___|___| ! *----------------------> y -! 2 boxes of 2x4x4, if nodes are inside yz and +/-x -! -! z x0 x1 x2 x3 -! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ +! 2 boxes of 2x4x4, if nodes are inside yz and +/-x +! +! z x0 x1 x2 x3 +! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ! | | | | | | | | | | | | | | | | | | | | | ! | |___|___|___|___| |___|___|___|___| |___|___|___|___| |___|___|___|___| ! | | | . | . | | | | | | | | | | | | | | . | . | | @@ -432,9 +432,9 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges ! | |___|___|___|___| |___|___|___|___| |___|___|___|___| |___|___|___|___| ! *----------------------> y ! 4 boxes of 2x2x4, if nodes are inside z and +/-x +/- y -! -! z x0 x1 x2 x3 -! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ +! +! z x0 x1 x2 x3 +! ^ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ! | | | | | | | | | | | | | | | | | | | | | ! | |___|___|___|___| |___|___|___|___| |___|___|___|___| |___|___|___|___| ! | | . | | | . | | | | | | | | | | | | . | | | . | @@ -463,9 +463,9 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges INTEGER(KIND=8),INTENT(OUT) :: s_minmax(8,2) ! sfc index ranges of the 27 boxes INTEGER(KIND=8),INTENT(OUT) :: smin ! minimum of s_minmax(:,1) INTEGER(KIND=8),INTENT(OUT) :: smax ! maximum of s_minmax(:,2) -INTEGER,INTENT(OUT) :: nRanges ! number of ranges +INTEGER,INTENT(OUT) :: nRanges ! number of ranges !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: i,j,k,l ! ? INTEGER :: Ranges(3),start(3) ! ? LOGICAL :: xi0(3),xi1(3) ! ? @@ -476,8 +476,8 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges box_di4=box_di2+box_di2 IJK_min(:)=box_di4*(IntCoord(:)/(box_di4)) -xi0(:)=(MOD(IntCoord(:)/box_di2,2).NE.0) -xi1(:)=(MOD(IntCoord(:)/box_di,2).NE.0) +xi0(:)=(MOD(IntCoord(:)/box_di2,INT(2,KIND=8)).NE.0) +xi1(:)=(MOD(IntCoord(:)/box_di ,INT(2,KIND=8)).NE.0) Ranges=2 start=0 @@ -489,7 +489,7 @@ SUBROUTINE FindBoxes(IntCoord,box_di,box_nBits,maxIJK,s_minmax,smin,smax,nRanges Ranges(3)=1 IF(xi0(2).NEQV.xi1(2)) THEN Ranges(2)=1 - IF(xi0(1).NEQV.xi1(1))THEN + IF(xi0(1).NEQV.xi1(1))THEN Ranges(1)=1 END IF END IF @@ -521,7 +521,7 @@ END SUBROUTINE FindBoxes SUBROUTINE SetCountNodeID(NodeID_in,NodeID) !=================================================================================================================================== -! insert a new node id +! insert a new node id !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -532,7 +532,7 @@ SUBROUTINE SetCountNodeID(NodeID_in,NodeID) ! OUTPUT VARIABLES INTEGER,INTENT(INOUT) :: NodeID_in,NodeID ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== IF(NodeID_in.EQ.0)THEN NodeID=NodeID+1 @@ -543,7 +543,7 @@ END SUBROUTINE SetCountNodeID FUNCTION INVMAP(ID,nIDs,ArrID) !=================================================================================================================================== ! find the inverse Mapping of sfc index in a sorted list (a sorted array of unique NodeIDs), using bisection -! if Index is not in the range, -1 will be returned, gives back the first entry in the sorted list which is <= ID +! if Index is not in the range, -1 will be returned, gives back the first entry in the sorted list which is <= ID !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -555,7 +555,7 @@ FUNCTION INVMAP(ID,nIDs,ArrID) INTEGER(KIND=8), INTENT(IN) :: ArrID(nIDs) ! 1D array of IDs, SORTED!! !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES -INTEGER :: INVMAP ! position in arrID, where arrID(INVMAP) <= ID +INTEGER :: INVMAP ! position in arrID, where arrID(INVMAP) <= ID !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES INTEGER :: i,low,up,mid ! ? @@ -577,13 +577,13 @@ FUNCTION INVMAP(ID,nIDs,ArrID) maxSteps=INT(LOG(REAL(nIDs))*1.442695040888964)+1 DO i=1,maxSteps mid=(up-low)/2+low - IF(ArrID(mid).GE.ID )THEN !seek in lower half + IF(ArrID(mid).GE.ID )THEN !seek in lower half up=mid ELSE low=mid END IF END DO INVMAP=low -END FUNCTION INVMAP +END FUNCTION INVMAP END MODULE MOD_GlobalUniqueNodes diff --git a/src/mesh/mesh.f90 b/src/mesh/mesh.f90 index bd14f86..ab8e451 100644 --- a/src/mesh/mesh.f90 +++ b/src/mesh/mesh.f90 @@ -9,7 +9,7 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx -! Copyright (C) 2017 Florian Hindenlang +! Copyright (C) 2023 Florian Hindenlang ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -74,8 +74,7 @@ SUBROUTINE InitMesh() WRITE(UNIT_StdOut,'(132("-"))') WRITE(UNIT_stdOut,'(A)') ' INIT MESH...' IF(.NOT.OutputInitDone)THEN - CALL abort(__STAMP__, & - 'ERROR: InitOutput has to be called before InitMesh!') + CALL abort(__STAMP__,'ERROR: InitOutput has to be called before InitMesh!') END IF ! Curved @@ -231,8 +230,7 @@ SUBROUTINE InitMesh() ExactNormals = GETINTARRAY('exactNormals',tmpInt*2) !(Curvedindex,exactnormaltype,...) ! >0 if an analytical normal can be used (see curved.f90,exactNormals) CASE DEFAULT - CALL abort(__STAMP__,& - 'No normal type specified.') + CALL abort(__STAMP__,'No normal type specified.') END SELECT CASE(3) ! refined surface elements (only ANSA readin) SplitElemFile = GETSTR('SplitElemFile') @@ -244,8 +242,7 @@ SUBROUTINE InitMesh() CASE(4) ! ICEM spectral elements SpecElemFile = GETSTR('specelemfile') CASE DEFAULT - CALL abort(__STAMP__,& - 'Specified curving method does not exist. =1: NormalVectors, =3: SplitElemFile, =4: SpecElemFile') + CALL abort(__STAMP__,'Specified curving method does not exist. =1: NormalVectors, =3: SplitElemFile, =4: SpecElemFile') END SELECT ! Volume curving by radial basis functions @@ -289,8 +286,7 @@ SUBROUTINE InitMesh() ! Boundaries nUserDefinedBoundaries=CNTSTR('BoundaryName','0') IF(nUserDefinedBoundaries.NE.CNTSTR('BoundaryType','0'))& - CALL abort(__STAMP__,& - 'The number of boundary names and boundary types has to be identical.') + CALL abort(__STAMP__,'The number of boundary names and boundary types has to be identical.') IF(nUserDefinedBoundaries .GT. 0)THEN ALLOCATE(BoundaryName(nUserDefinedBoundaries)) ALLOCATE(BoundaryType(nUserDefinedBoundaries,4)) @@ -381,7 +377,7 @@ SUBROUTINE InitMesh() IF(postConnect.EQ.3)THEN IF(nVV.GT.0)THEN tmpInt= CNTSTR('postVV','0') - IF(tmpInt.NE.nVV) STOP 'postVV must be specified for all previous vv!' + IF(tmpInt.NE.nVV) CALL abort(__STAMP__,'postVV must be specified for all previous vv!') ALLOCATE(postVV(3,nVV)) DO i=1,nVV postVV(:,i)=GETREALARRAY('postvv',3) @@ -393,6 +389,8 @@ SUBROUTINE InitMesh() ! Connect ConformConnect=GETLOGICAL('ConformConnect','.TRUE.') ! Fast connect for conform mesh +! build connect of edges and vertices: +generateFEMconnectivity=GETLOGICAL('generateFEMconnectivity','.FALSE.') ! Elem Check checkElemJacobians=GETLOGICAL('checkElemJacobians','.TRUE.') jacobianTolerance=GETREAL('jacobianTolerance','1.E-16') @@ -437,6 +435,47 @@ SUBROUTINE InitMesh() ElemSideMapping(8,5,:) = (/1,5,8,4/) ElemSideMapping(8,6,:) = (/5,6,7,8/) +CGNSElemEdgeToNode=-1 +! tet ( 4 nodes) +CGNSElemEdgeToNode(4, 1,1:2)=(/1,2/) +CGNSElemEdgeToNode(4, 2,1:2)=(/2,3/) +CGNSElemEdgeToNode(4, 3,1:2)=(/3,1/) +CGNSElemEdgeToNode(4, 4,1:2)=(/1,4/) +CGNSElemEdgeToNode(4, 5,1:2)=(/2,4/) +CGNSElemEdgeToNode(4, 6,1:2)=(/3,4/) +! pyra (5nodes) +CGNSElemEdgeToNode(5, 1,1:2)=(/1,2/) +CGNSElemEdgeToNode(5, 2,1:2)=(/2,3/) +CGNSElemEdgeToNode(5, 3,1:2)=(/3,4/) +CGNSElemEdgeToNode(5, 4,1:2)=(/4,1/) +CGNSElemEdgeToNode(5, 5,1:2)=(/1,5/) +CGNSElemEdgeToNode(5, 6,1:2)=(/2,5/) +CGNSElemEdgeToNode(5, 7,1:2)=(/3,5/) +CGNSElemEdgeToNode(5, 8,1:2)=(/4,5/) +! prism (6nodes) +CGNSElemEdgeToNode(6, 1,1:2)=(/1,2/) +CGNSElemEdgeToNode(6, 2,1:2)=(/2,3/) +CGNSElemEdgeToNode(6, 3,1:2)=(/3,1/) +CGNSElemEdgeToNode(6, 4,1:2)=(/1,4/) +CGNSElemEdgeToNode(6, 5,1:2)=(/2,5/) +CGNSElemEdgeToNode(6, 6,1:2)=(/3,6/) +CGNSElemEdgeToNode(6, 7,1:2)=(/4,5/) +CGNSElemEdgeToNode(6, 8,1:2)=(/5,6/) +CGNSElemEdgeToNode(6, 9,1:2)=(/6,4/) +! hexa (8nodes) +CGNSElemEdgeToNode(8, 1,1:2)=(/1,2/) +CGNSElemEdgeToNode(8, 2,1:2)=(/2,3/) +CGNSElemEdgeToNode(8, 3,1:2)=(/3,4/) +CGNSElemEdgeToNode(8, 4,1:2)=(/4,1/) +CGNSElemEdgeToNode(8, 5,1:2)=(/1,5/) +CGNSElemEdgeToNode(8, 6,1:2)=(/2,6/) +CGNSElemEdgeToNode(8, 7,1:2)=(/3,7/) +CGNSElemEdgeToNode(8, 8,1:2)=(/4,8/) +CGNSElemEdgeToNode(8, 9,1:2)=(/5,6/) +CGNSElemEdgeToNode(8,10,1:2)=(/6,7/) +CGNSElemEdgeToNode(8,11,1:2)=(/7,8/) +CGNSElemEdgeToNode(8,12,1:2)=(/8,5/) + MeshInitDone=.TRUE. WRITE(UNIT_stdOut,'(A)')' INIT MESH DONE!' WRITE(UNIT_StdOut,'(132("-"))') @@ -459,13 +498,13 @@ SUBROUTINE fillMesh() USE MOD_Curved, ONLY: readNormals USE MOD_Curved, ONLY: ProjectToExactSurfaces USE MOD_Curved, ONLY: RebuildMortarGeometry -USE MOD_Mesh_Basis, ONLY: BuildEdges,ElemGeometry,FindElemTypes +USE MOD_Mesh_Basis, ONLY: BuildEdges,BuildFEMconnectivity,ElemGeometry,FindElemTypes USE MOD_Mesh_Connect, ONLY: Connect USE MOD_Mesh_Connect, ONLY: Connect2DMesh USE MOD_GlobalUniqueNodes,ONLY: GlobalUniqueNodes USE MOD_CartMesh, ONLY: CartesianMesh USE MOD_CurvedCartMesh, ONLY: CurvedCartesianMesh -USE MOD_Mesh_Tools, ONLY: CountSplines,Netvisu,BCvisu,chkspl_surf,chkspl_vol +USE MOD_Mesh_Tools, ONLY: CountSplines,Netvisu,BCvisu,chkspl_surf,chkspl_vol,FEMnetVisu USE MOD_Mesh_Tools, ONLY: CheckMortarWaterTight USE MOD_Mesh_PostDeform, ONLY: PostDeform USE MOD_Output_HDF5, ONLY: WriteMeshToHDF5 @@ -532,8 +571,7 @@ SUBROUTINE fillMesh() meshIsAlreadyCurved=.TRUE. CALL fill25DMesh() CASE DEFAULT - CALL abort(__STAMP__, & - 'Not known how to construct mesh') + CALL abort(__STAMP__,'Not known how to construct mesh') END SELECT ! apply meshscale after readin @@ -605,6 +643,7 @@ SUBROUTINE fillMesh() IF(useCurveds.AND.Logging) CALL CountSplines() ! In case of restart there can be splines END IF CALL buildEdges() +IF(generateFEMconnectivity) CALL buildFEMconnectivity() ! check if sides to be curved exist curvedFound=.FALSE. @@ -647,8 +686,7 @@ SUBROUTINE fillMesh() CASE(4) CALL ReadCGNSSurfaceMesh(FirstSplitElem,SplitElemFile) CASE DEFAULT - CALL abort(__STAMP__, & - 'Splitted meshes can only be read in star cd format or cgns!') + CALL abort(__STAMP__,'Splitted meshes can only be read in star cd format or cgns!') END SELECT CALL Connect2DMesh(FirstSplitElem) IF(doScale.AND..NOT.postScale) CALL ApplyMeshScale(FirstSplitElem) @@ -687,6 +725,8 @@ SUBROUTINE fillMesh() IF(mortarFound) EXIT !do loop END DO !iElem +IF(mortarFound.AND.generateFEMconnectivity) CALL abort(__STAMP__,"generate FEM connectivity not yet implemented for mortar meshes!") + IF(doExactSurfProjection) CALL ProjectToExactSurfaces() ! get element types CALL FindElemTypes() @@ -753,6 +793,7 @@ SUBROUTINE fillMesh() IF(useCurveds .AND. Logging) CALL CountSplines() ! In case of restart there can be splines CALL WriteMeshToHDF5(TRIM(ProjectName)//'_mesh.h5') +IF(DebugVisu.AND.generateFEMconnectivity)CALL FEMnetVisu() ! visualize FEM faces/edges/vertices WRITE(UNIT_stdOut,'(132("~"))') CALL Timer(.FALSE.) END SUBROUTINE fillMesh @@ -791,6 +832,9 @@ SUBROUTINE fill25DMesh() ! curved ones Elem => FirstElem DO WHILE(ASSOCIATED(Elem)) + IF(.NOT.((Elem%nNodes.EQ.8).OR.(Elem%nNodes.EQ.6)))THEN + CALL abort(__STAMP__,'ERROR: Fill 2.5 D mesh, found non-prismatic (prism/hexa) element!') + END IF IF(Elem%nCurvedNodes.EQ.0)THEN nNodes=Elem%nNodes/2 ! Only Hexahedrons or prisms in 2.5D case -> 8/6 nodes DO iNode=nNodes+1,Elem%nNodes ! nodes 1 to Elem%nNodes/2 on lower z-layer, other nodes on upper z-layer diff --git a/src/mesh/mesh_basis.f90 b/src/mesh/mesh_basis.f90 index 4486dd6..20d32d8 100644 --- a/src/mesh/mesh_basis.f90 +++ b/src/mesh/mesh_basis.f90 @@ -9,10 +9,14 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx +! Copyright (C) 2024 Stephen Copplestone +! Copyright (C) 2024 Patrick Kopper +! Copyright (C) 2023 Florian Hindenlang +! Copyright (C) 2023 Tobias Ott ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,7 +35,7 @@ MODULE MOD_Mesh_Basis IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- INTERFACE ElemGeometry @@ -62,6 +66,10 @@ MODULE MOD_Mesh_Basis MODULE PROCEDURE BuildEdges END INTERFACE +INTERFACE BuildFEMconnectivity + MODULE PROCEDURE BuildFEMconnectivity +END INTERFACE + INTERFACE FlushMesh MODULE PROCEDURE FlushMesh END INTERFACE @@ -97,6 +105,7 @@ MODULE MOD_Mesh_Basis !PUBLIC::AdjustOrientedNodes PUBLIC::GetBoundaryIndex PUBLIC::BuildEdges +PUBLIC::buildFEMconnectivity PUBLIC::FlushMesh PUBLIC::assignBC PUBLIC::isOriented @@ -124,7 +133,7 @@ SUBROUTINE ElemGeometry(Elem,TrafoOpt,TrafoInvOpt) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL,INTENT(OUT),OPTIONAL :: TrafoOpt(3,3) ! see below -REAL,INTENT(OUT),OPTIONAL :: TrafoInvOpt(3,3) ! ? +REAL,INTENT(OUT),OPTIONAL :: TrafoInvOpt(3,3) ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES TYPE(tSide),POINTER :: Side ! ? @@ -248,7 +257,7 @@ SUBROUTINE INV33(M,MInv,detM) ! OUTPUT VARIABLES REAL,INTENT(OUT) :: MInv(3,3),detM ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== detM = M(1,1)*M(2,2)*M(3,3) & - M(1,1)*M(2,3)*M(3,2) & @@ -283,9 +292,9 @@ SUBROUTINE FindElemTypes() ! 5 = bilinear quadrangle ! 6/7 = triangle/quadrangle with curved sides ! 104/105/106/108 = tetra/pyramid/prism/hexaeder with linear sides -! 115/116/118 = pyramid/prism/hexaeder with bilinear sides +! 115/116/118 = pyramid/prism/hexaeder with bilinear sides ! 204/205/206/208 = tetra/pyramid/prism/hexaeder with curved sides -! >1000 = polygon or polyeder +! >1000 = polygon or polyeder !=================================================================================================================================== ! MODULES USE MOD_Mesh_Vars,ONLY:tElem,tSide,FirstElem @@ -296,7 +305,7 @@ SUBROUTINE FindElemTypes() !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tElem),POINTER :: Elem ! %nNodes,%Trafo,%node, is used. %type is set TYPE(tSide),POINTER :: Side ! %curvedNode are checked, %iscurved is set =true if curved LOGICAL :: elemCurved,sideCurved ! ? @@ -316,10 +325,10 @@ SUBROUTINE FindElemTypes() CASE DEFAULT Elem%Type=1000+Elem%nNodes END SELECT - + elemCurved=.FALSE. IF(ASSOCIATED(Elem%CurvedNode)) elemCurved=.TRUE. - + sideCurved=.FALSE. Side=>Elem%firstSide DO WHILE(ASSOCIATED(Side)) @@ -329,13 +338,13 @@ SUBROUTINE FindElemTypes() END IF Side=>Side%nextElemSide END DO - + !IF(sideCurved.AND.(.NOT.elemCurved)) CALL Abort(__STAMP__,& ! 'Sanity check: Element with uncurved volume but curved sides found. ElemInd:',Elem%Ind) ! !IF(.NOT.sideCurved.AND.elemCurved)& ! WRITE(*,*) 'WARNING: Element is curved without any side beeing curved. ElemInd:',Elem%ind - + IF ((Elem%Type .EQ. 104) .AND. (sideCurved)) Elem%Type=204 IF ((Elem%Type .EQ. 105) .AND. (sideCurved)) Elem%Type=205 IF ((Elem%Type .EQ. 106) .AND. (sideCurved)) Elem%Type=206 @@ -382,7 +391,7 @@ SUBROUTINE getNewHexa(Elem,zone,node1,node2,node3,node4,node5,node6,node7,node8) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== CALL GetNewElem(elem) Elem%zone=zone @@ -414,11 +423,11 @@ SUBROUTINE CreateSides(Elem,buildSides) !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES TYPE(tElem),POINTER,INTENT(INOUT) :: Elem ! pointer to Element -LOGICAL,INTENT(IN) :: buildSides ! determines if Sides should also be build +LOGICAL,INTENT(IN) :: buildSides ! determines if Sides should also be build !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tSide),POINTER :: Side ! ? TYPE(tNodePtr) :: TempNodeArray(Elem%nNodes) ! ? INTEGER :: iSide,iNode ! ? @@ -450,7 +459,8 @@ SUBROUTINE CreateSides(Elem,buildSides) CALL abort(__STAMP__, 'Unknown 3D Elem%nNodes in CreateSides') ENDIF -iSide=1 +iSide = 1 +Side => Elem%firstSide DO IF(iSide .EQ. 1) THEN IF(buildSides) CALL getNewSide(Elem%firstSide,nNodesElemSideMapping(Elem%nNodes,iSide)) !sidenNodesmapping(iSide)) @@ -466,8 +476,7 @@ SUBROUTINE CreateSides(Elem,buildSides) DO iNode=1,Side%nNodes IF(ElemSideMapping(Elem%nNodes,iSide,iNode).EQ.0) then WRITE(*,*)Elem%nNodes,iSide,iNode,Side%nNodes - CALL abort(__STAMP__, & - 'Error in ElemSideMapping in CreateSides') + CALL abort(__STAMP__,'Error in ElemSideMapping in CreateSides') END IF Side%Node(iNode)%np=>Elem%Node(ElemSideMapping(Elem%nNodes,iSide,iNode))%np IF(buildSides) Side%Node(iNode)%np%refCount=Side%Node(iNode)%np%refCount+1 @@ -504,7 +513,7 @@ END SUBROUTINE CreateSides !!---------------------------------------------------------------------------------------------------------------------------------- !! OUTPUT VARIABLES !!---------------------------------------------------------------------------------------------------------------------------------- -!! LOCAL VARIABLES +!! LOCAL VARIABLES !TYPE(tSide),POINTER :: nSide ! ? !INTEGER :: iNode,fNode,deriv(2) ! ? !REAL :: VV_loc(3) ! ? @@ -606,9 +615,9 @@ END FUNCTION GetBoundaryIndex SUBROUTINE buildEdges() !=================================================================================================================================== ! Create Edge datastructure, each edge is unique, and has a pointer from each side and from the node with the lower index. -! on the node, a list beginning with node%firstEdge is build up. On the Element sides, a edge pointer array Edge(1:nNodes) is -! filled, together with their orientation inside the side. Very important: OrientedNodes are used!!!! -! If the edge is oriented, it goes from orientedNode(i)-> orientedNode(i+1), and +! on the node, a list beginning with node%firstEdge is build up. On the Element sides, a edge pointer array Edge(1:nNodes) is +! filled, together with their orientation inside the side. Very important: OrientedNodes are used!!!! +! If the edge is oriented, it goes from orientedNode(i)-> orientedNode(i+1), and ! If the edge is not oriented, it goes from orientedNode(i+1)-> orientedNode(i) !=================================================================================================================================== ! MODULES @@ -626,16 +635,20 @@ SUBROUTINE buildEdges() TYPE(tSide),POINTER :: aSide,bSide ! ? TYPE(tEdge),POINTER :: aEdge,bEdge ! ? TYPE(tEdgePtr) :: smallEdges(4) ! ? -TYPE(tNode),POINTER :: aNode,bNode ! ? +TYPE(tNode),POINTER :: aNode,bNode ! ? INTEGER :: iSide,jSide,iEdge,jEdge,kEdge,iNode,iPlus,nSides,EdgeInd,nNodes ! ? INTEGER :: indA(2),indB(2,4),indTmp(2) INTEGER :: edgeCount ! ? LOGICAL :: edgeFound ! ? +INTEGER :: nSides_from_nNodes(4:8)=(/4,5,5,-1, 6/) !=================================================================================================================================== + CALL Timer(.TRUE.) WRITE(UNIT_stdOut,'(132("~"))') WRITE(UNIT_stdOut,'(A)')'BUILD EDGES ...' + + ! count unique corner nodes aElem=>firstElem DO WHILE(ASSOCIATED(aElem)) @@ -657,16 +670,7 @@ SUBROUTINE buildEdges() EdgeInd=0 aElem=>firstElem DO WHILE(ASSOCIATED(aElem)) - SELECT CASE(aElem%nNodes) - CASE(8) - nSides=6 - CASE(6) - nSides=5 - CASE(5) - nSides=5 - CASE(4) - nSides=4 - END SELECT + nSides=nSides_from_nNodes(aElem%nNodes) aSide=>aElem%firstSide DO iSide=1,nSides !!SIDES!!*********** DO iEdge=1,aSide%nNodes !!EDGES!! nNodes=nEdges************** @@ -680,13 +684,13 @@ SUBROUTINE buildEdges() aNode=>aSide%OrientedNode(iEdge)%np bNode=>aSide%OrientedNode(iPlus)%np aSide%edgeOrientation(iEdge)=.TRUE. - ELSE + ELSE WRITE(*,*) 'Problem with node%ind in buildEdges' WRITE(*,*) 'node IDs',aSide%OrientedNode(iEdge)%np%ind,aSide%OrientedNode(iPlus)%np%ind WRITE(*,*) 'node1%x',aSide%OrientedNode(iEdge)%np%x WRITE(*,*) 'node2%x',aSide%OrientedNode(iPlus)%np%x - - STOP + + CALL abort(__STAMP__,'Problem with node%ind in buildEdges') END IF edgeFound=.FALSE. @@ -702,10 +706,10 @@ SUBROUTINE buildEdges() CALL getNewEdge(aEdge,aNode,bNode) EdgeInd=EdgeInd+1 IF (ASSOCIATED(aNode%firstEdge)) THEN - aEdge%nextEdge=>aNode%firstEdge + aEdge%nextEdge=>aNode%firstEdge END IF aNode%firstEdge=>aEdge - END IF + END IF !WRITE(*,*)'DEBUG a',aNode%ind,'b',bNode%ind,edgeFound,aEdge%ind aSide%Edge(iEdge)%edp=>aEdge END DO !!EDGES!!*************** @@ -717,16 +721,7 @@ SUBROUTINE buildEdges() ! in case of nonconforming meshes, build nonconforming edge connectivity aElem=>firstElem DO WHILE(ASSOCIATED(aElem)) - SELECT CASE(aElem%nNodes) - CASE(8) - nSides=6 - CASE(6) - nSides=5 - CASE(5) - nSides=5 - CASE(4) - nSides=4 - END SELECT + nSides=nSides_from_nNodes(aElem%nNodes) aSide=>aElem%firstSide DO iSide=1,nSides IF(aSide%nMortars.LE.0)THEN ! only check big mortar sides @@ -771,9 +766,7 @@ SUBROUTINE buildEdges() END DO IF(edgeCount.EQ.3) CYCLE - IF(edgeCount.NE.4) THEN - STOP 'Mismatch of neighbour edge count of non-conforming edges.' - END IF + IF(edgeCount.NE.4) CALL abort(__STAMP__,'Mismatch of neighbour edge count of non-conforming edges.') ! now select the 2 edges of the found 4 edges, sharing a common node DO jEdge=1,3 @@ -800,10 +793,258 @@ SUBROUTINE buildEdges() END DO !!SIDES!!************** aElem=>aElem%nextElem END DO !! ELEMS!! - CALL timer(.FALSE.) END SUBROUTINE buildEdges +SUBROUTINE buildFEMconnectivity() +!=================================================================================================================================== +! Fill the FEM edge and Vertex connectivity as a pointer datastructure: +! We already have unique pointers for geometric "nodes" and geometric "edges" (buildEdges needed before calling this routine!) +! If periodic BCs are present, its important that a "FEM vertex" and a "FEM edge"=`LocalEdge` are unique in a topological sense, +! which is different to the geometrical uniqueness. +! For example, a 1 element fully periodic domain has 8 unique nodes, but only one FEM vertex, +! and it has 12 unique edges geometrically, but only 3 FEM edges (3 x (4 geometric edges)). +! +! FEM connectivity means that each geometric entity (vertex/edge) of an element needs to have a list of all elements +! which are connected via that entity. There is only one geometric entity that "owns" this list (=master edge/vertex), +! which is then accessed via the `FirstLocalEdge`/`FirstVertex` pointer (not associated for "slave" entities). +! In this list, there is then a `nextEdge`/`nextVertex` pointer, +! and the number of connections is counted in the `FirstLocalEdge%tmp`/`FirstVertex%tmp`. +! First we loop through all element sides which have a periodic neighbor, where we use +! the `orientedNodes` to access the neighbors edges and vertices, and add their connection to the pointer list. +! Then we loop through all sides again to fill the remaining edge and vertex connectivity into the pointer list. +! The pointer datastructure will be translated into the hdf5 meshfile data in "WriteMeshToHDF5" routine. +!=================================================================================================================================== +! MODULES + USE MOD_Mesh_Vars,ONLY:tElem,tSide,tEdge,tNode,tEdgePtr,tLocalEdge,tVertex + USE MOD_Mesh_Vars,ONLY:firstElem,CGNSElemEdgeToNode + USE MOD_Mesh_Vars,ONLY:getNewLocalEdge,getNewVertex + IMPLICIT NONE +!----------------------------------------------------------------------------------------------------------------------------------- +! INPUT VARIABLES +!----------------------------------------------------------------------------------------------------------------------------------- +! OUTPUT VARIABLES +!----------------------------------------------------------------------------------------------------------------------------------- +! LOCAL VARIABLES + TYPE(tElem),POINTER :: aElem ! ? + TYPE(tSide),POINTER :: aSide,bSide ! ? + TYPE(tEdge),POINTER :: aEdge,bEdge ! ? + TYPE(tLocalEdge),POINTER :: lEdge,nextlEdge ! ? + TYPE(tNode),POINTER :: aNode,bNode ! ? + TYPE(tVertex),POINTER :: vert,next_vert + INTEGER :: i,iSide,iEdge,iNode,iPlus,nSides + INTEGER :: indA(2),indTmp(2) + LOGICAL :: edgeFound ! ? + INTEGER :: nSides_from_nNodes(4:8)=(/4,5,5,-1, 6/) + INTEGER :: nEdges_from_nNodes(4:8)=(/6,8,9,-1,12/) +!=================================================================================================================================== +CALL Timer(.TRUE.) +WRITE(UNIT_stdOut,'(132("~"))') +WRITE(UNIT_stdOut,'(A)')'BUILD FEM connectivity of edges and vertices...' + +! set first local edge / first Vertex for all periodic edges before, such that they all point to one single geometrical edge / vertex +aElem=>firstElem +DO WHILE(ASSOCIATED(aElem)) + nSides=nSides_from_nNodes(aElem%nNodes) + aSide=>aElem%firstSide + DO iSide=1,nSides + IF(ASSOCIATED(aSide%BC))THEN ! + IF(aSide%BC%BCType.EQ.1)THEN !ONLY FOR periodic BC!! + !find periodic edge connection (edge exists two times!) + bSide=>aside%connection + !find from aside and bside the common edge => aEdge and bEdge + ! NOTE THAT "iEdge"=iOrientedNode + DO iEdge=1,aSide%nNodes + iPlus=iEdge+1 + IF(iEdge.EQ.aSide%nNodes) iPlus=1 + + ! aSide + edge from aNode->bNode + IF(aSide%edgeOrientation(iEdge))THEN + aNode=>aSide%OrientedNode(iEdge)%np + bNode=>aSide%OrientedNode(iPlus)%np + ELSE + aNode=>aSide%OrientedNode(iPlus)%np + bNode=>aSide%OrientedNode(iEdge)%np + END IF + indA(1)=aNode%ind + indA(2)=bNode%ind + edgeFound=.FALSE. + aEdge=>aNode%firstEdge ! edge list of edges that have the aNode as their first index + DO WHILE (ASSOCIATED(aEdge)) + indTmp(1)=aEdge%Node(1)%np%ind + indTmp(2)=aEdge%Node(2)%np%ind + IF((ANY(indA(1).EQ.indTmp)).AND.(ANY(indA(2).EQ.indTmp)))THEN + edgeFound=.TRUE. + EXIT + END IF + aEdge=>aEdge%nextEdge + END DO + IF(.NOT.edgeFound) CALL abort(__STAMP__,'problem in finding periodic side aEdge') + + !now for the periodic side (bSide,edge from anode->bnode) + IF(bSide%edgeOrientation(iEdge))THEN + aNode=>bSide%OrientedNode(iEdge)%np + bNode=>bSide%OrientedNode(iPlus)%np + ELSE + aNode=>bSide%OrientedNode(iPlus)%np + bNode=>bSide%OrientedNode(iEdge)%np + END IF + indA(1)=aNode%ind + indA(2)=bNode%ind + edgeFound=.FALSE. + bEdge=>aNode%firstEdge + DO WHILE (ASSOCIATED(bEdge)) + indTmp(1)=bEdge%Node(1)%np%ind + indTmp(2)=bEdge%Node(2)%np%ind + IF((ANY(indA(1).EQ.indTmp)).AND.(ANY(indA(2).EQ.indTmp)))THEN + edgeFound=.TRUE. + EXIT + END IF + bEdge=>bEdge%nextEdge + END DO + IF(.NOT.edgeFound) CALL abort(__STAMP__,'problem in finding periodic side bEdge') + + !set firstLocalEdge to the same global edge for all periodic edges found + IF(.NOT.ASSOCIATED(bEdge%FirstLocalEdge))THEN + IF(.NOT.ASSOCIATED(aEdge%FirstLocalEdge))THEN + CALL getNewLocalEdge(aEdge%FirstLocalEdge,Elem_in=aElem,Edge_in=aEdge) + aEdge%FirstLocalEdge%localEdgeID=-1 ! MARK PERIODIC FIRSTLOCALEDGE! + END IF! aedge%firstlocalEdge not associated + bEdge%FirstLocalEdge=>aEdge%FirstLocalEdge + ELSE + IF(.NOT.ASSOCIATED(aEdge%FirstLocalEdge))THEN + aEdge%FirstLocalEdge=>bEdge%FirstLocalEdge + ELSE + !both are already associated, but they are periodic, be sure that they are synchronized (re-pointer!) + IF(LOC(bEdge%FirstLocalEdge).NE.LOC(aEdge%FirstLocalEdge))THEN + bEdge%FirstLocalEdge=>aEdge%FirstLocalEdge + END IF + END IF !aedge + END IF !bedge%firstlocalEdge not associated + !set firstVertex to the same global node for all periodic vertices found + aNode=>aSide%OrientedNode(iEdge)%np ! node of aEdge + bNode=>bSide%OrientedNode(iEdge)%np !corresponding periodic node of bEdge + IF(.NOT.ASSOCIATED(bNode%FirstVertex))THEN + IF(.NOT.ASSOCIATED(aNode%FirstVertex))THEN + CALL getNewVertex(aNode%FirstVertex,Elem_in=aElem,Node_in=aNode) + aNode%FirstVertex%localVertexID=-1 ! MARK PERIODIC FIRSTVERTEX! + END IF! anode%firstVertex not associated + bNode%FirstVertex=>aNode%FirstVertex + ELSE + IF(.NOT.ASSOCIATED(aNode%FirstVertex))THEN + aNode%FirstVertex=>bNode%FirstVertex + ELSE + !both are already associated, but they are periodic, be sure that they are synchronized (re-pointer!) + IF(LOC(bNode%FirstVertex).NE.LOC(aNode%FirstVertex))THEN + bNode%FirstVertex=>aNode%FirstVertex + END IF + END IF !anode%firstvertex not associated + END IF !bnode%firstVertex not associated + END DO !iEdge=1,bSide%nnodes + END IF ! BC periodic + END IF ! BC side + aSide=>aSide%nextElemSide + END DO !iSides + aElem=>aElem%nextElem +END DO !ELEMS + +! Build all elem to localEdge / Vertex pointer arrays, where each connection found is appended to the list of FirstLocalEdge->next_connection / FirstVertex -> next_connection +aElem=>firstElem +DO WHILE(ASSOCIATED(aElem)) + aElem%nEdges=nEdges_from_nNodes(aElem%nNodes) + ALLOCATE(aElem%localEdge(aElem%nEdges)) + !fill element edges + DO iEdge=1,aElem%nEdges + aNode=>aElem%Node(CGNSElemEdgeToNode(aElem%nNodes,iEdge,1))%np + bNode=>aElem%Node(CGNSElemEdgeToNode(aElem%nNodes,iEdge,2))%np + !find edge from aNode->bNode (same orientation) / from bNode->aNode (opposite orientation) + + edgeFound=.FALSE. + indA(1)=aNode%ind + indA(2)=bNode%ind + DO i=1,2 ! loop anode, bnode + IF(i.EQ.1)THEN + aEdge=>aNode%firstEdge + ELSE + aEdge=>bNode%firstEdge + END IF + DO WHILE (ASSOCIATED(aEdge)) + indtmp(1)=aEdge%Node(1)%np%ind + indtmp(2)=aEdge%Node(2)%np%ind + IF((ANY(indA(1).EQ.indTmp)).AND.(ANY(indA(2).EQ.indTmp)))THEN + edgeFound=.TRUE. + EXIT + END IF + aEdge=>aEdge%nextEdge + END DO + IF(edgeFound) EXIT + END DO !i=1,2 + IF (edgeFound) THEN + IF(.NOT.ASSOCIATED(aEdge%firstLocalEdge))THEN + CALL getNewLocalEdge(aElem%LocalEdge(iEdge)%ledp,Elem_in=aElem,localEdgeID_in=iEdge) + lEdge=>aElem%LocalEdge(iEdge)%ledp + lEdge%edge=>aEdge + aEdge%FirstLocalEdge=>lEdge + ELSE + IF((aEdge%firstLocalEdge%elem%ind.EQ.aElem%ind).AND.(aEdge%FirstLocalEdge%localEdgeID.EQ.-1)) THEN !existing periodic firstlocalEdge, but not yet claimed by the attached same element! + aElem%localEdge(iEdge)%ledp=>aEdge%FirstlocalEdge + lEdge=>aElem%LocalEdge(iEdge)%ledp + lEdge%localEdgeID=iEdge + ELSE + CALL getNewLocalEdge(aElem%LocalEdge(iEdge)%ledp,Elem_in=aElem,localEdgeID_in=iEdge) + lEdge=>aElem%LocalEdge(iEdge)%ledp + + lEdge%tmp=-1 !mark as slave edge + lEdge%edge=>aEdge%FirstLocalEdge%edge + nextLedge=>aEdge%FirstLocalEdge + DO WHILE(ASSOCIATED(nextlEdge%next_connected)) + nextlEdge=>nextlEdge%next_connected + END DO + nextlEdge%next_connected=>lEdge !append to edge connectivity list + END IF + END IF !aedge%firstlocaledge associated + aEdge%FirstLocalEdge%tmp=aEdge%FirstLocalEdge%tmp+1 !count edge multiplicity in firstLocalEdge%tmp + lEdge%orientation=(SUM((bNode%x-aNode%x)*(lEdge%edge%Node(2)%np%x-lEdge%edge%Node(1)%np%x)).GT.0.) + ELSE + CALL abort(__STAMP__,'something is wrong cannot find edge in element') + END IF + END DO !iEdge=1,aElem%nEdges + + ALLOCATE(aElem%Vertex(aElem%nNodes)) + ! fill element vertex + DO iNode=1,aElem%nNodes + aNode=>aElem%Node(iNode)%np + + IF(.NOT.ASSOCIATED(aNode%firstVertex))THEN + CALL GetNewVertex(aElem%Vertex(iNode)%vp,Elem_in=aElem,localVertexID_in=iNode) + vert=>aElem%Vertex(iNode)%vp + aNode%FirstVertex=>vert + vert%node=>aNode + ELSE + IF((aNode%firstVertex%elem%ind.EQ.aElem%ind).AND.(aNode%FirstVertex%localVertexID.EQ.-1))THEN !periodic vertex found, but not yet claimed by the attached same elemnent + aElem%Vertex(iNode)%vp=>aNode%FirstVertex + vert=>aElem%Vertex(iNode)%vp + vert%localVertexID=iNode + ELSE + CALL GetNewVertex(aElem%Vertex(iNode)%vp,Elem_in=aElem,localVertexID_in=iNode) + vert=>aElem%Vertex(iNode)%vp + vert%node=>aNode%FirstVertex%node + vert%tmp=-1 ! mark as slave vertex + next_vert=>aNode%FirstVertex + DO WHILE(ASSOCIATED(next_vert%next_connected)) + next_vert=>next_vert%next_connected + END DO + next_vert%next_connected=>vert !append to vertex connectivity list + END IF + END IF + aNode%FirstVertex%tmp=aNode%FirstVertex%tmp+1 !vertex multiplicity counted on FirstVertex%tmp (master vertex) + END DO !iNode + aElem=>aElem%nextElem +END DO !! ELEMS!! + +CALL timer(.FALSE.) +END SUBROUTINE buildFEMconnectivity + SUBROUTINE FlushMesh() !=================================================================================================================================== @@ -819,8 +1060,8 @@ SUBROUTINE FlushMesh() !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES -TYPE(tElem),POINTER :: Elem +! LOCAL VARIABLES +TYPE(tElem),POINTER :: Elem !=================================================================================================================================== DO WHILE(ASSOCIATED(FirstElem)) Elem=>FirstElem @@ -843,7 +1084,7 @@ SUBROUTINE assignBC(BCcopy,BCorig) ! OUTPUT VARIABLES TYPE(tBC),POINTER,INTENT(OUT) :: BCcopy ! Copy of boundary condition "BCorig" !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== IF (ASSOCIATED(BCorig)) THEN IF (.NOT. ASSOCIATED(BCcopy)) THEN @@ -867,12 +1108,12 @@ FUNCTION isOriented(Side) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES -TYPE(tSide),POINTER,INTENT(IN) :: Side ! ? +TYPE(tSide),POINTER,INTENT(IN) :: Side ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES -LOGICAL :: isOriented ! ? +LOGICAL :: isOriented ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== isOriented=.FALSE. IF ((ASSOCIATED(Side%Node(1)%np, Side%orientedNode(1)%np)) .AND. & @@ -891,12 +1132,12 @@ FUNCTION getFlip(Side) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES -TYPE(tSide),POINTER,INTENT(IN) :: Side ! ? +TYPE(tSide),POINTER,INTENT(IN) :: Side ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES -INTEGER :: getFlip ! ? +INTEGER :: getFlip ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: i !=================================================================================================================================== getFlip=-1 @@ -905,7 +1146,7 @@ FUNCTION getFlip(Side) ELSE !not oriented DO i=1,Side%nNodes IF(ASSOCIATED(Side%Node(i)%np,Side%OrientedNode(1)%np))THEN - getFlip=i + getFlip=i EXIT END IF END DO @@ -913,33 +1154,33 @@ FUNCTION getFlip(Side) END FUNCTION getFlip -SUBROUTINE Pack1D(Ngeo,edge,data_out) +SUBROUTINE Pack1D(Ngeo,edge,data_out) !=================================================================================================================================== ! description !=================================================================================================================================== -! MODULES +! MODULES USE MOD_Mesh_Vars,ONLY:tEdge IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo TYPE(tEdge),POINTER,INTENT(IN) :: edge REAL,INTENT(OUT) :: data_out(3,0:Ngeo) !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: iNgeo +INTEGER :: iNgeo !=================================================================================================================================== IF(NGeo.GT.1)THEN DO iNgeo=0,Ngeo data_out(:,iNgeo) = edge%curvedNode(iNgeo+1)%np%x - END DO -ELSE + END DO +ELSE data_out(:,0) = edge%Node(1)%np%x data_out(:,1) = edge%Node(2)%np%x END IF END SUBROUTINE Pack1D -SUBROUTINE Pack2D(Ngeo,side,data_out) +SUBROUTINE Pack2D(Ngeo,side,data_out) !=================================================================================================================================== ! description !=================================================================================================================================== @@ -948,21 +1189,21 @@ SUBROUTINE Pack2D(Ngeo,side,data_out) USE MOD_Basis_Vars ,ONLY:QuadMapInv IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------! -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo TYPE(tSide),POINTER,INTENT(IN) :: side REAL,INTENT(OUT) :: data_out(3,0:Ngeo,0:Ngeo) !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: iNgeo,jNgeo,i1D +INTEGER :: iNgeo,jNgeo,i1D !=================================================================================================================================== IF(Ngeo.GT.1)THEN DO jNgeo=0,Ngeo DO iNgeo=0,Ngeo i1D = QuadMapInv(iNgeo,jNgeo) data_out(:,iNgeo,jNgeo) = side%curvedNode(i1D)%NP%x - END DO - END DO + END DO + END DO ELSE data_out(:,0,0) = side%OrientedNode(1)%NP%x data_out(:,1,0) = side%OrientedNode(2)%NP%x @@ -971,7 +1212,7 @@ SUBROUTINE Pack2D(Ngeo,side,data_out) END IF END SUBROUTINE Pack2D -SUBROUTINE Pack3D(Ngeo,elem,data_out) +SUBROUTINE Pack3D(Ngeo,elem,data_out) !=================================================================================================================================== ! description !=================================================================================================================================== @@ -980,13 +1221,13 @@ SUBROUTINE Pack3D(Ngeo,elem,data_out) USE MOD_Basis_Vars ,ONLY:HexaMapInv IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------! -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo TYPE(tElem),POINTER,INTENT(IN) :: elem REAL,INTENT(OUT) :: data_out(3,0:Ngeo,0:Ngeo,0:Ngeo) !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: iNgeo,jNgeo,kNgeo,i1D +INTEGER :: iNgeo,jNgeo,kNgeo,i1D !=================================================================================================================================== IF(Ngeo.GT.1)THEN DO kNgeo=0,Ngeo @@ -994,9 +1235,9 @@ SUBROUTINE Pack3D(Ngeo,elem,data_out) DO iNgeo=0,Ngeo i1D = HexaMapInv(iNgeo,jNgeo,kNgeo) data_out(:,iNgeo,jNgeo,kNgeo) = elem%curvedNode(i1D)%NP%x - END DO - END DO - END DO + END DO + END DO + END DO ELSE data_out(:,0,0,0) = elem%Node(1)%NP%x data_out(:,1,0,0) = elem%Node(2)%NP%x @@ -1009,7 +1250,7 @@ SUBROUTINE Pack3D(Ngeo,elem,data_out) END IF END SUBROUTINE Pack3D -SUBROUTINE Unpack1D(Ngeo,data_in,edge) +SUBROUTINE Unpack1D(Ngeo,data_in,edge) !=================================================================================================================================== ! description !=================================================================================================================================== @@ -1017,25 +1258,25 @@ SUBROUTINE Unpack1D(Ngeo,data_in,edge) USE MOD_Mesh_Vars,ONLY:tEdge IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------! -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo REAL,INTENT(IN) :: data_in(3,0:Ngeo) TYPE(tEdge),POINTER,INTENT(IN) :: edge !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: iNgeo +INTEGER :: iNgeo !=================================================================================================================================== IF(NGeo.GT.1)THEN DO iNgeo=0,Ngeo edge%curvedNode(iNgeo+1)%NP%x = data_in(:,iNgeo) - END DO + END DO ELSE edge%Node(1)%NP%x = data_in(:,0) edge%Node(2)%NP%x = data_in(:,1) END IF END SUBROUTINE Unpack1D -SUBROUTINE Unpack2D(Ngeo,data_in,side) +SUBROUTINE Unpack2D(Ngeo,data_in,side) !=================================================================================================================================== ! description !=================================================================================================================================== @@ -1044,7 +1285,7 @@ SUBROUTINE Unpack2D(Ngeo,data_in,side) USE MOD_Basis_Vars ,ONLY:QuadMapInv IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------! -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo REAL,INTENT(IN) :: data_in(3,0:Ngeo,0:Ngeo) TYPE(tSide),POINTER,INTENT(IN) :: side @@ -1057,8 +1298,8 @@ SUBROUTINE Unpack2D(Ngeo,data_in,side) DO iNgeo=0,Ngeo i1D = QuadMapInv(iNgeo,jNgeo) side%curvedNode(i1D)%NP%x = data_in(:,iNgeo,jNgeo) - END DO - END DO + END DO + END DO ELSE side%OrientedNode(1)%NP%x = data_in(:,0,0) side%OrientedNode(2)%NP%x = data_in(:,1,0) @@ -1067,7 +1308,7 @@ SUBROUTINE Unpack2D(Ngeo,data_in,side) END IF END SUBROUTINE Unpack2D -SUBROUTINE Unpack3D(Ngeo,data_in,elem) +SUBROUTINE Unpack3D(Ngeo,data_in,elem) !=================================================================================================================================== ! description !=================================================================================================================================== @@ -1076,7 +1317,7 @@ SUBROUTINE Unpack3D(Ngeo,data_in,elem) USE MOD_Basis_Vars ,ONLY:HexaMapInv IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------! -! INPUT / OUTPUT VARIABLES +! INPUT / OUTPUT VARIABLES INTEGER,INTENT(IN) :: Ngeo REAL,INTENT(IN) :: data_in(3,0:Ngeo,0:Ngeo,0:Ngeo) TYPE(tElem),POINTER,INTENT(IN) :: elem @@ -1090,9 +1331,9 @@ SUBROUTINE Unpack3D(Ngeo,data_in,elem) DO iNgeo=0,Ngeo i1D = HexaMapInv(iNgeo,jNgeo,kNgeo) elem%curvedNode(i1D)%NP%x = data_in(:,iNgeo,jNgeo,kNgeo) - END DO - END DO - END DO + END DO + END DO + END DO ELSE elem%Node(1)%NP%x = data_in(:,0,0,0) elem%Node(2)%NP%x = data_in(:,1,0,0) diff --git a/src/mesh/mesh_connect.f90 b/src/mesh/mesh_connect.f90 index 0ef907a..fb4e542 100644 --- a/src/mesh/mesh_connect.f90 +++ b/src/mesh/mesh_connect.f90 @@ -126,11 +126,9 @@ SUBROUTINE Connect(reconnect,deletePeriodic) ELSEIF (Side%BC%BCType .EQ. 1) THEN nPeriodicSides=nPeriodicSides+1 IF (Side%BC%BCalphaInd.EQ.0) & - CALL abort(__STAMP__, & - TRIM(conn)//': No displacement vector vv assigned to periodic BC') + CALL abort(__STAMP__,TRIM(conn)//': No displacement vector vv assigned to periodic BC') IF (abs(Side%BC%BCalphaInd).GT.nVV) & - CALL abort(__STAMP__, & - TRIM(conn)//':No defined displacement vector vv assigned to periodic BC') + CALL abort(__STAMP__,TRIM(conn)//':No defined displacement vector vv assigned to periodic BC') END IF END IF Side=>Side%nextElemSide @@ -208,8 +206,7 @@ SUBROUTINE Connect(reconnect,deletePeriodic) Side%tmp=0 Side%tmp2=0 IF(Side%LocSide .LE. 0) & - CALL abort(__STAMP__, & - 'Mesh '//TRIM(conn)//': Side%LocSide not set!') + CALL abort(__STAMP__,'Mesh '//TRIM(conn)//': Side%LocSide not set!') IF (ASSOCIATED(Side%BC)) THEN IF(Side%BC%BCType .EQ. 1) THEN nPeriodic(1)=nPeriodic(1)+1 @@ -255,8 +252,7 @@ SUBROUTINE Connect(reconnect,deletePeriodic) WRITE(*,*) 'Inner sides: ',nInner(2),' of ',nInner(1),' sides missing.' WRITE(*,*) 'Periodic sides ',nPeriodic(2),' of ',nPeriodic(1),' sides missing.' IF(nPeriodic(2).GT.0) CALL BCVisu() - CALL abort(__STAMP__, & - TRIM(conn)//': Sides with missing connection found.') + CALL abort(__STAMP__,TRIM(conn)//': Sides with missing connection found.') END IF WRITE(UNIT_stdOut,'(A,F0.3,A)')'Mesh '//TRIM(conn)//' completed with success. ' @@ -409,16 +405,14 @@ SUBROUTINE ConnectMesh() DO iNode=1,nSide%nNodes IF(ASSOCIATED(Side%Node(1)%np,nSide%Node(iNode)%np)) fNode=iNode END DO - IF(fNode.EQ.0)CALL abort(__STAMP__, & - 'Problem with OrientedNode !') + IF(fNode.EQ.0)CALL abort(__STAMP__,'Problem with OrientedNode !') ELSEIF(Side%tmp2.LT.0) THEN !only connect from periodic slave side to master side (->nSide has a dummy connection side) ! for adjustorientednodes by pointer association (no tolerance gedoens!) fNode=0 DO iNode=1,Side%nNodes IF(ASSOCIATED(Side%Node(1)%np,nSide%connection%Node(iNode)%np)) fNode=iNode END DO - IF(fNode.EQ.0)CALL abort(__STAMP__, & - 'Problem with OrientedNode on periodic side!') + IF(fNode.EQ.0)CALL abort(__STAMP__,'Problem with OrientedNode on periodic side!') !now delete dummy Side DO iNode=1,nSide%nNodes NULLIFY(nSide%connection%Node(iNode)%np) @@ -431,8 +425,7 @@ SUBROUTINE ConnectMesh() DO iNode=1,nSide%nNodes IF(ASSOCIATED(nSide%Node(1)%np,Side%connection%Node(iNode)%np)) fNode=iNode END DO - IF(fNode.EQ.0)CALL abort(__STAMP__, & - 'Problem with OrientedNode on periodic side (master)!') + IF(fNode.EQ.0)CALL abort(__STAMP__,'Problem with OrientedNode on periodic side (master)!') !now delete dummy Side DO iNode=1,Side%nNodes NULLIFY(Side%connection%Node(iNode)%np) @@ -723,11 +716,11 @@ SUBROUTINE NonconformConnectMesh(reconnect) smallSide2=>tmpSide END IF ELSE - STOP 'ERROR: Mortar type could not be identified!' + CALL abort(__STAMP__,'ERROR: Mortar type could not be identified!') END IF bigSide%nMortars=2 - IF(ASSOCIATED(bigSide%MortarSide)) STOP 'ERROR: Mortar connection already associated!' + IF(ASSOCIATED(bigSide%MortarSide)) CALL abort(__STAMP__,'ERROR: Mortar connection already associated!') ALLOCATE(bigSide%MortarSide(2)) bigSide%MortarSide(1)%sp=>smallSide1 bigSide%MortarSide(2)%sp=>smallSide2 @@ -800,7 +793,7 @@ SUBROUTINE NonconformConnectMesh(reconnect) aSide%MortarType=1 aSide%nMortars=4 SideDone(iSide)=.TRUE. - IF(ASSOCIATED(aSide%MortarSide)) STOP 'ERROR: Mortar connection already associated!' + IF(ASSOCIATED(aSide%MortarSide)) CALL abort(__STAMP__,'ERROR: Mortar connection already associated!') ALLOCATE(aSide%MortarSide(4)) DO iNode=1,4 ! for type 1, small mortars are sorted on a cartesian grid (first xi, then eta) @@ -869,7 +862,7 @@ SUBROUTINE NonconformConnectMesh(reconnect) ELSE ! dummy side is mortar slave, update connection of mortar master bigSide=>dummySide%connection - IF(ASSOCIATED(dummySide,bigSide)) STOP 'ERROR: Periodic mortar slave has no connection to master!' + IF(ASSOCIATED(dummySide,bigSide)) CALL abort(__STAMP__,'ERROR: Periodic mortar slave has no connection to master!') DO iSide=1,bigSide%nMortars IF(ASSOCIATED(bigSide%MortarSide(iSide)%sp,dummySide))THEN bigSide%MortarSide(iSide)%sp=>aSide @@ -968,7 +961,7 @@ SUBROUTINE SetMortarOrientedNodes(aSide) END DO IF(commonNode) EXIT END DO - IF(.NOT.commonNode) STOP 'ERROR: no common node of big and small mortar sides found' + IF(.NOT.commonNode) CALL abort(__STAMP__,'ERROR: no common node of big and small mortar sides found') DO iNode=1,aSide%nNodes bSide%orientedNode(masterNode)%np=>bSide%Node(slaveNode)%np masterNode=prev1(masterNode,aSide%nNodes) diff --git a/src/mesh/mesh_jacobians.f90 b/src/mesh/mesh_jacobians.f90 index 0e88ece..067b623 100644 --- a/src/mesh/mesh_jacobians.f90 +++ b/src/mesh/mesh_jacobians.f90 @@ -13,7 +13,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -32,7 +32,7 @@ MODULE MOD_Mesh_Jacobians IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! Private Part --------------------------------------------------------------------------------------------------------------------- ! Public Part ---------------------------------------------------------------------------------------------------------------------- @@ -90,7 +90,7 @@ SUBROUTINE CheckJacobians() xEq(i)=2.*REAL(i)/REAL(N) -1. END DO !i ! take derivatives on Gauss-Lobatto points -! interpolate Eq (N)-> GL (N), derivative on GL (N) +! interpolate Eq (N)-> GL (N), derivative on GL (N) CALL LegGaussLobNodesAndWeights(N,xGL) CALL PolynomialDerivativeMatrix(N,xGL,DGL) @@ -125,7 +125,7 @@ SUBROUTINE CheckJacobians() Jac(:,:,:) = EvalJac(Xgeo) maxJac=MAXVAL(ABS(Jac)) minJac=MINVAL(Jac) - + scaledJac(iElem)=minJac/maxJac ! Check that Nodal Jacobians are positive !DO k=0,nAnalyze; DO j=0,nAnalyze; DO i=0,nAnalyze @@ -169,15 +169,15 @@ SUBROUTINE CheckJacobians() DO iElem=1,nMeshElems i=CEILING(MAX(0.,scaledJac(iElem)*10)) - scaledJacStat(i)=scaledJacStat(i)+1 + scaledJacStat(i)=scaledJacStat(i)+1 END DO WRITE(Unit_StdOut,'(A)') ' Number of element with scaled Jacobians ranging between:' WRITE(Unit_StdOut,'(A)') ' < 0.0 < 0.1 < 0.2 < 0.3 < 0.4 < 0.5 < 0.6 < 0.7 < 0.8 < 0.9 < 1.0 ' DO i=0,10 - WRITE(Unit_StdOut,'(I6,X,A1)',ADVANCE='NO')scaledJacStat(i),'|' + WRITE(Unit_StdOut,'(I6,1X,A1)',ADVANCE='NO')scaledJacStat(i),'|' END DO WRITE(Unit_StdOut,'(A1)')' ' - + CALL Timer(.FALSE.) WRITE(UNIT_StdOut,'(132("="))') diff --git a/src/mesh/mesh_postdeform.f90 b/src/mesh/mesh_postdeform.f90 index 27971a5..dfa693d 100644 --- a/src/mesh/mesh_postdeform.f90 +++ b/src/mesh/mesh_postdeform.f90 @@ -13,7 +13,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,7 +31,7 @@ MODULE MOD_Mesh_PostDeform IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! Private Part --------------------------------------------------------------------------------------------------------------------- ! Public Part ---------------------------------------------------------------------------------------------------------------------- @@ -46,7 +46,7 @@ MODULE MOD_Mesh_PostDeform SUBROUTINE PostDeform() !=================================================================================================================================== -! input x,y,z node coordinates are transformed by a smooth (!) mapping to new x,y,z coordinates +! input x,y,z node coordinates are transformed by a smooth (!) mapping to new x,y,z coordinates !=================================================================================================================================== !MODULE INPUT VARIABLES USE MOD_Globals @@ -67,13 +67,14 @@ SUBROUTINE PostDeform() ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -TYPE(tElem),POINTER :: aElem -INTEGER :: iNode -INTEGER :: nTotal +TYPE(tElem),POINTER :: aElem +INTEGER :: iNode +INTEGER :: nTotal INTEGER :: i,iElem,ijk(3) REAL,DIMENSION(0:N) :: xi_EQ,xi_GL,wBary_EQ,wBary_GL REAL,DIMENSION(0:N,0:N) :: Vdm_EQtoGL, Vdm_GLtoEQ -REAL :: xElem(3,0:N,0:N,0:N,nMeshElems) +REAL :: xElem( 3,0:N,0:N,0:N,nMeshElems) +REAL :: xElemDeform(3,0:N,0:N,0:N,nMeshElems) INTEGER :: HexaMapN1(8,3) !=================================================================================================================================== IF(MeshPostDeform.EQ.0) RETURN @@ -124,13 +125,14 @@ SUBROUTINE PostDeform() !transform (all nodes are marked from -2 to -1) nTotal=(N+1)**3*nMeshElems -CALL PostDeformFunc(nTotal,xElem,xElem) +CALL PostDeformFunc(nTotal,xElem,xElemDeform) +xElem = xElemDeform IF((PostDeform_useGL).AND.(N.GT.2))THEN !transform back from GL to EQ CALL ChangeBasis3D(3,nMeshElems,N,N,Vdm_GLtoEQ,xElem,xElem,.FALSE.) END IF - + ! copy back (all nodes are marked from -1 to 0) DO iElem=1,nMeshElems aElem=>Elems(iElem)%ep @@ -160,11 +162,11 @@ END SUBROUTINE PostDeform SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) !=================================================================================================================================== -! input x,y,z node coordinates are transformed by a smooth (!) mapping to new x,y,z coordinates +! input x,y,z node coordinates are transformed by a smooth (!) mapping to new x,y,z coordinates !=================================================================================================================================== !MODULE INPUT VARIABLES USE MOD_Globals -USE MOD_Mesh_Vars,ONLY:MeshPostDeform,PostDeform_R0,PostDeform_Rtorus +USE MOD_Mesh_Vars,ONLY:MeshPostDeform,PostDeform_R0,PostDeform_Rtorus USE MOD_Mesh_Vars,ONLY:PostDeform_sq,PostDeform_Lz !MODULE OUTPUT VARIABLES ! MODULES @@ -176,7 +178,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) REAL,INTENT(IN) :: X_in(3,nTotal) ! contains original xyz coords !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT/OUTPUT VARIABLES -REAL,INTENT(OUT) :: X_out(3,nTotal) ! contains new XYZ position +REAL,INTENT(OUT) :: X_out(3,nTotal) ! contains new XYZ position !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- @@ -185,9 +187,9 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) REAL :: rr,x(3),dx(3),dx1(3),dx2(3),dx3(3) REAL :: xout(3) REAL :: alpha,HH, xi,eta -REAL :: cosa,cosb,sina,sinb +REAL :: cosa,cosb,sina,sinb REAL :: rotmat(2,2),arg -REAL :: g,h,hMax,xLeft,normal,vec(2),length +REAL :: g,h,hMax,xLeft,vec(2),length REAL :: vecRefBottom(2),xBlendBottom REAL :: vecRefTop(2), xBlendTop !=================================================================================================================================== @@ -213,7 +215,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) dx(1:2)=alpha*(dx1(1:2)*(/2*x(1),1./)+dx2(1:2)*(/1.,2*x(2)/)) ELSE !outside [-0.5,0.5]^2 IF(ABS(x(2)).LT.ABS(x(1)))THEN !left and right quarter - dx(1)=x(1)*SQRT(2.)*COS(0.25*Pi*x(2)/x(1))-x(1) + dx(1)=x(1)*SQRT(2.)*COS(0.25*Pi*x(2)/x(1))-x(1) dx(2)=x(1)*SQRT(2.)*SIN(0.25*Pi*x(2)/x(1))-x(2) ELSEIF(ABS(x(2)).GE.ABS(x(1)))THEN !upper and lower quarter dx(1)=x(2)*SQRT(2.)*SIN(0.25*Pi*x(1)/x(2))-x(1) @@ -221,7 +223,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) END IF alpha=MIN(1.,2.*rr-1.) !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary max(|x|,|y|)=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|)=1, and alpha=0.35 at max(|x|,|y|)=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|)=1, and alpha=0.35 at max(|x|,|y|)=0.5 dx(1:2)=alpha*dx(1:2) END IF xout(1:2)=PostDeform_R0*SQRT(0.5)*(x(1:2)+dx(1:2)) @@ -249,7 +251,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) END IF X_out(:,i)=xout(:) END DO !i=1,nTotal -CASE(66) +CASE(66) DO i=1,nTotal x(:)=X_in(:,i) ! 2D HEXAGON, x,y in [-1,1]^2, to cylinder with radius PostDeform_R0 (with PostDeform_Rtorus>0 to a torus, with zperiodic [0,1]) @@ -260,8 +262,8 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ! | _ ! 0-----------0 ^ ! / \ / \ | - ! / \ / \ _ | - ! / 3-----2 \ ^ |1.0 + ! / \ / \ _ | + ! / 3-----2 \ ^ |1.0 ! / / \ \ \ |0.5 | ! / / \ \ \ | | ! 0-----4 0-----1-----0 -----> x _v _v @@ -274,7 +276,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ! |<>| 0.25 ! |<--->| 0.5 ! |<--------->| 1. - ! y direction is not correctly scaled, will be scaled here by sqrt(3)/2 + ! y direction is not correctly scaled, will be scaled here by sqrt(3)/2 ! ! inside [-1,1]^2 and outside [-0.5,0.5]^2 there will be a blending from a circle to a square ! the inner square [-0.5,0.5]^2 will be a linear blending of the bounding curves @@ -302,7 +304,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ELSE ! domain (0-5-6-1) dx1(1:2)= (/0.5,0./)+eta*(/-0.25,-0.5*HH/) !point at 1-6 dx2(1:2)= xi*(/0.5,0./)+ (/-0.25,-0.5*HH/) !point at 5-6 - END IF + END IF ELSE ! domain (0-1-6-5), xi 0->3, eta 0->5 eta= -x(2)/HH-2.*x(1) xi = x(2)/HH-2.*x(1) @@ -311,10 +313,10 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) END IF dx(1:2)= alpha*xi* (0.5/SQRT(SUM(dx1(1:2)**2))-1.)*dx1(1:2) & +alpha*eta*(0.5/SQRT(SUM(dx2(1:2)**2))-1.)*dx2(1:2) - ELSE !outside hexagon 1-6, rr>=0.5 , for rr>1, alpha=1 + ELSE !outside hexagon 1-6, rr>=0.5 , for rr>1, alpha=1 alpha=MIN(1.,2.*rr-1.) !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary rr=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at rr=1, and alpha=0.35 at rr=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at rr=1, and alpha=0.35 at rr=0.5 !r=SQRT(x(1)**2+x(2)**2) !r always > 0 here dx(1:2)=alpha*(rr/SQRT(SUM(x(1:2)**2))-1.)*x(1:2) END IF !inside/outside hexagon @@ -323,7 +325,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) xout(3)=x(3)*PostDeform_Lz !cylinder X_out(:,i)=xout(:) END DO !i=1,nTotal -CASE(2) ! 3D box, x,y in [-1,1]^3, to Sphere with radius PostDeform_R0 +CASE(2) ! 3D box, x,y in [-1,1]^3, to Sphere with radius PostDeform_R0 ! all points outside [-1,1]^4 will be mapped directly to a sphere DO i=1,nTotal x(:)=x_in(:,i) @@ -357,7 +359,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) dx3(3)=cosa*cosb dx3(:)=dx3(:)*0.5*SQRT(3./(cosb*cosb+(cosa*sinb)**2))-(/x(1),x(2),0.5/) alpha=0.35 - !dx =0 at the corners, coons mapping for faces + !dx =0 at the corners, coons mapping for faces dx(1:3)=alpha*( dx1(1:3)*(/ 2*x(1), 1., 1./) & +dx2(1:3)*(/ 1.,2*x(2) , 1./) & +dx3(1:3)*(/ 1., 1.,2*x(3) /)) @@ -389,7 +391,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) alpha*2*( dx1(1:3)*(/ x(1) , x(2) , 0.5*(ABS(x(1))+ABS(x(2))) /) & +dx2(1:3)*(/ 0.5*(ABS(x(2))+ABS(x(3))), x(2) , x(3) /) & +dx3(1:3)*(/ x(1) ,0.5*(ABS(x(1))+ABS(x(3))), x(3) /)) - + ELSE !outside [-0.5,0.5]^3 IF((ABS(x(2)).LT.ABS(x(1))).AND.(ABS(x(3)).LT.ABS(x(1))))THEN !left and right (x dir) cosa=COS(0.25*Pi*x(2)/x(1)) @@ -421,14 +423,14 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) END IF alpha=MIN(1.,2.*rr-1.) !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary max(|x|,|y|,|z|)=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 dx(:)=alpha*dx(:) END IF xout(1:3)=PostDeform_R0/SQRT(3.)*(x(1:3)+dx(1:3)) X_out(:,i)=xout(:) END DO !i=1,nTotal CASE(3) ! 2D box, x,y in [-1,1]^2, to cylinder with radius PostDeform_R0 z [0,1] is mapped to z*PostDeform_Lz) - ! all points outside [-1,1]^3 and inside [-4,4]^3 are smoothly mapped back to a cube of + ! all points outside [-1,1]^3 and inside [-4,4]^3 are smoothly mapped back to a cube of ! of size [-4,4]*PostDeform_R0/sqrt(2) DO i=1,nTotal x(:)=x_in(:,i) @@ -454,19 +456,19 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) IF(rr.LE.1.)THEN alpha=2.*rr-1. !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary max(|x|,|y|,|z|)=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 dx(1:2)=alpha*dx(1:2) ELSE !alpha=((4.-rr)/((4.-1.)*rr)) !between [-1,1] and [-4,4] alpha=(4.-rr)/(4.-1.) !maps [1,4] --> [1,0] and alpha=1 outside [-1,1]^2 - alpha=SIN(0.5*Pi*alpha) !smooth transition + alpha=SIN(0.5*Pi*alpha) !smooth transition dx(1:2)=alpha*(dx(1:2)/rr) END IF ELSE !outside [-4,4]^2 dx=0. END IF xout(1:2)=PostDeform_R0*SQRT(0.5)*(x(1:2)+dx(1:2)) - xout(3)=x(3)*PostDeform_Lz + xout(3)=x(3)*PostDeform_Lz X_out(:,i)=xout(:) END DO !i=1,nTotal CASE(300) ! planar Annulus: tensor-product mapping: input 2*pi*x=>theta must be [-1,1] y => height in z ,z=> radius @@ -485,8 +487,8 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) xout(3)=PostDeform_R0*x(3)*SIN(pi*x(2)) X_out(:,i)=xout(:) END DO !i=1,nTotal -CASE(4) ! 3D box, x,y in [-1,1]^3, to Sphere with radius PostDeform_R0 - ! all points outside [-1,1]^3 and inside [-4,4]^3 are smoothly mapped back to a cube of +CASE(4) ! 3D box, x,y in [-1,1]^3, to Sphere with radius PostDeform_R0 + ! all points outside [-1,1]^3 and inside [-4,4]^3 are smoothly mapped back to a cube of ! of size [-4,4]*PostDeform_R0/sqrt(3) DO i=1,nTotal x(:)=x_in(:,i) @@ -520,7 +522,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) dx3(3)=cosa*cosb dx3(:)=dx3(:)*0.5*SQRT(3./(cosb*cosb+(cosa*sinb)**2))-(/x(1),x(2),0.5/) alpha=0.35 - !dx =0 at the corners, coons mapping for faces + !dx =0 at the corners, coons mapping for faces dx(1:3)=alpha*( dx1(1:3)*(/ 2*x(1), 1., 1./) & +dx2(1:3)*(/ 1.,2*x(2) , 1./) & +dx3(1:3)*(/ 1., 1.,2*x(3) /)) @@ -552,7 +554,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) alpha*2*( dx1(1:3)*(/ x(1) , x(2) , 0.5*(ABS(x(1))+ABS(x(2))) /) & +dx2(1:3)*(/ 0.5*(ABS(x(2))+ABS(x(3))), x(2) , x(3) /) & +dx3(1:3)*(/ x(1) ,0.5*(ABS(x(1))+ABS(x(3))), x(3) /)) - + ELSEIF((rr.GT.0.5).AND.(rr.LE.4.))THEN !outside [-0.5,0.5]^3 and inside [-4,4]^3 IF((ABS(x(2)).LT.ABS(x(1))).AND.(ABS(x(3)).LT.ABS(x(1))))THEN !left and right (x dir) cosa=COS(0.25*Pi*x(2)/x(1)) @@ -585,15 +587,15 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) IF(rr.LE.1.)THEN alpha=2.*rr-1. !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary max(|x|,|y|,|z|)=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|,|z|)=1, and alpha=0.35 at max(|x|,|y|,|z|)=0.5 dx(:)=alpha*dx(:) ELSE !alpha=((4.-rr)/((4.-1.)*rr)) !between [-1,1] and [-4,4] alpha=(4.-rr)/(4.-1.) !maps [1,4] --> [1,0] and alpha=1 outside [-1,1]^2 - alpha=SIN(0.5*Pi*alpha) !smooth transition + alpha=SIN(0.5*Pi*alpha) !smooth transition dx(:)=alpha*(dx(:)/rr) END IF - ELSE !outside [-4,4]^3 + ELSE !outside [-4,4]^3 dx=0. END IF !rr xout(1:3)=PostDeform_R0/SQRT(3.)*(x(1:3)+dx(1:3)) @@ -614,7 +616,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) h = PHILL_H(x(1)) ! polynomial for smooth mesh deformation across points in y direction - g = 2./hMax**3*x(2)**3 - 3./hMax**2*x(2)**2 + 1. + g = 2./hMax**3*x(2)**3 - 3./hMax**2*x(2)**2 + 1. ! First, simply move the geometry in y-direction regarding to the local hill size xout(2) = xout(2) + g*h @@ -626,8 +628,8 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ! Length of the vector from the hill to the current point, used for scaling length = xout(2) - h - ! surface normal vector: - ! Near the horizontal walls on the top and bottom of the hill, + ! surface normal vector: + ! Near the horizontal walls on the top and bottom of the hill, ! the slope will be lineary increased/decreased to infinity to smear out the sharp bends xBlendTop = 0.8 xBlendBottom = 1.6 @@ -640,7 +642,7 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ! hill bottom vecRefBottom = PHILL_NORMAL(xBlendBottom) vec = vecRefBottom + (xLeft-xBlendBottom)/(4.5-xBlendBottom)*((/0.,1./)-vecRefBottom) - ELSE + ELSE ! default case (at the hill slope): take the actual normal vector vec = PHILL_NORMAL(xLeft) END IF @@ -650,12 +652,12 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) ! Smooth out the mesh deformation xout(1:2) = xout(1:2) + 0.9*g**3*length*(vec-(/0.,1./)) - END IF + END IF X_out(:,i)=xout(:) END DO !i=1,nTotal -CASE(21)!Laval nozzle +CASE(21)!Laval nozzle ! 3D box, x,y in [-1,1]^2 and z in [0,nozzle_length], to cylindrical cross section with a r(z) profile ! r(z) profile here given by a fitted monomial polynomial over z. ! all points outside [-1,1]^2 will be mapped directly to a circle (p.e. 2,2 => sqrt(0.5)*PostDeform_R0*(2,2) ) @@ -684,12 +686,12 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) END IF alpha=MIN(1.,2.*rr-1.) !maps [0.5,1] --> [0,1] and alpha=1 outside [-1,1]^2 alpha=SIN(0.5*Pi*alpha) !smooth transition at the outer boundary max(|x|,|y|)=1 - alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|)=1, and alpha=0.35 at max(|x|,|y|)=0.5 + alpha=1.0*alpha+0.35*(1.-alpha) !alpha=1 at max(|x|,|y|)=1, and alpha=0.35 at max(|x|,|y|)=0.5 dx(1:2)=alpha*dx(1:2) END IF xout(1:2)=PostDeform_R0*SQRT(0.5)*(x(1:2)+dx(1:2)) !r=[0;1] !scale with radius (polynomial given for z in [0;3.2]!!) - xout(1:2)=xout(1:2)* ((((((( 5.650243547593181E-03)*x(3) -6.234872576213188E-02)*x(3) +2.717131733412690E-01)*x(3) & + xout(1:2)=xout(1:2)* ((((((( 5.650243547593181E-03)*x(3) -6.234872576213188E-02)*x(3) +2.717131733412690E-01)*x(3) & -5.898455159792279E-01)*x(3) +6.077001327643441E-01)*x(3) -3.529284589734004E-02)*x(3) & +5.008061090611048E-01) xout(3)=x(3) @@ -715,19 +717,19 @@ SUBROUTINE PostDeformFunc(nTotal,X_in,X_out) x_out(1,:) = x_in(1,:)+ 0.1*COS(1.5*Pi*x_in(1,:))*COS(1.5*Pi*x_in(2,:))*COS(1.5*Pi*x_in(3,:)) x_out(2,:) = x_in(2,:)+ 0.1*COS(1.5*Pi*x_in(1,:))*COS(1.5*Pi*x_in(2,:))*COS(1.5*Pi*x_in(3,:)) x_out(3,:) = x_in(3,:)+ 0.1*COS(1.5*Pi*x_in(1,:))*COS(1.5*Pi*x_in(2,:))*COS(1.5*Pi*x_in(3,:)) -CASE(40) ! cos with coupling [-1;1]^3 (from https://arxiv.org/pdf/1809.01178.pdf, page 20) +CASE(40) ! cos with coupling [-1;1]^3 (from https://arxiv.org/pdf/1809.01178.pdf, page 20) x_out(2,:) = x_in(2,:)+ 0.15*COS(1.5*Pi*x_in( 1,:))*COS(0.5*Pi*x_in( 2,:))*COS(0.5*Pi*x_in(3,:)) x_out(1,:) = x_in(1,:)+ 0.15*COS(0.5*Pi*x_in( 1,:))*SIN(2.0*Pi*x_out(2,:))*COS(0.5*Pi*x_in(3,:)) x_out(3,:) = x_in(3,:)+ 0.15*COS(0.5*Pi*x_out(1,:))*COS( Pi*x_out(2,:))*COS(0.5*Pi*x_in(3,:)) -CASE(41) ! cos in xy with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) +CASE(41) ! cos in xy with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) x_out(1,:) = x_in(1,:)+ 0.15*COS(0.5*Pi*x_in( 1,:))*COS(1.5*Pi*x_in( 2,:)) x_out(2,:) = x_in(2,:)+ 0.15*COS(2.0*Pi*x_out(1,:))*COS(0.5*Pi*x_in( 2,:)) x_out(3,:) = x_in(3,:) -CASE(42) ! cos in xz with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) +CASE(42) ! cos in xz with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) x_out(1,:) = x_in(1,:)+ 0.15*COS(0.5*Pi*x_in( 1,:))*COS(1.5*Pi*x_in( 3,:)) x_out(2,:) = x_in(2,:) x_out(3,:) = x_in(3,:)+ 0.15*COS(2.0*Pi*x_out(1,:))*COS(0.5*Pi*x_in( 3,:)) -CASE(43) ! cos in yz with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) +CASE(43) ! cos in yz with coupling [-1;1]^2 (from https://arxiv.org/pdf/1809.01178.pdf, page 18) x_out(1,:) = x_in(1,:) x_out(2,:) = x_in(2,:)+ 0.15*COS(0.5*Pi*x_in( 2,:))*COS(1.5*Pi*x_in( 3,:)) x_out(3,:) = x_in(3,:)+ 0.15*COS(2.0*Pi*x_out(2,:))*COS(0.5*Pi*x_in( 3,:)) @@ -794,9 +796,12 @@ FUNCTION PHILL_H(X_in) ! Between x=54. and middle of domain ELSEIF(xloc.GT.54.) THEN PHILL_H = 0. +ELSE + PHILL_H = 0. END IF PHILL_H = PHILL_H/scale_factor ! Scale back to computational domain + END FUNCTION PHILL_H !=================================================================================================================================== @@ -867,7 +872,7 @@ FUNCTION PHILL_NORMAL(X_in) ! This is the vector along the normal PHILL_NORMAL = (/ 1.,-1./hDeriv /) PHILL_NORMAL = PHILL_NORMAL/NORM2(PHILL_NORMAL) -END IF +END IF END FUNCTION PHILL_NORMAL END MODULE MOD_Mesh_PostDeform diff --git a/src/mesh/mesh_tools.f90 b/src/mesh/mesh_tools.f90 index dcb6d66..8747131 100644 --- a/src/mesh/mesh_tools.f90 +++ b/src/mesh/mesh_tools.f90 @@ -42,6 +42,10 @@ MODULE MOD_Mesh_Tools MODULE PROCEDURE NetVisu END INTERFACE +INTERFACE FEMnetVisu + MODULE PROCEDURE FEMnetVisu +END INTERFACE + INTERFACE BCVisu MODULE PROCEDURE BCVisu END INTERFACE @@ -62,7 +66,7 @@ MODULE MOD_Mesh_Tools MODULE PROCEDURE CheckMortarWaterTight END INTERFACE -PUBLIC::CountSplines,NetVisu,BCVisu +PUBLIC::CountSplines,NetVisu,BCVisu,FEMnetVisu PUBLIC::chkspl_surf,chkspl_vol PUBLIC::SetTempMarker PUBLIC::CheckMortarWaterTight @@ -220,6 +224,125 @@ SUBROUTINE NetVisu() END SUBROUTINE netVisu +SUBROUTINE FEMNetVisu() + !=================================================================================================================================== + ! Debug visualization of the grid with the unique Face ID, unique FEM Edge ID and unique Vertex ID. + ! Visulaize faceID separately + !=================================================================================================================================== + ! MODULES + USE MOD_Globals + USE MOD_Mesh_Vars,ONLY:tElem,tSide,tNode,tLocalEdge,tVertex + USE MOD_Mesh_Vars,ONLY:FirstElem,CGNSElemEdgeToNode + USE MOD_Output ,ONLY:Visualize + ! IMPLICIT VARIABLE HANDLING + IMPLICIT NONE + !----------------------------------------------------------------------------------------------------------------------------------- + ! INPUT VARIABLES + !----------------------------------------------------------------------------------------------------------------------------------- + ! OUTPUT VARIABLES + !----------------------------------------------------------------------------------------------------------------------------------- + ! LOCAL VARIABLES + TYPE(tElem),POINTER :: Elem + TYPE(tSide),POINTER :: Side + TYPE(tLocalEdge),POINTER :: lEdge + TYPE(tNode),POINTER :: aNode,bNode + TYPE(tVertex),POINTER :: avert,bVert + INTEGER :: nVal,iNode,nElems,nSidesElem,nSides,nEdges,iSide,iElemSide,iEdge,iLocEdge ! ? + INTEGER :: NodeMap(1:4,3:4) ! ? + CHARACTER(LEN=255) :: FileString ! ? + CHARACTER(LEN=255) :: VarNames(5) ! ? + REAL,ALLOCATABLE :: Coord(:,:,:),Solution(:,:,:) ! ? + INTEGER :: nSides_from_nNodes(4:8)=(/4,5,5,-1, 6/) + !=================================================================================================================================== + WRITE(UNIT_stdOut,'(132("~"))') + WRITE(UNIT_stdOut,'(A)')'WRITING THE DEBUGMESH FOR FEM CONNECTIVITY...' + CALL Timer(.TRUE.) + ! Count elements and nodes and DoF + nElems = 0 + nSides=0 + nEdges=0 + Elem=>firstElem + DO WHILE(ASSOCIATED(elem)) + nElems=nElems+1 + nSidesElem=nSides_from_nNodes(Elem%nNodes) + nSides=nSides+nSidesElem + nEdges=nEdges+Elem%nEdges + elem=>elem%nextElem + END DO + WRITE(UNIT_stdOut,*)' #Elements ',nElems, '#Sides',nSides,'#Edges',nEdges + filestring=TRIM(ProjectName)//'_'//'Debugmesh_Faces' + nVal=2 + VarNames(1)='elemind' + VarNames(2)='UniqueFaceID' + + NodeMap=0 + !mapping from Side nNodes to i,j [0;1] + NodeMap(:,3)=(/1,2,3,3/) !tri + NodeMap(:,4)=(/1,2,4,3/) !quad + + ALLOCATE(Coord(3,1:4,nSides)) + ALLOCATE(Solution(nVal,1:4,nSides)) + + iSide=0 + Elem=>firstElem + DO WHILE(ASSOCIATED(elem)) + + nSidesElem=nSides_from_nNodes(Elem%nNodes) + Side=>Elem%firstSide + DO iElemSide=1,nSidesElem + iSide=iSide+1 + DO iNode=1,4 + Coord(:,iNode,iSide)=(Side%Node(NodeMap(iNode,Side%nNodes))%np%x) + END DO + Solution(1,:,iSide)=Elem%ind + Solution(2,:,iSide)=Side%ind + Side=>Side%nextElemSide + END DO !nSides + Elem=>elem%nextElem + END DO + CALL Visualize(2,nVal,1,nSides,VarNames(1:nVal),Coord,Solution,FileString) + + DEALLOCATE(Coord,Solution) + + filestring=TRIM(ProjectName)//'_'//'Debugmesh_Edges' + nVal=5 + ALLOCATE(Coord(3,1:2,nEdges)) + ALLOCATE(Solution(nVal,1:2,nEdges)) + VarNames(1)='elemind' + VarNames(2)='FEMedgeID' + VarNames(3)='FEMVertexID' + VarNames(4)='EdgeIsMaster' + VarNames(5)='VertexIsMaster' + + + iEdge=0 + Elem=>firstElem + DO WHILE(ASSOCIATED(elem)) + DO iLocEdge=1,Elem%nEdges + lEdge=>Elem%localEdge(iLocEdge)%LEDP + aVert=>Elem%Vertex(CGNSElemEdgeToNode(Elem%nNodes,iLocEdge,1))%vp + bVert=>Elem%Vertex(CGNSElemEdgeToNode(Elem%nNodes,iLocEdge,2))%vp + aNode=>Elem%Node(CGNSElemEdgeToNode(Elem%nNodes,iLocEdge,1))%np + bNode=>Elem%Node(CGNSElemEdgeToNode(Elem%nNodes,iLocEdge,2))%np + iEdge=iEdge+1 + Coord(:,1,iEdge)=aNode%x + Coord(:,2,iEdge)=bNode%x + Solution(1,:,iEdge)=Elem%ind + Solution(2,:,iEdge)=lEdge%ind + Solution(3,1,iEdge)=aVert%ind + Solution(3,2,iEdge)=bVert%ind + Solution(4,:,iEdge)=MERGE(1,-1, (lEdge%tmp.GT.0) ) + Solution(5,1,iEdge)=MERGE(1,-1, (aVert%tmp.GT.0) ) + Solution(5,2,iEdge)=MERGE(1,-1, (bVert%tmp.GT.0) ) + END DO !iLocEdge + Elem=>elem%nextElem + END DO + CALL Visualize(1,nVal,1,nEdges,VarNames(1:nVal),Coord,Solution,FileString) + + DEALLOCATE(Coord,Solution) + CALL Timer(.FALSE.) + +END SUBROUTINE FEMnetVisu SUBROUTINE BCVisu() !=================================================================================================================================== @@ -415,8 +538,7 @@ SUBROUTINE chkSpl_Surf() IF(ASSOCIATED(Side%curvedNode(iNode)%np))THEN xNode(iNode,:)=Side%curvedNode(iNode)%np%x ELSE - CALL abort(__STAMP__, & - 'Curved node array has not the right size.',999,999.) ! check required due to intel compiler error (02) + CALL abort(__STAMP__,'Curved node array has not the right size.',999,999.) ! check required due to intel compiler error (02) END IF END DO SELECT CASE(Side%nNodes) @@ -553,8 +675,7 @@ SUBROUTINE chkSpl_Vol() IF(ASSOCIATED(Elem%curvedNode(iNode)%np))THEN xNode(iNode,:)=Elem%curvedNode(iNode)%np%x ELSE - CALL abort(__STAMP__, & - 'Curved node array has not the right size.',999,999.) ! check required due to intel compiler error (02) + CALL abort(__STAMP__,'Curved node array has not the right size.',999,999.) ! check required due to intel compiler error (02) END IF END DO x = MATMUL(Vdm_Visu_Hexa,xNode(1:nNodes,:)) @@ -875,8 +996,7 @@ SUBROUTINE checkMortarWatertight() IF(waterTight.GT.0) THEN WRITE(UNIT_stdOut,*)' ERROR: ', waterTight,' Mortar sides of ',nMortars, & ' are not watertight, MaxError= ',MaxNsurfErr - CALL abort(__STAMP__, & - 'ERROR: mortars not watertight !!!',waterTight,maxNsurfErr) + CALL abort(__STAMP__,'ERROR: mortars not watertight !!!',waterTight,maxNsurfErr) ELSE WRITE(UNIT_stdOut,*)' ==> all mortars are watertight ;)' END IF diff --git a/src/mesh/mesh_vars.f90 b/src/mesh/mesh_vars.f90 index 0500e93..29ff2ec 100644 --- a/src/mesh/mesh_vars.f90 +++ b/src/mesh/mesh_vars.f90 @@ -9,11 +9,12 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx -! Copyright (C) 2017 Florian Hindenlang +! Copyright (C) 2017-2023 Florian Hindenlang +! Copyright (C) 2023 Tobias Ott ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,7 +32,7 @@ MODULE MOD_Mesh_Vars IMPLICIT NONE PUBLIC !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! User Defined Types --------------------------------------------------------------------------------------------------------------- @@ -48,25 +49,37 @@ MODULE MOD_Mesh_Vars TYPE(tEdge),POINTER :: EDP ! edge pointer END TYPE tEdgePtr + +TYPE tLocalEdgePtr + TYPE(tLocalEdge),POINTER :: LEDP ! local edge pointer +END TYPE tLocalEdgePtr + TYPE tNodePtr TYPE(tNode),POINTER :: NP ! node pointer END TYPE tNodePtr +TYPE tVertexPtr + TYPE(tVertex),POINTER :: VP ! vertex pointer +END TYPE tVertexPtr + ! Actual derived types ------------------------------------------------------------------------------------------------------------ TYPE tElem ! provides data structure for local element ! Derived data types -----------------------------------------------! TYPE(tSide), POINTER :: firstSide ! pointer to element's first side TYPE(tNodePtr),POINTER :: node(:) ! pointer to element's nodes used for restart and meshing - TYPE(tNodePtr),POINTER :: curvedNode(:) ! ? + TYPE(tNodePtr),POINTER :: curvedNode(:) ! ? + TYPE(tLocalEdgePtr),POINTER :: localEdge(:) ! allocated with number of edges in the element, CGNS ordering + TYPE(tVertexPtr),POINTER :: Vertex(:) ! allocated with number of vertices in the element, CGNS ordering TYPE(tElem),POINTER :: nextElem ! pointer to next element in order to continue a loop - TYPE(tElem),POINTER :: prevElem ! pointer to previous element in order to continue a loop + TYPE(tElem),POINTER :: prevElem ! pointer to previous element in order to continue a loop TYPE(tElem),POINTER :: tree ! pointer to tree if MortarMesh=1 REAL :: DetT ! element mapping depandant on the element type ! INTEGER ----------------------------------------------------------! - INTEGER :: TYPE ! element type, for memory efficiency (involved tolerance) + INTEGER :: TYPE ! element type, for memory efficiency (involved tolerance) ! ! triangle/quadrangle etc.. is set in findElemType INTEGER :: zone ! zone for zonal concept is given indirectly in the inifile INTEGER :: nNodes ! total number of nodes for one Elem + INTEGER :: nEdges ! total number of edges for one Elem INTEGER :: nCurvedNodes ! Used for writing curveds to hdf5 mesh format INTEGER :: ind ! unique Element index for each element on all processors INTEGER :: tmp @@ -78,17 +91,17 @@ MODULE MOD_Mesh_Vars ! Derived data types -----------------------------------------------! TYPE(tBC),POINTER :: BC ! pointer to boundary condition information TYPE(tNodePtr),POINTER :: node(:) ! node pointer - TYPE(tNodePtr),POINTER :: curvedNode(:) ! ? + TYPE(tNodePtr),POINTER :: curvedNode(:) ! ? TYPE(tNodePtr),POINTER :: orientednode(:) ! node pointer to oriented node used mainly in curved TYPE(tEdgePtr),POINTER :: Edge(:) ! Edge pointer - TYPE(tElem),POINTER :: elem ! Local element pointer + TYPE(tElem),POINTER :: elem ! Local element pointer TYPE(tSide),POINTER :: connection ! pointer to connected side TYPE(tSide),POINTER :: nextElemSide ! pointer to next element's side TYPE(tSidePtr),POINTER :: MortarSide(:) ! array of side pointers to slave mortar sides ! INTEGER ----------------------------------------------------------! INTEGER :: nNodes ! total number of nodes on that side INTEGER :: nCurvedNodes ! Used for writing curveds to hdf5 mesh format - INTEGER :: LocSide ! CGNS ordering of element sides + INTEGER :: LocSide ! CGNS ordering of element sides ! ! for blended sides INTEGER :: curveIndex ! IF curveIndex .NE. 0 we also have a numbered curved side INTEGER :: ind ! index for grouping together curved sides @@ -104,55 +117,66 @@ MODULE MOD_Mesh_Vars LOGICAL :: isCurved ! true if side is curved END TYPE tSide -TYPE tEdge ! provides data structure for local edge +TYPE tEdge ! provides data structure for global edges TYPE(tNodePtr) :: Node(2) ! pointer to node always 2 TYPE(tNodePtr),POINTER :: CurvedNode(:) ! pointer to interpolation nodes of curved sides - TYPE(tEdge),POINTER :: nextEdge ! only used to assign edges + TYPE(tEdge),POINTER :: nextEdge ! only used to assign edges TYPE(tEdgePtr),POINTER :: MortarEdge(:) ! array of edge pointers to slave mortar edges TYPE(tEdge),POINTER :: parentEdge ! parentEdge in case of non-conforming meshes + TYPE(tLocalEdge),POINTER :: FirstLocalEdge ! pointer to local edge of first connected element + INTEGER :: ind ! used for global edge index (geometrical) END TYPE tEdge + +TYPE tLocalEdge ! provides data structure for local element edges, needed for edge connectivity + TYPE(tEdge),POINTER :: Edge ! pointer back to geometrically unique edge + TYPE(tLocalEdge),POINTER :: next_connected ! pointer + TYPE(tElem),POINTER :: elem ! pointer to element connected to that edge + INTEGER :: localEdgeID !local edge id in connected element (CGNS standard) + LOGICAL :: orientation ! orientation from local to global edge (True: same, False: opposite) + INTEGER :: ind ! used for global FEMedge index (topological, so with periodic BCs) + INTEGER :: tmp ! used as counter for the list of edge connections +END TYPE tLocalEdge + TYPE tNode ! provides data structure for local node TYPE(tNormal),POINTER :: firstNormal ! pointer to first normal of node TYPE(tEdge),POINTER :: firstEdge ! pointer to first normal of node REAL :: x(3) ! node coordinates - INTEGER :: ind ! node counter + INTEGER :: ind ! used for global node index (geometrical) INTEGER :: tmp ! ? - INTEGER :: refCount ! In general nodes are used by more than + INTEGER :: refCount ! In general nodes are used by more than ! ! one side / element -> Node%refCount > 1 ! ! Node%refCount = 0 means that node is not used any more + TYPE(tVertex),POINTER :: FirstVertex ! pointer to the beginning of the vertex connection list END TYPE tNode + +TYPE tVertex ! provides data structure for local element "vertices", needed for vertex connectivity + TYPE(tNode),POINTER :: node ! pointer back to geometrically unique node + TYPE(tVertex),POINTER :: next_connected ! pointer to next connected vertex + TYPE(tElem),POINTER :: elem ! pointer to element connected to that vertex + INTEGER :: localVertexID ! local vertex id in connected element (CGNS standard) + INTEGER :: ind ! used for global FEMVertex index (topological, so with periodic BCs) + INTEGER :: tmp ! used as counter for the list of vertex connections +END TYPE tVertex + + TYPE tNormal REAL :: normal(3) ! Normals(nDim) normals vector of a node INTEGER,ALLOCATABLE :: FaceID(:) ! FaceID(maxFaceIDs) normal vector from CAD geometry - TYPE(tNormal),POINTER :: prevNormal ! Pointer to previous normal vector - TYPE(tNormal),POINTER :: nextNormal ! Pointer to next normal vector -END TYPE + TYPE(tNormal),POINTER :: prevNormal ! Pointer to previous normal vector + TYPE(tNormal),POINTER :: nextNormal ! Pointer to next normal vector +END TYPE TYPE tNormalPtr - TYPE(tNormal),POINTER :: np ! first Normal in list -END TYPE - -! Used for connect 3d -TYPE tsuperNode ! provides data structure for nodes that are shared by "aSide" and "bSide". - ! ! For each shared node a new SuperNode is created and put in a list of - ! ! SuperNodes that starts with "firstSuperNode". - TYPE(tNode),POINTER :: meshNode ! pointer to node - TYPE(tNode),POINTER :: periodicNode ! pointer to periodic node - TYPE(tsuperNode),POINTER :: nextSuperNode ! pointer to next SuperNode - REAL :: aCoeff(2) ! Position of node on edge of aSide - REAL :: bCoeff(2) ! Position of node on edge of bSide - INTEGER :: aEdge(2) ! Node number of first/last edge on aSide - INTEGER :: bEdge(2) ! Node number of first/last edge on bSide - LOGICAL :: periodic ! Default: not periodic but ste to .TRUE. - ! ! for periodic boundary sides -END TYPE tsuperNode + TYPE(tNormal),POINTER :: np ! first Normal in list +END TYPE + TYPE tBC ! container for boundary condition information INTEGER :: BCtype ! CGNS boundary types which are mapped by the code ! ! = Null - ! ! = BCExtrapolate Used as periodic which + ! ! = BCExtrapolate Used as periodic which ! ! doesent exist in CGNS (WHY??) ! ! = BCGeneral General means exactfunction here ! ! = BCWallViscousHeatFlux We have always adiabatic now @@ -180,16 +204,16 @@ MODULE MOD_Mesh_Vars CHARACTER(LEN=255) :: NormalVectFile ! file with normals if using CAD-normals CHARACTER(LEN=255) :: SplitElemFile ! file with subdivided surface mesh for curving CHARACTER(LEN=255) :: SpecElemFile ! curved nodes file for CGNS(ICEM) -LOGICAL :: ConformConnect ! If mesh is knwon to be conform, this switch enhances connect speed +LOGICAL :: ConformConnect ! If mesh is knwon to be conform, this switch enhances connect speed LOGICAL :: useBinary ! read in special binary GAMBIT files LOGICAL :: BugFix_ANSA_CGNS ! for ANSA unstructured CGNS Ansa Files, to set Boundary Condition ! PointList always to an ElementList, default is false LOGICAL :: MeshInitDone=.FALSE. -LOGICAL :: checkElemJacobians ! check if Jacobians are positiv over curved Elements,default=.TRUE.! -INTEGER :: NegativeJacobians=0 ! counter for elements with scaledJac0! +LOGICAL :: checkElemJacobians ! check if Jacobians are positiv over curved Elements,default=.TRUE.! +INTEGER :: NegativeJacobians=0 ! counter for elements with scaledJac0! REAL :: jacobianTolerance ! smallest value of jacobian permitted (e.g. 1.e-16) - +LOGICAL :: generateFEMconnectivity! Flag for generating and writing the element edge and vertex connectivity, needed for a FEM solver !----------------------------------------------------------------------------------------------------------------------------------- ! GEOMETRY !----------------------------------------------------------------------------------------------------------------------------------- @@ -199,16 +223,17 @@ MODULE MOD_Mesh_Vars LOGICAL :: preScale ! apply scaling after readin or before output LOGICAL :: postScale ! apply scaling after readin or before output REAL :: MeshScale ! scaling factor applied to Node Coordinates during read in -REAL :: SpaceQuandt ! Characteristic length in the mesh. Used as tolerance +REAL :: SpaceQuandt ! Characteristic length in the mesh. Used as tolerance REAL :: minDX ! smallest edge length REAL :: maxDX(3) ! Used for search mesh INTEGER :: nMeshElems =0 ! number of elements in the mesh -INTEGER :: nInnerSides =0 ! number of unique innner sides in the mesh -INTEGER :: nConformingSides=0 ! number of unique innner sides in the mesh +INTEGER :: nInnerSides =0 ! number of unique innner sides in the mesh +INTEGER :: nConformingSides=0 ! number of unique innner sides in the mesh INTEGER :: nBoundarySides=0 ! number of boundary sides in the mesh INTEGER :: NodeCount=0,SideCount=0,ElemCount=0 ! Counter for nodes,sides and elements. INTEGER :: nNodesElemSideMapping(8,6) ! mapping matrix for Elem side mappings following the CGNS standard INTEGER :: ElemSideMapping(8,6,4) ! mapping matrix for Elem side mappings following the CGNS standard +INTEGER :: CGNSElemEdgeToNode(4:8,12,2) ! mapping matrix for Elem Edges to element corners following the CGNS standard INTEGER :: TypeIndex(8) ! typeIndex mapping of index for different element types ! ! used for urElem administration INTEGER :: TypeIndex_surf(4) ! typeIndex_surf(nNodes) determines the typeIndex of the Surface(nNodes) @@ -228,20 +253,20 @@ MODULE MOD_Mesh_Vars INTEGER :: nTrees ! local number of trees INTEGER :: offsetTree ! tree offset LOGICAL :: doRebuildMortarGeometry ! for curved mortarmeshes ensure that small mortar geometry is identical -REAL,ALLOCATABLE :: M_0_1_T(:,:),M_0_2_T(:,:) +REAL,ALLOCATABLE :: M_0_1_T(:,:),M_0_2_T(:,:) ! to big mortar geometry !----------------------------------------------------------------------------------------------------------------------------------- ! CURVED !----------------------------------------------------------------------------------------------------------------------------------- -REAL :: minNormalAngle ! cos of min angle between normals, below which edges in geometry are no +REAL :: minNormalAngle ! cos of min angle between normals, below which edges in geometry are no ! longer resolved INTEGER :: curvingMethod ! parameter to be specified in ini file to choose the method to be used to ! generate curved meshes (set zero curved meshes, otherwise curved - ! boundaries will be regenerated + ! boundaries will be regenerated INTEGER :: normalsType ! source of normals vectors used for curving (1=reconstr, 2=CAD, 3=exact) -INTEGER,ALLOCATABLE :: ExactNormals(:) ! for 3D spline patches, an analytical normal can be used -INTEGER :: N ! polynomial degree of boundary element discretization +INTEGER,ALLOCATABLE :: ExactNormals(:) ! for 3D spline patches, an analytical normal can be used +INTEGER :: N ! polynomial degree of boundary element discretization INTEGER :: BoundaryOrder ! N+1 INTEGER :: NBlock ! for structured CGNS readin INTEGER :: nSkip ! for structured CGNS readin @@ -269,24 +294,24 @@ MODULE MOD_Mesh_Vars INTEGER :: CurvedMeshType,WhichMapping ! ? REAL :: R_0,R_INF,DY,PHI ! R_0...radius of cylinder, R_INF...radius of domain, DY...extension in - and + y dir ! PHI...angle of circle segment -INTEGER :: StretchType(3) ! Type of Strechting: 1 (default): dx(i)=dx(i-1)*fac, 2. DxMaxToDxMin-> fac 3. bell shaped +INTEGER :: StretchType(3) ! Type of Strechting: 1 (default): dx(i)=dx(i-1)*fac, 2. DxMaxToDxMin-> fac 3. bell shaped REAL :: fac(3),fac2(3) ! ? REAL :: DxMaxToDxMin(3) ! ? -REAL :: X0(3) ! MeshType=1: origin of the physical domain +REAL :: X0(3) ! MeshType=1: origin of the physical domain REAL :: DX(3) ! MeshType=1: dimensions of the physical domain -REAL :: XP(3,8) ! MeshType=2: 8 Corner Points +REAL :: XP(3,8) ! MeshType=2: 8 Corner Points !----------------------------------------------------------------------------------------------------------------------------------- ! BOUNDARY CONDITIONS !----------------------------------------------------------------------------------------------------------------------------------- -REAL,POINTER :: VV(:,:) ! vv(nDim,nVV) side connection vectors for periodic boundaries, the - ! BcalphaInd of one side is the positive vector index the other one is +REAL,POINTER :: VV(:,:) ! vv(nDim,nVV) side connection vectors for periodic boundaries, the + ! BcalphaInd of one side is the positive vector index the other one is ! the negative vector index (INPUT) INTEGER :: nVV=0 ! number of side connection vectors for periodic boundaries INTEGER :: nUserDefinedBoundaries=0 ! number of boundary conditions given in inifile -INTEGER,ALLOCATABLE :: BoundaryType(:,:) ! 4 integer code for each bound. cond. (BCType,CurveInd,BCState,BCalpha) +INTEGER,ALLOCATABLE :: BoundaryType(:,:) ! 4 integer code for each bound. cond. (BCType,CurveInd,BCState,BCalpha) CHARACTER(LEN=255),ALLOCATABLE :: BoundaryName(:) ! Name of boundary condition, size: nUserDefinedBoundaries !----------------------------------------------------------------------------------------------------------------------------------- -! 2.5D MESH +! 2.5D MESH !----------------------------------------------------------------------------------------------------------------------------------- REAL :: zLength ! 2.5D mesh: length in z-direction REAL :: dz ! MESH%zLength/MESH%nElemsZ @@ -298,24 +323,24 @@ MODULE MOD_Mesh_Vars INTEGER :: lowerZ_BC_Ind ! Boundary condition index for the z=0. boundary INTEGER :: upperZ_BC_Ind ! Boundary condition index for the z=MESH%zLength boundary !----------------------------------------------------------------------------------------------------------------------------------- -! zcorrection +! zcorrection !----------------------------------------------------------------------------------------------------------------------------------- -LOGICAL :: doZcorrection -REAL :: zstart -LOGICAL :: zPeriodic +LOGICAL :: doZcorrection +REAL :: zstart +LOGICAL :: zPeriodic INTEGER,ALLOCATABLE :: whichdirArr(:),orientArr(:) !----------------------------------------------------------------------------------------------------------------------------------- -! Splitting of Elements +! Splitting of Elements !----------------------------------------------------------------------------------------------------------------------------------- -LOGICAL :: AdaptedMesh=.FALSE. ! set to true if using splitToHex, nFineHexa -LOGICAL :: SplitToHex ! split all elements to hexas (works only for tetra,prism and hex) +LOGICAL :: AdaptedMesh=.FALSE. ! set to true if using splitToHex, nFineHexa +LOGICAL :: SplitToHex ! split all elements to hexas (works only for tetra,prism and hex) INTEGER :: nFineHexa ! split all hexa mesh. nFineHexa=2-> 8 Elems nFineHexa=3 -> 27 Elems... INTEGER :: nSplitBoxes REAL,ALLOCATABLE :: SplitBoxes(:,:,:) ! (1:3,1,i) xmin, (1:3,2,i) xmax, i split boxes !----------------------------------------------------------------------------------------------------------------------------------- -! exact surface projection +! exact surface projection !----------------------------------------------------------------------------------------------------------------------------------- -LOGICAL :: doExactSurfProjection +LOGICAL :: doExactSurfProjection INTEGER :: nExactSurfFuncs INTEGER,ALLOCATABLE :: ExactSurfFunc(:) !----------------------------------------------------------------------------------------------------------------------------------- @@ -323,18 +348,18 @@ MODULE MOD_Mesh_Vars !----------------------------------------------------------------------------------------------------------------------------------- ! Post deformation functions deform a domain (typically [-1,1]^3) to arbirary other domain !----------------------------------------------------------------------------------------------------------------------------------- -INTEGER :: MeshPostDeform ! Function index (off: 0) +INTEGER :: MeshPostDeform ! Function index (off: 0) INTEGER :: PostConnect ! only used when MeshPostDeform >0. =0: no reconnect after postdeform. ! =1, reconnect after postdeform, - ! =2, reconnect after postdeform& deleta periodic sides, + ! =2, reconnect after postdeform& deleta periodic sides, ! =3: reconnect and redefine vv =postvv REAL,POINTER :: PostVV(:,:) ! for postconnect=3, to overwrite vv vectors for periodic BCs before reconnect ! parameter for postdeform: LOGICAL :: PostDeform_useGL ! change from equidistant to GL points before postdeform (interp. more accurate) -REAL :: PostDeform_R0 -REAL :: PostDeform_Lz -REAL :: PostDeform_sq -REAL :: PostDeform_Rtorus +REAL :: PostDeform_R0 +REAL :: PostDeform_Lz +REAL :: PostDeform_sq +REAL :: PostDeform_Rtorus TYPE(tElemPtr),POINTER :: Elems(:) ! INTERFACES ----------------------------------------------------------------------------------------------------------------------- INTERFACE getNewElem @@ -349,10 +374,19 @@ MODULE MOD_Mesh_Vars MODULE PROCEDURE getNewEdge END INTERFACE +INTERFACE getNewLocalEdge + MODULE PROCEDURE getNewLocalEdge +END INTERFACE + INTERFACE getNewNode MODULE PROCEDURE getNewNode END INTERFACE + +INTERFACE getNewVertex + MODULE PROCEDURE getNewVertex +END INTERFACE + INTERFACE getNewQuad MODULE PROCEDURE getNewQuad END INTERFACE @@ -361,10 +395,6 @@ MODULE MOD_Mesh_Vars MODULE PROCEDURE getNewBC END INTERFACE -INTERFACE getNewSuperNode - MODULE PROCEDURE getNewSuperNode -END INTERFACE - INTERFACE copyBC MODULE PROCEDURE copyBC END INTERFACE @@ -397,10 +427,6 @@ MODULE MOD_Mesh_Vars MODULE PROCEDURE deleteBC END INTERFACE -INTERFACE deleteSuperNodes - MODULE PROCEDURE deleteSuperNodes -END INTERFACE - !=================================================================================================================================== CONTAINS @@ -418,13 +444,14 @@ SUBROUTINE getNewElem(Elem) ! OUTPUT VARIABLES TYPE(tElem),POINTER,INTENT(OUT) :: Elem ! New element !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== ALLOCATE(Elem) NULLIFY(Elem%Node,& Elem%prevElem,Elem%nextElem,Elem%firstSide) NULLIFY(Elem%CurvedNode) NULLIFY(Elem%tree) +NULLIFY(Elem%localEdge) Elem%nCurvedNodes = 0 Elem%ind = 0 Elem%detT = 0. @@ -447,7 +474,7 @@ SUBROUTINE getNewSide(Side,nNodes) ! OUTPUT VARIABLES TYPE(tSide),POINTER,INTENT(OUT) :: Side ! New side !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iNode ! ? !=================================================================================================================================== ALLOCATE(Side) @@ -492,7 +519,7 @@ SUBROUTINE getNewEdge(Edge,Node1,Node2) ! OUTPUT VARIABLES TYPE(tEdge),POINTER,INTENT(INOUT) :: Edge ! New edge !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== ALLOCATE(Edge) Edge%Node(1)%np=>Node1 @@ -501,9 +528,90 @@ SUBROUTINE getNewEdge(Edge,Node1,Node2) NULLIFY(Edge%curvedNode) NULLIFY(Edge%MortarEdge) NULLIFY(Edge%parentEdge) +NULLIFY(Edge%FirstLocalEdge) +Edge%ind=0 END SUBROUTINE getNewEdge +SUBROUTINE getNewLocalEdge(lEdge,localEdgeID_in,Elem_in,edge_in) + !=================================================================================================================================== + ! Create "Edge" with nodes "Node1" and "Node2" + !=================================================================================================================================== + ! MODULES + ! IMPLICIT VARIABLE HANDLING + IMPLICIT NONE + !----------------------------------------------------------------------------------------------------------------------------------- + ! INPUT VARIABLES + INTEGER,INTENT(IN),OPTIONAL :: localEdgeID_in + TYPE(tElem),POINTER,INTENT(IN),OPTIONAL :: Elem_in + TYPE(tEdge),POINTER,INTENT(IN),OPTIONAL :: edge_in + !----------------------------------------------------------------------------------------------------------------------------------- + ! OUTPUT VARIABLES + TYPE(tLocalEdge),POINTER,INTENT(INOUT) :: lEdge ! New edge + !----------------------------------------------------------------------------------------------------------------------------------- + ! LOCAL VARIABLES + !=================================================================================================================================== + ALLOCATE(lEdge) + lEdge%ind=0 + lEdge%tmp=0 + NULLIFY(lEdge%next_connected) + IF(PRESENT(localEdgeID_in))THEN + lEdge%localEdgeID=localEdgeID_in + ELSE + lEdge%localEdgeID=0 + END IF + IF(PRESENT(elem_in))THEN + lEdge%elem=>elem_in + ELSE + NULLIFY(lEdge%elem) + END IF + IF(PRESENT(edge_in))THEN + lEdge%edge=>edge_in + ELSE + NULLIFY(lEdge%edge) + END IF +END SUBROUTINE getNewLocalEdge + +SUBROUTINE getNewVertex(vert,localVertexID_in,Elem_in,node_in) + !=================================================================================================================================== + ! Create "Edge" with nodes "Node1" and "Node2" + !=================================================================================================================================== + ! MODULES + ! IMPLICIT VARIABLE HANDLING + IMPLICIT NONE + !----------------------------------------------------------------------------------------------------------------------------------- + ! INPUT VARIABLES + INTEGER,INTENT(IN),OPTIONAL :: localVertexID_in + TYPE(tElem),POINTER,INTENT(IN),OPTIONAL :: Elem_in + TYPE(tNode),POINTER,INTENT(IN),OPTIONAL :: node_in + !----------------------------------------------------------------------------------------------------------------------------------- + ! OUTPUT VARIABLES + TYPE(tVertex),POINTER,INTENT(INOUT) :: vert ! New edge + !----------------------------------------------------------------------------------------------------------------------------------- + ! LOCAL VARIABLES + !=================================================================================================================================== + ALLOCATE(vert) + vert%ind=0 + vert%tmp=0 + NULLIFY(vert%next_connected) + IF(PRESENT(localVertexID_in))THEN + vert%localVertexID=localVertexID_in + ELSE + vert%localVertexID=0 + END IF + IF(PRESENT(elem_in))THEN + vert%elem=>elem_in + ELSE + NULLIFY(vert%elem) + END IF + IF(PRESENT(node_in))THEN + vert%node=>node_in + ELSE + NULLIFY(vert%node) + END IF +END SUBROUTINE getNewVertex + + SUBROUTINE getNewNode(Node,refCount,ind) !=================================================================================================================================== ! Allocate and initialize new node "Node" @@ -519,7 +627,7 @@ SUBROUTINE getNewNode(Node,refCount,ind) ! OUTPUT VARIABLES TYPE(tNode),POINTER,INTENT(INOUT) :: Node ! New node !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== ALLOCATE(Node) Node%ind=0 @@ -532,6 +640,7 @@ SUBROUTINE getNewNode(Node,refCount,ind) NodeCount=NodeCount+1 NULLIFY(Node%firstNormal) NULLIFY(Node%firstEdge) +NULLIFY(Node%firstVertex) END SUBROUTINE getNewNode @@ -551,7 +660,7 @@ SUBROUTINE GetNewQuad(FirstElem_in,CornerNode) ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -TYPE(tElem),POINTER :: aElem +TYPE(tElem),POINTER :: aElem INTEGER :: i !=================================================================================================================================== CALL getNewElem(aElem) @@ -585,7 +694,7 @@ SUBROUTINE getNewBC(BC) ! OUTPUT VARIABLES TYPE(tBC),POINTER,INTENT(OUT) :: BC ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== ALLOCATE(BC) BC%BCType = 0 @@ -595,66 +704,6 @@ SUBROUTINE getNewBC(BC) END SUBROUTINE getNewBC -SUBROUTINE getNewSuperNode(superNode,meshNode,aNode,bNode,aSide_nNodes,bSide_nNodes,aCoeff,bCoeff) -!=================================================================================================================================== -! Allocate and initialize new SuperNode (used for connect 3d) -!=================================================================================================================================== -! MODULES -! IMPLICIT VARIABLE HANDLING -IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------------------- -! INPUT VARIABLES -TYPE(tNode),POINTER,INTENT(IN) :: meshNode ! "Real" mesh node -INTEGER,INTENT(IN) :: aNode ! Node number on aSide -INTEGER,INTENT(IN) :: bNode ! Node number on bSide -INTEGER,INTENT(IN) :: aSide_nNodes ! Number of nodes of aSide -INTEGER,INTENT(IN) :: bSide_nNodes ! Number of nodes of bSide -REAL,INTENT(IN) :: aCoeff ! Position of node on edge of aSide -REAL,INTENT(IN) :: bCoeff ! Position of node on edge of bSide -!----------------------------------------------------------------------------------------------------------------------------------- -! OUTPUT VARIABLES -TYPE(tsuperNode),POINTER,INTENT(OUT) :: superNode ! New SuperNode -!----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES -!=================================================================================================================================== -ALLOCATE(superNode) -! Set mesh node -superNode%meshNode=>meshNode -NULLIFY(superNode%nextSuperNode,superNode%periodicNode) -! Default: not periodic -superNode%periodic=.FALSE. -! aSide edge numbers -superNode%aEdge(1)=aNode ! First edge -superNode%aCoeff(1)=aCoeff ! Position on first edge -! Set second edge - side vertices only -IF((aNode.NE.0).AND.(aCoeff.EQ.0.))THEN - IF(aNode.EQ.1)THEN - superNode%aEdge(2)=aSide_nNodes - ELSE - superNode%aEdge(2)=aNode-1 - END IF - superNode%bCoeff(2)=1. -ELSE - superNode%aEdge(2)=0 - superNode%aCoeff(2)=0. -END IF -! bSide edge numbers -superNode%bEdge(1)=bNode ! First edge -superNode%bCoeff(1)=bCoeff ! Position on first edge -! Set second edge - side vertices only -IF((bNode.NE.0).AND.(bCoeff.EQ.0.))THEN - IF(bNode.EQ.1)THEN - superNode%bEdge(2)=bSide_nNodes - ELSE - superNode%bEdge(2)=bNode-1 - END IF - superNode%bCoeff(2)=1. -ELSE - superNode%bEdge(2)=0 - superNode%bCoeff(2)=0. -END IF -END SUBROUTINE getNewSuperNode - SUBROUTINE copyBC(BCSide,Side) !=================================================================================================================================== @@ -670,14 +719,14 @@ SUBROUTINE copyBC(BCSide,Side) ! OUTPUT VARIABLES TYPE(tSide),POINTER,INTENT(INOUT) :: Side ! ? !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== -CALL getNewBC(Side%BC) -Side%BC%BCType = BCSide%BC%BCType -Side%CurveIndex = BCSide%CurveIndex -Side%BC%BCstate = BCSide%BC%BCstate +CALL getNewBC(Side%BC) +Side%BC%BCType = BCSide%BC%BCType +Side%CurveIndex = BCSide%CurveIndex +Side%BC%BCstate = BCSide%BC%BCstate Side%BC%BCalphaInd = BCSide%BC%BCalphaInd -Side%BC%BCIndex = BCSide%BC%BCIndex +Side%BC%BCIndex = BCSide%BC%BCIndex END SUBROUTINE copyBC ! DELETE OBJECTS ------------------------------------------------------------------------------------------------------------------- @@ -695,7 +744,7 @@ SUBROUTINE DeleteElem(firstElem,Elem) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tElem),POINTER :: firstOut ! ? TYPE(tSide),POINTER :: Side ! ? INTEGER :: iNode ! ? @@ -723,7 +772,7 @@ END SUBROUTINE deleteElem SUBROUTINE DisconnectElem(firstElem,Elem) !=================================================================================================================================== -! Disconnects element "Elem" from mesh. +! Disconnects element "Elem" from mesh. !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -735,7 +784,7 @@ SUBROUTINE DisconnectElem(firstElem,Elem) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tElem),POINTER :: firstOut ! Local element pointer !=================================================================================================================================== firstOut=>firstElem ! Save first element @@ -768,7 +817,7 @@ RECURSIVE SUBROUTINE DeleteSide(firstSide,Side) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tSide),POINTER :: firstOut ! ? INTEGER :: iNode,iSide ! ? !=================================================================================================================================== @@ -820,7 +869,7 @@ SUBROUTINE DisconnectSide(firstSide,Side) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES TYPE(tSide),POINTER :: aSide ! ? !=================================================================================================================================== IF(.NOT. ASSOCIATED(Side)) RETURN @@ -853,7 +902,7 @@ SUBROUTINE deleteEdge(Edge) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES INTEGER :: iEdge !=================================================================================================================================== IF(ASSOCIATED(Edge%MortarEdge))THEN @@ -865,6 +914,7 @@ SUBROUTINE deleteEdge(Edge) END IF SDEALLOCATE(Edge%MortarEdge) SDEALLOCATE(Edge%parentEdge) +SDEALLOCATE(Edge%FirstLocalEdge) SDEALLOCATE(Edge) END SUBROUTINE deleteEdge @@ -882,12 +932,12 @@ SUBROUTINE deleteNode(Node) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== IF(.NOT. ASSOCIATED(Node)) RETURN Node%refCount=Node%refCount-1 ! In general nodes are used by more than one side / element -> Node%refCount > 1 IF(Node%refCount .LE. 0)THEN ! Node%refCount = 0 means that node is not used any more -! DEALLOCATE(Node) + ! DEALLOCATE(Node) NULLIFY(Node) NodeCount=NodeCount-1 END IF @@ -906,36 +956,10 @@ SUBROUTINE DeleteBC(BC) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES +! LOCAL VARIABLES !=================================================================================================================================== DEALLOCATE(BC) NULLIFY(BC) END SUBROUTINE deleteBC - -SUBROUTINE deleteSuperNodes(firstSuperNode) -!=================================================================================================================================== -! Deletes a list of SuperNodes -!=================================================================================================================================== -! MODULES -! IMPLICIT VARIABLE HANDLING -IMPLICIT NONE -!----------------------------------------------------------------------------------------------------------------------------------- -! INPUT VARIABLES -TYPE(tsuperNode),POINTER,INTENT(INOUT) :: firstSuperNode ! First super node in list -!----------------------------------------------------------------------------------------------------------------------------------- -! OUTPUT VARIABLES -!----------------------------------------------------------------------------------------------------------------------------------- -! LOCAL VARIABLES -TYPE(tsuperNode),POINTER :: superNode ! ? -!=================================================================================================================================== -superNode=>firstSuperNode -DO WHILE(ASSOCIATED(superNode)) - firstSuperNode=>superNode%nextSuperNode - NULLIFY(superNode%nextSuperNode,superNode%periodicNode,superNode%MeshNode) - DEALLOCATE(superNode) - superNode=>firstSuperNode -END DO -END SUBROUTINE deleteSuperNodes - END MODULE MOD_Mesh_Vars diff --git a/src/mesh/rbf.f90 b/src/mesh/rbf.f90 index fb4681d..1a04e54 100644 --- a/src/mesh/rbf.f90 +++ b/src/mesh/rbf.f90 @@ -72,7 +72,7 @@ SUBROUTINE RBFVolumeCurving(iRBFBox) REAL :: xCornerVol(1:3,8),xCornerSurf(1:3,4) REAL :: dist,x(3),xTmp(3),rbfvalue INTEGER :: iBP -REAL :: xMin,xMax,yMin,yMax,xBary(3) +REAL :: xMin,xMax,yMin,yMax !=================================================================================================================================== WRITE(UNIT_StdOut,'(132("-"))') @@ -571,6 +571,7 @@ FUNCTION EvaluateRBF(dist,supportRadius,RBFType) CASE(14) EvaluateRBF = EXP(-(xi**2.)) CASE DEFAULT + EvaluateRBF = 0. ! Silence compiler warning CALL Abort(__STAMP__,'RBF Type is unknown') END SELECT diff --git a/src/mesh/splittohex.f90 b/src/mesh/splittohex.f90 index 11a390e..0a3e870 100644 --- a/src/mesh/splittohex.f90 +++ b/src/mesh/splittohex.f90 @@ -76,8 +76,7 @@ SUBROUTINE SplitAllHexa(nFine) CALL Timer(.TRUE.) WRITE(UNIT_stdOut,'(132("~"))') WRITE(UNIT_stdOut,'(A,I8,A)')' SPLIT EACH HEXA INTO nFineHexa^3=' ,nFine**3,' HEXA ...' -IF(useCurveds) CALL abort(__STAMP__, & - 'SplitAllHex cannot be used with curved elements up to now!') +IF(useCurveds) CALL abort(__STAMP__,'SplitAllHex cannot be used with curved elements up to now!') !check first if all elements are hexa Elem=>firstElem !get maxInd of nodes @@ -131,8 +130,7 @@ SUBROUTINE SplitHexaByBoxes() CALL Timer(.TRUE.) WRITE(UNIT_stdOut,'(132("~"))') WRITE(UNIT_stdOut,'(A,I8,A)')' SPLIT HEXA BY SPLITBOXES ...' -IF(useCurveds) CALL abort(__STAMP__, & - 'SplitAllHex cannot be used with curved elements up to now!') +IF(useCurveds) CALL abort(__STAMP__,'SplitAllHex cannot be used with curved elements up to now!') !check first if all elements are hexa Elem=>firstElem !get maxInd of nodes @@ -198,8 +196,7 @@ SUBROUTINE SplitElementsToHex() WRITE(UNIT_stdOut,'(132("~"))') WRITE(UNIT_stdOut,'(A)')' SPLIT ELEMENTS...' maxInd=0 -IF(useCurveds) CALL abort(__STAMP__, & - 'SplitToHex cannot be used with curved elements up to now!') +IF(useCurveds) CALL abort(__STAMP__,'SplitToHex cannot be used with curved elements up to now!') Elem=>firstElem !get maxInd of nodes DO WHILE(ASSOCIATED(Elem)) @@ -216,8 +213,7 @@ SUBROUTINE SplitElementsToHex() counter(1)=counter(1)+1 CALL SplitTetraToHexa(Elem,maxInd) CASE(5) !Pyra - CALL abort(__STAMP__, & - 'pyramidal element found, cannot be splitted to hexa!') + CALL abort(__STAMP__,'pyramidal element found, cannot be splitted to hexa!') CASE(6) !linear bilinear prism counter(2)=counter(2)+1 CALL SplitPentaToHexa(Elem,2,maxInd) diff --git a/src/mesh/zcorrection.f90 b/src/mesh/zcorrection.f90 index 62d0d95..718b20f 100644 --- a/src/mesh/zcorrection.f90 +++ b/src/mesh/zcorrection.f90 @@ -87,7 +87,7 @@ SUBROUTINE OrientElemsToZ() END IF Side=>Elem%firstSide DO iSide=1,6 - IF(.NOT.ASSOCIATED(Side)) STOP 'Problem Side Pointer not associated' + IF(.NOT.ASSOCIATED(Side)) CALL abort(__STAMP__,'Problem Side Pointer not associated') IF(ASSOCIATED(Side%CurvedNode))THEN WRITE(UNIT_stdOut,*) & 'WARNING! Rotation only implemented for linear hexas and hexas only with volume curvednodes (no sides curved)!' @@ -147,7 +147,7 @@ SUBROUTINE OrientElemsToZ() END IF END DO IF(.NOT.found) THEN - STOP "Element with no axis aligned with z direction found, cannot perform z orientation!" + CALL abort(__STAMP__,'Element with no axis aligned with z direction found, cannot perform z orientation!') END IF switch=2 IF(scalprod.GT.0) switch=1 !else is set to 2 @@ -344,7 +344,7 @@ SUBROUTINE zcorrection(InitZOrient_In) END IF END DO IF(.NOT.found) THEN - STOP "Element with no axis aligned with z direction found, cannot perform z correction!" + CALL abort(__STAMP__,'Element with no axis aligned with z direction found, cannot perform z correction!') END IF whichdirArr(Elem%ind)=whichdir IF(scalprod.GT.0) orientArr(Elem%ind)=1 !else is set to 2 @@ -481,7 +481,7 @@ SUBROUTINE zcorrection(InitZOrient_In) Elem%tmp=0 firstLayer= .FALSE. IF(ASSOCIATED(Side%BC)) THEN - IF(zcounter .NE. nElemsZ) STOP "Specified nElemsZ not correct." + IF(zcounter .NE. nElemsZ) CALL abort(__STAMP__,'Specified nElemsZ not correct.') zplusSide=>Side IF(zPeriodic)THEN nPeriodicSides=nPeriodicSides+2 @@ -503,7 +503,7 @@ SUBROUTINE zcorrection(InitZOrient_In) fNode=iNode END IF END DO - IF(fNode.EQ.0)STOP 'Problem with zPeriodic' + IF(fNode.EQ.0) CALL abort(__STAMP__,'Problem with zPeriodic') dominant=.FALSE. IF(zminusSide%Elem%ind .LT. zplusSide%Elem%ind) dominant=.TRUE. IF(dominant) THEN diff --git a/src/output/output_cgns.f90 b/src/output/output_cgns.f90 index 56ca8c2..045107c 100644 --- a/src/output/output_cgns.f90 +++ b/src/output/output_cgns.f90 @@ -83,8 +83,7 @@ SUBROUTINE WriteDataToCGNS(dim1,nVal,NPlot,nElems,VarNames,Coord,Values,FileStri #endif /*defined PP_USE_CGNS*/ !=================================================================================================================================== #ifndef PP_USE_CGNS -CALL ABORT(__STAMP__, & - 'WriteDataToCGNS needs compilation with USE_CGNS flag!') +CALL ABORT(__STAMP__,'WriteDataToCGNS needs compilation with USE_CGNS flag!') #else WRITE(UNIT_stdOut,'(A)',ADVANCE='NO')" WRITE DATA TO CGNS FILE... "//TRIM(FileString) one=1 @@ -223,8 +222,7 @@ SUBROUTINE my_cg_error_exit(ErrorMessage,CGNSFile) WRITE(Unit_StdOut,'(A)') ErrorMessage WRITE(Unit_StdOut,'(A)') 'CGNS Error Output: ' WRITE(Unit_StdOut,'(A)') CGNSmessage -CALL abort(__STAMP__, & - 'CGNS error!') +CALL abort(__STAMP__,'CGNS error!') END SUBROUTINE my_cg_error_exit #endif /*defined PP_USE_CGNS*/ diff --git a/src/output/output_hdf5.f90 b/src/output/output_hdf5.f90 index 7662fec..b7138c1 100644 --- a/src/output/output_hdf5.f90 +++ b/src/output/output_hdf5.f90 @@ -9,7 +9,8 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx -! Copyright (C) 2017 Florian Hindenlang +! Copyright (C) 2017-2023 Florian Hindenlang +! Copyright (C) 2023 Tobias Ott ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -52,7 +53,7 @@ SUBROUTINE WriteMeshToHDF5(FileString) ! Subroutine to write Data to HDF5 format !=================================================================================================================================== ! MODULES -USE MOD_Mesh_Vars,ONLY:tElem,tSide +USE MOD_Mesh_Vars,ONLY:tElem,tSide,generateFEMconnectivity,tEdge,tLocalEdge,tNode,tVertex USE MOD_Mesh_Vars,ONLY:FirstElem USE MOD_Mesh_Vars,ONLY:N USE MOD_Output_Vars,ONLY:dosortIJK @@ -68,9 +69,13 @@ SUBROUTINE WriteMeshToHDF5(FileString) ! LOCAL VARIABLES TYPE(tElem),POINTER :: Elem ! ? TYPE(tSide),POINTER :: Side ! ? -INTEGER :: ElemID,SideID,NodeID ! ? +TYPE(tEdge),POINTER :: aEdge ! ? +TYPE(tLocalEdge),POINTER :: lEdge,nextLedge ! ? +TYPE(tnode),POINTER :: aNode ! ? +TYPE(tVertex),POINTER :: vert,next_vert ! ? +INTEGER :: ElemID,SideID,NodeID,EdgeID,FEMEdgeID,FEMVertexID ! ? INTEGER :: locnSides -INTEGER :: iNode,i,iMortar +INTEGER :: iNode,i,iMortar,iLocEdge,iLocVert LOGICAL :: found CHARACTER(LEN=26) :: ElemTypeName(1:11) !=================================================================================================================================== @@ -102,11 +107,18 @@ SUBROUTINE WriteMeshToHDF5(FileString) ! count Elements , unique sides and nodes are marked with ind=0 +nNodes=0 !number of all nodes nNodeIDs=0 !number of unique nodeIDs +nSides=0 !number of all sides nSideIDs=0 !number of unique side IDs (side and side%connection have the same sideID) nElems=0 !number of elements -nSides=0 !number of all sides -nNodes=0 !number of all nodes +nEdges=0 !number of all element local Edges +nEdgeIDs=0 +nFEMEdgeIDs=0 +nFEMEdgeConnections=0 +nVertices=0 +nFEMVertexIDs=0 +nFEMVertexConnections=0 Elem=>firstElem DO WHILE(ASSOCIATED(Elem)) @@ -158,12 +170,43 @@ SUBROUTINE WriteMeshToHDF5(FileString) nNodes = nNodes+Elem%nCurvedNodes END IF nSides = nSides+locnSides + IF(generateFEMconnectivity)THEN + nEdges=nEdges+Elem%nEdges + ! Count edges + DO iLocEdge=1,Elem%nEdges + lEdge=>Elem%localEdge(iLocEdge)%ledp + aEdge=>lEdge%edge + IF(aEdge%ind.NE.-777777) THEN + nEdgeIDs=nEdgeIDs+1 + aEdge%ind=-777777 + END IF + IF(aEdge%FirstLocalEdge%ind.NE.-99999) THEN + nFEMEdgeIDs=nFEMEdgeIDs+1 + aEdge%FirstLocalEdge%ind=-99999 + END IF + !!! COUNT connections here and save them to aEdge%FirstLocalEdge%tmp + IF(aEdge%FirstLocalEdge%tmp.LE.0) CALL abort(__STAMP__,'Something is wrong with edge multiplicity') + nFEMEdgeConnections=nFEMEdgeConnections+(aEdge%FirstLocalEdge%tmp-1) + END DO !iLocEdge + nVertices=nVertices+Elem%nNodes + ! Count Vertices + DO iLocVert=1,Elem%nNodes + vert=>Elem%Vertex(iLocVert)%vp + aNode=>vert%node + IF(aNode%FirstVertex%ind.NE.-5555) THEN + nFEMVertexIDs=nFEMVertexIDs+1 + aNode%FirstVertex%ind=-5555 + END IF + !!! COUNT connections here and save them to aEdge%FirstLocalEdge%tmp + IF(aNode%FirstVertex%tmp.LE.0) CALL abort(__STAMP__,'Something is wrong with vertex multiplicity') + nFEMVertexConnections=nFEMVertexConnections+(aNode%FirstVertex%tmp-1) + END DO !iLocVert + END IF !FEMCONNECT Elem=>Elem%nextElem END DO - !NOW CALLED IN FILLMESH!! -!! prepare sorting by space filling curve +!! prepare sorting by space filling curvedic.ini (Failed) !! NOTE: SpaceFillingcurve is not used, if existing hdf5 mesh is read in and the sorting should stay identical !IF(useSpaceFillingCurve)THEN ! CALL SpaceFillingCurve() @@ -176,6 +219,9 @@ SUBROUTINE WriteMeshToHDF5(FileString) ElemID=0 SideID=0 NodeID=0 +EdgeID=0 +FEMEdgeID=0 +FEMVertexID=0 Elem=>firstElem DO WHILE(ASSOCIATED(Elem)) ElemID=ElemID+1 @@ -219,16 +265,53 @@ SUBROUTINE WriteMeshToHDF5(FileString) END IF Side=>Side%nextElemSide END DO + IF(generateFEMconnectivity)THEN + ! set edge counters + DO iLocEdge=1,Elem%nEdges + lEdge=>Elem%localEdge(iLocEdge)%ledp + aEdge=>lEdge%Edge + IF(aEdge%ind.EQ.-777777)THEN + EdgeID=EdgeID+1 + aEdge%ind=EdgeID + END IF + IF(aEdge%FirstLocalEdge%ind.EQ.-99999)THEN + FEMEdgeID=FEMEdgeID+1 + aEdge%FirstLocalEdge%ind=FEMEdgeID + nextLedge=>aEdge%FirstLocalEdge%next_connected + DO WHILE(ASSOCIATED(nextlEdge)) + IF(nextLedge%tmp.NE.-1) CALL abort(__STAMP__,'Something wrong with nextLedge not being set') + nextLedge%ind=FEMEdgeID + nextLedge=>nextLedge%next_connected + END DO + END IF + END DO + ! set vertex counters (node counters already set) + DO iLocVert=1,Elem%nNodes + vert=>Elem%Vertex(iLocVert)%vp + aNode=>vert%node + IF(aNode%FirstVertex%ind.EQ.-5555) THEN + FEMVertexID=FEMVertexID+1 + aNode%FirstVertex%ind=FEMVertexID + next_vert=>aNode%FirstVertex%next_connected + DO WHILE(ASSOCIATED(next_vert)) + IF(next_vert%tmp.NE.-1) CALL abort(__STAMP__,'Something wrong with next_vert not being set') + next_vert%ind=FEMVertexID + next_vert=>next_vert%next_connected + END DO + END IF + END DO !iLocVert + END IF !FEMCONNECT Elem=>Elem%nextElem END DO !Elem -IF(NodeID.NE.nNodeIDs) CALL abort(__STAMP__,& - 'Sanity check: max(nodeID <> nNodeIDs!') -IF(SideID.NE.nSideIDs) CALL abort(__STAMP__,& - 'Sanity check: max(sideID <> nSideIDs!') -IF(ElemID.NE.nElems) CALL abort(__STAMP__,& - 'Sanity check: max(elemID <> nElems!') - +IF(NodeID.NE.nNodeIDs) CALL abort(__STAMP__,'Sanity check: max(nodeID <> nNodeIDs!') +IF(SideID.NE.nSideIDs) CALL abort(__STAMP__,'Sanity check: max(sideID <> nSideIDs!') +IF(ElemID.NE.nElems) CALL abort(__STAMP__,'Sanity check: max(elemID <> nElems!') +IF(generateFEMconnectivity)THEN + IF(EdgeID.NE.nEdgeIDs) CALL abort(__STAMP__,'Sanity check: max(edgeID <> nEdgeIDs!') + IF(FEMEdgeID.NE.nFEMEdgeIDs) CALL abort(__STAMP__,'Sanity check: max(femedgeID <> nFEMEdgeIDs!') + IF(FEMVertexID.NE.nFEMVertexIDs) CALL abort(__STAMP__,'Sanity check: max(femvertexID <> nFEMVertexIDs!') +END IF !FEMconnect !set Side Flip Elem=>firstElem @@ -256,10 +339,9 @@ SUBROUTINE WriteMeshToHDF5(FileString) EXIT END IF END DO - IF(.NOT.found) STOP 'Flip not found' + IF(.NOT.found) CALL abort(__STAMP__,'Flip not found') Side%flip=iNode - IF(.NOT.ASSOCIATED(Side%connection)) CALL ABORT(__STAMP__, & - 'Side connection should be associated for non-oreinted side') + IF(.NOT.ASSOCIATED(Side%connection)) CALL ABORT(__STAMP__,'Side connection should be associated for non-oreinted side') IF (Side%connection%MortarType.LE.0) Side%connection%flip=iNode !flip is the same for the connection END IF Side=>Side%nextElemSide @@ -272,7 +354,7 @@ SUBROUTINE WriteMeshToHDF5(FileString) ! Create the file CALL OpenHDF5File(FileString,create=.TRUE.) -!attributes +!attributes WRITE(UNIT=HoprVersionStr,FMT='(I0,A1,I0,A1,I0)') MajorVersion,".",MinorVersion,".",PatchVersion CALL WriteAttribute(File_ID,'HoprVersion',1,StrScalar=TRIM(HoprVersionStr)) CALL WriteAttribute(File_ID,'HoprVersionInt',1,IntScalar=HoprVersionInt) @@ -282,6 +364,16 @@ SUBROUTINE WriteMeshToHDF5(FileString) CALL WriteAttribute(File_ID,'nNodes',1,IntScalar=nNodes) CALL WriteAttribute(File_ID,'nUniqueSides',1,IntScalar=nSideIDs) CALL WriteAttribute(File_ID,'nUniqueNodes',1,IntScalar=nNodeIDs) +CALL WriteAttribute(File_ID,'FEMconnect',1,StrScalar=TRIM(MERGE("ON ","OFF",generateFEMconnectivity))) +IF(generateFEMconnectivity)THEN + CALL WriteAttribute(File_ID,'nEdges',1,IntScalar=nEdges) + CALL WriteAttribute(File_ID,'nUniqueEdges',1,IntScalar=nEdgeIDs) + CALL WriteAttribute(File_ID,'nFEMEdges',1,IntScalar=nFEMEdgeIDs) + CALL WriteAttribute(File_ID,'nFEMEdgeConnections',1,IntScalar=nFEMEdgeConnections) + CALL WriteAttribute(File_ID,'nVertices',1,IntScalar=nVertices) + CALL WriteAttribute(File_ID,'nFEMVertices',1,IntScalar=nFEMVertexIDs) + CALL WriteAttribute(File_ID,'nFEMVertexConnections',1,IntScalar=nFEMVertexConnections) +END IF !FEMCONNECT !WRITE ElemInfo,into (1,nElems) CALL WriteArrayToHDF5(File_ID,'ElemInfo',2,(/ElemInfoSize,nElems/),IntegerArray=ElemInfo) @@ -291,6 +383,25 @@ SUBROUTINE WriteMeshToHDF5(FileString) CALL WriteArrayToHDF5(File_ID,'SideInfo',2,(/SideInfoSize,nSides/),IntegerArray=SideInfo) DEALLOCATE(SideInfo) +IF(generateFEMconnectivity)THEN + CALL WriteArrayToHDF5(File_ID,'FEMElemInfo',2,(/FEMElemInfoSize,nElems/),IntegerArray=FEMElemInfo) + DEALLOCATE(FEMElemInfo) + + !WRITE EdgeInfo + CALL WriteArrayToHDF5(File_ID,'EdgeInfo',2,(/EdgeInfoSize,nEdges/),IntegerArray=EdgeInfo) + DEALLOCATE(EdgeInfo) + + CALL WriteArrayToHDF5(File_ID,'EdgeConnectInfo',2,(/EDGEConnectInfoSize,nFEMEdgeConnections/),IntegerArray=EdgeConnectInfo) + DEALLOCATE(EdgeConnectInfo) + + !WRITE EdgeInfo + CALL WriteArrayToHDF5(File_ID,'VertexInfo',2,(/VertexInfoSize,nVertices/),IntegerArray=VertexInfo) + DEALLOCATE(VertexInfo) + + CALL WriteArrayToHDF5(File_ID,'VertexConnectInfo',2,(/VertexConnectInfoSize,nFEMVertexConnections/),IntegerArray=VertexConnectInfo) + DEALLOCATE(VertexConnectInfo) +END IF !FEMCONNECT + ! WRITE NodeCoords and NodeIDs CALL WriteArrayToHDF5(File_ID,'NodeCoords',2,(/3,nNodes/),RealArray=NodeCoords) CALL WriteArrayToHDF5(File_ID,'GlobalNodeIDs',1,(/nNodes/),IntegerArray=GlobalNodeIDs) @@ -328,17 +439,17 @@ SUBROUTINE WriteMeshToHDF5(FileString) ' #elements .......... of type: ' WRITE(*,'(A40)') & ' ------------------------------------' -ElemTypeName(1:11)= (/' straight-edge Tetrahedra ', & - ' curved Tetrahedra ', & - ' planar-faced Prisms ', & - ' straight-edge Prisms ', & - ' curved Prisms ', & - ' planar-faced Pyramids ', & - ' straight-edge Pyramids ', & - ' curved Pyramids ', & - ' planar-faced Hexahedra ', & - ' straight-edge Hexahedra ', & - ' curved Hexahedra '/) +ElemTypeName(1:11)= (/' straight-edge Tetrahedra ', & !104 + ' curved Tetrahedra ', & !204 + ' planar-faced Pyramids ', & !105 + ' straight-edge Pyramids ', & !115 + ' curved Pyramids ', & !205 + ' planar-faced Prisms ', & !106 + ' straight-edge Prisms ', & !116 + ' curved Prisms ', & !206 + ' planar-faced Hexahedra ', & !108 + ' straight-edge Hexahedra ', & !118 + ' curved Hexahedra '/) !208 DO i=1,11 IF(ElemCounter(2,i).GT.0) & WRITE(*,'(A4,I9,A26)')' ',Elemcounter(2, i),ElemTypeName(i) @@ -365,7 +476,7 @@ SUBROUTINE getMeshInfo() ! Subroutine prepares ElemInfo,Sideinfo,Nodeinfo,NodeCoords arrays !=================================================================================================================================== ! MODULES -USE MOD_Mesh_Vars,ONLY:tElem,tSide +USE MOD_Mesh_Vars,ONLY:tElem,tSide,generateFEMconnectivity,tEdge,tlocalEdge,tNode,tVertex USE MOD_Mesh_Vars,ONLY:FirstElem USE MOD_Mesh_Vars,ONLY:N USE MOD_Mesh_Basis,ONLY:ISORIENTED @@ -377,9 +488,13 @@ SUBROUTINE getMeshInfo() !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES TYPE(tElem),POINTER :: Elem ! ? +TYPE(tEdge),POINTER :: aEdge ! ? +TYPE(tlocalEdge),POINTER :: lEdge,next_lEdge ! ? +TYPE(tNode),POINTER :: aNode ! ? +TYPE(tVertex),POINTER :: vert,next_vert ! ? TYPE(tSide),POINTER :: Side ! ? INTEGER :: locnNodes,locnSides -INTEGER :: iNode,iSide,iElem,i,iMortar +INTEGER :: iNode,iSide,iElem,i,iMortar,iEdge,jEdge,iLocEdge,iVert,jVert,iLocVert TYPE(tSide),POINTER :: aSide !=================================================================================================================================== !fill ElementInfo. @@ -480,9 +595,8 @@ SUBROUTINE getMeshInfo() END IF IF (Side%MortarType.GT.0) THEN ! Mortar master side (only implemented for Quad-sides!!!) - IF(ASSOCIATED(Side%Connection)) CALL abort(__STAMP__,& - 'Mortar master with connection is not allowed') - IF(Side%flip.NE.0) STOP 'Problem with flip on mortar' + IF(ASSOCIATED(Side%Connection)) CALL abort(__STAMP__,'Mortar master with connection is not allowed') + IF(Side%flip.NE.0) CALL abort(__STAMP__,'Problem with flip on mortar') SideInfo(SIDE_nbElemID,iSide)= -Side%MortarType SideInfo(SIDE_nbLocSide_flip,iSide)=0 DO iMortar=1,Side%nMortars @@ -517,9 +631,96 @@ SUBROUTINE getMeshInfo() Elem=>Elem%nextElem END DO -IF(iSide.NE.nSides) CALL abort(__STAMP__,& - 'Sanity check: nSides not equal to total number of sides!') +IF(iSide.NE.nSides) CALL abort(__STAMP__,'Sanity check: nSides not equal to total number of sides!') + +IF(generateFEMconnectivity)THEN + ALLOCATE(FEMElemInfo(FEMElemInfoSize,1:nElems)) + FEMElemInfo=0 + iElem=0 + iEdge=0 + iVert=0 + Elem=>firstElem + DO WHILE(ASSOCIATED(Elem)) + iElem=iElem+1 + + FEMElemInfo(FEMELEM_FirstEdgeInd,iElem)=iEdge + iEdge=iEdge+Elem%nEdges + FEMElemInfo(FEMELEM_lastEdgeInd,iElem)=iEdge + + FEMElemInfo(FEMELEM_FirstVertexInd,iElem)=iVert + iVert=iVert+Elem%nNodes + FEMElemInfo(FEMELEM_lastVertexInd,iElem)=iVert + Elem=>Elem%nextElem + END DO + + !fill Edge Info + ALLOCATE(EdgeInfo(EdgeInfoSize,1:nEdges)) + ALLOCATE(EdgeConnectInfo(EDGEConnectInfoSize,1:nFEMEdgeConnections)) + EdgeInfo=0 + EdgeConnectInfo=0 + iEdge=0 !counter in EdgeInfo + jEdge=0 !counter in EdgeConnectInfo + + Elem=>firstElem + DO WHILE(ASSOCIATED(Elem)) + DO iLocEdge=1,Elem%nEdges + lEdge=>Elem%localEdge(iLocEdge)%LEDP + aEdge=>lEdge%edge + iEdge=iEdge+1 + EdgeInfo(EDGE_FEMEdgeID,iEdge)=ledge%ind*(MERGE(1,-1,lEdge%orientation)) ! negative sign means opposite orientation of local to global edge + EdgeInfo(EDGE_offsetIndEdgeConnect,iEdge)=jEdge + !start the connection list from the firstLocalEdge + next_lEdge=>lEdge%edge%FirstlocalEdge + DO WHILE (ASSOCIATED(next_lEdge)) + IF(.NOT.((Elem%ind.EQ.next_lEdge%elem%ind).AND.(iLocEdge.EQ.next_lEdge%localEdgeID)))THEN !skip own edge "connection" (same element & same iLocEdge) + jEdge=jEdge+1 + EdgeConnectInfo(EDGEConnect_nbElemID,jEdge)=next_lEdge%elem%ind*(MERGE(1,-1, (next_lEdge%tmp.GT.0) )) ! + is master, - is slave + EdgeConnectInfo(EDGEConnect_nbLocEdgeID,jEdge)=next_lEdge%localEdgeID*(MERGE(1,-1,next_lEdge%orientation)) + END IF + next_lEdge=>next_lEdge%next_connected + END DO ! + EdgeInfo(EDGE_lastIndEdgeConnect,iEdge)=jEdge + IF((EdgeInfo(EDGE_lastIndEdgeConnect,iEdge)-EdgeInfo(EDGE_offsetIndEdgeConnect,iEdge)).NE. (aEdge%FirstLocalEdge%tmp-1)) THEN + CALL abort(__STAMP__,"wrong number of edge connections in firstEdge%tmp") + END IF + END DO !iLoc + Elem=>Elem%nextElem + END DO + + !fill Vertex Info + ALLOCATE(VertexInfo(VertexInfoSize,1:nVertices)) + ALLOCATE(VertexConnectInfo(VertexConnectInfoSize,1:nFEMVertexConnections)) + VertexInfo=0 + VertexConnectInfo=0 + iVert=0 !counter in VertexInfo + jVert=0 !counter in VertexConnectInfo + Elem=>firstElem + DO WHILE(ASSOCIATED(Elem)) + DO iLocVert=1,Elem%nNodes + vert=>Elem%Vertex(iLocVert)%vp + aNode=>vert%node + iVert=iVert+1 + VertexInfo(VERTEX_FEMVertexID,iVert)=vert%ind + VertexInfo(VERTEX_offsetIndVertexConnect,iVert)=jVert + !start the connection list from the firstVertex + next_vert=>vert%node%FirstVertex + DO WHILE (ASSOCIATED(next_vert)) + IF(.NOT.((Elem%ind.EQ.next_vert%elem%ind).AND.(iLocVert.EQ.next_vert%localVertexID)))THEN !skip own vertex "connection" (same element & same iLocVertex) + jVert=jVert+1 + VertexConnectInfo(VERTEXConnect_nbElemID,jVert)=next_vert%elem%ind*(MERGE(1,-1, (next_vert%tmp.GT.0) )) ! + is master, - is slave + VertexConnectInfo(VERTEXConnect_nbLocVertexID,jVert)=next_vert%localVertexID + END IF + next_vert=>next_vert%next_connected + END DO ! + VertexInfo(VERTEX_lastIndVertexConnect,iVert)=jVert + IF((VertexInfo(VERTEX_lastIndVertexConnect,iVert)-VertexInfo(VERTEX_offsetIndVertexConnect,iVert)).NE. (aNode%FirstVertex%tmp-1)) THEN + CALL abort(__STAMP__,"wrong number of vertex connections in firstvertex%tmp") + END IF + END DO !iLoc + Elem=>Elem%nextElem + END DO +END IF !FEMCONNECT !fill GlobalNodeID ALLOCATE(NodeCoords(3,nNodes),GlobalNodeIDs(nNodes)) iNode=0 @@ -545,8 +746,7 @@ SUBROUTINE getMeshInfo() END DO END IF -IF(iNode.NE.nNodes) CALL abort(__STAMP__,& - 'Sanity check: nNodes not equal to total number of nodes!') +IF(iNode.NE.nNodes) CALL abort(__STAMP__,'Sanity check: nNodes not equal to total number of nodes!') END SUBROUTINE getMeshinfo diff --git a/src/output/output_vtk.f90 b/src/output/output_vtk.f90 index 915dca5..8af69b9 100644 --- a/src/output/output_vtk.f90 +++ b/src/output/output_vtk.f90 @@ -9,7 +9,7 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx -! Copyright (C) 2017 Florian Hindenlang +! Copyright (C) 2017-2024 Florian Hindenlang ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -64,7 +64,7 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES -INTEGER,INTENT(IN) :: dim1 ! dimension of the data (either 2=quads or 3=hexas) +INTEGER,INTENT(IN) :: dim1 ! dimension of the data (either 1:lines,2=quads or 3=hexas) INTEGER,INTENT(IN) :: vecdim ! dimension of coordinates INTEGER,INTENT(IN) :: nVal ! Number of nodal output variables INTEGER,INTENT(IN) :: NPlot ! Number of output points .EQ. NAnalyze @@ -77,10 +77,14 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi ! OUTPUT VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES -INTEGER :: i,j,k,iVal,iElem,Offset,nBytes,nVTKElems,nVTKCells,ivtk=44 -INTEGER :: INT -INTEGER :: Vertex(2**dim1,(NPlot+1)**dim1*nElems) ! ? -INTEGER :: NPlot_p1_3,NPlot_p1_2,NPlot_p1,NodeID,NodeIDElem,ElemType ! ? +INTEGER,PARAMETER :: kindFloat=8 !set floating point accuracy single (4) double (8), should be equal or lower than input data! +REAL(KIND=kindFloat) :: FLOATdummy +CHARACTER(LEN=7) :: strfloat +INTEGER :: INTdummy +INTEGER :: sizefloat,sizeInt +INTEGER :: i,j,k,iVal,iElem,Offset,nBytes,nVTKPoints,nVTKCells,ivtk=44 +INTEGER :: Vertex(2**dim1,(NPlot)**dim1*nElems) ! ? +INTEGER :: NPlot_p1_3,NPlot_p1_2,NPlot_p1,CellID,PointID,ElemType ! ? CHARACTER(LEN=35) :: StrOffset,TempStr1,TempStr2 ! ? CHARACTER(LEN=300) :: Buffer CHARACTER(LEN=255) :: tmpVarName,tmpVarNameY,tmpVarNameZ @@ -88,16 +92,25 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi LOGICAL :: isVector,maybeVector CHARACTER(LEN=1) :: strvecdim CHARACTER(LEN=1) :: lf -REAL(KIND=4) :: Float !=================================================================================================================================== WRITE(UNIT_stdOut,'(A)',ADVANCE='NO')" WRITE DATA TO VTX XML BINARY (VTU) FILE... "//TRIM(FileString) NPlot_p1 =(Nplot+1) NPlot_p1_2=Nplot_p1*Nplot_p1 NPlot_p1_3=NPlot_p1_2*Nplot_p1 +IF(kindFloat.EQ.4) THEN + strfloat='Float32' +ELSEIF(kindFloat.EQ.8)THEN + strfloat='Float64' +ELSE + CALL abort(__STAMP__,'kindFloat not implemented in output vtk') +END IF +sizefloat=SIZEOF_F(FLOATdummy) +sizeInt =SIZEOF_F(INTdummy) + IF(vecdim.LT.dim1) THEN WRITE(*,*)'WARNING:dim1 should be > vecdim! dim1= ',dim1,' vecdim= ',vecdim - STOP + CALL abort(__STAMP__,'WARNING:dim1 should be > vecdim!') END IF ! Line feed character lf = char(10) @@ -109,10 +122,10 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi Buffer=''//lf;WRITE(ivtk) TRIM(Buffer) Buffer=''//lf;WRITE(ivtk) TRIM(Buffer) ! Specify file type -nVTKElems=NPlot_p1**dim1*nElems +nVTKPoints=NPlot_p1**dim1*nElems nVTKCells=NPlot**dim1*nElems Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) -WRITE(TempStr1,'(I16)')nVTKElems +WRITE(TempStr1,'(I16)')nVTKPoints WRITE(TempStr2,'(I16)')nVTKCells Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) @@ -152,16 +165,16 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi IF(isvector)THEN !variable is a vector! tmpVarName=tmpVarName(:StrLen-1) - Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) - Offset=Offset+SIZEOF_F(INT)+vecdim*nVTKElems*SIZEOF_F(FLOAT) + Offset=Offset+sizeInt+vecdim*nVTKPoints*sizefloat WRITE(StrOffset,'(I16)')Offset VecOffset(iValVec)=VecOffset(iValVec-1)+vecdim iVal=iVal+vecdim-1 !skip the Y (& Z) components ELSE - Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) - Offset=Offset+SIZEOF_F(INT)+nVTKElems*SIZEOF_F(FLOAT) + Offset=Offset+sizeInt+nVTKPoints*sizeFloat WRITE(StrOffset,'(I16)')Offset VecOffset(iValVec)=VecOffset(iValVec-1)+1 END IF !isvector @@ -173,9 +186,9 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) ! Specify coordinate data Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) -Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) -Offset=Offset+SIZEOF_F(INT)+vecdim*nVTKElems*SIZEOF_F(FLOAT) +Offset=Offset+sizeInt+vecdim*nVTKPoints*sizeFloat WRITE(StrOffset,'(I16)')Offset Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) ! Specify necessary cell data @@ -183,12 +196,12 @@ SUBROUTINE WriteDataToVTK(dim1,vecDim,nVal,NPlot,nElems,VarNames,Coord,Values,Fi ! Connectivity Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) -Offset=Offset+SIZEOF_F(INT)+2**dim1*nVTKElems*SIZEOF_F(INT) +Offset=Offset+sizeInt+2**dim1*nVTKCells*sizeInt WRITE(StrOffset,'(I16)')Offset -! Offsets +! Offset in connectivity data Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) -Offset=Offset+SIZEOF_F(INT)+nVTKElems*SIZEOF_F(INT) +Offset=Offset+sizeInt+nVTKCells*sizeInt WRITE(StrOffset,'(I16)')Offset ! Elem types Buffer=' '//lf;WRITE(ivtk) TRIM(Buffer) Buffer=''//lf;WRITE(ivtk) TRIM(Buffer) diff --git a/src/readin/isovaryingstring.f90 b/src/readin/isovaryingstring.f90 index 7a5a900..347cf20 100644 --- a/src/readin/isovaryingstring.f90 +++ b/src/readin/isovaryingstring.f90 @@ -1,3593 +1,2618 @@ -!============================================================================================================ xX ================= -! _____ _____ _______________ _______________ _______________ .xXXXXXXXx. X -! / /) / /) / _____ /) / _____ /) / _____ /) .XXXXXXXXXXXXXXx .XXXXx -! / // / // / /)___/ // / /)___/ // / /)___/ // .XXXXXXXXXXXXXXXXXXXXXXXXXx -! / //___/ // / // / // / //___/ // / //___/ // .XXXXXXXXXXXXXXXXXXXXXXX` -! / _____ // / // / // / __________// / __ __// .XX``XXXXXXXXXXXXXXXXX` -! / /)___/ // / // / // / /)_________) / /)_| |__) XX` `XXXXX` .X` -! / // / // / //___/ // / // / // | |_ XX XXX` .` -! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` -! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` -! xxX` XXx -! Copyright (C) 2017 Claus-Dieter Munz -! This file is part of HOPR, a software for the generation of high-order meshes. +module MOD_ISO_VARYING_STRING +! Modified version of Rich Townsend's iso_varying_string.f90, minimal +! modifications have been made in order to make the internal string +! storage compatible with a null-terminated C string; the original API +! has not changed, it has been completed with a constructor from a +! pointer to a C null-terminated string and a function returning a C +! const char* pointer to an existing varying string. The iso_c_binding +! intrinsic module is now required. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +! Copyright 2003 Rich Townsend +! Copyright 2011 Davide Cesari ! -! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -! of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +! This file is part of FortranGIS. ! -! You should have received a copy of the GNU General Public License along with HOPR. If not, see . -!================================================================================================================================= -MODULE ISO_VARYING_STRING - -! Written by J.L.Schonfelder -! Incorporating suggestions by C.Tanasescu, C.Weber, J.Wagener and W.Walter, -! and corrections due to L.Moss, M.Cohen, P.Griffiths, B.T.Smith -! and many other members of the committee ISO/IEC JTC1/SC22/WG5 - -! Version produced (??-Jul-94) - -!-----------------------------------------------------------------------------! -! This module defines the interface and one possible implementation for a ! -! dynamic length character string facility in Fortran 90. The Fortran 90 ! -! language is defined by the standard ISO/IEC 1539 : 1991. ! -! The publicly accessible interface defined by this module is conformant ! -! with the auxilliary standard, ISO/IEC 1539-2 : 1994. ! -! The detailed implementation may be considered as an informal definition of ! -! the required semantics, and may also be used as a guide to the production ! -! of a portable implementation. ! -! N.B. Although every care has been taken to produce valid Fortran code in ! -! construction of this module no guarantee is given or implied that this ! -! code will work correctly without error on any specific processor, nor ! -! is this implementation intended to be in any way optimal either in use ! -! of storage or CPU cycles. ! -!-----------------------------------------------------------------------------! - -PRIVATE - -!-----------------------------------------------------------------------------! -! By default all entities declared or defined in this module are private to ! -! the module. Only those entities declared explicitly as being public are ! -! accessible to programs using the module. In particular, the procedures and ! -! operators defined herein are made accessible via their generic identifiers ! -! only; their specific names are private. ! -!-----------------------------------------------------------------------------! - -TYPE VARYING_STRING - PRIVATE - CHARACTER,DIMENSION(:),POINTER :: chars -ENDTYPE VARYING_STRING - -!-----------------------------------------------------------------------------! -! The representation chosen for this definition of the module is of a string ! -! type consisting of a single component that is a pointer to a rank one array ! -! of characters. ! -! Note: this Module is defined only for characters of default kind. A similar ! -! module could be defined for non-default characters if these are supported ! -! on a processor by adding a KIND parameter to the component in the type ! -! definition, and to all delarations of objects of CHARACTER type. ! -!-----------------------------------------------------------------------------! - -CHARACTER,PARAMETER :: blank = " " - -!----- GENERIC PROCEDURE INTERFACE DEFINITIONS -------------------------------! - -!----- LEN interface ---------------------------------------------------------! -INTERFACE LEN - MODULE PROCEDURE len_s ! length of string -ENDINTERFACE - -!----- Conversion procedure interfaces ---------------------------------------! -INTERFACE VAR_STR - MODULE PROCEDURE c_to_s ! character to string -ENDINTERFACE - -INTERFACE CHAR - MODULE PROCEDURE s_to_c, & ! string to character - s_to_fix_c ! string to specified length character -ENDINTERFACE - -!----- ASSIGNMENT interfaces -------------------------------------------------! -INTERFACE ASSIGNMENT(=) - MODULE PROCEDURE s_ass_s, & ! string = string - c_ass_s, & ! character = string - s_ass_c ! string = character -ENDINTERFACE - -!----- Concatenation operator interfaces -------------------------------------! -INTERFACE OPERATOR(//) - MODULE PROCEDURE s_concat_s, & ! string//string - s_concat_c, & ! string//character - c_concat_s ! character//string -ENDINTERFACE - -!----- Repeated Concatenation interface --------------------------------------! -INTERFACE REPEAT - MODULE PROCEDURE repeat_s -ENDINTERFACE - -!------ Equality comparison operator interfaces-------------------------------! -INTERFACE OPERATOR(==) - MODULE PROCEDURE s_eq_s, & ! string==string - s_eq_c, & ! string==character - c_eq_s ! character==string -ENDINTERFACE - -!----- not-equality comparison operator interfaces ---------------------------! -INTERFACE OPERATOR(/=) - MODULE PROCEDURE s_ne_s, & ! string/=string - s_ne_c, & ! string/=character - c_ne_s ! character/=string -ENDINTERFACE - -!----- less-than comparison operator interfaces ------------------------------! -INTERFACE OPERATOR(<) - MODULE PROCEDURE s_lt_s, & ! string=) - MODULE PROCEDURE s_ge_s, & ! string>=string - s_ge_c, & ! string>=character - c_ge_s ! character>=string -ENDINTERFACE - -!----- greater-than comparison operator interfaces ---------------------------! -INTERFACE OPERATOR(>) - MODULE PROCEDURE s_gt_s, & ! string>string - s_gt_c, & ! string>character - c_gt_s ! character>string -ENDINTERFACE - -!----- LLT procedure interfaces ----------------------------------------------! -INTERFACE LLT - MODULE PROCEDURE s_llt_s, & ! LLT(string,string) - s_llt_c, & ! LLT(string,character) - c_llt_s ! LLT(character,string) -ENDINTERFACE - -!----- LLE procedure interfaces ----------------------------------------------! -INTERFACE LLE - MODULE PROCEDURE s_lle_s, & ! LLE(string,string) - s_lle_c, & ! LLE(string,character) - c_lle_s ! LLE(character,string) -ENDINTERFACE - -!----- LGE procedure interfaces ----------------------------------------------! -INTERFACE LGE - MODULE PROCEDURE s_lge_s, & ! LGE(string,string) - s_lge_c, & ! LGE(string,character) - c_lge_s ! LGE(character,string) -ENDINTERFACE - -!----- LGT procedure interfaces ----------------------------------------------! -INTERFACE LGT - MODULE PROCEDURE s_lgt_s, & ! LGT(string,string) - s_lgt_c, & ! LGT(string,character) - c_lgt_s ! LGT(character,string) -ENDINTERFACE - -!----- Input procedure interfaces --------------------------------------------! -INTERFACE GET - MODULE PROCEDURE get_d_eor, & ! default unit, EoR termination - get_u_eor, & ! specified unit, EoR termination - get_d_tset_s, & ! default unit, string set termination - get_u_tset_s, & ! specified unit, string set termination - get_d_tset_c, & ! default unit, char set termination - get_u_tset_c ! specified unit, char set termination -ENDINTERFACE - -!----- Output procedure interfaces -------------------------------------------! -INTERFACE PUT - MODULE PROCEDURE put_d_s, & ! string to default unit - put_u_s, & ! string to specified unit - put_d_c, & ! char to default unit - put_u_c ! char to specified unit -ENDINTERFACE - -INTERFACE PUT_LINE - MODULE PROCEDURE putline_d_s, & ! string to default unit - putline_u_s, & ! string to specified unit - putline_d_c, & ! char to default unit - putline_u_c ! char to specified unit -ENDINTERFACE - -!----- Insert procedure interfaces -------------------------------------------! -INTERFACE INSERT - MODULE PROCEDURE insert_ss, & ! string in string - insert_sc, & ! char in string - insert_cs, & ! string in char - insert_cc ! char in char -ENDINTERFACE - -!----- Replace procedure interfaces ------------------------------------------! -INTERFACE REPLACE - MODULE PROCEDURE replace_ss, & ! string by string, at specified - replace_sc, & ! string by char , starting - replace_cs, & ! char by string , point - replace_cc, & ! char by char - replace_ss_sf,& ! string by string, between - replace_sc_sf,& ! string by char , specified - replace_cs_sf,& ! char by string , starting and - replace_cc_sf,& ! char by char , finishing points - replace_sss, & ! in string replace string by string - replace_ssc, & ! in string replace string by char - replace_scs, & ! in string replace char by string - replace_scc, & ! in string replace char by char - replace_css, & ! in char replace string by string - replace_csc, & ! in char replace string by char - replace_ccs, & ! in char replace char by string - replace_ccc ! in char replace char by char -ENDINTERFACE - -!----- Remove procedure interface --------------------------------------------! -INTERFACE REMOVE - MODULE PROCEDURE remove_s, & ! characters from string, between start - remove_c ! characters from char , and finish -ENDINTERFACE - -!----- Extract procedure interface -------------------------------------------! -INTERFACE EXTRACT - MODULE PROCEDURE extract_s, & ! from string extract string, between start - extract_c ! from char extract string, and finish -ENDINTERFACE - -!----- Split procedure interface ---------------------------------------------! -INTERFACE SPLIT - MODULE PROCEDURE split_s, & ! split string at first occurance of - split_c ! character in set -ENDINTERFACE - -!----- Index procedure interfaces --------------------------------------------! -INTERFACE INDEX - MODULE PROCEDURE index_ss, index_sc, index_cs -ENDINTERFACE - -!----- Scan procedure interfaces ---------------------------------------------! -INTERFACE SCAN - MODULE PROCEDURE scan_ss, scan_sc, scan_cs -ENDINTERFACE - -!----- Verify procedure interfaces -------------------------------------------! -INTERFACE VERIFY - MODULE PROCEDURE verify_ss, verify_sc, verify_cs -ENDINTERFACE - -!----- Interfaces for remaining intrinsic function overloads -----------------! -INTERFACE LEN_TRIM - MODULE PROCEDURE len_trim_s -ENDINTERFACE - -INTERFACE TRIM - MODULE PROCEDURE trim_s -ENDINTERFACE - -INTERFACE IACHAR - MODULE PROCEDURE iachar_s -ENDINTERFACE - -INTERFACE ICHAR - MODULE PROCEDURE ichar_s -ENDINTERFACE - -INTERFACE ADJUSTL - MODULE PROCEDURE adjustl_s -ENDINTERFACE - -INTERFACE ADJUSTR - MODULE PROCEDURE adjustr_s -ENDINTERFACE - -!----- specification of publically accessible entities -----------------------! -PUBLIC :: VARYING_STRING,VAR_STR,CHAR,LEN,GET,PUT,PUT_LINE,INSERT,REPLACE, & - SPLIT,REMOVE,REPEAT,EXTRACT,INDEX,SCAN,VERIFY,LLT,LLE,LGE,LGT, & - ASSIGNMENT(=),OPERATOR(//),OPERATOR(==),OPERATOR(/=),OPERATOR(<), & - OPERATOR(<=),OPERATOR(>=),OPERATOR(>),LEN_TRIM,TRIM,IACHAR,ICHAR, & - ADJUSTL,ADJUSTR - -CONTAINS - -!----- LEN Procedure ---------------------------------------------------------! - FUNCTION len_s(string) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER :: len_s - ! returns the length of the string argument or zero if there is no current - ! string value - IF(.NOT.ASSOCIATED(string%chars))THEN - len_s = 0 - ELSE - len_s = SIZE(string%chars) - ENDIF - ENDFUNCTION len_s - -!----- Conversion Procedures ------------------------------------------------! - FUNCTION c_to_s(chr) - type(VARYING_STRING) :: c_to_s - CHARACTER(LEN=*),INTENT(IN) :: chr - ! returns the string consisting of the characters char - INTEGER :: lc,i - lc=LEN(chr) - ALLOCATE(c_to_s%chars(1:lc)) - DO i=1,lc - c_to_s%chars(i) = chr(i:i) - ENDDO - ENDFUNCTION c_to_s - - FUNCTION s_to_c(string) - type(VARYING_STRING),INTENT(IN) :: string - CHARACTER(LEN=SIZE(string%chars)) :: s_to_c - ! returns the characters of string as an automatically sized character - INTEGER :: lc,i - lc=SIZE(string%chars) - DO i=1,lc - s_to_c(i:i) = string%chars(i) - ENDDO - ENDFUNCTION s_to_c - - FUNCTION s_to_fix_c(string,length) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: length - CHARACTER(LEN=length) :: s_to_fix_c - ! returns the character of fixed length, length, containing the characters - ! of string either padded with blanks or truncated on the right to fit - INTEGER :: lc,i - lc=MIN(SIZE(string%chars),length) - DO i=1,lc - s_to_fix_c(i:i) = string%chars(i) - ENDDO - IF(lc < length)THEN ! result longer than string padding needed - s_to_fix_c(lc+1:length) = blank - ENDIF - ENDFUNCTION s_to_fix_c - -!----- ASSIGNMENT Procedures -------------------------------------------------! - SUBROUTINE s_ass_s(var,expr) - type(VARYING_STRING),INTENT(OUT) :: var - type(VARYING_STRING),INTENT(IN) :: expr - ! assign a string value to a string variable overriding default assignement - ! reallocates string variable to size of string value and copies characters - ALLOCATE(var%chars(1:LEN(expr))) - var%chars = expr%chars - ENDSUBROUTINE s_ass_s - - SUBROUTINE c_ass_s(var,expr) - CHARACTER(LEN=*),INTENT(OUT) :: var - type(VARYING_STRING),INTENT(IN) :: expr - ! assign a string value to a character variable - ! if the string is longer than the character truncate the string on the right - ! if the string is shorter the character is blank padded on the right - INTEGER :: lc,ls,i - lc = LEN(var); ls = MIN(LEN(expr),lc) - DO i = 1,ls - var(i:i) = expr%chars(i) - ENDDO - DO i = ls+1,lc - var(i:i) = blank - ENDDO - ENDSUBROUTINE c_ass_s - - SUBROUTINE s_ass_c(var,expr) - type(VARYING_STRING),INTENT(OUT) :: var - CHARACTER(LEN=*),INTENT(IN) :: expr - ! assign a character value to a string variable - ! disassociates the string variable from its current value, allocates new - ! space to hold the characters and copies them from the character value - ! into this space. - INTEGER :: lc,i - lc = LEN(expr) - ALLOCATE(var%chars(1:lc)) - DO i = 1,lc - var%chars(i) = expr(i:i) - ENDDO - ENDSUBROUTINE s_ass_c - -!----- Concatenation operator procedures ------------------------------------! - FUNCTION s_concat_s(string_a,string_b) ! string//string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - type(VARYING_STRING) :: s_concat_s - INTEGER :: la,lb - la = LEN(string_a); lb = LEN(string_b) - ALLOCATE(s_concat_s%chars(1:la+lb)) - s_concat_s%chars(1:la) = string_a%chars - s_concat_s%chars(1+la:la+lb) = string_b%chars - ENDFUNCTION s_concat_s - - FUNCTION s_concat_c(string_a,string_b) ! string//character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - type(VARYING_STRING) :: s_concat_c - INTEGER :: la,lb,i - la = LEN(string_a); lb = LEN(string_b) - ALLOCATE(s_concat_c%chars(1:la+lb)) - s_concat_c%chars(1:la) = string_a%chars - DO i = 1,lb - s_concat_c%chars(la+i) = string_b(i:i) - ENDDO - ENDFUNCTION s_concat_c - - FUNCTION c_concat_s(string_a,string_b) ! character//string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - type(VARYING_STRING) :: c_concat_s - INTEGER :: la,lb,i - la = LEN(string_a); lb = LEN(string_b) - ALLOCATE(c_concat_s%chars(1:la+lb)) - DO i = 1,la - c_concat_s%chars(i) = string_a(i:i) - ENDDO - c_concat_s%chars(1+la:la+lb) = string_b%chars - ENDFUNCTION c_concat_s - -!----- Reapeated concatenation procedures -----------------------------------! -FUNCTION repeat_s(string,ncopies) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: ncopies - type(VARYING_STRING) :: repeat_s - ! Returns a string produced by the concatenation of ncopies of the - ! argument string - INTEGER :: lr,ls,i - IF (ncopies < 0) THEN - WRITE(*,*) " Negative ncopies requested in REPEAT" - STOP - ENDIF - ls = LEN(string); lr = ls*ncopies - ALLOCATE(repeat_s%chars(1:lr)) - DO i = 1,ncopies - repeat_s%chars(1+(i-1)*ls:i*ls) = string%chars - ENDDO -ENDFUNCTION repeat_s - -!------ Equality comparison operators ----------------------------------------! - FUNCTION s_eq_s(string_a,string_b) ! string==string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_eq_s - INTEGER :: la,lb - la = LEN(string_a); lb = LEN(string_b) - IF (la > lb) THEN - s_eq_s = ALL(string_a%chars(1:lb) == string_b%chars) .AND. & - ALL(string_a%chars(lb+1:la) == blank) - ELSEIF (la < lb) THEN - s_eq_s = ALL(string_a%chars == string_b%chars(1:la)) .AND. & - ALL(blank == string_b%chars(la+1:lb)) - ELSE - s_eq_s = ALL(string_a%chars == string_b%chars) - ENDIF - ENDFUNCTION s_eq_s - - FUNCTION s_eq_c(string_a,string_b) ! string==character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_eq_c - INTEGER :: la,lb,ls,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) /= string_b(i:i) )THEN - s_eq_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la > lb .AND. ANY( string_a%chars(lb+1:la) /= blank ) )THEN - s_eq_c = .FALSE.; RETURN - ELSEIF( la < lb .AND. blank /= string_b(la+1:lb) )THEN - s_eq_c = .FALSE.; RETURN - ENDIF - s_eq_c = .TRUE. - ENDFUNCTION s_eq_c - - FUNCTION c_eq_s(string_a,string_b) ! character==string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_eq_s - INTEGER :: la,lb,ls,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a(i:i) /= string_b%chars(i) )THEN - c_eq_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la > lb .AND. string_a(lb+1:la) /= blank )THEN - c_eq_s = .FALSE.; RETURN - ELSEIF( la < lb .AND. ANY( blank /= string_b%chars(la+1:lb) ) )THEN - c_eq_s = .FALSE.; RETURN - ENDIF - c_eq_s = .TRUE. - ENDFUNCTION c_eq_s - -!------ Non-equality operators -----------------------------------------------! - FUNCTION s_ne_s(string_a,string_b) ! string/=string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_ne_s - INTEGER :: la,lb - la = LEN(string_a); lb = LEN(string_b) - IF (la > lb) THEN - s_ne_s = ANY(string_a%chars(1:lb) /= string_b%chars) .OR. & - ANY(string_a%chars(lb+1:la) /= blank) - ELSEIF (la < lb) THEN - s_ne_s = ANY(string_a%chars /= string_b%chars(1:la)) .OR. & - ANY(blank /= string_b%chars(la+1:lb)) - ELSE - s_ne_s = ANY(string_a%chars /= string_b%chars) - ENDIF - ENDFUNCTION s_ne_s - - FUNCTION s_ne_c(string_a,string_b) ! string/=character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_ne_c - INTEGER :: la,lb,ls,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) /= string_b(i:i) )THEN - s_ne_c = .TRUE.; RETURN - ENDIF - ENDDO - IF( la > lb .AND. ANY( string_a%chars(lb+1:la) /= blank ) )THEN - s_ne_c = .TRUE.; RETURN - ELSEIF( la < lb .AND. blank /= string_b(la+1:lb) )THEN - s_ne_c = .TRUE.; RETURN - ENDIF - s_ne_c = .FALSE. - ENDFUNCTION s_ne_c - - FUNCTION c_ne_s(string_a,string_b) ! character/=string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_ne_s - INTEGER :: la,lb,ls,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a(i:i) /= string_b%chars(i) )THEN - c_ne_s = .TRUE.; RETURN - ENDIF - ENDDO - IF( la > lb .AND. string_a(lb+1:la) /= blank )THEN - c_ne_s = .TRUE.; RETURN - ELSEIF( la < lb .AND. ANY( blank /= string_b%chars(la+1:lb) ) )THEN - c_ne_s = .TRUE.; RETURN - ENDIF - c_ne_s = .FALSE. - ENDFUNCTION c_ne_s - -!------ Less-than operators --------------------------------------------------! - FUNCTION s_lt_s(string_a,string_b) ! string string_b%chars(i) )THEN - s_lt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank < string_b%chars(i) )THEN - s_lt_s = .TRUE.; RETURN - ELSEIF( blank > string_b%chars(i) )THEN - s_lt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) < blank )THEN - s_lt_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > blank )THEN - s_lt_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lt_s = .FALSE. - ENDFUNCTION s_lt_s - - FUNCTION s_lt_c(string_a,string_b) ! string string_b(i:i) )THEN - s_lt_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( blank < string_b(la+1:lb) )THEN - s_lt_c = .TRUE.; RETURN - ELSEIF( blank > string_b(la+1:lb) )THEN - s_lt_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) < blank )THEN - s_lt_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > blank )THEN - s_lt_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lt_c = .FALSE. - ENDFUNCTION s_lt_c - - FUNCTION c_lt_s(string_a,string_b) ! character string_b%chars(i) )THEN - c_lt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank < string_b%chars(i) )THEN - c_lt_s = .TRUE.; RETURN - ELSEIF( blank > string_b%chars(i) )THEN - c_lt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( string_a(lb+1:la) < blank )THEN - c_lt_s = .TRUE.; RETURN - ELSEIF( string_a(lb+1:la) > blank )THEN - c_lt_s = .FALSE.; RETURN - ENDIF - ENDIF - c_lt_s = .FALSE. - ENDFUNCTION c_lt_s - -!------ Less-than-or-equal-to operators --------------------------------------! - FUNCTION s_le_s(string_a,string_b) ! string<=string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_le_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) < string_b%chars(i) )THEN - s_le_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > string_b%chars(i) )THEN - s_le_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank < string_b%chars(i) )THEN - s_le_s = .TRUE.; RETURN - ELSEIF( blank > string_b%chars(i) )THEN - s_le_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) < blank )THEN - s_le_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > blank )THEN - s_le_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_le_s = .TRUE. - ENDFUNCTION s_le_s - - FUNCTION s_le_c(string_a,string_b) ! string<=character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_le_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) < string_b(i:i) )THEN - s_le_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > string_b(i:i) )THEN - s_le_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( blank < string_b(la+1:lb) )THEN - s_le_c = .TRUE.; RETURN - ELSEIF( blank > string_b(la+1:lb) )THEN - s_le_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) < blank )THEN - s_le_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) > blank )THEN - s_le_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_le_c = .TRUE. - ENDFUNCTION s_le_c - - FUNCTION c_le_s(string_a,string_b) ! character<=string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_le_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a(i:i) < string_b%chars(i) )THEN - c_le_s = .TRUE.; RETURN - ELSEIF( string_a(i:i) > string_b%chars(i) )THEN - c_le_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank < string_b%chars(i) )THEN - c_le_s = .TRUE.; RETURN - ELSEIF( blank > string_b%chars(i) )THEN - c_le_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( string_a(lb+1:la) < blank )THEN - c_le_s = .TRUE.; RETURN - ELSEIF( string_a(lb+1:la) > blank )THEN - c_le_s = .FALSE.; RETURN - ENDIF - ENDIF - c_le_s = .TRUE. - ENDFUNCTION c_le_s - -!------ Greater-than-or-equal-to operators -----------------------------------! - FUNCTION s_ge_s(string_a,string_b) ! string>=string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_ge_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) > string_b%chars(i) )THEN - s_ge_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < string_b%chars(i) )THEN - s_ge_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank > string_b%chars(i) )THEN - s_ge_s = .TRUE.; RETURN - ELSEIF( blank < string_b%chars(i) )THEN - s_ge_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) > blank )THEN - s_ge_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < blank )THEN - s_ge_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_ge_s = .TRUE. - ENDFUNCTION s_ge_s - - FUNCTION s_ge_c(string_a,string_b) ! string>=character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_ge_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) > string_b(i:i) )THEN - s_ge_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < string_b(i:i) )THEN - s_ge_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( blank > string_b(la+1:lb) )THEN - s_ge_c = .TRUE.; RETURN - ELSEIF( blank < string_b(la+1:lb) )THEN - s_ge_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) > blank )THEN - s_ge_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < blank )THEN - s_ge_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_ge_c = .TRUE. - ENDFUNCTION s_ge_c - - FUNCTION c_ge_s(string_a,string_b) ! character>=string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_ge_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a(i:i) > string_b%chars(i) )THEN - c_ge_s = .TRUE.; RETURN - ELSEIF( string_a(i:i) < string_b%chars(i) )THEN - c_ge_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank > string_b%chars(i) )THEN - c_ge_s = .TRUE.; RETURN - ELSEIF( blank < string_b%chars(i) )THEN - c_ge_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( string_a(lb+1:la) > blank )THEN - c_ge_s = .TRUE.; RETURN - ELSEIF( string_a(lb+1:la) < blank )THEN - c_ge_s = .FALSE.; RETURN - ENDIF - ENDIF - c_ge_s = .TRUE. - ENDFUNCTION c_ge_s - -!------ Greater-than operators -----------------------------------------------! - FUNCTION s_gt_s(string_a,string_b) ! string>string - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_gt_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) > string_b%chars(i) )THEN - s_gt_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < string_b%chars(i) )THEN - s_gt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank > string_b%chars(i) )THEN - s_gt_s = .TRUE.; RETURN - ELSEIF( blank < string_b%chars(i) )THEN - s_gt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) > blank )THEN - s_gt_s = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < blank )THEN - s_gt_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_gt_s = .FALSE. - ENDFUNCTION s_gt_s - - FUNCTION s_gt_c(string_a,string_b) ! string>character - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_gt_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a%chars(i) > string_b(i:i) )THEN - s_gt_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < string_b(i:i) )THEN - s_gt_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( blank > string_b(la+1:lb) )THEN - s_gt_c = .TRUE.; RETURN - ELSEIF( blank < string_b(la+1:lb) )THEN - s_gt_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( string_a%chars(i) > blank )THEN - s_gt_c = .TRUE.; RETURN - ELSEIF( string_a%chars(i) < blank )THEN - s_gt_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_gt_c = .FALSE. - ENDFUNCTION s_gt_c - - FUNCTION c_gt_s(string_a,string_b) ! character>string - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_gt_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( string_a(i:i) > string_b%chars(i) )THEN - c_gt_s = .TRUE.; RETURN - ELSEIF( string_a(i:i) < string_b%chars(i) )THEN - c_gt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( blank > string_b%chars(i) )THEN - c_gt_s = .TRUE.; RETURN - ELSEIF( blank < string_b%chars(i) )THEN - c_gt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( string_a(lb+1:la) > blank )THEN - c_gt_s = .TRUE.; RETURN - ELSEIF( string_a(lb+1:la) < blank )THEN - c_gt_s = .FALSE.; RETURN - ENDIF - ENDIF - c_gt_s = .FALSE. - ENDFUNCTION c_gt_s - -!----- LLT procedures -------------------------------------------------------! -FUNCTION s_llt_s(string_a,string_b) ! string_a lb )THEN - DO i = lb+1,la - IF( LLT(string_a%chars(i),blank) )THEN - s_llt_s = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),blank) )THEN - s_llt_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_llt_s = .FALSE. -ENDFUNCTION s_llt_s - -FUNCTION s_llt_c(string_a,string_b) ! string_a lb )THEN - DO i = lb+1,la - IF( LLT(string_a%chars(i),blank) )THEN - s_llt_c = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),blank) )THEN - s_llt_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_llt_c = .FALSE. -ENDFUNCTION s_llt_c - -FUNCTION c_llt_s(string_a,string_b) ! string_a,string_b ISO-646 ordering - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_llt_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LLT(string_a(i:i),string_b%chars(i)) )THEN - c_llt_s = .TRUE.; RETURN - ELSEIF( LGT(string_a(i:i),string_b%chars(i)) )THEN - c_llt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LLT(blank,string_b%chars(i)) )THEN - c_llt_s = .TRUE.; RETURN - ELSEIF( LGT(blank,string_b%chars(i)) )THEN - c_llt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( LLT(string_a(lb+1:la),blank) )THEN - c_llt_s = .TRUE.; RETURN - ELSEIF( LGT(string_a(lb+1:la),blank) )THEN - c_llt_s = .FALSE.; RETURN - ENDIF - ENDIF - c_llt_s = .FALSE. -ENDFUNCTION c_llt_s - -!----- LLE procedures -------------------------------------------------------! -FUNCTION s_lle_s(string_a,string_b) ! string_a<=string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_lle_s - ! Returns TRUE if strings are equal or if string_a preceeds string_b in the - ! ISO 646 collating sequence. Otherwise the result is FALSE. - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LLT(string_a%chars(i),string_b%chars(i)) )THEN - s_lle_s = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),string_b%chars(i)) )THEN - s_lle_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LLT(blank,string_b%chars(i)) )THEN - s_lle_s = .TRUE.; RETURN - ELSEIF( LGT(blank,string_b%chars(i)) )THEN - s_lle_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LLT(string_a%chars(i),blank) )THEN - s_lle_s = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),blank) )THEN - s_lle_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lle_s = .TRUE. -ENDFUNCTION s_lle_s - -FUNCTION s_lle_c(string_a,string_b) ! strung_a<=string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_lle_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LLT(string_a%chars(i),string_b(i:i)) )THEN - s_lle_c = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),string_b(i:i)) )THEN - s_lle_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( LLT(blank,string_b(la+1:lb)) )THEN - s_lle_c = .TRUE.; RETURN - ELSEIF( LGT(blank,string_b(la+1:lb)) )THEN - s_lle_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LLT(string_a%chars(i),blank) )THEN - s_lle_c = .TRUE.; RETURN - ELSEIF( LGT(string_a%chars(i),blank) )THEN - s_lle_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lle_c = .TRUE. -ENDFUNCTION s_lle_c - -FUNCTION c_lle_s(string_a,string_b) ! string_a<=string_b ISO-646 ordering - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_lle_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LLT(string_a(i:i),string_b%chars(i)) )THEN - c_lle_s = .TRUE.; RETURN - ELSEIF( LGT(string_a(i:i),string_b%chars(i)) )THEN - c_lle_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LLT(blank,string_b%chars(i)) )THEN - c_lle_s = .TRUE.; RETURN - ELSEIF( LGT(blank,string_b%chars(i)) )THEN - c_lle_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( LLT(string_a(lb+1:la),blank) )THEN - c_lle_s = .TRUE.; RETURN - ELSEIF( LGT(string_a(lb+1:la),blank) )THEN - c_lle_s = .FALSE.; RETURN - ENDIF - ENDIF - c_lle_s = .TRUE. -ENDFUNCTION c_lle_s - -!----- LGE procedures -------------------------------------------------------! -FUNCTION s_lge_s(string_a,string_b) ! string_a>=string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_lge_s - ! Returns TRUE if strings are equal or if string_a follows string_b in the - ! ISO 646 collating sequence. Otherwise the result is FALSE. - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a%chars(i),string_b%chars(i)) )THEN - s_lge_s = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),string_b%chars(i)) )THEN - s_lge_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LGT(blank,string_b%chars(i)) )THEN - s_lge_s = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b%chars(i)) )THEN - s_lge_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LGT(string_a%chars(i),blank) )THEN - s_lge_s = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),blank) )THEN - s_lge_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lge_s = .TRUE. -ENDFUNCTION s_lge_s - -FUNCTION s_lge_c(string_a,string_b) ! string_a>=string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_lge_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a%chars(i),string_b(i:i)) )THEN - s_lge_c = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),string_b(i:i)) )THEN - s_lge_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( LGT(blank,string_b(la+1:lb)) )THEN - s_lge_c = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b(la+1:lb)) )THEN - s_lge_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LGT(string_a%chars(i),blank) )THEN - s_lge_c = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),blank) )THEN - s_lge_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lge_c = .TRUE. -ENDFUNCTION s_lge_c - -FUNCTION c_lge_s(string_a,string_b) ! string_a>=string_b ISO-646 ordering - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_lge_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a(i:i),string_b%chars(i)) )THEN - c_lge_s = .TRUE.; RETURN - ELSEIF( LLT(string_a(i:i),string_b%chars(i)) )THEN - c_lge_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LGT(blank,string_b%chars(i)) )THEN - c_lge_s = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b%chars(i)) )THEN - c_lge_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( LGT(string_a(lb+1:la),blank) )THEN - c_lge_s = .TRUE.; RETURN - ELSEIF( LLT(string_a(lb+1:la),blank) )THEN - c_lge_s = .FALSE.; RETURN - ENDIF - ENDIF - c_lge_s = .TRUE. -ENDFUNCTION c_lge_s - -!----- LGT procedures -------------------------------------------------------! -FUNCTION s_lgt_s(string_a,string_b) ! string_a>string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a,string_b - LOGICAL :: s_lgt_s - ! Returns TRUE if string_a follows string_b in the ISO 646 collating sequence. - ! Otherwise the result is FALSE. The result is FALSE if both string_a and - ! string_b are zero length. - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a%chars(i),string_b%chars(i)) )THEN - s_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),string_b%chars(i)) )THEN - s_lgt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LGT(blank,string_b%chars(i)) )THEN - s_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b%chars(i)) )THEN - s_lgt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LGT(string_a%chars(i),blank) )THEN - s_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),blank) )THEN - s_lgt_s = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lgt_s = .FALSE. -ENDFUNCTION s_lgt_s - -FUNCTION s_lgt_c(string_a,string_b) ! string_a>string_b ISO-646 ordering - type(VARYING_STRING),INTENT(IN) :: string_a - CHARACTER(LEN=*),INTENT(IN) :: string_b - LOGICAL :: s_lgt_c - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a%chars(i),string_b(i:i)) )THEN - s_lgt_c = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),string_b(i:i)) )THEN - s_lgt_c = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - IF( LGT(blank,string_b(la+1:lb)) )THEN - s_lgt_c = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b(la+1:lb)) )THEN - s_lgt_c = .FALSE.; RETURN - ENDIF - ELSEIF( la > lb )THEN - DO i = lb+1,la - IF( LGT(string_a%chars(i),blank) )THEN - s_lgt_c = .TRUE.; RETURN - ELSEIF( LLT(string_a%chars(i),blank) )THEN - s_lgt_c = .FALSE.; RETURN - ENDIF - ENDDO - ENDIF - s_lgt_c = .FALSE. -ENDFUNCTION s_lgt_c - -FUNCTION c_lgt_s(string_a,string_b) ! string_a>string_b ISO-646 ordering - CHARACTER(LEN=*),INTENT(IN) :: string_a - type(VARYING_STRING),INTENT(IN) :: string_b - LOGICAL :: c_lgt_s - INTEGER :: ls,la,lb,i - la = LEN(string_a); lb = LEN(string_b); ls = MIN(la,lb) - DO i = 1,ls - IF( LGT(string_a(i:i),string_b%chars(i)) )THEN - c_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(string_a(i:i),string_b%chars(i)) )THEN - c_lgt_s = .FALSE.; RETURN - ENDIF - ENDDO - IF( la < lb )THEN - DO i = la+1,lb - IF( LGT(blank,string_b%chars(i)) )THEN - c_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(blank,string_b%chars(i)) )THEN - c_lgt_s = .FALSE.; RETURN - ENDIF - ENDDO - ELSEIF( la > lb )THEN - IF( LGT(string_a(lb+1:la),blank) )THEN - c_lgt_s = .TRUE.; RETURN - ELSEIF( LLT(string_a(lb+1:la),blank) )THEN - c_lgt_s = .FALSE.; RETURN - ENDIF - ENDIF - c_lgt_s = .FALSE. -ENDFUNCTION c_lgt_s - - -!----- Input string procedure -----------------------------------------------! -SUBROUTINE get_d_eor(string,maxlen,iostat) - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the default unit - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from the default unit starting at next character in the file -! and terminating at the end of record or after maxlen characters. - CHARACTER(LEN=80) :: buffer - INTEGER :: ist,nch,toread,nb - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string = "" ! clears return string - DO ! repeatedly read buffer and add to string until EoR - ! or maxlen reached - IF(toread <= 0)EXIT - nb=MIN(80,toread) - READ(*,FMT='(A)',ADVANCE='NO',EOR=9999,SIZE=nch,IOSTAT=ist) buffer(1:nb) - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during READ_STRING of varying string on default unit" - STOP - ENDIF - ENDIF - string = string //buffer(1:nb) - toread = toread - nb - ENDDO - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 string = string //buffer(1:nch) - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_d_eor - -SUBROUTINE get_u_eor(unit,string,maxlen,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the input unit which must be - ! connected for sequential formatted read - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the unit - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from unit starting at next character in the file and -! terminating at the end of record or after maxlen characters. - CHARACTER(LEN=80) :: buffer - INTEGER :: ist,nch,toread,nb - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string="" ! clears return string - DO ! repeatedly read buffer and add to string until EoR - ! or maxlen reached - IF(toread <= 0)EXIT - nb=MIN(80,toread) - READ(unit,FMT='(A)',ADVANCE='NO',EOR=9999,SIZE=nch,IOSTAT=ist) buffer(1:nb) - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during READ_STRING of varying string on UNIT ",unit - STOP - ENDIF - ENDIF - string = string //buffer(1:nb) - toread = toread - nb - ENDDO - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 string = string //buffer(1:nch) - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_u_eor - -SUBROUTINE get_d_tset_s(string,set,separator,maxlen,iostat) - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the default unit - type(VARYING_STRING),INTENT(IN) :: set - ! the set of characters which if found in - ! the input terminate the read - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - ! the actual separator character from set - ! found as the input string terminator - ! returned as zero length if termination - ! by maxlen or EOR - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from the default unit starting at next character in the file and -! terminating at the end of record, occurance of a character in set, -! or after reading maxlen characters. - CHARACTER :: buffer ! characters must be read one at a time to detect - ! first terminator character in set - INTEGER :: ist,toread,lenset,j - lenset = LEN(set) - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string = "" ! clears return string - IF(PRESENT(separator)) separator="" ! clear the separator - readchar:DO ! repeatedly read buffer and add to string - IF(toread <= 0)EXIT readchar ! maxlen reached - READ(*,FMT='(A)',ADVANCE='NO',EOR=9999,IOSTAT=ist) buffer - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during GET of varying string on default unit" - STOP - ENDIF - ENDIF - ! check for occurance of set character in buffer - DO j = 1,lenset - IF(buffer == set%chars(j))THEN - IF(PRESENT(separator)) separator=buffer - EXIT readchar ! separator terminator found - ENDIF - ENDDO - string = string//buffer - toread = toread - 1 - ENDDO readchar - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 CONTINUE ! EOR terminator read - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_d_tset_s - -SUBROUTINE get_u_tset_s(unit,string,set,separator,maxlen,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the input unit which must be - ! connected for sequential formatted read - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the unit - type(VARYING_STRING),INTENT(IN) :: set - ! the set of characters which if found in - ! the input terminate the read - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - ! the actual separator character from set - ! found as the input string terminator - ! returned as zero length if termination - ! by maxlen or EOR - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from unit starting at next character in the file and -! terminating at the end of record, occurance of a character in set, -! or after reading maxlen characters. - CHARACTER :: buffer ! characters must be read one at a time to detect - ! first terminator character in set - INTEGER :: ist,toread,lenset,j - lenset = LEN(set) - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string = "" ! clears return string - IF(PRESENT(separator)) separator="" ! clear the separator - readchar:DO ! repeatedly read buffer and add to string - IF(toread <= 0)EXIT readchar ! maxlen reached - READ(unit,FMT='(A)',ADVANCE='NO',EOR=9999,IOSTAT=ist) buffer - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during GET of varying string on unit ",unit - STOP - ENDIF - ENDIF - ! check for occurance of set character in buffer - DO j = 1,lenset - IF(buffer == set%chars(j))THEN - IF(PRESENT(separator)) separator=buffer - EXIT readchar ! separator terminator found - ENDIF - ENDDO - string = string//buffer - toread = toread - 1 - ENDDO readchar - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 CONTINUE ! EOR terminator found - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_u_tset_s - -SUBROUTINE get_d_tset_c(string,set,separator,maxlen,iostat) - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the default unit - CHARACTER(LEN=*),INTENT(IN) :: set - ! the set of characters which if found in - ! the input terminate the read - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - ! the actual separator character from set - ! found as the input string terminator - ! returned as zero length if termination - ! by maxlen or EOR - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from the default unit starting at next character in the file and -! terminating at the end of record, occurance of a character in set, -! or after reading maxlen characters. - CHARACTER :: buffer ! characters must be read one at a time to detect - ! first terminator character in set - INTEGER :: ist,toread,lenset,j - lenset = LEN(set) - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string = "" ! clears return string - IF(PRESENT(separator)) separator="" ! clear separator - readchar:DO ! repeatedly read buffer and add to string - IF(toread <= 0)EXIT readchar ! maxlen reached - READ(*,FMT='(A)',ADVANCE='NO',EOR=9999,IOSTAT=ist) buffer - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during GET of varying string on default unit" - STOP - ENDIF - ENDIF - ! check for occurance of set character in buffer - DO j = 1,lenset - IF(buffer == set(j:j))THEN - IF(PRESENT(separator)) separator=buffer - EXIT readchar - ENDIF - ENDDO - string = string//buffer - toread = toread - 1 - ENDDO readchar - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 CONTINUE ! EOR terminator read - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_d_tset_c - -SUBROUTINE get_u_tset_c(unit,string,set,separator,maxlen,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the input unit which must be - ! connected for sequential formatted read - type(VARYING_STRING),INTENT(OUT) :: string - ! the string variable to be filled with - ! characters read from the - ! file connected to the unit - CHARACTER(LEN=*),INTENT(IN) :: set - ! the set of characters which if found in - ! the input terminate the read - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - ! the actual separator character from set - ! found as the input string terminator - ! returned as zero length if termination - ! by maxlen or EOR - INTEGER,INTENT(IN),OPTIONAL :: maxlen - ! if present indicates the maximum - ! number of characters that will be - ! read from the file - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! reads string from unit starting at next character in the file and -! terminating at the end of record, occurance of a character in set, -! or after reading maxlen characters. - CHARACTER :: buffer ! characters must be read one at a time to detect - ! first terminator character in set - INTEGER :: ist,toread,lenset,j - lenset = LEN(set) - IF(PRESENT(maxlen))THEN - toread=maxlen - ELSE - toread=HUGE(1) - ENDIF - string = "" ! clears return string - IF(PRESENT(separator)) separator="" ! clear separator - readchar:DO ! repeatedly read buffer and add to string - IF(toread <= 0)EXIT readchar ! maxlen reached - READ(unit,FMT='(A)',ADVANCE='NO',EOR=9999,IOSTAT=ist) buffer - IF( ist /= 0 )THEN - IF(PRESENT(iostat)) THEN - iostat=ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during GET of varying string on unit ",unit - STOP - ENDIF - ENDIF - ! check for occurance of set character in buffer - DO j = 1,lenset - IF(buffer == set(j:j))THEN - IF(PRESENT(separator)) separator=buffer - EXIT readchar ! separator terminator found - ENDIF - ENDDO - string = string//buffer - toread = toread - 1 - ENDDO readchar - IF(PRESENT(iostat)) iostat = 0 - RETURN - 9999 CONTINUE ! EOR terminator read - IF(PRESENT(iostat)) iostat = ist -ENDSUBROUTINE get_u_tset_c - -!----- Output string procedures ----------------------------------------------! -SUBROUTINE put_d_s(string,iostat) - type(VARYING_STRING),INTENT(IN) :: string - ! the string variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - ! uses the default unit - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination - INTEGER :: ist - WRITE(*,FMT='(A)',ADVANCE='NO',IOSTAT=ist) CHAR(string) - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during PUT of varying string on default unit" - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE put_d_s - -SUBROUTINE put_u_s(unit,string,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the output unit which must - ! be connected for sequential formatted - ! write - type(VARYING_STRING),INTENT(IN) :: string - ! the string variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination - INTEGER :: ist - WRITE(unit,FMT='(A)',ADVANCE='NO',IOSTAT=ist) CHAR(string) - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during PUT of varying string on UNIT ",unit - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE put_u_s - -SUBROUTINE put_d_c(string,iostat) - CHARACTER(LEN=*),INTENT(IN) :: string - ! the character variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - ! uses the default unit - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination - INTEGER :: ist - WRITE(*,FMT='(A)',ADVANCE='NO',IOSTAT=ist) string - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during PUT of character on default unit" - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE put_d_c - -SUBROUTINE put_u_c(unit,string,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the output unit which must - ! be connected for sequential formatted - ! write - CHARACTER(LEN=*),INTENT(IN) :: string - ! the character variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination - INTEGER :: ist - WRITE(unit,FMT='(A)',ADVANCE='NO',IOSTAT=ist) string - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSE - WRITE(*,*) " Error No.",ist," during PUT of character on UNIT ",unit - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE put_u_c - -SUBROUTINE putline_d_s(string,iostat) - type(VARYING_STRING),INTENT(IN) :: string - ! the string variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - ! uses the default unit - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! appends the string to the current record and then ends the record -! leaves the file positioned after the record just completed which then -! becomes the previous and last record in the file. - INTEGER :: ist - WRITE(*,FMT='(A,/)',ADVANCE='NO',IOSTAT=ist) CHAR(string) - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist; RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during PUT_LINE of varying string on default unit" - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE putline_d_s - -SUBROUTINE putline_u_s(unit,string,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the output unit which must - ! be connected for sequential formatted - ! write - type(VARYING_STRING),INTENT(IN) :: string - ! the string variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! appends the string to the current record and then ends the record -! leaves the file positioned after the record just completed which then -! becomes the previous and last record in the file. - INTEGER :: ist - WRITE(unit,FMT='(A,/)',ADVANCE='NO',IOSTAT=ist) CHAR(string) - IF( ist /= 0 )THEN - IF(PRESENT(iostat))THEN - iostat = ist; RETURN - ELSE - WRITE(*,*) " Error No.",ist, & - " during PUT_LINE of varying string on UNIT",unit - STOP - ENDIF - ENDIF - IF(PRESENT(iostat)) iostat=0 -ENDSUBROUTINE putline_u_s - -SUBROUTINE putline_d_c(string,iostat) - CHARACTER(LEN=*),INTENT(IN) :: string - ! the character variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - ! uses the default unit - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! appends the string to the current record and then ends the record -! leaves the file positioned after the record just completed which then -! becomes the previous and last record in the file. - INTEGER :: ist - WRITE(*,FMT='(A,/)',ADVANCE='NO',IOSTAT=ist) string - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSEIF( ist /= 0 )THEN - WRITE(*,*) " Error No.",ist, & - " during PUT_LINE of character on default unit" - STOP - ENDIF -ENDSUBROUTINE putline_d_c - -SUBROUTINE putline_u_c(unit,string,iostat) - INTEGER,INTENT(IN) :: unit - ! identifies the output unit which must - ! be connected for sequential formatted - ! write - CHARACTER(LEN=*),INTENT(IN) :: string - ! the character variable to be appended to - ! the current record or to the start of - ! the next record if there is no - ! current record - INTEGER,INTENT(OUT),OPTIONAL :: iostat - ! if present used to return the status - ! of the data transfer - ! if absent errors cause termination -! appends the string to the current record and then ends the record -! leaves the file positioned after the record just completed which then -! becomes the previous and last record in the file. - INTEGER :: ist - WRITE(unit,FMT='(A,/)',ADVANCE='NO',IOSTAT=ist) string - IF(PRESENT(iostat))THEN - iostat = ist - RETURN - ELSEIF( ist /= 0 )THEN - WRITE(*,*) " Error No.",ist, & - " during WRITE_LINE of character on UNIT",unit - STOP - ENDIF -ENDSUBROUTINE putline_u_c - -!----- Insert procedures ----------------------------------------------------! - FUNCTION insert_ss(string,start,substring) - type(VARYING_STRING) :: insert_ss - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates result string by inserting the substring into string - ! beginning at position start pushing the remainder of the string - ! to the right and enlarging it accordingly, - ! if start is greater than LEN(string) the substring is simply appended - ! to string by concatenation. if start is less than 1 - ! substring is inserted before string, ie. start is treated as if it were 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,lsub,ls - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - ALLOCATE(work(1:lsub+ls)) - work(1:ip-1) = string%chars(1:ip-1) - work(ip:ip+lsub-1) =substring%chars - work(ip+lsub:lsub+ls) = string%chars(ip:ls) - insert_ss%chars => work - ENDFUNCTION insert_ss - - FUNCTION insert_sc(string,start,substring) - type(VARYING_STRING) :: insert_sc - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates result string by inserting the substring into string - ! beginning at position start pushing the remainder of the string - ! to the right and enlarging it accordingly, - ! if start is greater than LEN(string) the substring is simply appended - ! to string by concatenation. if start is less than 1 - ! substring is inserted before string, ie. start is treated as if it were 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - ALLOCATE(work(1:lsub+ls)) - work(1:ip-1) = string%chars(1:ip-1) - DO i = 1,lsub - work(ip-1+i) = substring(i:i) - ENDDO - work(ip+lsub:lsub+ls) = string%chars(ip:ls) - insert_sc%chars => work - ENDFUNCTION insert_sc - - FUNCTION insert_cs(string,start,substring) - type(VARYING_STRING) :: insert_cs - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates result string by inserting the substring into string - ! beginning at position start pushing the remainder of the string - ! to the right and enlarging it accordingly, - ! if start is greater than LEN(string) the substring is simply appended - ! to string by concatenation. if start is less than 1 - ! substring is inserted before string, ie. start is treated as if it were 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - ALLOCATE(work(1:lsub+ls)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - work(ip:ip+lsub-1) =substring%chars - DO i=ip,ls - work(i+lsub) = string(i:i) - ENDDO - insert_cs%chars => work - ENDFUNCTION insert_cs - - FUNCTION insert_cc(string,start,substring) - type(VARYING_STRING) :: insert_cc - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates result string by inserting the substring into string - ! beginning at position start pushing the remainder of the string - ! to the right and enlarging it accordingly, - ! if start is greater than LEN(string) the substring is simply appended - ! to string by concatenation. if start is less than 1 - ! substring is inserted before string, ie. start is treated as if it were 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - ALLOCATE(work(1:lsub+ls)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - DO i = 1,lsub - work(ip-1+i) = substring(i:i) - ENDDO - DO i=ip,ls - work(i+lsub) = string(i:i) - ENDDO - insert_cc%chars => work - ENDFUNCTION insert_cc - -!----- Replace procedures ---------------------------------------------------! -FUNCTION replace_ss(string,start,substring) - type(VARYING_STRING) :: replace_ss - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following LEN(substring) characters of the string - ! and enlarging string if necessary. if start is greater than LEN(string) - ! substring is simply appended to string by concatenation. If start is less - ! than 1, substring replaces characters in string starting at 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,nw,lsub,ls - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - nw = MAX(ls,ip+lsub-1) - ALLOCATE(work(1:nw)) - work(1:ip-1) = string%chars(1:ip-1) - work(ip:ip+lsub-1) = substring%chars - work(ip+lsub:nw) = string%chars(ip+lsub:ls) - replace_ss%chars => work -ENDFUNCTION replace_ss - -FUNCTION replace_ss_sf(string,start,finish,substring) - type(VARYING_STRING) :: replace_ss_sf - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start,finish - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following finish-start+1 characters of the string - ! and enlarging or shrinking the string if necessary. - ! If start is greater than LEN(string) substring is simply appended to string - ! by concatenation. If start is less than 1, start = 1 is used - ! If finish is greater than LEN(string), finish = LEN(string) is used - ! If finish is less than start, substring is inserted before start - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,if,nw,lsub,ls - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - if = MAX(ip-1,MIN(finish,ls)) - nw = lsub + ls - if+ip-1 - ALLOCATE(work(1:nw)) - work(1:ip-1) = string%chars(1:ip-1) - work(ip:ip+lsub-1) = substring%chars - work(ip+lsub:nw) = string%chars(if+1:ls) - replace_ss_sf%chars => work -ENDFUNCTION replace_ss_sf - -FUNCTION replace_sc(string,start,substring) - type(VARYING_STRING) :: replace_sc - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the characters from substring into string beginning at position - ! start replacing the following LEN(substring) characters of the string - ! and enlarging string if necessary. If start is greater than LEN(string) - ! substring is simply appended to string by concatenation. If start is less - ! than 1, substring replaces characters in string starting at 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - nw = MAX(ls,ip+lsub-1) - ALLOCATE(work(1:nw)) - work(1:ip-1) = string%chars(1:ip-1) - DO i = 1,lsub - work(ip-1+i) = substring(i:i) - ENDDO - work(ip+lsub:nw) = string%chars(ip+lsub:ls) - replace_sc%chars => work -ENDFUNCTION replace_sc - -FUNCTION replace_sc_sf(string,start,finish,substring) - type(VARYING_STRING) :: replace_sc_sf - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start,finish - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following finish-start+1 characters of the string - ! and enlarging or shrinking the string if necessary. - ! If start is greater than LEN(string) substring is simply appended to string - ! by concatenation. If start is less than 1, start = 1 is used - ! If finish is greater than LEN(string), finish = LEN(string) is used - ! If finish is less than start, substring is inserted before start - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,if,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - if = MAX(ip-1,MIN(finish,ls)) - nw = lsub + ls - if+ip-1 - ALLOCATE(work(1:nw)) - work(1:ip-1) = string%chars(1:ip-1) - DO i = 1,lsub - work(ip-1+i) = substring(i:i) - ENDDO - work(ip+lsub:nw) = string%chars(if+1:ls) - replace_sc_sf%chars => work -ENDFUNCTION replace_sc_sf - -FUNCTION replace_cs(string,start,substring) - type(VARYING_STRING) :: replace_cs - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following LEN(substring) characters of the string - ! and enlarging string if necessary. if start is greater than LEN(string) - ! substring is simply appended to string by concatenation. If start is less - ! than 1, substring replaces characters in string starting at 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - nw = MAX(ls,ip+lsub-1) - ALLOCATE(work(1:nw)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - work(ip:ip+lsub-1) = substring%chars - DO i=ip+lsub,nw - work(i) = string(i:i) - ENDDO - replace_cs%chars => work -ENDFUNCTION replace_cs - -FUNCTION replace_cs_sf(string,start,finish,substring) - type(VARYING_STRING) :: replace_cs_sf - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start,finish - type(VARYING_STRING),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following finish-start+1 characters of the string - ! and enlarging or shrinking the string if necessary. - ! If start is greater than LEN(string) substring is simply appended to string - ! by concatenation. If start is less than 1, start = 1 is used - ! If finish is greater than LEN(string), finish = LEN(string) is used - ! If finish is less than start, substring is inserted before start - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,if,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - if = MAX(ip-1,MIN(finish,ls)) - nw = lsub + ls - if+ip-1 - ALLOCATE(work(1:nw)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - work(ip:ip+lsub-1) = substring%chars - DO i=1,nw-ip-lsub+1 - work(i+ip+lsub-1) = string(if+i:if+i) - ENDDO - replace_cs_sf%chars => work -ENDFUNCTION replace_cs_sf - -FUNCTION replace_cc(string,start,substring) - type(VARYING_STRING) :: replace_cc - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the characters from substring into string beginning at position - ! start replacing the following LEN(substring) characters of the string - ! and enlarging string if necessary. If start is greater than LEN(string) - ! substring is simply appended to string by concatenation. If start is less - ! than 1, substring replaces characters in string starting at 1 - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - nw = MAX(ls,ip+lsub-1) - ALLOCATE(work(1:nw)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - DO i=1,lsub - work(ip-1+i) = substring(i:i) - ENDDO - DO i=ip+lsub,nw - work(i) = string(i:i) - ENDDO - replace_cc%chars => work -ENDFUNCTION replace_cc - -FUNCTION replace_cc_sf(string,start,finish,substring) - type(VARYING_STRING) :: replace_cc_sf - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN) :: start,finish - CHARACTER(LEN=*),INTENT(IN) :: substring - ! calculates the result string by the following actions: - ! inserts the substring into string beginning at position - ! start replacing the following finish-start+1 characters of the string - ! and enlarging or shrinking the string if necessary. - ! If start is greater than LEN(string) substring is simply appended to string - ! by concatenation. If start is less than 1, start = 1 is used - ! If finish is greater than LEN(string), finish = LEN(string) is used - ! If finish is less than start, substring is inserted before start - CHARACTER,POINTER,DIMENSION(:) :: work - INTEGER :: ip,is,if,nw,lsub,ls,i - lsub = LEN(substring); ls = LEN(string) - is = MAX(start,1) - ip = MIN(ls+1,is) - if = MAX(ip-1,MIN(finish,ls)) - nw = lsub + ls - if+ip-1 - ALLOCATE(work(1:nw)) - DO i=1,ip-1 - work(i) = string(i:i) - ENDDO - DO i=1,lsub - work(i+ip-1) = substring(i:i) - ENDDO - DO i=1,nw-ip-lsub+1 - work(i+ip+lsub-1) = string(if+i:if+i) - ENDDO - replace_cc_sf%chars => work -ENDFUNCTION replace_cc_sf - -FUNCTION replace_sss(string,target,substring,every,back) - type(VARYING_STRING) :: replace_sss - type(VARYING_STRING),INTENT(IN) :: string,target,substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all occurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp - INTEGER :: ls,lt,lsub,ipos,ipow - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); work = string%chars - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - temp(ipos:ipos+lsub-1) = substring%chars - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - temp(ipow:ipow+lsub-1) = substring%chars - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_sss%chars => work -ENDFUNCTION replace_sss - -FUNCTION replace_ssc(string,target,substring,every,back) - type(VARYING_STRING) :: replace_ssc - type(VARYING_STRING),INTENT(IN) :: string,target - CHARACTER(LEN=*),INTENT(IN) :: substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all occurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); work = string%chars - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - DO i=1,lsub - temp(i+ipos-1) = substring(i:i) - ENDDO - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - DO i=1,lsub - temp(i+ipow-1) = substring(i:i) - ENDDO - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_ssc%chars => work -ENDFUNCTION replace_ssc - -FUNCTION replace_scs(string,target,substring,every,back) - type(VARYING_STRING) :: replace_scs - type(VARYING_STRING),INTENT(IN) :: string,substring - CHARACTER(LEN=*),INTENT(IN) :: target - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp,tget - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); work = string%chars - ALLOCATE(tget(1:lt)) - DO i=1,lt - tget(i) = target(i:i) - ENDDO - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == tget) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - temp(ipos:ipos+lsub-1) = substring%chars - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == tget) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - temp(ipow:ipow+lsub-1) = substring%chars - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_scs%chars => work -ENDFUNCTION replace_scs - -FUNCTION replace_scc(string,target,substring,every,back) - type(VARYING_STRING) :: replace_scc - type(VARYING_STRING),INTENT(IN) :: string - CHARACTER(LEN=*),INTENT(IN) :: target,substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp,tget - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); work = string%chars - ALLOCATE(tget(1:lt)) - DO i=1,lt - tget(i) = target(i:i) - ENDDO - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == tget) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - DO i=1,lsub - temp(i+ipos-1) = substring(i:i) - ENDDO - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(string%chars(ipos:ipos+lt-1) == tget) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - DO i=1,lsub - temp(i+ipow-1) = substring(i:i) - ENDDO - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_scc%chars => work -ENDFUNCTION replace_scc - -FUNCTION replace_css(string,target,substring,every,back) - type(VARYING_STRING) :: replace_css - CHARACTER(LEN=*),INTENT(IN) :: string - type(VARYING_STRING),INTENT(IN) :: target,substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp,str - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); ALLOCATE(str(1:ls)) - DO i=1,ls - str(i) = string(i:i) - ENDDO - work = str - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(str(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - temp(ipos:ipos+lsub-1) = substring%chars - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(str(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - temp(ipow:ipow+lsub-1) = substring%chars - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_css%chars => work -ENDFUNCTION replace_css - -FUNCTION replace_csc(string,target,substring,every,back) - type(VARYING_STRING) :: replace_csc - type(VARYING_STRING),INTENT(IN) :: target - CHARACTER(LEN=*),INTENT(IN) :: string,substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp,str - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)); ALLOCATE(str(1:ls)) - DO i=1,ls - str(i) = string(i:i) - ENDDO - work = str - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( ALL(str(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - DO i=1,lsub - temp(i+ipos-1) = substring(i:i) - ENDDO - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( ALL(str(ipos:ipos+lt-1) == target%chars) )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - DO i=1,lsub - temp(i+ipow-1) = substring(i:i) - ENDDO - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_csc%chars => work -ENDFUNCTION replace_csc - -FUNCTION replace_ccs(string,target,substring,every,back) - type(VARYING_STRING) :: replace_ccs - type(VARYING_STRING),INTENT(IN) :: substring - CHARACTER(LEN=*),INTENT(IN) :: string,target - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)) - DO i=1,ls - work(i) = string(i:i) - ENDDO - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( string(ipos:ipos+lt-1) == target )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - temp(ipos:ipos+lsub-1) = substring%chars - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( string(ipos:ipos+lt-1) == target )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - temp(ipow:ipow+lsub-1) = substring%chars - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_ccs%chars => work -ENDFUNCTION replace_ccs - -FUNCTION replace_ccc(string,target,substring,every,back) - type(VARYING_STRING) :: replace_ccc - CHARACTER(LEN=*),INTENT(IN) :: string,target,substring - LOGICAL,INTENT(IN),OPTIONAL :: every,back - ! calculates the result string by the following actions: - ! searches for occurences of target in string, and replaces these with - ! substring. if back present with value true search is backward otherwise - ! search is done forward. if every present with value true all accurences - ! of target in string are replaced, otherwise only the first found is - ! replaced. if target is not found the result is the same as string. - LOGICAL :: dir_switch, rep_search - CHARACTER,DIMENSION(:),POINTER :: work,temp - INTEGER :: ls,lt,lsub,ipos,ipow,i - ls = LEN(string); lt = LEN(target); lsub = LEN(substring) - IF(lt==0)THEN - WRITE(*,*) " Zero length target in REPLACE" - STOP - ENDIF - ALLOCATE(work(1:ls)) - DO i=1,ls - work(i) = string(i:i) - ENDDO - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF( PRESENT(every) )THEN - rep_search = every - ELSE - rep_search = .FALSE. - ENDIF - IF( dir_switch )THEN ! backwards search - ipos = ls-lt+1 - DO - IF( ipos < 1 )EXIT ! search past start of string - ! test for occurance of target in string at this position - IF( string(ipos:ipos+lt-1) == target )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipos-1) = work(1:ipos-1) - DO i=1,lsub - temp(i+ipos-1) = substring(i:i) - ENDDO - temp(ipos+lsub:) = work(ipos+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos-lt+1 - ENDIF - ipos=ipos-1 - ENDDO - ELSE ! forward search - ipos = 1; ipow = 1 - DO - IF( ipos > ls-lt+1 )EXIT ! search past end of string - ! test for occurance of target in string at this position - IF( string(ipos:ipos+lt-1) == target )THEN - ! match found allocate space for string with this occurance of - ! target replaced by substring - ALLOCATE(temp(1:SIZE(work)+lsub-lt)) - ! copy work into temp replacing this occurance of target by - ! substring - temp(1:ipow-1) = work(1:ipow-1) - DO i=1,lsub - temp(i+ipow-1) = substring(i:i) - ENDDO - temp(ipow+lsub:) = work(ipow+lt:) - work => temp ! make new version of work point at the temp space - IF(.NOT.rep_search)EXIT ! exit if only first replacement wanted - ! move search and replacement positions over the effected positions - ipos = ipos+lt-1; ipow = ipow+lsub-1 - ENDIF - ipos=ipos+1; ipow=ipow+1 - ENDDO - ENDIF - replace_ccc%chars => work -ENDFUNCTION replace_ccc - -!----- Remove procedures ----------------------------------------------------! -FUNCTION remove_s(string,start,finish) - type(VARYING_STRING) :: remove_s - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN),OPTIONAL :: start - INTEGER,INTENT(IN),OPTIONAL :: finish - ! returns as result the string produced by the actions - ! removes the characters between start and finish from string reducing it in - ! size by MAX(0,ABS(finish-start+1)) - ! if start < 1 or is missing then assumes start=1 - ! if finish > LEN(string) or is missing then assumes finish=LEN(string) - CHARACTER,DIMENSION(:),POINTER :: arg_str - INTEGER :: is,if,ls - ls = LEN(string) - IF (PRESENT(start)) THEN - is = MAX(1,start) - ELSE - is = 1 - ENDIF - IF (PRESENT(finish)) THEN - if = MIN(ls,finish) - ELSE - if = ls - ENDIF - IF( if < is ) THEN ! zero characters to be removed, string is unchanged - ALLOCATE(arg_str(1:ls)) - arg_str = string%chars - ELSE - ALLOCATE(arg_str(1:ls-if+is-1) ) - arg_str(1:is-1) = string%chars(1:is-1) - arg_str(is:) = string%chars(if+1:) - ENDIF - remove_s%chars => arg_str -ENDFUNCTION remove_s - -FUNCTION remove_c(string,start,finish) - type(VARYING_STRING) :: remove_c - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN),OPTIONAL :: start - INTEGER,INTENT(IN),OPTIONAL :: finish - ! returns as result the string produced by the actions - ! removes the characters between start and finish from string reducing it in - ! size by MAX(0,ABS(finish-start+1)) - ! if start < 1 or is missing then assumes start=1 - ! if finish > LEN(string) or is missing then assumes finish=LEN(string) - CHARACTER,DIMENSION(:),POINTER :: arg_str - INTEGER :: is,if,ls,i - ls = LEN(string) - IF (PRESENT(start)) THEN - is = MAX(1,start) - ELSE - is = 1 - ENDIF - IF (PRESENT(finish)) THEN - if = MIN(ls,finish) - ELSE - if = ls - ENDIF - IF( if < is ) THEN ! zero characters to be removed, string is unchanged - ALLOCATE(arg_str(1:ls)) - DO i=1,ls - arg_str(i) = string(i:i) - ENDDO - ELSE - ALLOCATE(arg_str(1:ls-if+is-1) ) - DO i=1,is-1 - arg_str(i) = string(i:i) - ENDDO - DO i=is,ls-if+is-1 - arg_str(i) = string(i-is+if+1:i-is+if+1) - ENDDO - ENDIF - remove_c%chars => arg_str -ENDFUNCTION remove_c - -!----- Extract procedures ---------------------------------------------------! - FUNCTION extract_s(string,start,finish) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER,INTENT(IN),OPTIONAL :: start - INTEGER,INTENT(IN),OPTIONAL :: finish - type(VARYING_STRING) :: extract_s - ! extracts the characters between start and finish from string and - ! delivers these as the result of the function, string is unchanged - ! if start < 1 or is missing then it is treated as 1 - ! if finish > LEN(string) or is missing then it is treated as LEN(string) - INTEGER :: is,if - IF (PRESENT(start)) THEN - is = MAX(1,start) - ELSE - is = 1 - ENDIF - IF (PRESENT(finish)) THEN - if = MIN(LEN(string),finish) - ELSE - if = LEN(string) - ENDIF - ALLOCATE(extract_s%chars(1:if-is+1)) - extract_s%chars = string%chars(is:if) - ENDFUNCTION extract_s - - FUNCTION extract_c(string,start,finish) - CHARACTER(LEN=*),INTENT(IN) :: string - INTEGER,INTENT(IN),OPTIONAL :: start - INTEGER,INTENT(IN),OPTIONAL :: finish - type(VARYING_STRING) :: extract_c - ! extracts the characters between start and finish from character string and - ! delivers these as the result of the function, string is unchanged - ! if start < 1 or is missing then it is treated as 1 - ! if finish > LEN(string) or is missing then it is treated as LEN(string) - INTEGER :: is,if,i - IF (PRESENT(start)) THEN - is = MAX(1,start) - ELSE - is = 1 - ENDIF - IF (PRESENT(finish)) THEN - if = MIN(LEN(string),finish) - ELSE - if = LEN(string) - ENDIF - ALLOCATE(extract_c%chars(1:if-is+1)) - DO i=is,if - extract_c%chars(i-is+1) = string(i:i) - ENDDO - ENDFUNCTION extract_c - -!----- Split procedures ------------------------------------------------------! - SUBROUTINE split_s(string,word,set,separator,back) - type(VARYING_STRING),INTENT(INOUT) :: string - type(VARYING_STRING),INTENT(OUT) :: word - type(VARYING_STRING),INTENT(IN) :: set - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - LOGICAL,INTENT(IN),OPTIONAL :: back - ! splits the input string at the first(last) character in set - ! returns the leading(trailing) substring in word and the trailing(leading) - ! substring in string. The search is done in the forward or backward - ! direction depending on back. If separator is present, the actual separator - ! character found is returned in separator. - ! If no character in set is found string and separator are returned as - ! zero length and the whole input string is returned in word. - LOGICAL :: dir_switch - INTEGER :: ls,tpos - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO tpos = ls,1,-1 - IF(ANY(string%chars(tpos) == set%chars))EXIT - ENDDO - word%chars => string%chars(tpos+1:ls) - IF(PRESENT(separator))THEN - IF(tpos==0)THEN - separator = "" - ELSE - separator%chars => string%chars(tpos:tpos) - ENDIF - ENDIF - string%chars => string%chars(1:tpos-1) - ELSE ! forwards search - DO tpos =1,ls - IF(ANY(string%chars(tpos) == set%chars))EXIT - ENDDO - word%chars => string%chars(1:tpos-1) - IF(PRESENT(separator))THEN - IF(tpos==ls+1)THEN - separator = "" - ELSE - separator%chars => string%chars(tpos:tpos) - ENDIF - ENDIF - string%chars => string%chars(tpos+1:ls) - ENDIF - ENDSUBROUTINE split_s - - SUBROUTINE split_c(string,word,set,separator,back) - type(VARYING_STRING),INTENT(INOUT) :: string - type(VARYING_STRING),INTENT(OUT) :: word - CHARACTER(LEN=*),INTENT(IN) :: set - type(VARYING_STRING),INTENT(OUT),OPTIONAL :: separator - LOGICAL,INTENT(IN),OPTIONAL :: back - ! splits the input string at the first(last) character in set - ! returns the leading(trailing) substring in word and the trailing(leading) - ! substring in string. The search is done in the forward or backward - ! direction depending on back. If separator is present, the actual separator - ! character found is returned in separator. - ! If no character in set is found string and separator are returned as - ! zero length and the whole input string is returned in word. - LOGICAL :: dir_switch - INTEGER :: ls,tpos,lset,i - ls = LEN(string); lset = LEN(set) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - BSEARCH:DO tpos = ls,1,-1 - DO i=1,lset - IF(string%chars(tpos) == set(i:i))EXIT BSEARCH - ENDDO - ENDDO BSEARCH - word%chars => string%chars(tpos+1:ls) - IF(PRESENT(separator))THEN - IF(tpos==0)THEN - separator = "" - ELSE - separator%chars => string%chars(tpos:tpos) - ENDIF - ENDIF - string%chars => string%chars(1:tpos-1) - ELSE ! forwards search - FSEARCH:DO tpos =1,ls - DO i=1,lset - IF(string%chars(tpos) == set(i:i))EXIT FSEARCH - ENDDO - ENDDO FSEARCH - word%chars => string%chars(1:tpos-1) - IF(PRESENT(separator))THEN - IF(tpos==ls+1)THEN - separator = "" - ELSE - separator%chars => string%chars(tpos:tpos) - ENDIF +! The original copyright notice follows: +! ****************************************************************************** +! * * +! * iso_varying_string.f90 * +! * * +! * Copyright (c) 2003, Rich Townsend * +! * All rights reserved. * +! * * +! * Redistribution and use in source and binary forms, with or without * +! * modification, are permitted provided that the following conditions are * +! * met: * +! * * +! * * Redistributions of source code must retain the above copyright notice, * +! * this list of conditions and the following disclaimer. * +! * * Redistributions in binary form must reproduce the above copyright * +! * notice, this list of conditions and the following disclaimer in the * +! * documentation and/or other materials provided with the distribution. * +! * * +! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * +! * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * +! * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * +! * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * +! * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * +! * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * +! * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * +! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +! * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * +! * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * +! * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * +! * * +! ****************************************************************************** +! +! Author : Rich Townsend +! Synopsis : Definition of iso_varying_string module, conformant to the API +! specified in ISO/IEC 1539-2:2000 (varying-length strings for +! Fortran 95). +! Version : 1.3-F +! Thanks : Lawrie Schonfelder (bugfixes and design pointers), Walt Brainerd +! (conversion to F). + +USE,INTRINSIC :: iso_c_binding + +! No implicit typing + + implicit none + +! Parameter definitions + + integer, parameter, private :: GET_BUFFER_LEN = 256 + +! Type definitions + + type, public :: varying_string + private + character(LEN=1), dimension(:), allocatable :: chars + end type varying_string + +! Interface blocks + + interface assignment(=) + module procedure op_assign_CH_VS + module procedure op_assign_VS_CH + end interface assignment(=) + + interface operator(//) + module procedure op_concat_VS_VS + module procedure op_concat_CH_VS + module procedure op_concat_VS_CH + end interface operator(//) + + interface operator(==) + module procedure op_eq_VS_VS + module procedure op_eq_CH_VS + module procedure op_eq_VS_CH + end interface operator(==) + + interface operator(/=) + module procedure op_ne_VS_VS + module procedure op_ne_CH_VS + module procedure op_ne_VS_CH + end interface operator (/=) + + interface operator(<) + module procedure op_lt_VS_VS + module procedure op_lt_CH_VS + module procedure op_lt_VS_CH + end interface operator (<) + + interface operator(<=) + module procedure op_le_VS_VS + module procedure op_le_CH_VS + module procedure op_le_VS_CH + end interface operator (<=) + + interface operator(>=) + module procedure op_ge_VS_VS + module procedure op_ge_CH_VS + module procedure op_ge_VS_CH + end interface operator (>=) + + interface operator(>) + module procedure op_gt_VS_VS + module procedure op_gt_CH_VS + module procedure op_gt_VS_CH + end interface operator (>) + + interface adjustl + module procedure adjustl_ + end interface adjustl + + interface adjustr + module procedure adjustr_ + end interface adjustr + + interface char + module procedure char_auto + module procedure char_fixed + end interface char + + interface iachar + module procedure iachar_ + end interface iachar + + interface ichar + module procedure ichar_ + end interface ichar + + interface index + module procedure index_VS_VS + module procedure index_CH_VS + module procedure index_VS_CH + end interface index + + interface len + module procedure len_ + end interface len + + interface len_trim + module procedure len_trim_ + end interface len_trim + + interface lge + module procedure lge_VS_VS + module procedure lge_CH_VS + module procedure lge_VS_CH + end interface lge + + interface lgt + module procedure lgt_VS_VS + module procedure lgt_CH_VS + module procedure lgt_VS_CH + end interface lgt + + interface lle + module procedure lle_VS_VS + module procedure lle_CH_VS + module procedure lle_VS_CH + end interface lle + + interface llt + module procedure llt_VS_VS + module procedure llt_CH_VS + module procedure llt_VS_CH + end interface llt + + interface repeat + module procedure repeat_ + end interface repeat + + interface scan + module procedure scan_VS_VS + module procedure scan_CH_VS + module procedure scan_VS_CH + end interface scan + + interface trim + module procedure trim_ + end interface trim + + interface verify + module procedure verify_VS_VS + module procedure verify_CH_VS + module procedure verify_VS_CH + end interface verify + + interface var_str + module procedure var_str_ + module procedure var_str_c_ptr + end interface var_str + + interface get + module procedure get_ + module procedure get_unit + module procedure get_set_VS + module procedure get_set_CH + module procedure get_unit_set_VS + module procedure get_unit_set_CH + end interface get + + interface put + module procedure put_VS + module procedure put_CH + module procedure put_unit_VS + module procedure put_unit_CH + end interface put + + interface put_line + module procedure put_line_VS + module procedure put_line_CH + module procedure put_line_unit_VS + module procedure put_line_unit_CH + end interface put_line + + interface extract + module procedure extract_VS + module procedure extract_CH + end interface extract + + interface insert + module procedure insert_VS_VS + module procedure insert_CH_VS + module procedure insert_VS_CH + module procedure insert_CH_CH + end interface insert + + interface remove + module procedure remove_VS + module procedure remove_CH + end interface remove + + interface replace + module procedure replace_VS_VS_auto + module procedure replace_CH_VS_auto + module procedure replace_VS_CH_auto + module procedure replace_CH_CH_auto + module procedure replace_VS_VS_fixed + module procedure replace_CH_VS_fixed + module procedure replace_VS_CH_fixed + module procedure replace_CH_CH_fixed + module procedure replace_VS_VS_VS_target + module procedure replace_CH_VS_VS_target + module procedure replace_VS_CH_VS_target + module procedure replace_CH_CH_VS_target + module procedure replace_VS_VS_CH_target + module procedure replace_CH_VS_CH_target + module procedure replace_VS_CH_CH_target + module procedure replace_CH_CH_CH_target + end interface + + interface split + module procedure split_VS + module procedure split_CH + end interface split + + interface c_ptr_new + module procedure c_ptr_new_VS + end interface c_ptr_new + + +! Access specifiers + + public :: assignment(=) + public :: operator(//) + public :: operator(==) + public :: operator(/=) + public :: operator(<) + public :: operator(<=) + public :: operator(>=) + public :: operator(>) + public :: adjustl + public :: adjustr + public :: char + public :: iachar + public :: ichar + public :: index + public :: len + public :: len_trim + public :: lge + public :: lgt + public :: lle + public :: llt + public :: repeat + public :: scan + public :: trim + public :: verify + public :: var_str + public :: get + public :: put + public :: put_line + public :: extract + public :: insert + public :: remove + public :: replace + public :: split + + private :: op_assign_CH_VS + private :: op_assign_VS_CH + private :: op_concat_VS_VS + private :: op_concat_CH_VS + private :: op_concat_VS_CH + private :: op_eq_VS_VS + private :: op_eq_CH_VS + private :: op_eq_VS_CH + private :: op_ne_VS_VS + private :: op_ne_CH_VS + private :: op_ne_VS_CH + private :: op_lt_VS_VS + private :: op_lt_CH_VS + private :: op_lt_VS_CH + private :: op_le_VS_VS + private :: op_le_CH_VS + private :: op_le_VS_CH + private :: op_ge_VS_VS + private :: op_ge_CH_VS + private :: op_ge_VS_CH + private :: op_gt_VS_VS + private :: op_gt_CH_VS + private :: op_gt_VS_CH + private :: adjustl_ + private :: adjustr_ + private :: char_auto + private :: char_fixed + private :: iachar_ + private :: ichar_ + private :: index_VS_VS + private :: index_CH_VS + private :: index_VS_CH + private :: len_ + private :: len_trim_ + private :: lge_VS_VS + private :: lge_CH_VS + private :: lge_VS_CH + private :: lgt_VS_VS + private :: lgt_CH_VS + private :: lgt_VS_CH + private :: lle_VS_VS + private :: lle_CH_VS + private :: lle_VS_CH + private :: llt_VS_VS + private :: llt_CH_VS + private :: llt_VS_CH + private :: repeat_ + private :: scan_VS_VS + private :: scan_CH_VS + private :: scan_VS_CH + private :: trim_ + private :: verify_VS_VS + private :: verify_CH_VS + private :: verify_VS_CH + private :: var_str_ + private :: var_str_c_ptr + private :: get_ + private :: get_unit + private :: get_set_VS + private :: get_set_CH + private :: get_unit_set_VS + private :: get_unit_set_CH + private :: put_VS + private :: put_CH + private :: put_unit_VS + private :: put_unit_CH + private :: put_line_VS + private :: put_line_CH + private :: put_line_unit_VS + private :: put_line_unit_CH + private :: extract_VS + private :: extract_CH + private :: insert_VS_VS + private :: insert_CH_VS + private :: insert_VS_CH + private :: insert_CH_CH + private :: remove_VS + private :: remove_CH + private :: replace_VS_VS_auto + private :: replace_CH_VS_auto + private :: replace_VS_CH_auto + private :: replace_CH_CH_auto + private :: replace_VS_VS_fixed + private :: replace_CH_VS_fixed + private :: replace_VS_CH_fixed + private :: replace_CH_CH_fixed + private :: replace_VS_VS_VS_target + private :: replace_CH_VS_VS_target + private :: replace_VS_CH_VS_target + private :: replace_CH_CH_VS_target + private :: replace_VS_VS_CH_target + private :: replace_CH_VS_CH_target + private :: replace_VS_CH_CH_target + private :: replace_CH_CH_CH_target + private :: split_VS + private :: split_CH + +! Procedures + +contains + +!**** + + elemental subroutine op_assign_CH_VS (var, exp) + + character(LEN=*), intent(out) :: var + type(varying_string), intent(in) :: exp + +! Assign a varying string to a character string + + var = char(exp) + +! Finish + + return + + end subroutine op_assign_CH_VS + +!**** + + elemental subroutine op_assign_VS_CH (var, exp) + + type(varying_string), intent(out) :: var + character(LEN=*), intent(in) :: exp + +! Assign a character string to a varying string + + var = var_str(exp) + +! Finish + + return + + end subroutine op_assign_VS_CH + +!**** + + elemental function op_concat_VS_VS (string_a, string_b) result (concat_string) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + type(varying_string) :: concat_string + + integer :: len_string_a + +! Concatenate two varying strings + + len_string_a = len(string_a) + + ALLOCATE(concat_string%chars(len_string_a+len(string_b)+1)) + concat_string%chars(:len_string_a) = string_a%chars(:len_string_a) + concat_string%chars(len_string_a+1:) = string_b%chars(:) + + +! Finish + + return + + end function op_concat_VS_VS + +!**** + + elemental function op_concat_CH_VS (string_a, string_b) result (concat_string) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + type(varying_string) :: concat_string + +! Concatenate a character string and a varying +! string + + concat_string = op_concat_VS_VS(var_str(string_a), string_b) + +! Finish + + return + + end function op_concat_CH_VS + +!**** + + elemental function op_concat_VS_CH (string_a, string_b) result (concat_string) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + type(varying_string) :: concat_string + +! Concatenate a varying string and a character +! string + + concat_string = op_concat_VS_VS(string_a, var_str(string_b)) + +! Finish + + return + + end function op_concat_VS_CH + +!**** + + elemental function op_eq_VS_VS (string_a, string_b) result (op_eq) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_eq + +! Compare (==) two varying strings + + op_eq = char(string_a) == char(string_b) + +! Finish + + return + + end function op_eq_VS_VS + +!**** + + elemental function op_eq_CH_VS (string_a, string_b) result (op_eq) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_eq + +! Compare (==) a character string and a varying +! string + + op_eq = string_a == char(string_b) + +! Finish + + return + + end function op_eq_CH_VS + +!**** + + elemental function op_eq_VS_CH (string_a, string_b) result (op_eq) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_eq + +! Compare (==) a varying string and a character +! string + + op_eq = char(string_a) == string_b + +! Finish + + return + + end function op_eq_VS_CH + +!**** + + elemental function op_ne_VS_VS (string_a, string_b) result (op_ne) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_ne + +! Compare (/=) two varying strings + + op_ne = char(string_a) /= char(string_b) + +! Finish + + return + + end function op_ne_VS_VS + +!**** + + elemental function op_ne_CH_VS (string_a, string_b) result (op_ne) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_ne + +! Compare (/=) a character string and a varying +! string + + op_ne = string_a /= char(string_b) + +! Finish + + return + + end function op_ne_CH_VS + +!**** + + elemental function op_ne_VS_CH (string_a, string_b) result (op_ne) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_ne + +! Compare (/=) a varying string and a character +! string + + op_ne = char(string_a) /= string_b + +! Finish + + return + + end function op_ne_VS_CH + +!**** + + elemental function op_lt_VS_VS (string_a, string_b) result (op_lt) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_lt + +! Compare (<) two varying strings + + op_lt = char(string_a) < char(string_b) + +! Finish + + return + + end function op_lt_VS_VS + +!**** + + elemental function op_lt_CH_VS (string_a, string_b) result (op_lt) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_lt + +! Compare (<) a character string and a varying +! string + + op_lt = string_a < char(string_b) + +! Finish + + return + + end function op_lt_CH_VS + +!**** + + elemental function op_lt_VS_CH (string_a, string_b) result (op_lt) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_lt + +! Compare (<) a varying string and a character +! string + + op_lt = char(string_a) < string_b + +! Finish + + return + + end function op_lt_VS_CH + +!**** + + elemental function op_le_VS_VS (string_a, string_b) result (op_le) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_le + +! Compare (<=) two varying strings + + op_le = char(string_a) <= char(string_b) + +! Finish + + return + + end function op_le_VS_VS + +!**** + + elemental function op_le_CH_VS (string_a, string_b) result (op_le) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_le + +! Compare (<=) a character string and a varying +! string + + op_le = string_a <= char(string_b) + +! Finish + + return + + end function op_le_CH_VS + +!**** + + elemental function op_le_VS_CH (string_a, string_b) result (op_le) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_le + +! Compare (<=) a varying string and a character +! string + + op_le = char(string_a) <= string_b + +! Finish + + return + + end function op_le_VS_CH + +!**** + + elemental function op_ge_VS_VS (string_a, string_b) result (op_ge) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_ge + +! Compare (>=) two varying strings + + op_ge = char(string_a) >= char(string_b) + +! Finish + + return + + end function op_ge_VS_VS + +!**** + + elemental function op_ge_CH_VS (string_a, string_b) result (op_ge) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_ge + +! Compare (>=) a character string and a varying +! string + + op_ge = string_a >= char(string_b) + +! Finish + + return + + end function op_ge_CH_VS + +!**** + + elemental function op_ge_VS_CH (string_a, string_b) result (op_ge) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_ge + +! Compare (>=) a varying string and a character +! string + + op_ge = char(string_a) >= string_b + +! Finish + + return + + end function op_ge_VS_CH + +!**** + + elemental function op_gt_VS_VS (string_a, string_b) result (op_gt) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_gt + +! Compare (>) two varying strings + + op_gt = char(string_a) > char(string_b) + +! Finish + + return + + end function op_gt_VS_VS + +!**** + + elemental function op_gt_CH_VS (string_a, string_b) result (op_gt) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: op_gt + +! Compare (>) a character string and a varying +! string + + op_gt = string_a > char(string_b) + +! Finish + + return + + end function op_gt_CH_VS + +!**** + + elemental function op_gt_VS_CH (string_a, string_b) result (op_gt) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_gt + +! Compare (>) a varying string and a character +! string + + op_gt = char(string_a) > string_b + +! Finish + + return + + end function op_gt_VS_CH + +!**** + + elemental function adjustl_ (string) result (adjustl_string) + + type(varying_string), intent(in) :: string + type(varying_string) :: adjustl_string + +! Adjust the varying string to the left + + adjustl_string = ADJUSTL(CHAR(string)) + +! Finish + + return + + end function adjustl_ + +!**** + + elemental function adjustr_ (string) result (adjustr_string) + + type(varying_string), intent(in) :: string + type(varying_string) :: adjustr_string + +! Adjust the varying string to the right + + adjustr_string = ADJUSTR(CHAR(string)) + +! Finish + + return + + end function adjustr_ + +!**** + + elemental function len_ (string) result (length) + + type(varying_string), intent(in) :: string + integer :: length + +! Get the length of a varying string + + if(ALLOCATED(string%chars)) then + length = SIZE(string%chars)-1 + else + length = 0 + endif + +! Finish + + return + + end function len_ + +!**** + + elemental function len_trim_ (string) result (length) + + type(varying_string), intent(in) :: string + integer :: length + +! Get the trimmed length of a varying string + + if(ALLOCATED(string%chars)) then + length = LEN_TRIM(char(string)) + else + length = 0 + endif + +! Finish + + return + + end function len_trim_ + +!**** + + pure function char_auto (string) result (char_string) + + type(varying_string), intent(in) :: string + character(LEN=len(string)) :: char_string + + integer :: i_char + +! Convert a varying string into a character string +! (automatic length) + + forall(i_char = 1:len(string)) + char_string(i_char:i_char) = string%chars(i_char) + end forall + +! Finish + + return + + end function char_auto + +!**** + + pure function char_fixed (string, length) result (char_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: length + character(LEN=length) :: char_string + +! Convert a varying string into a character string +! (fixed length) + + char_string = char(string) + +! Finish + + return + + end function char_fixed + +!**** + + elemental function iachar_ (c) result (i) + + type(varying_string), intent(in) :: c + integer :: i + +! Get the position in the ISO 646 collating sequence +! of a varying string character + + i = ICHAR(char(c)) + +! Finish + + return + + end function iachar_ + +!**** + + elemental function ichar_ (c) result (i) + + type(varying_string), intent(in) :: c + integer :: i + +! Get the position in the processor collating +! sequence of a varying string character + + i = ICHAR(char(c)) + +! Finish + + return + + end function ichar_ + +!**** + + elemental function index_VS_VS (string, substring, back) result (i_substring) + + type(varying_string), intent(in) :: string + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: back + integer :: i_substring + +! Get the index of a varying substring within a +! varying string + + i_substring = INDEX(char(string), char(substring), back) + +! Finish + + return + + end function index_VS_VS + +!**** + + elemental function index_CH_VS (string, substring, back) result (i_substring) + + character(LEN=*), intent(in) :: string + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: back + integer :: i_substring + +! Get the index of a varying substring within a +! character string + + i_substring = INDEX(string, char(substring), back) + +! Finish + + return + + end function index_CH_VS + +!**** + + elemental function index_VS_CH (string, substring, back) result (i_substring) + + type(varying_string), intent(in) :: string + character(LEN=*), intent(in) :: substring + logical, intent(in), optional :: back + integer :: i_substring + +! Get the index of a character substring within a +! varying string + + i_substring = INDEX(char(string), substring, back) + +! Finish + + return + + end function index_VS_CH + +!**** + + elemental function lge_VS_VS (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LGE) two varying strings + + comp = (char(string_a) >= char(string_b)) + +! Finish + + return + + end function lge_VS_VS + +!**** + + elemental function lge_CH_VS (string_a, string_b) result (comp) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LGE) a character string and a varying +! string + + comp = (string_a >= char(string_b)) + +! Finish + + return + + end function lge_CH_VS + +!**** + + elemental function lge_VS_CH (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: comp + +! Compare (LGE) a varying string and a character +! string + + comp = (char(string_a) >= string_b) + +! Finish + + return + + end function lge_VS_CH + +!**** + + elemental function lgt_VS_VS (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LGT) two varying strings + + comp = (char(string_a) > char(string_b)) + +! Finish + + return + + end function lgt_VS_VS + +!**** + + elemental function lgt_CH_VS (string_a, string_b) result (comp) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LGT) a character string and a varying +! string + + comp = (string_a > char(string_b)) + +! Finish + + return + + end function lgt_CH_VS + +!**** + + elemental function lgt_VS_CH (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: comp + +! Compare (LGT) a varying string and a character +! string + + comp = (char(string_a) > string_b) + +! Finish + + return + + end function lgt_VS_CH + +!**** + + elemental function lle_VS_VS (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LLE) two varying strings + + comp = (char(string_a) <= char(string_b)) + +! Finish + + return + + end function lle_VS_VS + +!**** + + elemental function lle_CH_VS (string_a, string_b) result (comp) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LLE) a character string and a varying +! string + + comp = (string_a <= char(string_b)) + +! Finish + + return + + end function lle_CH_VS + +!**** + + elemental function lle_VS_CH (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: comp + +! Compare (LLE) a varying string and a character +! string + + comp = (char(string_a) <= string_b) + +! Finish + + return + + end function lle_VS_CH + +!**** + + elemental function llt_VS_VS (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LLT) two varying strings + + comp = (char(string_a) < char(string_b)) + +! Finish + + return + + end function llt_VS_VS + +!**** + + elemental function llt_CH_VS (string_a, string_b) result (comp) + + character(LEN=*), intent(in) :: string_a + type(varying_string), intent(in) :: string_b + logical :: comp + +! Compare (LLT) a character string and a varying +! string + + comp = (string_a < char(string_b)) + +! Finish + + return + + end function llt_CH_VS + +!**** + + elemental function llt_VS_CH (string_a, string_b) result (comp) + + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: comp + +! Compare (LLT) a varying string and a character +! string + + comp = (char(string_a) < string_b) + +! Finish + + return + + end function llt_VS_CH + +!**** + + elemental function repeat_ (string, ncopies) result (repeat_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: ncopies + type(varying_string) :: repeat_string + +! Concatenate several copies of a varying string + + repeat_string = var_str(REPEAT(char(string), ncopies)) + +! Finish + + return + + end function repeat_ + +!**** + + elemental function scan_VS_VS (string, set, back) result (i) + + type(varying_string), intent(in) :: string + type(varying_string), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Scan a varying string for occurrences of +! characters in a varying-string set + + i = SCAN(char(string), char(set), back) + +! Finish + + return + + end function scan_VS_VS + +!**** + + elemental function scan_CH_VS (string, set, back) result (i) + + character(LEN=*), intent(in) :: string + type(varying_string), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Scan a character string for occurrences of +! characters in a varying-string set + + i = SCAN(string, char(set), back) + +! Finish + + return + + end function scan_CH_VS + +!**** + + elemental function scan_VS_CH (string, set, back) result (i) + + type(varying_string), intent(in) :: string + character(LEN=*), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Scan a varying string for occurrences of +! characters in a character-string set + + i = SCAN(char(string), set, back) + +! Finish + + return + + end function scan_VS_CH + +!**** + + elemental function trim_ (string) result (trim_string) + + type(varying_string), intent(in) :: string + type(varying_string) :: trim_string + +! Remove trailing blanks from a varying string + + trim_string = TRIM(char(string)) + +! Finish + + return + + end function trim_ + +!**** + + elemental function verify_VS_VS (string, set, back) result (i) + + type(varying_string), intent(in) :: string + type(varying_string), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Verify a varying string for occurrences of +! characters in a varying-string set + + i = VERIFY(char(string), char(set), back) + +! Finish + + return + + end function verify_VS_VS + +!**** + + elemental function verify_CH_VS (string, set, back) result (i) + + character(LEN=*), intent(in) :: string + type(varying_string), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Verify a character string for occurrences of +! characters in a varying-string set + + i = VERIFY(string, char(set), back) + +! Finish + + return + + end function verify_CH_VS + +!**** + + elemental function verify_VS_CH (string, set, back) result (i) + + type(varying_string), intent(in) :: string + character(LEN=*), intent(in) :: set + logical, intent(in), optional :: back + integer :: i + +! Verify a varying string for occurrences of +! characters in a character-string set + + i = VERIFY(char(string), set, back) + +! Finish + + return + + end function verify_VS_CH + +!**** + + elemental function var_str_ (char_) result (string) + + character(LEN=*), intent(in) :: char_ + type(varying_string) :: string + + integer :: length + integer :: i_char + +! Convert a character string to a varying string + + length = LEN(char_) + + ALLOCATE(string%chars(length+1)) + + forall(i_char = 1:length) + string%chars(i_char) = char_(i_char:i_char) + end forall + string%chars(length+1) = char(0) + +! Finish + + return + + end function var_str_ + +!**** + + function var_str_c_ptr (char_c_ptr) result (string) + + type(c_ptr), intent(in) :: char_c_ptr + type(varying_string) :: string + + CHARACTER(len=1),pointer :: char_(:) + INTEGER :: length + +! Convert a character string to a varying string + + IF (c_ASSOCIATED(char_c_ptr)) THEN + + CALL C_F_POINTER(char_c_ptr, char_, (/HUGE(1)-1/)) + + DO length = 1, SIZE(char_) + IF (char_(length) == CHAR(0)) EXIT + ENDDO + + ALLOCATE(string%chars(length)) + string%chars(:) = char_(1:length) + string%chars(length) = CHAR(0) ! handle absurdus HUGE() case + + ELSE + + string = var_str('') + ENDIF - string%chars => string%chars(tpos+1:ls) - ENDIF - ENDSUBROUTINE split_c - -!----- INDEX procedures ------------------------------------------------------! - FUNCTION index_ss(string,substring,back) - type(VARYING_STRING),INTENT(IN) :: string,substring - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: index_ss - ! returns the starting position in string of the substring - ! scanning from the front or back depending on the logical argument back - LOGICAL :: dir_switch - INTEGER :: ls,lsub,i - ls = LEN(string); lsub = LEN(substring) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls-lsub+1,1,-1 - IF( ALL(string%chars(i:i+lsub-1) == substring%chars) )THEN - index_ss = i - RETURN - ENDIF - ENDDO - index_ss = 0 - ELSE ! forward search - DO i = 1,ls-lsub+1 - IF( ALL(string%chars(i:i+lsub-1) == substring%chars) )THEN - index_ss = i - RETURN - ENDIF - ENDDO - index_ss = 0 - ENDIF - ENDFUNCTION index_ss - - FUNCTION index_sc(string,substring,back) - type(VARYING_STRING),INTENT(IN) :: string - CHARACTER(LEN=*),INTENT(IN) :: substring - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: index_sc - ! returns the starting position in string of the substring - ! scanning from the front or back depending on the logical argument back - LOGICAL :: dir_switch,matched - INTEGER :: ls,lsub,i,j - ls = LEN(string); lsub = LEN(substring) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF (dir_switch) THEN ! backwards search - DO i = ls-lsub+1,1,-1 - matched = .TRUE. - DO j = 1,lsub - IF( string%chars(i+j-1) /= substring(j:j) )THEN - matched = .FALSE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - index_sc = i - RETURN - ENDIF - ENDDO - index_sc = 0 - ELSE ! forward search - DO i = 1,ls-lsub+1 - matched = .TRUE. - DO j = 1,lsub - IF( string%chars(i+j-1) /= substring(j:j) )THEN - matched = .FALSE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - index_sc = i - RETURN - ENDIF - ENDDO - index_sc = 0 - ENDIF - ENDFUNCTION index_sc - - FUNCTION index_cs(string,substring,back) - CHARACTER(LEN=*),INTENT(IN) :: string - type(VARYING_STRING),INTENT(IN) :: substring - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: index_cs - ! returns the starting position in string of the substring - ! scanning from the front or back depending on the logical argument back - LOGICAL :: dir_switch,matched - INTEGER :: ls,lsub,i,j - ls = LEN(string); lsub = LEN(substring) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls-lsub+1,1,-1 - matched = .TRUE. - DO j = 1,lsub - IF( string(i+j-1:i+j-1) /= substring%chars(j) )THEN - matched = .FALSE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - index_cs = i - RETURN - ENDIF - ENDDO - index_cs = 0 - ELSE ! forward search - DO i = 1,ls-lsub+1 - matched = .TRUE. - DO j = 1,lsub - IF( string(i+j-1:i+j-1) /= substring%chars(j) )THEN - matched = .FALSE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - index_cs = i - RETURN - ENDIF - ENDDO - index_cs = 0 - ENDIF - ENDFUNCTION index_cs - -!----- SCAN procedures ------------------------------------------------------! - FUNCTION scan_ss(string,set,back) - type(VARYING_STRING),INTENT(IN) :: string,set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: scan_ss - ! returns the first position in string occupied by a character from - ! the characters in set, scanning is forward or backwards depending on back - LOGICAL :: dir_switch - INTEGER :: ls,i - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls,1,-1 - IF( ANY( set%chars == string%chars(i) ) )THEN - scan_ss = i - RETURN - ENDIF - ENDDO - scan_ss = 0 - ELSE ! forward search - DO i = 1,ls - IF( ANY( set%chars == string%chars(i) ) )THEN - scan_ss = i - RETURN - ENDIF - ENDDO - scan_ss = 0 - ENDIF - ENDFUNCTION scan_ss - - FUNCTION scan_sc(string,set,back) - type(VARYING_STRING),INTENT(IN) :: string - CHARACTER(LEN=*),INTENT(IN) :: set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: scan_sc - ! returns the first position in string occupied by a character from - ! the characters in set, scanning is forward or backwards depending on back - LOGICAL :: dir_switch,matched - INTEGER :: ls,i,j - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls,1,-1 - matched = .FALSE. - DO j = 1,LEN(set) - IF( string%chars(i) == set(j:j) )THEN - matched = .TRUE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - scan_sc = i - RETURN - ENDIF - ENDDO - scan_sc = 0 - ELSE ! forward search - DO i = 1,ls - matched = .FALSE. - DO j = 1,LEN(set) - IF( string%chars(i) == set(j:j) )THEN - matched = .TRUE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - scan_sc = i - RETURN - ENDIF - ENDDO - scan_sc = 0 - ENDIF - ENDFUNCTION scan_sc - - FUNCTION scan_cs(string,set,back) - CHARACTER(LEN=*),INTENT(IN) :: string - type(VARYING_STRING),INTENT(IN) :: set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: scan_cs - ! returns the first position in character string occupied by a character from - ! the characters in set, scanning is forward or backwards depending on back - LOGICAL :: dir_switch,matched - INTEGER :: ls,i,j - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls,1,-1 - matched = .FALSE. - DO j = 1,LEN(set) - IF( string(i:i) == set%chars(j) )THEN - matched = .TRUE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - scan_cs = i - RETURN - ENDIF - ENDDO - scan_cs = 0 - ELSE ! forward search - DO i = 1,ls - matched = .FALSE. - DO j = 1,LEN(set) - IF( string(i:i) == set%chars(j) )THEN - matched = .TRUE. - EXIT - ENDIF - ENDDO - IF( matched )THEN - scan_cs = i - RETURN - ENDIF - ENDDO - scan_cs = 0 - ENDIF - ENDFUNCTION scan_cs - -!----- VERIFY procedures ----------------------------------------------------! - FUNCTION verify_ss(string,set,back) - type(VARYING_STRING),INTENT(IN) :: string,set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: verify_ss - ! returns the first position in string not occupied by a character from - ! the characters in set, scanning is forward or backwards depending on back - LOGICAL :: dir_switch - INTEGER :: ls,i - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - DO i = ls,1,-1 - IF( .NOT.(ANY( set%chars == string%chars(i) )) )THEN - verify_ss = i - RETURN - ENDIF - ENDDO - verify_ss = 0 - ELSE ! forward search - DO i = 1,ls - IF( .NOT.(ANY( set%chars == string%chars(i) )) )THEN - verify_ss = i - RETURN - ENDIF - ENDDO - verify_ss = 0 - ENDIF - ENDFUNCTION verify_ss - - FUNCTION verify_sc(string,set,back) - type(VARYING_STRING),INTENT(IN) :: string - CHARACTER(LEN=*),INTENT(IN) :: set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: verify_sc - ! returns the first position in string not occupied by a character from - ! the characters in set, scanning is forward or backwards depending on back - LOGICAL :: dir_switch - INTEGER :: ls,i,j - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - back_string_search:DO i = ls,1,-1 - DO j = 1,LEN(set) - IF( string%chars(i) == set(j:j) )CYCLE back_string_search - ! cycle string search if string character found in set - ENDDO - ! string character not found in set index i is result - verify_sc = i - RETURN - ENDDO back_string_search - ! each string character found in set - verify_sc = 0 - ELSE ! forward search - frwd_string_search:DO i = 1,ls - DO j = 1,LEN(set) - IF( string%chars(i) == set(j:j) )CYCLE frwd_string_search - ENDDO - verify_sc = i - RETURN - ENDDO frwd_string_search - verify_sc = 0 - ENDIF - ENDFUNCTION verify_sc - - FUNCTION verify_cs(string,set,back) - CHARACTER(LEN=*),INTENT(IN) :: string - type(VARYING_STRING),INTENT(IN) :: set - LOGICAL,INTENT(IN),OPTIONAL :: back - INTEGER :: verify_cs - ! returns the first position in icharacter string not occupied by a character - ! from the characters in set, scanning is forward or backwards depending on - ! back - LOGICAL :: dir_switch - INTEGER :: ls,i,j - ls = LEN(string) - IF( PRESENT(back) )THEN - dir_switch = back - ELSE - dir_switch = .FALSE. - ENDIF - IF(dir_switch)THEN ! backwards search - back_string_search:DO i = ls,1,-1 - DO j = 1,LEN(set) - IF( string(i:i) == set%chars(j) )CYCLE back_string_search - ENDDO - verify_cs = i - RETURN - ENDDO back_string_search - verify_cs = 0 - ELSE ! forward search - frwd_string_search:DO i = 1,ls - DO j = 1,LEN(set) - IF( string(i:i) == set%chars(j) )CYCLE frwd_string_search - ENDDO - verify_cs = i - RETURN - ENDDO frwd_string_search - verify_cs = 0 - ENDIF - ENDFUNCTION verify_cs - -!----- LEN_TRIM procedure ----------------------------------------------------! -FUNCTION len_trim_s(string) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER :: len_trim_s - ! Returns the length of the string without counting trailing blanks - INTEGER :: ls,i - ls=LEN(string) - len_trim_s = 0 - DO i = ls,1,-1 - IF (string%chars(i) /= BLANK) THEN - len_trim_s = i - EXIT - ENDIF - ENDDO -ENDFUNCTION len_trim_s - -!----- TRIM procedure -------------------------------------------------------! -FUNCTION trim_s(string) - type(VARYING_STRING),INTENT(IN) :: string - type(VARYING_STRING) :: trim_s - ! Returns the argument string with trailing blanks removed - INTEGER :: ls,pos,i - ls=LEN(string) - pos=0 - DO i = ls,1,-1 - IF(string%chars(i) /= BLANK) THEN - pos=i - EXIT - ENDIF - ENDDO - ALLOCATE(trim_s%chars(1:pos)) - trim_s%chars(1:pos) = string%chars(1:pos) -ENDFUNCTION trim_s - -!----- IACHAR procedure ------------------------------------------------------! -FUNCTION iachar_s(string) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER :: iachar_s - ! returns the position of the character string in the ISO 646 - ! collating sequence. - ! string must be of length one - IF (LEN(string) /= 1) THEN - WRITE(*,*) " ERROR, argument in IACHAR not of length one" - STOP - ENDIF - iachar_s = IACHAR(string%chars(1)) -ENDFUNCTION iachar_s - -!----- ICHAR procedure ------------------------------------------------------! -FUNCTION ichar_s(string) - type(VARYING_STRING),INTENT(IN) :: string - INTEGER :: ichar_s - ! returns the position of character from string in the processor collating - ! sequence. - ! string must be of length one - IF (LEN(string) /= 1) THEN - WRITE(*,*) " Argument string in ICHAR has to be of length one" - STOP - ENDIF - ichar_s = ICHAR(string%chars(1)) -ENDFUNCTION ichar_s - -!----- ADJUSTL procedure ----------------------------------------------------! -FUNCTION adjustl_s(string) - type(VARYING_STRING),INTENT(IN) :: string - type(VARYING_STRING) :: adjustl_s - ! Returns the string adjusted to the left, removing leading blanks and - ! inserting trailing blanks - INTEGER :: ls,pos - ls=LEN(string) - DO pos = 1,ls - IF(string%chars(pos) /= blank) EXIT - ENDDO - ! pos now holds the position of the first non-blank character - ! or ls+1 if all characters are blank - ALLOCATE(adjustl_s%chars(1:ls)) - adjustl_s%chars(1:ls-pos+1) = string%chars(pos:ls) - adjustl_s%chars(ls-pos+2:ls) = blank -ENDFUNCTION adjustl_s - -!----- ADJUSTR procedure ----------------------------------------------------! -FUNCTION adjustr_s(string) - type(VARYING_STRING),INTENT(IN) :: string - type(VARYING_STRING) :: adjustr_s - ! Returns the string adjusted to the right, removing trailing blanks - ! and inserting leading blanks - INTEGER :: ls,pos - ls=LEN(string) - DO pos = ls,1,-1 - IF(string%chars(pos) /= blank) EXIT - ENDDO - ! pos now holds the position of the last non-blank character - ! or zero if all characters are blank - ALLOCATE(adjustr_s%chars(1:ls)) - adjustr_s%chars(ls-pos+1:ls) = string%chars(1:pos) - adjustr_s%chars(1:ls-pos) = blank -ENDFUNCTION adjustr_s - -ENDMODULE ISO_VARYING_STRING + +! Finish + + return + + end function var_str_c_ptr + +!**** + + subroutine get_ (string, maxlen, iostat) + + type(varying_string), intent(out) :: string + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + + integer :: n_chars_remain + integer :: n_chars_read + character(LEN=GET_BUFFER_LEN) :: buffer + integer :: local_iostat + +! Read from the default unit into a varying string + + string = "" + + if(PRESENT(maxlen)) then + n_chars_remain = maxlen + else + n_chars_remain = HUGE(1) + endif + + read_loop : do + + if(n_chars_remain <= 0) return + + n_chars_read = MIN(n_chars_remain, GET_BUFFER_LEN) + + if(PRESENT(iostat)) then + read(unit=*, FMT="(A)", ADVANCE="NO", & + IOSTAT=iostat, SIZE=n_chars_read) buffer(:n_chars_read) + if(iostat < 0) exit read_loop + if(iostat > 0) return + else + read(unit=*, FMT="(A)", ADVANCE="NO", & + IOSTAT=local_iostat, SIZE=n_chars_read) buffer(:n_chars_read) + if(local_iostat < 0) exit read_loop + endif + + string = string//buffer(:n_chars_read) + n_chars_remain = n_chars_remain - n_chars_read + + end do read_loop + + string = string//buffer(:n_chars_read) + +! Finish (end-of-record) + + return + + end subroutine get_ + +!**** + + subroutine get_unit (unit, string, maxlen, iostat) + + integer, intent(in) :: unit + type(varying_string), intent(out) :: string + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + + integer :: n_chars_remain + integer :: n_chars_read + character(LEN=GET_BUFFER_LEN) :: buffer + integer :: local_iostat + +! Read from the specified unit into a varying string + + string = "" + + if(PRESENT(maxlen)) then + n_chars_remain = maxlen + else + n_chars_remain = HUGE(1) + endif + + read_loop : do + + if(n_chars_remain <= 0) return + + n_chars_read = MIN(n_chars_remain, GET_BUFFER_LEN) + + if(PRESENT(iostat)) then + read(unit=unit, FMT="(A)", ADVANCE="NO", & + IOSTAT=iostat, SIZE=n_chars_read) buffer(:n_chars_read) + if(iostat < 0) exit read_loop + if(iostat > 0) return + else + read(unit=unit, FMT="(A)", ADVANCE="NO", & + IOSTAT=local_iostat, SIZE=n_chars_read) buffer(:n_chars_read) + if(local_iostat < 0) exit read_loop + endif + + string = string//buffer(:n_chars_read) + n_chars_remain = n_chars_remain - n_chars_read + + end do read_loop + + string = string//buffer(:n_chars_read) + +! Finish (end-of-record) + + return + + end subroutine get_unit + +!**** + + subroutine get_set_VS (string, set, separator, maxlen, iostat) + + type(varying_string), intent(out) :: string + type(varying_string), intent(in) :: set + type(varying_string), intent(out), optional :: separator + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + +! Read from the default unit into a varying string, +! with a custom varying-string separator + + call get(string, char(set), separator, maxlen, iostat) + +! Finish + + return + + end subroutine get_set_VS + +!**** + + subroutine get_set_CH (string, set, separator, maxlen, iostat) + + type(varying_string), intent(out) :: string + character(LEN=*), intent(in) :: set + type(varying_string), intent(out), optional :: separator + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + + integer :: n_chars_remain + character(LEN=1) :: buffer + integer :: i_set + integer :: local_iostat + +! Read from the default unit into a varying string, +! with a custom character-string separator + + string = "" + + if(PRESENT(maxlen)) then + n_chars_remain = maxlen + else + n_chars_remain = HUGE(1) + endif + + if(PRESENT(separator)) separator = "" + + read_loop : do + + if(n_chars_remain <= 0) return + + if(PRESENT(iostat)) then + read(unit=*, FMT="(A1)", ADVANCE="NO", IOSTAT=iostat) buffer + if(iostat /= 0) exit read_loop + else + read(unit=*, FMT="(A1)", ADVANCE="NO", IOSTAT=local_iostat) buffer + if(local_iostat /= 0) exit read_loop + endif + + i_set = SCAN(buffer, set) + + if(i_set == 1) then + if(PRESENT(separator)) separator = buffer + exit read_loop + endif + + string = string//buffer + n_chars_remain = n_chars_remain - 1 + + end do read_loop + +! Finish + + return + + end subroutine get_set_CH + +!**** + + subroutine get_unit_set_VS (unit, string, set, separator, maxlen, iostat) + + integer, intent(in) :: unit + type(varying_string), intent(out) :: string + type(varying_string), intent(in) :: set + type(varying_string), intent(out), optional :: separator + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + +! Read from the specified unit into a varying string, +! with a custom varying-string separator + + call get(unit, string, char(set), separator, maxlen, iostat) + +! Finish + + return + + end subroutine get_unit_set_VS + +!**** + + subroutine get_unit_set_CH (unit, string, set, separator, maxlen, iostat) + + integer, intent(in) :: unit + type(varying_string), intent(out) :: string + character(LEN=*), intent(in) :: set + type(varying_string), intent(out), optional :: separator + integer, intent(in), optional :: maxlen + integer, intent(out), optional :: iostat + + integer :: n_chars_remain + character(LEN=1) :: buffer + integer :: i_set + integer :: local_iostat + +! Read from the default unit into a varying string, +! with a custom character-string separator + + string = "" + + if(PRESENT(maxlen)) then + n_chars_remain = maxlen + else + n_chars_remain = HUGE(1) + endif + + if(PRESENT(separator)) separator = "" + + read_loop : do + + if(n_chars_remain <= 0) return + + if(PRESENT(iostat)) then + read(unit=unit, FMT="(A1)", ADVANCE="NO", IOSTAT=iostat) buffer + if(iostat /= 0) exit read_loop + else + read(unit=unit, FMT="(A1)", ADVANCE="NO", IOSTAT=local_iostat) buffer + if(local_iostat /= 0) exit read_loop + endif + + i_set = SCAN(buffer, set) + + if(i_set == 1) then + if(PRESENT(separator)) separator = buffer + exit read_loop + endif + + string = string//buffer + n_chars_remain = n_chars_remain - 1 + + end do read_loop + +! Finish + + return + + end subroutine get_unit_set_CH + +!**** + + subroutine put_VS (string, iostat) + + type(varying_string), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the default unit + + call put(char(string), iostat) + +! Finish + + end subroutine put_VS + +!**** + + subroutine put_CH (string, iostat) + + character(LEN=*), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a character string to the current record of +! the default unit + + if(PRESENT(iostat)) then + write(unit=*, FMT="(A)", ADVANCE="NO", IOSTAT=iostat) string + else + write(unit=*, FMT="(A)", ADVANCE="NO") string + endif + +! Finish + + end subroutine put_CH + +!**** + + subroutine put_unit_VS (unit, string, iostat) + + integer, intent(in) :: unit + type(varying_string), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the specified unit + + call put(unit, char(string), iostat) + +! Finish + + return + + end subroutine put_unit_VS + +!**** + + subroutine put_unit_CH (unit, string, iostat) + + integer, intent(in) :: unit + character(LEN=*), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a character string to the current record of +! the specified unit + + if(PRESENT(iostat)) then + write(unit=unit, FMT="(A)", ADVANCE="NO", IOSTAT=iostat) string + else + write(unit=unit, FMT="(A)", ADVANCE="NO") string + endif + +! Finish + + return + + end subroutine put_unit_CH + +!**** + + subroutine put_line_VS (string, iostat) + + type(varying_string), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the default unit, terminating the record + + call put_line(char(string), iostat) + +! Finish + + return + + end subroutine put_line_VS + +!**** + + subroutine put_line_CH (string, iostat) + + character(LEN=*), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the default unit, terminating the record + + if(PRESENT(iostat)) then + write(unit=*, FMT="(A,/)", ADVANCE="NO", IOSTAT=iostat) string + else + write(unit=*, FMT="(A,/)", ADVANCE="NO") string + endif + +! Finish + + return + + end subroutine put_line_CH + +!**** + + subroutine put_line_unit_VS (unit, string, iostat) + + integer, intent(in) :: unit + type(varying_string), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the specified unit, terminating the record + + call put_line(unit, char(string), iostat) + +! Finish + + return + + end subroutine put_line_unit_VS + +!**** + + subroutine put_line_unit_CH (unit, string, iostat) + + integer, intent(in) :: unit + character(LEN=*), intent(in) :: string + integer, intent(out), optional :: iostat + +! Append a varying string to the current record of +! the specified unit, terminating the record + + if(PRESENT(iostat)) then + write(unit=unit, FMT="(A,/)", ADVANCE="NO", IOSTAT=iostat) string + else + write(unit=unit, FMT="(A,/)", ADVANCE="NO") string + endif + +! Finish + + return + + end subroutine put_line_unit_CH + +!**** + + elemental function extract_VS (string, start, finish) result (ext_string) + + type(varying_string), intent(in) :: string + integer, intent(in), optional :: start + integer, intent(in), optional :: finish + type(varying_string) :: ext_string + +! Extract a varying substring from a varying string + + ext_string = extract(char(string), start, finish) + +! Finish + + return + + end function extract_VS + +!**** + + elemental function extract_CH (string, start, finish) result (ext_string) + + character(LEN=*), intent(in) :: string + integer, intent(in), optional :: start + integer, intent(in), optional :: finish + type(varying_string) :: ext_string + + integer :: start_ + integer :: finish_ + +! Extract a varying substring from a character string + + if(PRESENT(start)) then + start_ = MAX(1, start) + else + start_ = 1 + endif + + if(PRESENT(finish)) then + finish_ = MIN(LEN(string), finish) + else + finish_ = LEN(string) + endif + + ext_string = var_str(string(start_:finish_)) + +! Finish + + return + + end function extract_CH + +!**** + + elemental function insert_VS_VS (string, start, substring) result (ins_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + type(varying_string), intent(in) :: substring + type(varying_string) :: ins_string + +! Insert a varying substring into a varying string + + ins_string = insert(char(string), start, char(substring)) + +! Finish + + return + + end function insert_VS_VS + +!**** + + elemental function insert_CH_VS (string, start, substring) result (ins_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + type(varying_string), intent(in) :: substring + type(varying_string) :: ins_string + +! Insert a varying substring into a character string + + ins_string = insert(string, start, char(substring)) + +! Finish + + return + + end function insert_CH_VS + +!**** + + elemental function insert_VS_CH (string, start, substring) result (ins_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + character(LEN=*), intent(in) :: substring + type(varying_string) :: ins_string + +! Insert a character substring into a varying string + + ins_string = insert(char(string), start, substring) + +! Finish + + return + + end function insert_VS_CH + +!**** + + elemental function insert_CH_CH (string, start, substring) result (ins_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + character(LEN=*), intent(in) :: substring + type(varying_string) :: ins_string + + integer :: start_ + +! Insert a character substring into a character +! string + + start_ = MAX(1, MIN(start, LEN(string)+1)) + + ins_string = var_str(string(:start_-1)//substring//string(start_:)) + +! Finish + + return + + end function insert_CH_CH + +!**** + + elemental function remove_VS (string, start, finish) result (rem_string) + + type(varying_string), intent(in) :: string + integer, intent(in), optional :: start + integer, intent(in), optional :: finish + type(varying_string) :: rem_string + +! Remove a substring from a varying string + + rem_string = remove(char(string), start, finish) + +! Finish + + return + + end function remove_VS + +!**** + + elemental function remove_CH (string, start, finish) result (rem_string) + + character(LEN=*), intent(in) :: string + integer, intent(in), optional :: start + integer, intent(in), optional :: finish + type(varying_string) :: rem_string + + integer :: start_ + integer :: finish_ + +! Remove a substring from a character string + + if(PRESENT(start)) then + start_ = MAX(1, start) + else + start_ = 1 + endif + + if(PRESENT(finish)) then + finish_ = MIN(LEN(string), finish) + else + finish_ = LEN(string) + endif + + if(finish_ >= start_) then + rem_string = var_str(string(:start_-1)//string(finish_+1:)) + else + rem_string = string + endif + +! Finish + + return + + end function remove_CH + +!**** + + elemental function replace_VS_VS_auto (string, start, substring) result (rep_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + type(varying_string), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a varying string with a varying +! substring + + rep_string = replace(char(string), start, MAX(start, 1)+len(substring)-1, char(substring)) + +! Finish + + return + + end function replace_VS_VS_auto + +!**** + + elemental function replace_CH_VS_auto (string, start, substring) result (rep_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + type(varying_string), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a character string with a varying +! substring + + rep_string = replace(string, start, MAX(start, 1)+len(substring)-1, char(substring)) + +! Finish + + return + + end function replace_CH_VS_auto + +!**** + + elemental function replace_VS_CH_auto (string, start, substring) result (rep_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + character(LEN=*), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a varying string with a character +! substring + + rep_string = replace(char(string), start, MAX(start, 1)+LEN(substring)-1, substring) + +! Finish + + return + + end function replace_VS_CH_auto + +!**** + + elemental function replace_CH_CH_auto (string, start, substring) result (rep_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + character(LEN=*), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a character string with a character +! substring + + rep_string = replace(string, start, MAX(start, 1)+LEN(substring)-1, substring) + +! Finish + + return + + end function replace_CH_CH_auto + +!**** + + elemental function replace_VS_VS_fixed (string, start, finish, substring) result (rep_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + integer, intent(in) :: finish + type(varying_string), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a varying string with a varying +! substring + + rep_string = replace(char(string), start, finish, char(substring)) + +! Finish + + return + + end function replace_VS_VS_fixed + +!**** + +!**** + + elemental function replace_CH_VS_fixed (string, start, finish, substring) result (rep_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + integer, intent(in) :: finish + type(varying_string), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a character string with a varying +! substring + + rep_string = replace(string, start, finish, char(substring)) + +! Finish + + return + + end function replace_CH_VS_fixed + +!**** + + elemental function replace_VS_CH_fixed (string, start, finish, substring) result (rep_string) + + type(varying_string), intent(in) :: string + integer, intent(in) :: start + integer, intent(in) :: finish + character(LEN=*), intent(in) :: substring + type(varying_string) :: rep_string + +! Replace part of a varying string with a character +! substring + + rep_string = replace(char(string), start, finish, substring) + +! Finish + + return + + end function replace_VS_CH_fixed + +!**** + + elemental function replace_CH_CH_fixed (string, start, finish, substring) result (rep_string) + + character(LEN=*), intent(in) :: string + integer, intent(in) :: start + integer, intent(in) :: finish + character(LEN=*), intent(in) :: substring + type(varying_string) :: rep_string + + integer :: start_ + integer :: finish_ + +! Replace part of a character string with a character +! substring + + start_ = MAX(1, start) + finish_ = MIN(LEN(string), finish) + + if(finish_ < start_) then + rep_string = insert(string, start_, substring) + else + rep_string = var_str(string(:start_-1)//substring//string(finish_+1:)) + endif + +! Finish + + return + + end function replace_CH_CH_fixed + +!**** + + elemental function replace_VS_VS_VS_target (string, target, substring, every, back) result (rep_string) + + type(varying_string), intent(in) :: string + type(varying_string), intent(in) :: target + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a varying string with a varying +! substring, at a location matching a varying- +! string target + + rep_string = replace(char(string), char(target), char(substring), every, back) + +! Finish + + return + + end function replace_VS_VS_VS_target + +!**** + + elemental function replace_CH_VS_VS_target (string, target, substring, every, back) result (rep_string) + + character(LEN=*), intent(in) :: string + type(varying_string), intent(in) :: target + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a character string with a varying +! substring, at a location matching a varying- +! string target + + rep_string = replace(string, char(target), char(substring), every, back) + +! Finish + + return + + end function replace_CH_VS_VS_target + +!**** + + elemental function replace_VS_CH_VS_target (string, target, substring, every, back) result (rep_string) + + type(varying_string), intent(in) :: string + character(LEN=*), intent(in) :: target + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a character string with a varying +! substring, at a location matching a character- +! string target + + rep_string = replace(char(string), target, char(substring), every, back) + +! Finish + + return + + end function replace_VS_CH_VS_target + +!**** + + elemental function replace_CH_CH_VS_target (string, target, substring, every, back) result (rep_string) + + character(LEN=*), intent(in) :: string + character(LEN=*), intent(in) :: target + type(varying_string), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a character string with a varying +! substring, at a location matching a character- +! string target + + rep_string = replace(string, target, char(substring), every, back) + +! Finish + + return + + end function replace_CH_CH_VS_target + +!**** + + elemental function replace_VS_VS_CH_target (string, target, substring, every, back) result (rep_string) + + type(varying_string), intent(in) :: string + type(varying_string), intent(in) :: target + character(LEN=*), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a varying string with a character +! substring, at a location matching a varying- +! string target + + rep_string = replace(char(string), char(target), substring, every, back) + +! Finish + + return + + end function replace_VS_VS_CH_target + +!**** + + elemental function replace_CH_VS_CH_target (string, target, substring, every, back) result (rep_string) + + character(LEN=*), intent(in) :: string + type(varying_string), intent(in) :: target + character(LEN=*), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a character string with a character +! substring, at a location matching a varying- +! string target + + rep_string = replace(string, char(target), substring, every, back) + +! Finish + + return + + end function replace_CH_VS_CH_target + +!**** + + elemental function replace_VS_CH_CH_target (string, target, substring, every, back) result (rep_string) + + type(varying_string), intent(in) :: string + character(LEN=*), intent(in) :: target + character(LEN=*), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + +! Replace part of a varying string with a character +! substring, at a location matching a character- +! string target + + rep_string = replace(char(string), target, substring, every, back) + +! Finish + + return + + end function replace_VS_CH_CH_target + +!**** + + elemental function replace_CH_CH_CH_target (string, target, substring, every, back) result (rep_string) + + character(LEN=*), intent(in) :: string + character(LEN=*), intent(in) :: target + character(LEN=*), intent(in) :: substring + logical, intent(in), optional :: every + logical, intent(in), optional :: back + type(varying_string) :: rep_string + + logical :: every_ + logical :: back_ + type(varying_string) :: work_string + integer :: length_target + integer :: i_target + +! Handle special cases when LEN(target) == 0. Such +! instances are prohibited by the standard, but +! since this function is elemental, no error can be +! thrown. Therefore, it makes sense to handle them +! in a sensible manner + + if(LEN(target) == 0) then + if(LEN(string) /= 0) then + rep_string = string + else + rep_string = substring + endif + return + end if + +! Replace part of a character string with a character +! substring, at a location matching a character- +! string target + + if(PRESENT(every)) then + every_ = every + else + every_ = .false. + endif + + if(PRESENT(back)) then + back_ = back + else + back_ = .false. + endif + + rep_string = "" + + work_string = string + + length_target = LEN(target) + + replace_loop : do + + i_target = index(work_string, target, back_) + + if(i_target == 0) exit replace_loop + + if(back_) then + rep_string = substring//extract(work_string, start=i_target+length_target)//rep_string + work_string = extract(work_string, finish=i_target-1) + else + rep_string = rep_string//extract(work_string, finish=i_target-1)//substring + work_string = extract(work_string, start=i_target+length_target) + endif + + if(.NOT. every_) exit replace_loop + + end do replace_loop + + if(back_) then + rep_string = work_string//rep_string + else + rep_string = rep_string//work_string + endif + +! Finish + + return + + end function replace_CH_CH_CH_target + +!**** + + elemental subroutine split_VS (string, word, set, separator, back) + + type(varying_string), intent(inout) :: string + type(varying_string), intent(out) :: word + type(varying_string), intent(in) :: set + type(varying_string), intent(out), optional :: separator + logical, intent(in), optional :: back + +! Split a varying string into two verying strings + + call split_CH(string, word, char(set), separator, back) + +! Finish + + return + + end subroutine split_VS + +!**** + + elemental subroutine split_CH (string, word, set, separator, back) + + type(varying_string), intent(inout) :: string + type(varying_string), intent(out) :: word + character(LEN=*), intent(in) :: set + type(varying_string), intent(out), optional :: separator + logical, intent(in), optional :: back + + logical :: back_ + integer :: i_separator + +! Split a varying string into two verying strings + + if(PRESENT(back)) then + back_ = back + else + back_ = .false. + endif + + i_separator = scan(string, set, back_) + + if(i_separator /= 0) then + + if(back_) then + word = extract(string, start=i_separator+1) + if(PRESENT(separator)) separator = extract(string, start=i_separator, finish=i_separator) + string = extract(string, finish=i_separator-1) + else + word = extract(string, finish=i_separator-1) + if(PRESENT(separator)) separator = extract(string, start=i_separator, finish=i_separator) + string = extract(string, start=i_separator+1) + endif + + else + + word = string + if(PRESENT(separator)) separator = "" + string = "" + + endif + +! Finish + + return + + end subroutine split_CH + + + FUNCTION c_ptr_new_VS(string) RESULT(c_ptr_new) + TYPE(varying_string),INTENT(in),TARGET :: string + TYPE(c_ptr) :: c_ptr_new + + c_ptr_new = C_LOC(string%chars(1)) + + END FUNCTION c_ptr_new_VS + + +end module MOD_ISO_VARYING_STRING + diff --git a/src/readin/readin_ANSA.f90 b/src/readin/readin_ANSA.f90 index 2f98649..0a606c6 100644 --- a/src/readin/readin_ANSA.f90 +++ b/src/readin/readin_ANSA.f90 @@ -151,8 +151,7 @@ SUBROUTINE ReadStar() EXIT END IF END DO - IF(.NOT.found) CALL abort(__STAMP__, & - 'UserDefinedBoundary condition missing: '//TRIM(cdummy3),nUserDefinedBoundaries,999.) + IF(.NOT.found) CALL abort(__STAMP__,'UserDefinedBoundary condition missing: '//TRIM(cdummy3),nUserDefinedBoundaries,999.) END IF END DO CLOSE(106) @@ -220,8 +219,7 @@ SUBROUTINE ReadStar() EXIT END IF END DO - IF(.NOT.found) CALL abort(__STAMP__, & - 'a boundary condition was used without corresponding UserDefinedBoundary',dummy2,999.) + IF(.NOT.found) CALL abort(__STAMP__,'a boundary condition was used without corresponding UserDefinedBoundary',dummy2,999.) DO iNode=1,4 NodeBC(conn(iNode),iBC)=.true. END DO @@ -311,8 +309,7 @@ SUBROUTINE ReadStar() ALLOCATE(aElem%Node(nElNodes)) DO iNode=1,nElNodes nodeInd=iDummyArray2(iElem,NodeMap(nElNodes-3,iNode)) - IF(nodeInd.GT.nNodes) CALL abort(__STAMP__, & - 'nodeInd>nNodes,node indizes not contiguous',nodeInd,REAL(nNodes)) + IF(nodeInd.GT.nNodes) CALL abort(__STAMP__,'nodeInd>nNodes,node indizes not contiguous',nodeInd,REAL(nNodes)) IF(.NOT.ASSOCIATED(Nodes(nodeInd)%np))THEN CALL getNewNode(Nodes(nodeInd)%np) END IF @@ -330,8 +327,7 @@ SUBROUTINE ReadStar() EXIT END IF END DO - IF(aElem%zone.EQ.0) CALL abort(__STAMP__, & - 'Zone Number not found in readStar',iDummyArray2(iElem,9),999.) + IF(aElem%zone.EQ.0) CALL abort(__STAMP__,'Zone Number not found in readStar',iDummyArray2(iElem,9),999.) ! boundary conditions aSide=>aElem%firstSide DO WHILE(ASSOCIATED(aSide)) @@ -425,8 +421,7 @@ SUBROUTINE ReadStar() EXIT END IF END DO !iBC - IF(.NOT.found) CALL abort(__STAMP__, & - 'a boundary condition was used without corresponding UserDefinedBoundary',iBCSide,999.) + IF(.NOT.found) CALL abort(__STAMP__,'a boundary condition was used without corresponding UserDefinedBoundary',iBCSide,999.) IF(found) THEN ALLOCATE(aSide%BC) i=MapBC(iBC) !iBC set from exit of upper do loop @@ -482,14 +477,12 @@ SUBROUTINE openstarfile(FileName,unit_in) ACCESS = 'SEQUENTIAL', & IOSTAT = os ) IF(os.NE.0) THEN ! File Error - CALL abort(__STAMP__, & - 'ERROR: cannot open star file: '//trim(FileName),999,999.) + CALL abort(__STAMP__,'ERROR: cannot open star file: '//trim(FileName),999,999.) END IF !V4 or V3 READ(unit_in,*)cdummy IF(INDEX(cdummy,'PROSTAR').NE.0)THEN !star V4 - CALL abort(__STAMP__, & - 'ERROR: star file of version V4, not implemented jet!',999,999.) + CALL abort(__STAMP__,'ERROR: star file of version V4, not implemented jet!',999,999.) ELSE !star V3 REWIND(unit_in) END IF @@ -503,9 +496,10 @@ SUBROUTINE readStar_split(firstElem_in,FileName) ! at firstElem_in. !=================================================================================================================================== ! MODULES -USE MOD_Mesh_Vars,ONLY:tElem,tSide,tSidePtr,tNodePtr -USE MOD_Mesh_Vars,ONLY:ElemCount,SideCount -USE MOD_Mesh_Vars,ONLY:getNewElem,getNewSide,getNewNode +USE MOD_Globals ,ONLY: abort +USE MOD_Mesh_Vars ,ONLY: tElem,tSide,tSidePtr,tNodePtr +USE MOD_Mesh_Vars ,ONLY: ElemCount,SideCount +USE MOD_Mesh_Vars ,ONLY: getNewElem,getNewSide,getNewNode ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -556,9 +550,7 @@ SUBROUTINE readStar_split(firstElem_in,FileName) DO ! ElemID, 8 Nodes, PID, ??? READ(105,*,iostat=os) dummy1, conn(:),dummy2,dummy3 IF(os.NE.0) EXIT !end of file - IF(conn(5).NE.0) THEN - STOP 'not surface elements!' - END IF + IF(conn(5).NE.0) CALL abort(__STAMP__,'not surface elements!') nElems=nElems+1 END DO CLOSE(105) @@ -591,8 +583,7 @@ SUBROUTINE readStar_split(firstElem_in,FileName) READ(105,*,iostat=os) dummy1, conn(:),dummy2,dummy3 IF(os.NE.0) EXIT !end of file IF(conn(5).NE.0) THEN - CALL abort(__STAMP__, & - 'ERROR: split element list contains volumes!'//TRIM(FileName)//'.cel',999,999.) + CALL abort(__STAMP__,'ERROR: split element list contains volumes!'//TRIM(FileName)//'.cel',999,999.) END IF iElem=iElem+1 !find out number of element nodes @@ -623,8 +614,7 @@ SUBROUTINE readStar_split(firstElem_in,FileName) END DO DO iNode=1,nElNodes nodeInd=ElemConnect(iElem,iNode) - IF(nodeInd .GT. nNodes) CALL abort(__STAMP__, & - 'ERROR: nodeInd>nNodes, node indizes are not contiguous!',nodeInd,REAL(nNodes)) + IF(nodeInd .GT. nNodes) CALL abort(__STAMP__,'ERROR: nodeInd>nNodes, node indizes are not contiguous!',nodeInd,REAL(nNodes)) IF(.NOT.ASSOCIATED(Nodes(nodeInd)%np))THEN CALL getNewNode(Nodes(nodeInd)%np) Nodes(nodeInd)%np%ind=nodeInd diff --git a/src/readin/readin_CGNS.f90 b/src/readin/readin_CGNS.f90 index 1494170..9861fa2 100644 --- a/src/readin/readin_CGNS.f90 +++ b/src/readin/readin_CGNS.f90 @@ -73,7 +73,6 @@ SUBROUTINE ReadCGNSmesh() USE MOD_Mesh_Vars,ONLY:nMeshFiles,MeshFileName USE MOD_Mesh_Vars,ONLY:MeshDim USE MOD_Mesh_Vars,ONLY:n2dNodes -USE MOD_Mesh_Vars,ONLY:nZones USE MOD_Mesh_Vars,ONLY:FirstElem ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE @@ -102,8 +101,7 @@ SUBROUTINE ReadCGNSmesh() #endif /*defined PP_USE_CGNS*/ !=================================================================================================================================== #ifndef PP_USE_CGNS -CALL ABORT(__STAMP__, & - 'ReadCGNSmesh needs compilation with USE_CGNS flag!') +CALL ABORT(__STAMP__,'ReadCGNSmesh needs compilation with USE_CGNS flag!') #else WRITE(UNIT_stdOut,'(132("~"))') CALL Timer(.TRUE.) @@ -149,7 +147,7 @@ SUBROUTINE ReadCGNSmesh() CALL abortCGNS(__STAMP__,CGNSFile) IF((INT(CellDim) .NE. MeshDim))THEN! .OR. (PhysDim .NE. MeshDim))THEN WRITE(UNIT_stdOut,*)'ERROR-Invalid dimensions in CGNS file: CellDim=',CellDim,', PhysDim=',PhysDim,'(MeshDim=',MeshDim,')' - STOP + CALL abort(__STAMP__,'ERROR-Invalid dimensions in CGNS file') END IF ! Get number of zones in CGNSBase CALL CG_NZONES_F(CGNSfile,CGNSBase,nCGNSZones,iError) @@ -165,7 +163,7 @@ SUBROUTINE ReadCGNSmesh() ELSEIF(ZoneType.EQ.Unstructured)THEN CALL ReadCGNSMeshUnstruct(FirstElem,CGNSFile,CGNSBase,iZone,nZonesGlob,nNodesGlob) ELSE - STOP 'Wrong zone type specifier, should be structured or unstructured.' + CALL abort(__STAMP__,'Wrong zone type specifier, should be structured or unstructured.') END IF @@ -337,8 +335,8 @@ SUBROUTINE ReadCGNSMeshUnstruct(FirstElem_in,CGNSFile,CGNSBase,iZone,nZonesGlob, #endif /*(PP_CGNS_VERSION>=4000)*/ ! Check if 2D element is not oriented in z+, check only first element# + orient2D=.TRUE. ! IF(MeshDim .EQ. 2)THEN - orient2D=.TRUE. ! IF(SectionElemType .EQ. MIXED) THEN locType=LocalConnect(1) iStart=2 @@ -503,6 +501,7 @@ SUBROUTINE ReadCGNSMeshUnstruct(FirstElem_in,CGNSFile,CGNSBase,iZone,nZonesGlob, END IF ! I think we will finish the boundaries + SideIsBCSide=.FALSE. DO iElem=1,nElems Side=>Elems(iElem)%EP%firstSide DO WHILE(ASSOCIATED(Side)) @@ -734,7 +733,7 @@ SUBROUTINE ReadCGNSMeshStruct(FirstElem_in,CGNSFile,CGNSBase,iZone,nZonesGlob,nN ELSEIF(meshdim.EQ.2) THEN ALLOCATE(nodeCoords(3,1:irmax(1),1:irmax(2),1)) ELSE - STOP 'Incompatible meshDimension' + CALL abort(__STAMP__,'Incompatible meshDimension') END IF ! Read Coordinates @@ -768,6 +767,7 @@ SUBROUTINE ReadCGNSMeshStruct(FirstElem_in,CGNSFile,CGNSBase,iZone,nZonesGlob,nN scalprod=SUM(dir(whichdir,:)*(/0.,0.,1./)) IF(ABS(scalprod).GT.0.95) EXIT END DO + zFit = .FALSE. SELECT CASE(whichDir) CASE(1) stepk=nSkipZ @@ -779,14 +779,14 @@ SUBROUTINE ReadCGNSMeshStruct(FirstElem_in,CGNSFile,CGNSBase,iZone,nZonesGlob,nN stepm=nSkipZ zFit=.NOT.(MOD((irmax(3)-1),stepm).NE.0) END SELECT - IF(.NOT.zfit)THEN + IF(.NOT.zFit)THEN IF(useCurveds)THEN WRITE(UNIT_StdOut,'(A)') 'WARNING: cannot read block, step=(order-1)*nSkipZ does not fit with block elem size.' ELSE WRITE(UNIT_StdOut,'(A)') 'WARNING: cannot read block, nSkipZ does not fit with block elem size.' END IF RETURN - END IF !zfit + END IF !zFit ! Now apply nSkip in z-dir ALLOCATE(NodeCoordsTmp(3,1:((irmax(1)-1)/stepk)+1,1:((irmax(2)-1)/stepl)+1,1:((irmax(3)-1)/stepm)+1)) @@ -1138,8 +1138,7 @@ SUBROUTINE ReadCGNSSurfaceMesh(FirstElem_in,FileName) #endif /*defined PP_USE_CGNS*/ !=================================================================================================================================== #ifndef PP_USE_CGNS -CALL ABORT(__STAMP__, & - 'ReadCGNSsurfaceMesh needs compilation with USE_CGNS flag!') +CALL ABORT(__STAMP__,'ReadCGNSsurfaceMesh needs compilation with USE_CGNS flag!') #else WRITE(UNIT_stdOut,*)'Read CGNS Surface File: ',TRIM(FileName) ! Open CGNS file @@ -1175,7 +1174,7 @@ SUBROUTINE ReadCGNSSurfaceMesh(FirstElem_in,FileName) CALL cg_zone_type_f(CGNSFile, CGNSBase, iZone, ZoneType, iError) IF (iError .NE. CG_OK) CALL cg_error_exit_f() IF (ZoneType.EQ.Structured)THEN - STOP 'no structured readin for surface data' + CALL abort(__STAMP__,'no structured readin for surface data') END IF coordNameCGNS(1) = 'CoordinateX' coordNameCGNS(2) = 'CoordinateY' @@ -1267,8 +1266,7 @@ SUBROUTINE ReadCGNSSurfaceMesh(FirstElem_in,FileName) iElem=iElem+1 IF(iElem.GT.nElems)THEN CALL closeFile(CGNSFile) - CALL abort(__STAMP__,& - 'Something wrrrrong with surf element numbers in CGNS File zone :',INT(iZone)) + CALL abort(__STAMP__,'Something wrrrrong with surf element numbers in CGNS File zone :',INT(iZone)) END IF ElemConnect(1 ,iElem)=LocType @@ -1418,8 +1416,7 @@ SUBROUTINE openBase(ioName,mode,celldim,physdim,CGNSFile,CGNSBase,externBase_in) CGNSbase=i IF( (cd .NE. cellDim) .OR. (pd .NE. physDim))THEN CALL closeFile(CGNSFile) - CALL abort(__STAMP__,& - 'Wrong dimensionalities in database ' // TRIM(basename) // ' in file:'//TRIM(filename),INT(cellDim),REAL(physDim)) + CALL abort(__STAMP__,'Wrong dimensionalities in database ' // TRIM(basename) // ' in file:'//TRIM(filename),INT(cellDim),REAL(physDim)) END IF END IF END DO @@ -1429,8 +1426,7 @@ SUBROUTINE openBase(ioName,mode,celldim,physdim,CGNSFile,CGNSBase,externBase_in) IF (CGNSBase .EQ. -999) THEN ! not found IF(mode .EQ. MODE_READ)THEN CALL closeFile(CGNSFile) - CALL abort(__STAMP__,& - 'Cannot find base '//TRIM(basename)//' in cgns file: '//TRIM(filename)) + CALL abort(__STAMP__,'Cannot find base '//TRIM(basename)//' in cgns file: '//TRIM(filename)) END IF IF((mode .EQ. MODE_MODIFY) .OR. (mode.EQ.MODE_WRITE)) THEN ! create base anyway diff --git a/src/readin/readin_GMSH.f90 b/src/readin/readin_GMSH.f90 index a9a458f..099afd8 100644 --- a/src/readin/readin_GMSH.f90 +++ b/src/readin/readin_GMSH.f90 @@ -9,6 +9,7 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx +! Copyright (C) 2023 Florian Hindenlang ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -588,16 +589,16 @@ SUBROUTINE buildElem(elem,elemCount,gmshElemType,Nodes,nodeInds) !> Assigning the nodes of a 2D/3D element !=================================================================================================================================== ! MODULES -USE MOD_Basis_Vars,ONLY:TetraMap,PyraMap,PrismMap,HexaMap -USE MOD_Mesh_Vars,ONLY:tElem,tElemPtr,tSide,tNode,tNodePtr -USE MOD_Mesh_Vars,ONLY:N, MeshDim -USE MOD_Mesh_Vars,ONLY:getNewElem,getNewBC -USE MOD_Mesh_Vars,ONLY:useCurveds,rebuildCurveds -USE MOD_Mesh_Basis,ONLY:createSides -USE MOD_Readin_GMSH_Vars,ONLY:bOrd,getGMSHVolumeMapping,GMSH_TYPES -USE MOD_Readin_GMSH_Vars,ONLY:tetMapGMSH,pyrMapGMSH,priMapGMSH,hexMapGMSH -USE MOD_Readin_GMSH_Vars,ONLY:tetMapCGNSToGMSH,pyrMapCGNSToGMSH,priMapCGNSToGMSH,hexMapCGNSToGMSH -USE MOD_Readin_GMSH_Vars,ONLY:quadMapCGNSToGMSH +USE MOD_Basis_Vars ,ONLY: TetraMap,PyraMap,PrismMap,HexaMap +USE MOD_Mesh_Vars ,ONLY: tElem,tElemPtr,tSide,tNode,tNodePtr +USE MOD_Mesh_Vars ,ONLY: N, MeshDim +USE MOD_Mesh_Vars ,ONLY: getNewElem,getNewBC +USE MOD_Mesh_Vars ,ONLY: useCurveds,rebuildCurveds +USE MOD_Mesh_Basis ,ONLY: createSides +USE MOD_Readin_GMSH_Vars ,ONLY: bOrd,getGMSHVolumeMapping,GMSH_TYPES +USE MOD_Readin_GMSH_Vars ,ONLY: tetMapGMSH,pyrMapGMSH,priMapGMSH,hexMapGMSH +USE MOD_Readin_GMSH_Vars ,ONLY: tetMapCGNSToGMSH,pyrMapCGNSToGMSH,priMapCGNSToGMSH,hexMapCGNSToGMSH +USE MOD_Readin_GMSH_Vars ,ONLY: quadMapCGNSToGMSH ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -617,13 +618,11 @@ SUBROUTINE buildElem(elem,elemCount,gmshElemType,Nodes,nodeInds) IF (bOrd .EQ.0) THEN bOrd = GMSH_TYPES(4,gmshElemType)+1 IF ((bOrd .NE. N+1).AND.useCurveds.AND..NOT.rebuildCurveds) & - CALL abort(__STAMP__,& - 'Mesh boundary order not equal to boundary order from ini file! Mesh order: ',N+1) + CALL abort(__STAMP__,'Mesh boundary order not equal to boundary order from ini file! Mesh order: ',N+1) CALL getGMSHVolumeMapping() ELSE IF (bOrd.NE.GMSH_TYPES(4,gmshElemType)+1) & - CALL abort(__STAMP__,& - 'All elements in the mesh are required to have the same boundary order!') + CALL abort(__STAMP__,'All elements in the mesh are required to have the same boundary order!') END IF ! Advance number of 3D elements @@ -635,8 +634,15 @@ SUBROUTINE buildElem(elem,elemCount,gmshElemType,Nodes,nodeInds) ALLOCATE(Elem%ep%Node(elem%ep%nNodes)) DO i=1,elem%ep%nNodes + NULLIFY(elem%ep%node(i)%np) SELECT CASE(elem%ep%nNodes) - CASE(4) +CASE(3) + IF(MeshDim.EQ.2) THEN + elem%ep%node(i)%np => Nodes(nodeInds(i))%NP + ELSE + CALL abort(__STAMP__,'Unknown element type, 3D element with 3 nodes...!') + END IF +CASE(4) IF(MeshDim.EQ.2) THEN elem%ep%node(i)%np => Nodes(nodeInds(quadMapCGNSToGMSH(i)))%np ELSE @@ -648,8 +654,8 @@ SUBROUTINE buildElem(elem,elemCount,gmshElemType,Nodes,nodeInds) elem%ep%node(i)%np => Nodes(nodeInds(PriMapCGNSToGMSH(i)))%np CASE(8) elem%ep%node(i)%np => Nodes(nodeInds(HexMapCGNSToGMSH(i)))%np - CASE DEFAULT - STOP 'Unknown element type!' + CASE DEFAULT + CALL abort(__STAMP__,'Unknown element type!') END SELECT elem%ep%node(i)%np%refCount = elem%ep%node(i)%np%refCount+1 END DO @@ -665,10 +671,10 @@ SUBROUTINE buildElem(elem,elemCount,gmshElemType,Nodes,nodeInds) CASE(4) elem%ep%curvedNode(i)%np => Nodes(nodeInds(tetMapGMSH(tetraMap(i,1),tetraMap(i,2),tetraMap(i,3))))%np CASE(5) - STOP 'High order pyramids not implemented yet for GMSH!' + CALL abort(__STAMP__,'High order pyramids not implemented yet for GMSH!') elem%ep%curvedNode(i)%np => Nodes(nodeInds(pyrMapGMSH(pyraMap(i,1),pyraMap(i,2),pyraMap(i,3))))%np CASE(6) - STOP 'High order prisms not implemented yet for GMSH!' + CALL abort(__STAMP__,'High order prisms not implemented yet for GMSH!') elem%ep%curvedNode(i)%np => Nodes(nodeInds(priMapGMSH(prismMap(i,1),prismMap(i,2),prismMap(i,3))))%np CASE(8) elem%ep%curvedNode(i)%np => Nodes(nodeInds(hexMapGMSH(hexaMap(i,1),hexaMap(i,2),hexaMap(i,3))))%np diff --git a/src/readin/readin_GMSH_Vars.f90 b/src/readin/readin_GMSH_Vars.f90 index 99f974a..464918b 100644 --- a/src/readin/readin_GMSH_Vars.f90 +++ b/src/readin/readin_GMSH_Vars.f90 @@ -411,8 +411,7 @@ SUBROUTINE getGMSHVolumeMapping() hexMapGMSH(3,3,3)= 6 CASE DEFAULT - CALL abort(__STAMP__,& - 'Elements of specified or higher order are not implemented yet. Order: ',bOrd) + CALL abort(__STAMP__,'Elements of specified or higher order are not implemented yet. Order: ',bOrd) END SELECT END SUBROUTINE getGMSHVolumeMapping diff --git a/src/readin/readin_ICEM.f90 b/src/readin/readin_ICEM.f90 index 1307f95..1776be1 100644 --- a/src/readin/readin_ICEM.f90 +++ b/src/readin/readin_ICEM.f90 @@ -141,7 +141,7 @@ SUBROUTINE readSpecEdges() END IF IF(MOD(iCounter-1,N).EQ.0.AND.dummyline.NE.'Edge')THEN WRITE(UNIT_stdOut,*)TRIM(filename),' in line',iCounter,' is not conform to boundaryOrder or corrupted' - STOP + CALL abort(__STAMP__,'not conform to boundaryOrder or corrupted') ENDIF END DO @@ -159,13 +159,13 @@ SUBROUTINE readSpecEdges() read(helpstring,*,IOSTAT=read_stat)EdgeIndex(iEdge,1:2) IF (read_stat.NE.0.OR.dummyline(1:17).NE.'Edge definition (') THEN WRITE(UNIT_stdOut,*)TRIM(filename),' in line',N*(iEdge-1)+1,'does not have the right format' - STOP + CALL abort(__STAMP__,'invalid format') END IF DO ii=1,N-1 READ(105,*,IOSTAT=read_stat) EdgeNodes(iEdge,ii,1:3) IF (read_stat.ne.0) THEN WRITE(UNIT_stdOut,*)TRIM(filename),' does not have the right format' - STOP + CALL abort(__STAMP__,'invalid format') END IF END DO IF (EdgeIndex(iEdge,1).GT.EdgeIndex(iEdge,2)) THEN !reverse nodes and indices if not oriented diff --git a/src/readin/readin_gambit.f90 b/src/readin/readin_gambit.f90 index b11ff2a..3457213 100644 --- a/src/readin/readin_gambit.f90 +++ b/src/readin/readin_gambit.f90 @@ -211,8 +211,7 @@ SUBROUTINE ReadGambit() DO iZone = 1, nZones iGlZone=iGlZone+1 IF (iGlZone .GT. nZones) & - CALL abort(__STAMP__, & - 'inconsistent numer of Zones in readGambit',999,999.) + CALL abort(__STAMP__,'inconsistent numer of Zones in readGambit',999,999.) IF(useBinary)THEN READ(104) dummy1 ELSE @@ -276,8 +275,7 @@ SUBROUTINE ReadGambit() EXIT END IF END DO - IF(.NOT.foundBC) CALL abort(__STAMP__, & - 'UserDefinedBoundary condition missing: '//TRIM(strBC),nUserDefinedBoundaries,999.) + IF(.NOT.foundBC) CALL abort(__STAMP__,'UserDefinedBoundary condition missing: '//TRIM(strBC),nUserDefinedBoundaries,999.) ALLOCATE(iDummyArray2(nBCElems,3)) IF(useBinary)THEN READ(104)iDummyArray2 diff --git a/src/readin/readin_hdf5.f90 b/src/readin/readin_hdf5.f90 index 4224871..cb74cbb 100644 --- a/src/readin/readin_hdf5.f90 +++ b/src/readin/readin_hdf5.f90 @@ -91,8 +91,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) !=================================================================================================================================== IF(initMesh) RETURN INQUIRE (FILE=TRIM(FileString), EXIST=fileExists) -IF(.NOT.FileExists) CALL abort(__STAMP__, & - 'readMesh from HDF5, file "'//TRIM(FileString)//'" does not exist') +IF(.NOT.FileExists) CALL abort(__STAMP__,'readMesh from HDF5, file "'//TRIM(FileString)//'" does not exist') WRITE(UNIT_stdOut,'(132("~"))') CALL Timer(.TRUE.) @@ -122,7 +121,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) IF(N.NE.Ngeo) THEN WRITE(*,*) 'boundary order of inifile = ',N+1,& ' does not match the boundary order in the mesh file:', Ngeo+1 - STOP + CALL abort(__STAMP__,'boundary order of inifile does not match the boundary order in the mesh file') END IF END IF !---------------------------------------------------------------------------------------------------------------------------- @@ -177,8 +176,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) IF(N.EQ.1)THEN IF(Elem%nNodes.NE.locnNodes) THEN write(*,*) Elem%nNodes, locnNodes - CALL abort(__STAMP__, & - ' Sanity check, number of element nodes do not fit for Ngeo=1') + CALL abort(__STAMP__,' Sanity check, number of element nodes do not fit for Ngeo=1') END IF DO i=1,Elem%nNodes iNode=iNode+1 @@ -202,8 +200,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) CASE(8) !hex Elem%nCurvedNodes=(N+1)**3 END SELECT - IF(Elem%nCurvedNodes.NE.LocnNodes) CALL abort(__STAMP__, & - ' Sanity check, number of curved element nodes do not fit') + IF(Elem%nCurvedNodes.NE.LocnNodes) CALL abort(__STAMP__,' Sanity check, number of curved element nodes do not fit') ALLOCATE(Elem%CurvedNode(Elem%nCurvedNodes)) DO i=1,Elem%nCurvedNodes iNode=iNode+1 @@ -323,7 +320,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) END DO !j=1,Side%nNodes ELSE !not oriented aSide%flip=MOD(Sideinfo(SIDE_nbLocSide_Flip,iSide),10) - IF((aSide%flip.LT.0).OR.(aSide%flip.GT.4)) STOP 'NodeID doesnt belong to side' + IF((aSide%flip.LT.0).OR.(aSide%flip.GT.4)) CALL abort(__STAMP__,'NodeID doesnt belong to side') k=aSide%flip DO j=1,aSide%nNodes aSide%OrientedNode(j)%np=>aSide%Node(k)%np @@ -337,7 +334,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) DO iMortar=1,aSide%nMortars iSide=iSide+1 aSide%mortarSide(iMortar)%sp%Elem=>Elem - IF(SideInfo(SIDE_ID,iSide).LT.0) STOP 'Problem in Mortar readin,should be flip=0' + IF(SideInfo(SIDE_ID,iSide).LT.0) CALL abort(__STAMP__,'Problem in Mortar readin,should be flip=0') aSide%mortarSide(iMortar)%sp%flip=0 aSide%mortarSide(iMortar)%sp%Ind=ABS(SideInfo(SIDE_ID,iSide)) END DO !iMortar @@ -415,8 +412,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) bbSide=>bbSide%nextElemSide END DO ELSE !MPI connection - CALL abort(__STAMP__, & - ' elemID of neighbor not in global Elem list ') + CALL abort(__STAMP__,' elemID of neighbor not in global Elem list ') END IF END IF END DO !iMortar @@ -481,8 +477,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) aSide=>Elem%firstSide DO WHILE(ASSOCIATED(aSide)) IF(aSide%LocSide .LE. 0) & - CALL abort(__STAMP__, & - 'io_hdf5: Side%LocSide not set!',999,999.) + CALL abort(__STAMP__,'io_hdf5: Side%LocSide not set!',999,999.) IF(ASSOCIATED(aSide%BC))THEN IF((.NOT. ASSOCIATED(aSide%Connection)) .AND. (aSide%BC%BCType .EQ. 1))THEN IF (aSide%nMortars.EQ.0) i1=i1+1 @@ -502,8 +497,7 @@ SUBROUTINE ReadMeshFromHDF5(FileString,doConnection) END DO IF(i1+j1 .GT. 0) THEN LOGWRITE(*,*)'..',k1 - CALL abort(__STAMP__, & - 'missing Connection of Side: with/without BC',i1,REAL(j1)) + CALL abort(__STAMP__,'missing Connection of Side: with/without BC',i1,REAL(j1)) END IF END IF @@ -637,7 +631,7 @@ SUBROUTINE ReadBCs() ! Read boundary types from HDF5 file CALL GetHDF5DataSize(File_ID,'BCType',nDims,HSize) -IF(HSize(2).NE.nBCs) STOP 'Problem in readBC' +IF(HSize(2).NE.nBCs) CALL abort(__STAMP__,'Problem in readBC') ERRWRITE(*,*)'BCType: ',nDims,HSize(:) DEALLOCATE(HSize) ALLOCATE(BCType(4,nBCs)) diff --git a/src/readin/readin_specmesh2d.f90 b/src/readin/readin_specmesh2d.f90 index 2f14605..783259e 100644 --- a/src/readin/readin_specmesh2d.f90 +++ b/src/readin/readin_specmesh2d.f90 @@ -135,7 +135,7 @@ SUBROUTINE ReadSpecMesh2D() IOSTAT = os ) IF ( os /= 0 ) THEN WRITE(UNIT_stdOut,*) 'Error opening file: ', TRIM(MeshFileName(iFile)) - STOP + CALL abort(__STAMP__,'Error opening file') ELSE WRITE(UNIT_stdOut,*) 'Reading mesh from file: ',TRIM(MeshFileName(iFile)) END IF @@ -340,7 +340,6 @@ SUBROUTINE ReadSpecMesh2D() END DO IF(BC_ID(k).EQ.-1) THEN WRITE(UNIT_stdOut,*)'ERROR - Could not find corresponding boundary definition of ',TRIM(BCnames(k)) - !STOP END IF END IF END DO !k=1,4 diff --git a/src/readin/readintools.f90 b/src/readin/readintools.f90 index ea83cfb..7c32c44 100644 --- a/src/readin/readintools.f90 +++ b/src/readin/readintools.f90 @@ -9,7 +9,7 @@ ! /____// /____// /______________// /____// /____// |_____/) ,X` XXX` ! )____) )____) )______________) )____) )____) )_____) ,xX` .XX` ! xxX` XXx -! Copyright (C) 2017 Florian Hindenlang +! Copyright (C) 2023 Florian Hindenlang ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! @@ -29,7 +29,7 @@ MODULE MOD_ReadInTools !=================================================================================================================================== ! MODULES USE MOD_Globals -USE ISO_VARYING_STRING +USE MOD_ISO_VARYING_STRING ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE PRIVATE @@ -45,6 +45,7 @@ MODULE MOD_ReadInTools PUBLIC::IgnoredStrings PUBLIC::FillStrings PUBLIC::STRICMP +PUBLIC::FinalizeStrings !=================================================================================================================================== @@ -108,6 +109,10 @@ MODULE MOD_ReadInTools MODULE PROCEDURE DeleteString END INTERFACE +INTERFACE FinalizeStrings + MODULE PROCEDURE FinalizeStrings +END INTERFACE + TYPE tString TYPE(Varying_String)::Str TYPE(tString),POINTER::NextStr,PrevStr @@ -147,8 +152,7 @@ FUNCTION TRYREAD(UnitLoc,Key,abortOpt) IF(TRIM(Key).NE.TRIM(tmp)) TRYREAD=.FALSE. IF(.NOT.TRYREAD.AND.abortLoc)& - CALL abort(__STAMP__,& - 'Keyword '//TRIM(Key)//' not found in file.') + CALL abort(__STAMP__,'Keyword '//TRIM(Key)//' not found in file.') END FUNCTION TRYREAD @@ -227,8 +231,7 @@ FUNCTION CNTSTR(Key,Proposal) CntStr=IntProposal ELSE SWRITE(UNIT_StdOut,*) 'Inifile missing necessary keyword item : ',TRIM(TmpKey) - CALL abort(__STAMP__, & - 'Code stopped during inifile parsing!') + CALL abort(__STAMP__,'Code stopped during inifile parsing!') END IF END IF END FUNCTION CNTSTR @@ -464,7 +467,7 @@ SUBROUTINE IgnoredStrings() ! Prints out remaining strings in list after read-in is complete !=================================================================================================================================== ! MODULES -USE ISO_VARYING_STRING +USE MOD_ISO_VARYING_STRING ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -493,7 +496,7 @@ SUBROUTINE FillStrings(IniFile) ! with "firstString" !=================================================================================================================================== ! MODULES -USE ISO_VARYING_STRING +USE MOD_ISO_VARYING_STRING USE,INTRINSIC :: ISO_FORTRAN_ENV,ONLY:IOSTAT_END ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE @@ -509,6 +512,7 @@ SUBROUTINE FillStrings(IniFile) CHARACTER(LEN=300) :: File ! ? TYPE(Varying_String) :: aStr,bStr,Separator ! ? INTEGER :: EOF ! ? +LOGICAL :: newString !=================================================================================================================================== ! Check if we have read in ini file already IF (ReadInDone) RETURN @@ -529,45 +533,49 @@ SUBROUTINE FillStrings(IniFile) EOF=0 NULLIFY(Str1,Str2) +newString = .FALSE. DO WHILE(EOF.NE.IOSTAT_END) IF(.NOT.ASSOCIATED(Str1)) CALL GetNewString(Str1) - ! Read line from file - CALL Get(103,aStr,iostat=EOF) - IF (EOF.NE.IOSTAT_END) THEN - ! Remove comments with "!" - CALL Split(aStr,Str1%Str,"!") - ! Remove comments with "#" - CALL Split(Str1%Str,bStr,"#") - Str1%Str=bStr - ! Remove "%" sign from old ini files, i.e. mesh% disc% etc. - CALL Split(Str1%Str,bStr,"%",Separator,Back=.false.) - ! If we have a newtype ini file, take the other part - IF(LEN(CHAR(Separator)).EQ.0) Str1%Str=bStr - ! Remove blanks - Str1%Str=Replace(Str1%Str," ","",Every=.true.) - ! Remove tabulator - Str1%Str=Replace(Str1%Str,CHAR(9),"",Every=.true.) - ! Replace brackets - Str1%Str=Replace(Str1%Str,"(/"," ",Every=.true.) - Str1%Str=Replace(Str1%Str,"/)"," ",Every=.true.) - ! Replace commas - Str1%Str=Replace(Str1%Str,","," ",Every=.true.) - ! Lower case - HelpStr = CHAR(Str1%Str) ! define HelpStr to set size of deferred-shape array - CALL LowCase(CHAR(Str1%Str),HelpStr) ! overwrite HelpStr without modifying size - ! If we have a remainder (no comment only) - IF(LEN_TRIM(HelpStr).GT.2) THEN - Str1%Str=Var_Str(HelpStr) - IF(.NOT.ASSOCIATED(Str2)) THEN - FirstString=>Str1 - ELSE - Str2%NextStr=>Str1 - Str1%PrevStr=>Str2 - END IF - Str2=>Str1 - CALL GetNewString(Str1) + + ! Read line from file + CALL Get(103,aStr,iostat=EOF) + IF (EOF.NE.IOSTAT_END) THEN + IF (newString) CALL GetNewString(Str1) + newString = .FALSE. + ! Remove comments with "!" + CALL Split(aStr,Str1%Str,"!") + ! Remove comments with "#" + CALL Split(Str1%Str,bStr,"#") + Str1%Str=bStr + ! Remove "%" sign from old ini files, i.e. mesh% disc% etc. + CALL Split(Str1%Str,bStr,"%",Separator,Back=.false.) + ! If we have a newtype ini file, take the other part + IF(LEN(CHAR(Separator)).EQ.0) Str1%Str=bStr + ! Remove blanks + Str1%Str=Replace(Str1%Str," ","",Every=.true.) + ! Remove tabulator + Str1%Str=Replace(Str1%Str,CHAR(9),"",Every=.true.) + ! Replace brackets + Str1%Str=Replace(Str1%Str,"(/"," ",Every=.true.) + Str1%Str=Replace(Str1%Str,"/)"," ",Every=.true.) + ! Replace commas + Str1%Str=Replace(Str1%Str,","," ",Every=.true.) + ! Lower case + HelpStr = CHAR(Str1%Str) ! define HelpStr to set size of deferred-shape array + CALL LowCase(CHAR(Str1%Str),HelpStr) ! overwrite HelpStr without modifying size + ! If we have a remainder (no comment only) + IF(LEN_TRIM(HelpStr).GT.2) THEN + Str1%Str=Var_Str(HelpStr) + IF(.NOT.ASSOCIATED(Str2)) THEN + FirstString=>Str1 + ELSE + Str2%NextStr=>Str1 + Str1%PrevStr=>Str2 END IF + Str2=>Str1 + newString = .TRUE. END IF + END IF END DO CLOSE(103) @@ -597,7 +605,7 @@ SUBROUTINE UserDefinedVars() ! Get the user defined variables !=================================================================================================================================== ! MODULES -USE iso_varying_string +USE MOD_ISO_VARYING_STRING ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -623,8 +631,7 @@ SUBROUTINE UserDefinedVars() IF (INDEX(TRIM(CHAR(DefVar(1,i))),TRIM(CHAR(DefVar(1,j)))).NE.0) THEN SWRITE(UNIT_StdOut,*) '!! WARNING !! Problem with DEFVAR ', TRIM(CHAR(DefVar(1,i))) SWRITE(UNIT_StdOut,*) ' a part of this variable name was already used in DEFVAR ' ,TRIM(CHAR(DefVar(1,j))) - CALL abort(__STAMP__, & - 'DEFVAR: do not reuse same strings for variable names! Code stopped during inifile parsing!') + CALL abort(__STAMP__,'DEFVAR: do not reuse same strings for variable names! Code stopped during inifile parsing!') END IF END DO Str1=>FirstString @@ -655,7 +662,7 @@ SUBROUTINE GetDefVar(DefVar) ! Get the user defined variables !=================================================================================================================================== ! MODULES -USE iso_varying_string +USE MOD_ISO_VARYING_STRING ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -699,8 +706,7 @@ SUBROUTINE GetDefVar(DefVar) IF(.NOT.((DefVarIsInt).OR.(DefVarIsIntArray).OR.(DefVarIsReal).OR.(defVarIsRealarray) ))THEN SWRITE(UNIT_StdOut,*) 'DEFVAR not correctly defined: ',TRIM(HelpStr) - CALL abort(__STAMP__, & - 'Code stopped during inifile parsing!') + CALL abort(__STAMP__,'Code stopped during inifile parsing!') END IF IF(DefVarIsIntArray.OR.DefVarIsRealArray)THEN @@ -823,8 +829,7 @@ SUBROUTINE FindStr(Key,Str,DefMsg,Proposal) IF (.NOT.ASSOCIATED(Str1)) THEN IF (.NOT.PRESENT(Proposal)) THEN SWRITE(UNIT_StdOut,*) 'Inifile missing necessary keyword item : ',TRIM(TmpKey) - CALL abort(__STAMP__, & - 'Code stopped during inifile parsing!') + CALL abort(__STAMP__,'Code stopped during inifile parsing!') ELSE ! Return default value ! CALL LowCase(TRIM(Proposal),Str) Str=TRIM(Proposal) @@ -909,7 +914,7 @@ SUBROUTINE getPImultiplies(helpstr) ! it with the value of pi=3.1415... etc. and oes a multiplication. !=================================================================================================================================== ! MODULES -USE iso_varying_string +USE MOD_ISO_VARYING_STRING ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -965,4 +970,18 @@ SUBROUTINE getPImultiplies(helpstr) helpstr=trim(char(dstr)) END SUBROUTINE getPImultiplies + +!=================================================================================================================================== +!> Clear parameters list 'prms'. +!=================================================================================================================================== +SUBROUTINE FinalizeStrings() +IMPLICIT NONE +! LOCAL VARIABLES +!=================================================================================================================================== + +SDEALLOCATE(FirstString) +FirstString => null() + +END SUBROUTINE FinalizeStrings + END MODULE MOD_ReadInTools diff --git a/src/search/search.f90 b/src/search/search.f90 index 70816b9..077e835 100644 --- a/src/search/search.f90 +++ b/src/search/search.f90 @@ -153,8 +153,7 @@ SUBROUTINE getNewSearchMesh(searchMesh,safedx,xmin,xmax,dx) INTEGER,ALLOCATABLE :: dist(:) ! ? INTEGER :: iNode,l,i,j,k ! ? !=================================================================================================================================== -IF(ASSOCIATED(searchMesh)) CALL abort(__STAMP__,& - 'Warning: search mesh already allocated.') +IF(ASSOCIATED(searchMesh)) CALL abort(__STAMP__,'Warning: search mesh already allocated.') ALLOCATE(searchMesh) searchMesh%actualInd = -1 searchMesh%idx_ur = -1 @@ -276,8 +275,7 @@ FUNCTION getfirstToObject(searchMesh,reduced,coords,idx) ELSEIF(PRESENT(coords)) THEN CALL getIdx(searchmesh,coords,searchMesh%actualInd) ! Calculate indices from coordinates ELSE - CALL abort(__STAMP__, & - 'error calling getFirstToObject') + CALL abort(__STAMP__,'error calling getFirstToObject') END IF maxn=searchMesh%n ! Number of points in search area IF(Reduced) maxn=searchMesh%nRed ! Use reduced number of points @@ -432,8 +430,7 @@ SUBROUTINE insertNode(searchMesh,Node,Elem) INTEGER :: idx(3) ! ? !=================================================================================================================================== CALL getIdx(searchmesh,Node%x,idx) ! Calculate search mesh indices of node -IF(.NOT.idxok(searchMesh,idx)) CALL abort(__STAMP__, & - 'search Mesh error') +IF(.NOT.idxok(searchMesh,idx)) CALL abort(__STAMP__,'search Mesh error') CALL getNewToObject(ToObject) ! Create new search mesh object ToObject%Node=>Node IF(PRESENT(Elem))ToObject%elem=>Elem diff --git a/src/sfc/spacefillingcurve.f90 b/src/sfc/spacefillingcurve.f90 index 05baa23..5e79c34 100644 --- a/src/sfc/spacefillingcurve.f90 +++ b/src/sfc/spacefillingcurve.f90 @@ -13,7 +13,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,7 +31,7 @@ MODULE MOD_SpaceFillingCurve IMPLICIT NONE PRIVATE !----------------------------------------------------------------------------------------------------------------------------------- -! GLOBAL VARIABLES +! GLOBAL VARIABLES !----------------------------------------------------------------------------------------------------------------------------------- TYPE tBox @@ -105,8 +105,7 @@ SUBROUTINE SortElemsBySpaceFillingCurve(nElems,ElemBary,IDList,whichBoundBox) lower=MINVAL(ElemBary) upper=MAXVAL(ElemBary) CASE DEFAULT - CALL abort(__STAMP__, & - 'wrong bounding box type (only 1,2) ') + CALL abort(__STAMP__,'wrong bounding box type (only 1,2) ') END SELECT DO i=1,3 IF(ALMOSTEQUAL(lower(i),upper(i)))THEN @@ -115,16 +114,16 @@ SUBROUTINE SortElemsBySpaceFillingCurve(nElems,ElemBary,IDList,whichBoundBox) END IF END DO CALL setBoundingBox(SCBox,lower,upper) - + DO iElem=1,nElems IntList(iElem) = COORD2INT(SCBox, ElemBary(iElem,:)) END DO - + ! Now sort the elements according to their index on the space filling curve. CALL Qsort1DoubleInt1Pint(IntList, IDList) ELSE IDList=1 -END IF +END IF CALL Timer(.FALSE.) END SUBROUTINE SortElemsBySpaceFillingCurve @@ -165,11 +164,10 @@ FUNCTION COORD2INT(Box, Coord) RESULT(ind) ind = evalhilbert(disc(1:2),box%nbits,2) ind = ind+ disc(3)*box%intfact2 CASE DEFAULT - CALL abort(__STAMP__, & - 'sfc_type does not exist (only hilbert,morton,mortonZ,hilbertZ)') - + CALL abort(__STAMP__,'sfc_type does not exist (only hilbert,morton,mortonZ,hilbertZ)') + END SELECT -END FUNCTION COORD2INT +END FUNCTION COORD2INT FUNCTION EVAL_MORTON(intcoords,nBits,nDim) RESULT(ind) @@ -180,12 +178,12 @@ FUNCTION EVAL_MORTON(intcoords,nBits,nDim) RESULT(ind) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES +INTEGER,INTENT(IN) :: nDim ! ? INTEGER(KIND=8),INTENT(IN) :: intcoords(nDim) ! ? -INTEGER,INTENT(IN) :: nBits ! ? -INTEGER,INTENT(IN) :: nDim ! ? +INTEGER,INTENT(IN) :: nBits ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES -INTEGER(KIND=8) :: ind ! ? +INTEGER(KIND=8) :: ind ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES INTEGER :: dir,i @@ -208,11 +206,12 @@ SUBROUTINE EVAL_MORTON_ARR(ind,intcoords,nP,nBits) IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES +INTEGER,INTENT(IN) :: nP ! ? INTEGER(KIND=8),INTENT(IN) :: intcoords(3,nP) ! ? -INTEGER,INTENT(IN) :: nBits,nP ! ? +INTEGER,INTENT(IN) :: nBits ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES -INTEGER(KIND=8),INTENT(OUT) :: ind(nP) ! ? +INTEGER(KIND=8),INTENT(OUT) :: ind(nP) ! ? !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES INTEGER :: dir,i diff --git a/src/sortingtools.f90 b/src/sortingtools.f90 index 88ccfdd..3cef1c4 100644 --- a/src/sortingtools.f90 +++ b/src/sortingtools.f90 @@ -12,7 +12,7 @@ ! Copyright (C) 2017 Claus-Dieter Munz ! This file is part of HOPR, a software for the generation of high-order meshes. ! -! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +! HOPR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ! ! HOPR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -31,6 +31,7 @@ !* $Author: iaghinde $ !* !*****************************************************************************! +#include "hopr.h" MODULE MOD_SortingTools !---------------------------------------------------------------------------- @@ -144,7 +145,7 @@ RECURSIVE SUBROUTINE Qsort1Int(A) END SUBROUTINE Qsort1Int SUBROUTINE Partition1Int(A,marker) !=================================================================================================================================== -! Sorting routine used by QSort1int above. This routine is PRIVATE +! Sorting routine used by QSort1int above. This routine is PRIVATE !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -226,7 +227,7 @@ END SUBROUTINE Qsort1Int1PInt SUBROUTINE Partition1Int1PInt(A,P,marker) !=================================================================================================================================== -! Sorting routine used by QSort1int above. This routine is PRIVATE +! Sorting routine used by QSort1int above. This routine is PRIVATE !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -312,7 +313,7 @@ END SUBROUTINE Qsort1DoubleInt1PInt SUBROUTINE Partition1DoubleInt1PInt(A,P,marker) !=================================================================================================================================== -! Sorting routine used by QSort1int above. This routine is PRIVATE +! Sorting routine used by QSort1int above. This routine is PRIVATE !=================================================================================================================================== ! MODULES ! IMPLICIT VARIABLE HANDLING @@ -862,6 +863,7 @@ RECURSIVE SUBROUTINE MSortNInt(A,N,ind) ! Sorts array of integers !=================================================================================================================================== ! MODULES +USE MOD_Globals, ONLY: abort ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -876,7 +878,7 @@ RECURSIVE SUBROUTINE MSortNInt(A,N,ind) !=================================================================================================================================== sA=SIZE(A,2) IF((N.LE.0).OR.(sA.EQ.1)) RETURN -IF(N > SIZE(A,1)-ind+1) STOP 'Number of entries to sort greater then array dimension!' +IF(N > SIZE(A,1)-ind+1) CALL abort(__STAMP__,'Number of entries to sort greater then array dimension!') CALL MergeSortInt(A,ind) IF(N.EQ.1) RETURN @@ -972,6 +974,7 @@ RECURSIVE SUBROUTINE MSortNLong(A,N,ind) ! Sorts array of integers !=================================================================================================================================== ! MODULES +USE MOD_Globals, ONLY: abort ! IMPLICIT VARIABLE HANDLING IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- @@ -986,7 +989,7 @@ RECURSIVE SUBROUTINE MSortNLong(A,N,ind) !=================================================================================================================================== sA=SIZE(A,2) IF((N.LE.0).OR.(sA.EQ.1)) RETURN -IF(N > SIZE(A,1)-ind+1) STOP 'Number of entries to sort greater then array dimension!' +IF(N > SIZE(A,1)-ind+1) CALL abort(__STAMP__,'Number of entries to sort greater then array dimension!') CALL MergeSortLong(A,ind) IF(N.EQ.1) RETURN diff --git a/tutorials/1-02-cartbox_periodic/parameter_curvedbox_periodic.ini b/tutorials/1-02-cartbox_periodic/parameter_curvedbox_periodic.ini index 2ed13b4..1117099 100644 --- a/tutorials/1-02-cartbox_periodic/parameter_curvedbox_periodic.ini +++ b/tutorials/1-02-cartbox_periodic/parameter_curvedbox_periodic.ini @@ -1,47 +1,47 @@ -DEFVAR=(INT): nxx = 004 -DEFVAR=(INT): nyy = 004 -DEFVAR=(INT): nzz = 004 +DEFVAR=(INT): nxx = 004 +DEFVAR=(INT): nyy = 004 +DEFVAR=(INT): nzz = 004 !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = CURVEDBOX_PERIODIC_Ngeo4_nxx_nyy_nzz ! Name of output files +ProjectName = CURVEDBOX_PERIODIC_Ngeo4_nxx_nyy_nzz ! Name of output files + +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 - Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) - DebugVisuLevel =2 - Nvisu = 10 - !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =1 ! number of boxes - Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & - -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) - ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) - nElems =(/nxx,nyy,nzz/) ! number of elements in each direction - BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) - elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) - useCurveds= T - BoundaryOrder=5 !=Ngeo+1 - +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_yminus ! BC index 3 - BoundaryType=(/1,0,0,2/) - BoundaryName=BC_xplus ! BC index 6 - BoundaryType=(/1,0,0,-1/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) - BoundaryName=BC_xminus ! BC index 5 - BoundaryType=(/1,0,0,1/) - BoundaryName=BC_zplus ! BC index 2 - BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side - vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 - vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 - vv=(/0.,0.,2./) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! diff --git a/tutorials/1-02-cartbox_periodic/parameter_internalcurvedbox_periodic.ini b/tutorials/1-02-cartbox_periodic/parameter_internalcurvedbox_periodic.ini index 1b62747..1646a9e 100644 --- a/tutorials/1-02-cartbox_periodic/parameter_internalcurvedbox_periodic.ini +++ b/tutorials/1-02-cartbox_periodic/parameter_internalcurvedbox_periodic.ini @@ -1,46 +1,46 @@ -DEFVAR=(INT): nxx = 004 -DEFVAR=(INT): nyy = 004 -DEFVAR=(INT): nzz = 004 +DEFVAR=(INT): nxx = 004 +DEFVAR=(INT): nyy = 004 +DEFVAR=(INT): nzz = 004 !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = INTERNALCURVEDBOX_PERIODIC_Ngeo4_nxx_nyy_nzz ! Name of output files +ProjectName = INTERNALCURVEDBOX_PERIODIC_Ngeo4_nxx_nyy_nzz ! Name of output files + +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 - Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) - DebugVisuLevel =2 - Nvisu = 10 - !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =1 ! number of boxes - Corner =(/0.,0.,0. ,,1.,0.,0. ,,1.,1.,0. ,, 0.,1.,0.,, 0.,0.,1.,,1.,0.,1.,,1.,1.,1.,, 0.,1.,1./) - ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) - nElems =(/nxx,nyy,nzz/) ! number of elements in each direction - BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) - elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) - useCurveds= T - BoundaryOrder=5 !=Ngeo+1 - +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/0.,0.,0. ,,1.,0.,0. ,,1.,1.,0. ,, 0.,1.,0.,, 0.,0.,1.,,1.,0.,1.,,1.,1.,1.,, 0.,1.,1./) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_yminus ! BC index 3 - BoundaryType=(/1,0,0,2/) - BoundaryName=BC_xplus ! BC index 6 - BoundaryType=(/1,0,0,-1/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) - BoundaryName=BC_xminus ! BC index 5 - BoundaryType=(/1,0,0,1/) - BoundaryName=BC_zplus ! BC index 2 - BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side - vv=(/1.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 - vv=(/0.,1.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 - vv=(/0.,0.,1./) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/1.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,1.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,1./) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! diff --git a/tutorials/1-06-curved-postdeform/parameter6.ini b/tutorials/1-06-curved-postdeform/parameter6.ini index 07b95b4..d5d9503 100644 --- a/tutorials/1-06-curved-postdeform/parameter6.ini +++ b/tutorials/1-06-curved-postdeform/parameter6.ini @@ -1,31 +1,31 @@ DEFVAR=(REAL~2): p_c = 0. , 0. ! center point DEFVAR=(REAL): r11 = 0.25 ! should not be changed -DEFVAR=(REAL): r12 = 0.5 ! should be 2*r11 +DEFVAR=(REAL): r12 = 0.5 ! should be 2*r11 DEFVAR=(REAL~2): p_11 = r12, 0. ! points around inner hexagon (at <0.5) DEFVAR=(REAL~2): p_12 = r11, r12 -DEFVAR=(REAL~2): p_13 =-r11, r12 -DEFVAR=(REAL~2): p_14 =-r12, 0. -DEFVAR=(REAL~2): p_15 =-r11,-r12 +DEFVAR=(REAL~2): p_13 =-r11, r12 +DEFVAR=(REAL~2): p_14 =-r12, 0. +DEFVAR=(REAL~2): p_15 =-r11,-r12 DEFVAR=(REAL~2): p_16 = r11,-r12 -DEFVAR=(REAL): r21 = 0.5 ! should not be changed +DEFVAR=(REAL): r21 = 0.5 ! should not be changed DEFVAR=(REAL): r22 = 1. ! should be 2*r21 DEFVAR=(REAL~2): p_21 = r22, 0. ! points around middle hexagon (at <1) DEFVAR=(REAL~2): p_22 = r21, r22 -DEFVAR=(REAL~2): p_23 =-r21, r22 -DEFVAR=(REAL~2): p_24 =-r22, 0. -DEFVAR=(REAL~2): p_25 =-r21,-r22 +DEFVAR=(REAL~2): p_23 =-r21, r22 +DEFVAR=(REAL~2): p_24 =-r22, 0. +DEFVAR=(REAL~2): p_25 =-r21,-r22 DEFVAR=(REAL~2): p_26 = r21,-r22 -DEFVAR=(REAL): r31 = 1.25 ! >1 can be changed (larger/smaller outer hexagon) -DEFVAR=(REAL): r32 = 2.5 ! should be 2*r31 +DEFVAR=(REAL): r31 = 1.25 ! >1 can be changed (larger/smaller outer hexagon) +DEFVAR=(REAL): r32 = 2.5 ! should be 2*r31 DEFVAR=(REAL~2): p_31 = r32, 0. !points around last hexagon (at >1) DEFVAR=(REAL~2): p_32 = r31, r32 DEFVAR=(REAL~2): p_33 =-r31, r32 -DEFVAR=(REAL~2): p_34 =-r32, 0. -DEFVAR=(REAL~2): p_35 =-r31,-r32 +DEFVAR=(REAL~2): p_34 =-r32, 0. +DEFVAR=(REAL~2): p_35 =-r31,-r32 DEFVAR=(REAL~2): p_36 = r31,-r32 DEFVAR=(INT): i0 = 001 ! no. elems in inner 3 blocks -DEFVAR=(INT): ir1= 001 ! no. elems in r for first ring +DEFVAR=(INT): ir1= 001 ! no. elems in r for first ring DEFVAR=(INT): ir2= 001 ! no. elems in r for second ring DEFVAR=(INT): iz = 001 ! no. elems in z DEFVAR=(REAL): s0 = 0.4 ! = 1/r0, scale to final radius @@ -36,112 +36,112 @@ DEFVAR=(REAL): f2 = 1. ! stretching factor in second ring !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = Cylinder6_Ngeo5_hexagonal ! Name of output files - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugvisuLevel= 3 - Nvisu= 7 - checkElemJacobians=T - +ProjectName = Cylinder6_Ngeo5_hexagonal ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugvisuLevel= 3 +Nvisu= 7 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =15 ! number of boxes - ! inner 3 zones - ! right upper - Corner =(/p_c ,0. ,,p_11,0. ,,p_12,0. ,, p_13,0.,, p_c,lz ,,p_11,lz ,,p_12,lz ,, p_13,lz /) - nElems =(/i0,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! stretching - ! left - Corner =(/p_c ,0. ,,p_13,0. ,,p_14,0. ,, p_15,0.,, p_c,lz ,,p_13,lz ,,p_14,lz ,, p_15,lz /) - nElems =(/i0,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! stretching - !right lower - Corner =(/p_c ,0. ,,p_15,0. ,,p_16,0. ,, p_11,0.,, p_c,lz ,,p_15,lz ,,p_16,lz ,, p_11,lz /) - nElems =(/i0,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! stretching - !first ring (counter clockwise) - Corner =(/p_11,0. ,,p_21,0. ,,p_22,0. ,, p_12,0.,, p_11,lz ,,p_21,lz ,,p_22,lz ,, p_12,lz /) - Corner =(/p_12,0. ,,p_22,0. ,,p_23,0. ,, p_13,0.,, p_12,lz ,,p_22,lz ,,p_23,lz ,, p_13,lz /) - Corner =(/p_13,0. ,,p_23,0. ,,p_24,0. ,, p_14,0.,, p_13,lz ,,p_23,lz ,,p_24,lz ,, p_14,lz /) - Corner =(/p_14,0. ,,p_24,0. ,,p_25,0. ,, p_15,0.,, p_14,lz ,,p_24,lz ,,p_25,lz ,, p_15,lz /) - Corner =(/p_15,0. ,,p_25,0. ,,p_26,0. ,, p_16,0.,, p_15,lz ,,p_25,lz ,,p_26,lz ,, p_16,lz /) - Corner =(/p_16,0. ,,p_26,0. ,,p_21,0. ,, p_11,0.,, p_16,lz ,,p_26,lz ,,p_21,lz ,, p_11,lz /) - nElems =(/ir1,i0,iz/) - nElems =(/ir1,i0,iz/) - nElems =(/ir1,i0,iz/) - nElems =(/ir1,i0,iz/) - nElems =(/ir1,i0,iz/) - nElems =(/ir1,i0,iz/) - BCIndex =(/1,0,0,0,0,2/) - BCIndex =(/1,0,0,0,0,2/) - BCIndex =(/1,0,0,0,0,2/) - BCIndex =(/1,0,0,0,0,2/) - BCIndex =(/1,0,0,0,0,2/) - BCIndex =(/1,0,0,0,0,2/) - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - factor =(/f1,1.,1./) ! stretching - factor =(/f1,1.,1./) - factor =(/f1,1.,1./) - factor =(/f1,1.,1./) - factor =(/f1,1.,1./) - factor =(/f1,1.,1./) - !second ring (counter clockwise) - Corner =(/p_21,0. ,,p_31,0. ,,p_32,0. ,, p_22,0.,, p_21,lz ,,p_31,lz ,,p_32,lz ,, p_22,lz /) - Corner =(/p_22,0. ,,p_32,0. ,,p_33,0. ,, p_23,0.,, p_22,lz ,,p_32,lz ,,p_33,lz ,, p_23,lz /) - Corner =(/p_23,0. ,,p_33,0. ,,p_34,0. ,, p_24,0.,, p_23,lz ,,p_33,lz ,,p_34,lz ,, p_24,lz /) - Corner =(/p_24,0. ,,p_34,0. ,,p_35,0. ,, p_25,0.,, p_24,lz ,,p_34,lz ,,p_35,lz ,, p_25,lz /) - Corner =(/p_25,0. ,,p_35,0. ,,p_36,0. ,, p_26,0.,, p_25,lz ,,p_35,lz ,,p_36,lz ,, p_26,lz /) - Corner =(/p_26,0. ,,p_36,0. ,,p_31,0. ,, p_21,0.,, p_26,lz ,,p_36,lz ,,p_31,lz ,, p_21,lz /) - nElems =(/ir2,i0,iz/) - nElems =(/ir2,i0,iz/) - nElems =(/ir2,i0,iz/) - nElems =(/ir2,i0,iz/) - nElems =(/ir2,i0,iz/) - nElems =(/ir2,i0,iz/) - BCIndex =(/1,0,3,0,0,2/) - BCIndex =(/1,0,3,0,0,2/) - BCIndex =(/1,0,3,0,0,2/) - BCIndex =(/1,0,3,0,0,2/) - BCIndex =(/1,0,3,0,0,2/) - BCIndex =(/1,0,3,0,0,2/) - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - elemtype =108 - factor =(/f2,1.,1./) ! stretching - factor =(/f2,1.,1./) - factor =(/f2,1.,1./) - factor =(/f2,1.,1./) - factor =(/f2,1.,1./) - factor =(/f2,1.,1./) +Mode =1 ! Mode for Cartesian boxes +nZones =15 ! number of boxes +! inner 3 zones +! right upper +Corner =(/p_c ,0. ,,p_11,0. ,,p_12,0. ,, p_13,0.,, p_c,lz ,,p_11,lz ,,p_12,lz ,, p_13,lz /) +nElems =(/i0,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! stretching +! left +Corner =(/p_c ,0. ,,p_13,0. ,,p_14,0. ,, p_15,0.,, p_c,lz ,,p_13,lz ,,p_14,lz ,, p_15,lz /) +nElems =(/i0,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! stretching +!right lower +Corner =(/p_c ,0. ,,p_15,0. ,,p_16,0. ,, p_11,0.,, p_c,lz ,,p_15,lz ,,p_16,lz ,, p_11,lz /) +nElems =(/i0,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,2/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! stretching +!first ring (counter clockwise) +Corner =(/p_11,0. ,,p_21,0. ,,p_22,0. ,, p_12,0.,, p_11,lz ,,p_21,lz ,,p_22,lz ,, p_12,lz /) +Corner =(/p_12,0. ,,p_22,0. ,,p_23,0. ,, p_13,0.,, p_12,lz ,,p_22,lz ,,p_23,lz ,, p_13,lz /) +Corner =(/p_13,0. ,,p_23,0. ,,p_24,0. ,, p_14,0.,, p_13,lz ,,p_23,lz ,,p_24,lz ,, p_14,lz /) +Corner =(/p_14,0. ,,p_24,0. ,,p_25,0. ,, p_15,0.,, p_14,lz ,,p_24,lz ,,p_25,lz ,, p_15,lz /) +Corner =(/p_15,0. ,,p_25,0. ,,p_26,0. ,, p_16,0.,, p_15,lz ,,p_25,lz ,,p_26,lz ,, p_16,lz /) +Corner =(/p_16,0. ,,p_26,0. ,,p_21,0. ,, p_11,0.,, p_16,lz ,,p_26,lz ,,p_21,lz ,, p_11,lz /) +nElems =(/ir1,i0,iz/) +nElems =(/ir1,i0,iz/) +nElems =(/ir1,i0,iz/) +nElems =(/ir1,i0,iz/) +nElems =(/ir1,i0,iz/) +nElems =(/ir1,i0,iz/) +BCIndex =(/1,0,0,0,0,2/) +BCIndex =(/1,0,0,0,0,2/) +BCIndex =(/1,0,0,0,0,2/) +BCIndex =(/1,0,0,0,0,2/) +BCIndex =(/1,0,0,0,0,2/) +BCIndex =(/1,0,0,0,0,2/) +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +factor =(/f1,1.,1./) ! stretching +factor =(/f1,1.,1./) +factor =(/f1,1.,1./) +factor =(/f1,1.,1./) +factor =(/f1,1.,1./) +factor =(/f1,1.,1./) +!second ring (counter clockwise) +Corner =(/p_21,0. ,,p_31,0. ,,p_32,0. ,, p_22,0.,, p_21,lz ,,p_31,lz ,,p_32,lz ,, p_22,lz /) +Corner =(/p_22,0. ,,p_32,0. ,,p_33,0. ,, p_23,0.,, p_22,lz ,,p_32,lz ,,p_33,lz ,, p_23,lz /) +Corner =(/p_23,0. ,,p_33,0. ,,p_34,0. ,, p_24,0.,, p_23,lz ,,p_33,lz ,,p_34,lz ,, p_24,lz /) +Corner =(/p_24,0. ,,p_34,0. ,,p_35,0. ,, p_25,0.,, p_24,lz ,,p_34,lz ,,p_35,lz ,, p_25,lz /) +Corner =(/p_25,0. ,,p_35,0. ,,p_36,0. ,, p_26,0.,, p_25,lz ,,p_35,lz ,,p_36,lz ,, p_26,lz /) +Corner =(/p_26,0. ,,p_36,0. ,,p_31,0. ,, p_21,0.,, p_26,lz ,,p_36,lz ,,p_31,lz ,, p_21,lz /) +nElems =(/ir2,i0,iz/) +nElems =(/ir2,i0,iz/) +nElems =(/ir2,i0,iz/) +nElems =(/ir2,i0,iz/) +nElems =(/ir2,i0,iz/) +nElems =(/ir2,i0,iz/) +BCIndex =(/1,0,3,0,0,2/) +BCIndex =(/1,0,3,0,0,2/) +BCIndex =(/1,0,3,0,0,2/) +BCIndex =(/1,0,3,0,0,2/) +BCIndex =(/1,0,3,0,0,2/) +BCIndex =(/1,0,3,0,0,2/) +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +elemtype =108 +factor =(/f2,1.,1./) ! stretching +factor =(/f2,1.,1./) +factor =(/f2,1.,1./) +factor =(/f2,1.,1./) +factor =(/f2,1.,1./) +factor =(/f2,1.,1./) - useCurveds =T - BoundaryOrder=6 !choose boundary order freely +useCurveds =T +BoundaryOrder=6 !choose boundary order freely !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus - BoundaryType=(/1,0,0,1/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/1,0,0,-1/) - BoundaryName=BC_outer - BoundaryType=(/2,0,0,0/) - vv=(/0.,0.,lz/) +BoundaryName=BC_zminus +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_outer +BoundaryType=(/2,0,0,0/) +vv=(/0.,0.,lz/) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! diff --git a/tutorials/1-06-curved-postdeform/parameter_annulus.ini b/tutorials/1-06-curved-postdeform/parameter_annulus.ini index 1b85cc0..6097c2c 100644 --- a/tutorials/1-06-curved-postdeform/parameter_annulus.ini +++ b/tutorials/1-06-curved-postdeform/parameter_annulus.ini @@ -1,57 +1,57 @@ DEFVAR=(INT): i0 = 032 ! no. elems along theta -DEFVAR=(INT): ir = 004 ! no. elems in r +DEFVAR=(INT): ir = 004 ! no. elems in r DEFVAR=(INT): iz = 001 ! no. elems in z (periodic direction) - + DEFVAR=(REAL): t0 = 0. ! theta start (should be 0) DEFVAR=(REAL): t1 = 2. ! theta end (full=2) DEFVAR=(REAL): ri = 1.0 ! inner radius (normalized, will be scaled with Postdeform_R0) DEFVAR=(REAL): r0 = 1.2 ! outer radius (normalized, will be scaled with Postdeform_R0) -DEFVAR=(REAL): lzh = 0.2 ! half length in z (periodic direction) +DEFVAR=(REAL): lzh = 0.2 ! half length in z (periodic direction) DEFVAR=(REAL): lzf = 0.4 ! full length in z DEFVAR=(REAL): f1 = 1.1 ! stretching factor in radial direction !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = PLANAR_ANNULUS_Ngeo4_i0_ir - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugvisuLevel=2 - checkElemJacobians=T - +ProjectName = PLANAR_ANNULUS_Ngeo4_i0_ir +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugvisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =1 ! number of boxes - !left - Corner =(/t0,-lzh,ri ,,t1,-lzh,ri,, t1,lzh,ri ,,t0,lzh,ri ,,t0,-lzh,r0 ,,t1,-lzh,r0,, t1,lzh,r0 ,,t0,lzh,r0 /) - nElems =(/i0,iz,ir/) ! number of elements in each direction - factor =(/1.,1.,f1/) - BCIndex =(/3,1,5,2,6,4/) ! - elemtype =108 ! element type (108: Hexahedral) +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +!left +Corner =(/t0,-lzh,ri ,,t1,-lzh,ri,, t1,lzh,ri ,,t0,lzh,ri ,,t0,-lzh,r0 ,,t1,-lzh,r0,, t1,lzh,r0 ,,t0,lzh,r0 /) +nElems =(/i0,iz,ir/) ! number of elements in each direction +factor =(/1.,1.,f1/) +BCIndex =(/3,1,5,2,6,4/) ! +elemtype =108 ! element type (108: Hexahedral) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_zplus ! BC index 2 - BoundaryType=(/1,0,0,-1/) - BoundaryName=BC_inner ! BC index 3 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_outer ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_theta_minus ! BC index 5 - BoundaryType=(/1,0,0,-2/) !set to periodic if full annulus, lie onto each other after postdeform! - BoundaryName=BC_theta_plus ! BC index 6 - BoundaryType=(/1,0,0,2/) - vv=(/0.,lzf,0./) - vv=(/t1,0.,0./) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_inner ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_outer ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_theta_minus ! BC index 5 +BoundaryType=(/1,0,0,-2/) !set to periodic if full annulus, lie onto each other after postdeform! +BoundaryName=BC_theta_plus ! BC index 6 +BoundaryType=(/1,0,0,2/) +vv=(/0.,lzf,0./) +vv=(/t1,0.,0./) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! -MeshPostDeform=300 !planar annulus +MeshPostDeform=300 !planar annulus PostDeform_R0=10. !scaling factor of the radius diff --git a/tutorials/1-06-curved-postdeform/parameter_cylinderinbox.ini b/tutorials/1-06-curved-postdeform/parameter_cylinderinbox.ini index bba9698..2dd4a84 100644 --- a/tutorials/1-06-curved-postdeform/parameter_cylinderinbox.ini +++ b/tutorials/1-06-curved-postdeform/parameter_cylinderinbox.ini @@ -1,5 +1,5 @@ DEFVAR=(INT): i0 = 004 ! no. elems in inner square i0xi0 -DEFVAR=(INT): ir1 = 003 ! no. elems in r for first ring +DEFVAR=(INT): ir1 = 003 ! no. elems in r for first ring DEFVAR=(INT): ir2 = 006 ! no. elems in r for second ring DEFVAR=(INT): iz = 004 ! no. elems in z DEFVAR=(REAL): ri = 0.5 ! inner square dim @@ -12,89 +12,89 @@ DEFVAR=(REAL): f2 = 1.2 ! stretching factor in second ring !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = CylinderInBox ! Name of output files - Debugvisu = F ! Visualize mesh and boundary conditions (tecplot ascii) - checkElemJacobians=T - +ProjectName = CylinderInBox ! Name of output files +Debugvisu = F ! Visualize mesh and boundary conditions (tecplot ascii) +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =9 ! number of boxes - !center - Corner =(/-ri,-ri,0. ,,ri,-ri,0. ,,ri,ri,0. ,, -ri,ri,0.,, -ri,-ri,lz ,,ri,-ri,lz ,,ri,ri,lz ,, -ri,ri,lz /) - nElems =(/i0,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! stretching - !left inner - Corner =(/-rm,-rm,0. ,,-ri,-ri,0. ,,-ri,ri,0. ,, -rm,rm,0.,, -rm,-rm,lz ,,-ri,-ri,lz ,,-ri,ri,lz ,, -rm,rm,lz /) - nElems =(/ir1,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f1,1.,1./) ! stretching - !right inner - Corner =(/ri,-ri,0. ,,rm,-rm,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,-ri,lz ,,rm,-rm,lz ,,rm,rm,lz ,, ri,ri,lz /) - nElems =(/ir1,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/-f1,1.,1./) ! stretching - !upper inner - Corner =(/-ri,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, -rm,rm,0.,, -ri,ri,lz ,,ri,ri,lz ,,rm,rm,lz ,, -rm,rm,lz /) - nElems =(/i0,ir1,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f1,1./) ! stretching - !lower inner - Corner =(/-rm,-rm,0. ,,rm,-rm,0. ,,ri,-ri,0. ,, -ri,-ri,0.,, -rm,-rm,lz ,,rm,-rm,lz ,,ri,-ri,lz ,, -ri,-ri,lz /) - nElems =(/i0,ir1,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f1,1./) ! stretching - !left - Corner =(/-r0,-r0,0. ,,-rm,-rm,0. ,,-rm,rm,0. ,, -r0,r0,0.,, -r0,-r0,lz ,,-rm,-rm,lz ,,-rm,rm,lz ,, -r0,r0,lz /) - nElems =(/ir2,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,5,6/) ! Indices of Boundary Conditions - factor =(/-f2,1.,1./) ! stretching - elemtype =108 ! element type (108: Hexahedral) - !rmght - Corner =(/rm,-rm,0. ,,r0,-r0,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,-rm,lz ,,r0,-r0,lz ,,r0,r0,lz ,, rm,rm,lz /) - nElems =(/ir2,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,3,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f2,1.,1./) ! stretching - !upper - Corner =(/-rm,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, -r0,r0,0.,, -rm,rm,lz ,,rm,rm,lz ,,r0,r0,lz ,, -r0,r0,lz /) - nElems =(/i0,ir2,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,4,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f2,1./) ! stretching - !lower - Corner =(/-r0,-r0,0. ,,r0,-r0,0. ,,rm,-rm,0. ,, -rm,-rm,0.,, -r0,-r0,lz ,,r0,-r0,lz ,,rm,-rm,lz ,, -rm,-rm,lz /) - nElems =(/i0,ir2,iz/) ! number of elements in each direction - BCIndex =(/1,2,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f2,1./) ! stretching +Mode =1 ! Mode for Cartesian boxes +nZones =9 ! number of boxes +!center +Corner =(/-ri,-ri,0. ,,ri,-ri,0. ,,ri,ri,0. ,, -ri,ri,0.,, -ri,-ri,lz ,,ri,-ri,lz ,,ri,ri,lz ,, -ri,ri,lz /) +nElems =(/i0,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! stretching +!left inner +Corner =(/-rm,-rm,0. ,,-ri,-ri,0. ,,-ri,ri,0. ,, -rm,rm,0.,, -rm,-rm,lz ,,-ri,-ri,lz ,,-ri,ri,lz ,, -rm,rm,lz /) +nElems =(/ir1,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f1,1.,1./) ! stretching +!right inner +Corner =(/ri,-ri,0. ,,rm,-rm,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,-ri,lz ,,rm,-rm,lz ,,rm,rm,lz ,, ri,ri,lz /) +nElems =(/ir1,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/-f1,1.,1./) ! stretching +!upper inner +Corner =(/-ri,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, -rm,rm,0.,, -ri,ri,lz ,,ri,ri,lz ,,rm,rm,lz ,, -rm,rm,lz /) +nElems =(/i0,ir1,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f1,1./) ! stretching +!lower inner +Corner =(/-rm,-rm,0. ,,rm,-rm,0. ,,ri,-ri,0. ,, -ri,-ri,0.,, -rm,-rm,lz ,,rm,-rm,lz ,,ri,-ri,lz ,, -ri,-ri,lz /) +nElems =(/i0,ir1,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f1,1./) ! stretching +!left +Corner =(/-r0,-r0,0. ,,-rm,-rm,0. ,,-rm,rm,0. ,, -r0,r0,0.,, -r0,-r0,lz ,,-rm,-rm,lz ,,-rm,rm,lz ,, -r0,r0,lz /) +nElems =(/ir2,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,5,6/) ! Indices of Boundary Conditions +factor =(/-f2,1.,1./) ! stretching +elemtype =108 ! element type (108: Hexahedral) +!rmght +Corner =(/rm,-rm,0. ,,r0,-r0,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,-rm,lz ,,r0,-r0,lz ,,r0,r0,lz ,, rm,rm,lz /) +nElems =(/ir2,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,3,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f2,1.,1./) ! stretching +!upper +Corner =(/-rm,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, -r0,r0,0.,, -rm,rm,lz ,,rm,rm,lz ,,r0,r0,lz ,, -r0,r0,lz /) +nElems =(/i0,ir2,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,4,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f2,1./) ! stretching +!lower +Corner =(/-r0,-r0,0. ,,r0,-r0,0. ,,rm,-rm,0. ,, -rm,-rm,0.,, -r0,-r0,lz ,,r0,-r0,lz ,,rm,-rm,lz ,, -rm,-rm,lz /) +nElems =(/i0,ir2,iz/) ! number of elements in each direction +BCIndex =(/1,2,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f2,1./) ! stretching - useCurveds =T - BoundaryOrder=6 !choose boundary order freely +useCurveds =T +BoundaryOrder=6 !choose boundary order freely !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_yminus ! BC index 2 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xplus ! BC index 3 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xminus ! BC index 5 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/1,0,0,-1/) - vv=(/0.,0.,lz/) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 2 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xplus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +vv=(/0.,0.,lz/) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! diff --git a/tutorials/1-06-curved-postdeform/parameter_spherical_annulus.ini b/tutorials/1-06-curved-postdeform/parameter_spherical_annulus.ini index 54dedfd..eb4234b 100644 --- a/tutorials/1-06-curved-postdeform/parameter_spherical_annulus.ini +++ b/tutorials/1-06-curved-postdeform/parameter_spherical_annulus.ini @@ -1,7 +1,7 @@ DEFVAR=(INT): i0 = 032 ! no. elems along theta -DEFVAR=(INT): ir = 004 ! no. elems in r +DEFVAR=(INT): ir = 004 ! no. elems in r DEFVAR=(INT): iz = 001 ! no. elems in z (periodic direction) - + DEFVAR=(REAL): t0 = 0. ! theta start (should be 0) DEFVAR=(REAL): t1 = 2. ! theta end (full=2) DEFVAR=(REAL): ri = 0.4 ! inner radius (normalized, will be scaled with Postdeform_R0) @@ -11,41 +11,41 @@ DEFVAR=(REAL): f1 = 1.1 ! stretching factor in radial direction !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = SPHERICAL_ANNULUS_Ngeo4_i0_ir - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugvisuLevel=2 - checkElemJacobians=T - +ProjectName = SPHERICAL_ANNULUS_Ngeo4_i0_ir +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugvisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =1 ! number of boxes - !left - Corner =(/t0,-lzh,ri ,,t1,-lzh,ri,, t1,lzh,ri ,,t0,lzh,ri ,,t0,-lzh,r0 ,,t1,-lzh,r0,, t1,lzh,r0 ,,t0,lzh,r0 /) - nElems =(/i0,iz,ir/) ! number of elements in each direction - factor =(/1.,1.,f1/) - BCIndex =(/3,1,5,2,6,4/) ! - elemtype =108 ! element type (108: Hexahedral) +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +!left +Corner =(/t0,-lzh,ri ,,t1,-lzh,ri,, t1,lzh,ri ,,t0,lzh,ri ,,t0,-lzh,r0 ,,t1,-lzh,r0,, t1,lzh,r0 ,,t0,lzh,r0 /) +nElems =(/i0,iz,ir/) ! number of elements in each direction +factor =(/1.,1.,f1/) +BCIndex =(/3,1,5,2,6,4/) ! +elemtype =108 ! element type (108: Hexahedral) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_zplus ! BC index 2 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_inner ! BC index 3 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_outer ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_theta_minus ! BC index 5 - BoundaryType=(/1,0,0,-1/) !set to periodic if full annulus, lie onto each other after postdeform! - BoundaryName=BC_theta_plus ! BC index 6 - BoundaryType=(/1,0,0,1/) - vv=(/t1,0.,0./) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_inner ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_outer ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_theta_minus ! BC index 5 +BoundaryType=(/1,0,0,-1/) !set to periodic if full annulus, lie onto each other after postdeform! +BoundaryName=BC_theta_plus ! BC index 6 +BoundaryType=(/1,0,0,1/) +vv=(/t1,0.,0./) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! diff --git a/tutorials/1-08-curved-sphere/parameter_cubed_sphere.ini b/tutorials/1-08-curved-sphere/parameter_cubed_sphere.ini index 1ad8386..58d4aaf 100644 --- a/tutorials/1-08-curved-sphere/parameter_cubed_sphere.ini +++ b/tutorials/1-08-curved-sphere/parameter_cubed_sphere.ini @@ -2,7 +2,7 @@ ! DEFVAR are search and replace macros inside of this parameterfile, executed one after the other! !================================================================================================================================= ! DEFVAR=(INT): i0 = 004 ! no. elems in inner square i0xi0 -DEFVAR=(INT): ir = 005 ! no. elems in r +DEFVAR=(INT): ir = 005 ! no. elems in r DEFVAR=(REAL): ri = 1. ! inner box dim DEFVAR=(REAL): r0 = 1.2 ! outer box dim DEFVAR=(REAL): f1 = 1.1 ! stretching factor (1.0 no stretching) should be< 1.3 @@ -13,7 +13,7 @@ ProjectName = CUBED_SPHERE_Ngeo4_i0_ir ! Name of output files Debugvisu = T ! Visualize mesh and boundary conditions (paraview vtu files) DebugVisuLevel = 2 ! 0: visualize linear mesh (*_Debugmesh), 1: +curved BCs (*_SplineSurf.vtu) 2: +curved elements (_SplineVol.vtu) Nvisu = 12 ! supersampling factor for visualization (in each direction,per element) - checkElemJacobians=T +checkElemJacobians=T !================================================================================================================================= ! ! MESH diff --git a/tutorials/1-08-curved-sphere/parameter_emptysphereincube.ini b/tutorials/1-08-curved-sphere/parameter_emptysphereincube.ini index 23c8c76..6ebffa5 100644 --- a/tutorials/1-08-curved-sphere/parameter_emptysphereincube.ini +++ b/tutorials/1-08-curved-sphere/parameter_emptysphereincube.ini @@ -7,71 +7,71 @@ DEFVAR=(REAL): lx = 8. ! end of of wake box in x !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = EmptySphereInCube !_Ngeo4_i0_ir_jr ! Name of output files - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugVisuLevel=2 - checkElemJacobians=T - +ProjectName = EmptySphereInCube !_Ngeo4_i0_ir_jr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =7 ! number of boxes - !left outer (-x) - Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,7,0,1,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !right outer (+x) - Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,7,0/) !(/0,0,2,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !lower outer (-y) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,3,0,7,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !upper outer (+y) - Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,7,0,4,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !back outer (-z) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/5,0,0,0,0,7/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !front outer (+z) - Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/7,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !right outer (+x) - Corner =(/r0,-r0,-r0 ,,lx,-r0,-r0 ,,lx,r0,-r0 ,, r0,r0,-r0,, r0,-r0,r0 ,,lx,-r0,r0 ,,lx,r0,r0 ,, r0,r0,r0 /) - nElems =(/ix,i0,i0/) ! number of elements in each direction - BCIndex =(/5,3,2,4,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) +Mode =1 ! Mode for Cartesian boxes +nZones =7 ! number of boxes +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,7,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,7,0/) !(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,7,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,7,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,7/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/7,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/r0,-r0,-r0 ,,lx,-r0,-r0 ,,lx,r0,-r0 ,, r0,r0,-r0,, r0,-r0,r0 ,,lx,-r0,r0 ,,lx,r0,r0 ,, r0,r0,r0 /) +nElems =(/ix,i0,i0/) ! number of elements in each direction +BCIndex =(/5,3,2,4,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_xplus ! BC index 2 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yminus ! BC index 3 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zminus ! BC index 5 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_sphere ! BC index 7 - BoundaryType=(/2,1,0,0/) +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_sphere ! BC index 7 +BoundaryType=(/2,1,0,0/) !================================================================================================================================= ! ! MESH POST DEFORM diff --git a/tutorials/1-08-curved-sphere/parameter_sphere.ini b/tutorials/1-08-curved-sphere/parameter_sphere.ini index 7167bcf..31d0533 100644 --- a/tutorials/1-08-curved-sphere/parameter_sphere.ini +++ b/tutorials/1-08-curved-sphere/parameter_sphere.ini @@ -1,5 +1,5 @@ DEFVAR=(INT): i0 = 004 ! no. elems in inner cube i0xi0xi0 -DEFVAR=(INT): ir = 003 ! no. elems in r inside +DEFVAR=(INT): ir = 003 ! no. elems in r inside DEFVAR=(INT): jr = 006 ! no. elems in r outside DEFVAR=(REAL): ri = 0.5 ! inner square dim DEFVAR=(REAL): rm = 1. ! middle square dim @@ -9,112 +9,112 @@ DEFVAR=(REAL): f2 = 1.2 ! strech factor second ring !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = Sphere !_Ngeo4_i0_ir_jr ! Name of output files - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugVisuLevel=2 - checkElemJacobians=T - +ProjectName = Sphere !_Ngeo4_i0_ir_jr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =13 ! number of boxes - !center - Corner =(/-ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri,, -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri /) - nElems =(/i0,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !left (-x) - Corner =(/-rm,-rm,-rm ,,-ri,-ri,-ri ,,-ri,ri,-ri ,, -rm,rm,-rm,, -rm,-rm,rm ,,-ri,-ri,ri ,,-ri,ri,ri ,, -rm,rm,rm /) - nElems =(/ir,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/-f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !right (+x) - Corner =(/ri,-ri,-ri ,,rm,-rm,-rm ,,rm,rm,-rm ,, ri,ri,-ri,, ri,-ri,ri ,,rm,-rm,rm ,,rm,rm,rm ,, ri,ri,ri /) - nElems =(/ir,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !lower (-y) - Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,ri,-ri,-ri ,, -ri,-ri,-ri,, -rm,-rm,rm ,,rm,-rm,rm ,,ri,-ri,ri ,, -ri,-ri,ri /) - nElems =(/i0,ir,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !upper (+y) - Corner =(/-ri,ri,-ri ,,ri,ri,-ri ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, -rm,rm,rm /) - nElems =(/i0,ir,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !back (-z) - Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri/) - nElems =(/i0,i0,ir/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,-f1/) ! element stretching, either with a constant growth factor (+/- changes direction) - !front (+z) - Corner =(/ -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri,, -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm/) - nElems =(/i0,i0,ir/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,f1/) ! element stretching, either with a constant growth factor (+/- changes direction) - !left outer (-x) - Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,5,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/-f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !right outer (+x) - Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,3,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !lower outer (-y) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,2,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !upper outer (+y) - Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !back outer (-z) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,-f2/) ! element stretching, either with a constant growth factor (+/- changes direction) - !front outer (+z) - Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,f2/) ! element stretching, either with a constant growth factor (+/- changes direction) +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri,, -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!left (-x) +Corner =(/-rm,-rm,-rm ,,-ri,-ri,-ri ,,-ri,ri,-ri ,, -rm,rm,-rm,, -rm,-rm,rm ,,-ri,-ri,ri ,,-ri,ri,ri ,, -rm,rm,rm /) +nElems =(/ir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/-f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!right (+x) +Corner =(/ri,-ri,-ri ,,rm,-rm,-rm ,,rm,rm,-rm ,, ri,ri,-ri,, ri,-ri,ri ,,rm,-rm,rm ,,rm,rm,rm ,, ri,ri,ri /) +nElems =(/ir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!lower (-y) +Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,ri,-ri,-ri ,, -ri,-ri,-ri,, -rm,-rm,rm ,,rm,-rm,rm ,,ri,-ri,ri ,, -ri,-ri,ri /) +nElems =(/i0,ir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!upper (+y) +Corner =(/-ri,ri,-ri ,,ri,ri,-ri ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, -rm,rm,rm /) +nElems =(/i0,ir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!back (-z) +Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri/) +nElems =(/i0,i0,ir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,-f1/) ! element stretching, either with a constant growth factor (+/- changes direction) +!front (+z) +Corner =(/ -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri,, -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm/) +nElems =(/i0,i0,ir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,f1/) ! element stretching, either with a constant growth factor (+/- changes direction) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,5,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/-f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!right outer (+x) +Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,3,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,2,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!upper outer (+y) +Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,-f2/) ! element stretching, either with a constant growth factor (+/- changes direction) +!front outer (+z) +Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,f2/) ! element stretching, either with a constant growth factor (+/- changes direction) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_yminus ! BC index 2 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xplus ! BC index 3 ... - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xminus ! BC index 5 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 2 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xplus ! BC index 3 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) !================================================================================================================================= ! ! MESH POST DEFORM diff --git a/tutorials/1-08-curved-sphere/parameter_sphere_oct.ini b/tutorials/1-08-curved-sphere/parameter_sphere_oct.ini index c9c49c1..0ce30ba 100644 --- a/tutorials/1-08-curved-sphere/parameter_sphere_oct.ini +++ b/tutorials/1-08-curved-sphere/parameter_sphere_oct.ini @@ -1,5 +1,5 @@ DEFVAR=(INT): i0 = 004 ! no. elems in inner cube i0xi0xi0 -DEFVAR=(INT): ir = 003 ! no. elems in r inside +DEFVAR=(INT): ir = 003 ! no. elems in r inside DEFVAR=(INT): jr = 006 ! no. elems in r outside DEFVAR=(REAL): ri = 0.5 ! inner square dim DEFVAR=(REAL): rm = 1. ! middle square dim @@ -9,76 +9,76 @@ DEFVAR=(REAL): f2 = 1.2 ! strech factor second ring !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = Sphere_Oct !_Ngeo4_i0_ir_jr ! Name of output files - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugVisuLevel=2 - checkElemJacobians=T - +ProjectName = Sphere_Oct !_Ngeo4_i0_ir_jr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =7 ! number of boxes - !center - Corner =(/0.,0.,0. ,,ri,0.,0. ,,ri,ri,0. ,, 0.,ri,0.,, 0.,0.,ri ,,ri,0.,ri ,,ri,ri,ri ,, 0.,ri,ri /) - nElems =(/i0,i0,i0/) ! number of elements in each direction - BCIndex =(/1,2,0,0,5,0/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !right (+x) - Corner =(/ri,0.,0. ,,rm,0.,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,0.,ri ,,rm,0.,rm ,,rm,rm,rm ,, ri,ri,ri /) - nElems =(/ir,i0,i0/) ! number of elements in each direction - BCIndex =(/1,2,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !upper (+y) - Corner =(/0.,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, 0.,rm,0.,, 0.,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, 0.,rm,rm /) - nElems =(/i0,ir,i0/) ! number of elements in each direction - BCIndex =(/1,0,0,0,5,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !front (+z) - Corner =(/ 0.,0.,ri ,,ri,0.,ri ,,ri,ri,ri ,, 0.,ri,ri,, 0.,0.,rm ,,rm,0.,rm ,,rm,rm,rm ,, 0.,rm,rm/) - nElems =(/i0,i0,ir/) ! number of elements in each direction - BCIndex =(/0,2,0,0,5,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,f1/) ! element stretching, either with a constant growth factor (+/- changes direction) - !right outer (+x) - Corner =(/rm,0.,0. ,,r0,0.,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,0.,rm ,,r0,0.,r0 ,,r0,r0,r0 ,, rm,rm,rm /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/1,2,3,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !upper outer (+y) - Corner =(/0.,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, 0.,r0,0.,, 0.,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, 0.,r0,r0 /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/1,0,0,4,5,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) - !front outer (+z) - Corner =(/ 0.,0.,rm ,,rm,0.,rm ,,rm,rm,rm ,, 0.,rm,rm,, 0.,0.,r0 ,,r0,0.,r0 ,,r0,r0,r0 ,, 0.,r0,r0/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/0,2,0,0,5,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,f2/) ! element stretching, either with a constant growth factor (+/- changes direction) +Mode =1 ! Mode for Cartesian boxes +nZones =7 ! number of boxes +!center +Corner =(/0.,0.,0. ,,ri,0.,0. ,,ri,ri,0. ,, 0.,ri,0.,, 0.,0.,ri ,,ri,0.,ri ,,ri,ri,ri ,, 0.,ri,ri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/1,2,0,0,5,0/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!right (+x) +Corner =(/ri,0.,0. ,,rm,0.,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,0.,ri ,,rm,0.,rm ,,rm,rm,rm ,, ri,ri,ri /) +nElems =(/ir,i0,i0/) ! number of elements in each direction +BCIndex =(/1,2,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f1,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!upper (+y) +Corner =(/0.,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, 0.,rm,0.,, 0.,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, 0.,rm,rm /) +nElems =(/i0,ir,i0/) ! number of elements in each direction +BCIndex =(/1,0,0,0,5,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f1,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!front (+z) +Corner =(/ 0.,0.,ri ,,ri,0.,ri ,,ri,ri,ri ,, 0.,ri,ri,, 0.,0.,rm ,,rm,0.,rm ,,rm,rm,rm ,, 0.,rm,rm/) +nElems =(/i0,i0,ir/) ! number of elements in each direction +BCIndex =(/0,2,0,0,5,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,f1/) ! element stretching, either with a constant growth factor (+/- changes direction) +!right outer (+x) +Corner =(/rm,0.,0. ,,r0,0.,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,0.,rm ,,r0,0.,r0 ,,r0,r0,r0 ,, rm,rm,rm /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/1,2,3,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f2,1.,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!upper outer (+y) +Corner =(/0.,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, 0.,r0,0.,, 0.,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, 0.,r0,r0 /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/1,0,0,4,5,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f2,1./) ! element stretching, either with a constant growth factor (+/- changes direction) +!front outer (+z) +Corner =(/ 0.,0.,rm ,,rm,0.,rm ,,rm,rm,rm ,, 0.,rm,rm,, 0.,0.,r0 ,,r0,0.,r0 ,,r0,r0,r0 ,, 0.,r0,r0/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/0,2,0,0,5,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,f2/) ! element stretching, either with a constant growth factor (+/- changes direction) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_yminus ! BC index 2 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xplus ! BC index 3 ... - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_xminus ! BC index 5 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 2 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xplus ! BC index 3 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) !================================================================================================================================= ! ! MESH POST DEFORM diff --git a/tutorials/1-08-curved-sphere/parameter_sphereincube.ini b/tutorials/1-08-curved-sphere/parameter_sphereincube.ini index 2b5283d..6362d7e 100644 --- a/tutorials/1-08-curved-sphere/parameter_sphereincube.ini +++ b/tutorials/1-08-curved-sphere/parameter_sphereincube.ini @@ -1,5 +1,5 @@ DEFVAR=(INT): i0 = 004 ! no. elems in inner cube i0xi0xi0 -DEFVAR=(INT): ir = 004 ! no. elems in r inside +DEFVAR=(INT): ir = 004 ! no. elems in r inside DEFVAR=(INT): jr = 005 ! no. elems in r outside DEFVAR=(INT): ix = 006 ! no. elems in wake box x direction DEFVAR=(REAL): ri = 0.5 ! inner square dim @@ -9,104 +9,104 @@ DEFVAR=(REAL): lx = 8. ! end of of wake box in x !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = SphereInCube !_Ngeo4_i0_ir_jr ! Name of output files - Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) - DebugVisuLevel=2 - checkElemJacobians=T - +ProjectName = SphereInCube !_Ngeo4_i0_ir_jr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =14 ! number of boxes - !center - Corner =(/-ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri,, -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri /) - nElems =(/i0,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !left (-x) - Corner =(/-rm,-rm,-rm ,,-ri,-ri,-ri ,,-ri,ri,-ri ,, -rm,rm,-rm,, -rm,-rm,rm ,,-ri,-ri,ri ,,-ri,ri,ri ,, -rm,rm,rm /) - nElems =(/ir,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !right (+x) - Corner =(/ri,-ri,-ri ,,rm,-rm,-rm ,,rm,rm,-rm ,, ri,ri,-ri,, ri,-ri,ri ,,rm,-rm,rm ,,rm,rm,rm ,, ri,ri,ri /) - nElems =(/ir,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !lower (-y) - Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,ri,-ri,-ri ,, -ri,-ri,-ri,, -rm,-rm,rm ,,rm,-rm,rm ,,ri,-ri,ri ,, -ri,-ri,ri /) - nElems =(/i0,ir,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !upper (+y) - Corner =(/-ri,ri,-ri ,,ri,ri,-ri ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, -rm,rm,rm /) - nElems =(/i0,ir,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !back (-z) - Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri/) - nElems =(/i0,i0,ir/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !front (+z) - Corner =(/ -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri,, -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm/) - nElems =(/i0,i0,ir/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !left outer (-x) - Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !right outer (+x) - Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) - nElems =(/jr,i0,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,0/) !(/0,0,2,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !lower outer (-y) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !upper outer (+y) - Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) - nElems =(/i0,jr,i0/) ! number of elements in each direction - BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !back outer (-z) - Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !front outer (+z) - Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) - nElems =(/i0,i0,jr/) ! number of elements in each direction - BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - !right outer (+x) - Corner =(/r0,-r0,-r0 ,,lx,-r0,-r0 ,,lx,r0,-r0 ,, r0,r0,-r0,, r0,-r0,r0 ,,lx,-r0,r0 ,,lx,r0,r0 ,, r0,r0,r0 /) - nElems =(/ix,i0,i0/) ! number of elements in each direction - BCIndex =(/5,3,2,4,0,6/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) +Mode =1 ! Mode for Cartesian boxes +nZones =14 ! number of boxes +!center +Corner =(/-ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri,, -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rm,-rm,-rm ,,-ri,-ri,-ri ,,-ri,ri,-ri ,, -rm,rm,-rm,, -rm,-rm,rm ,,-ri,-ri,ri ,,-ri,ri,ri ,, -rm,rm,rm /) +nElems =(/ir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/ri,-ri,-ri ,,rm,-rm,-rm ,,rm,rm,-rm ,, ri,ri,-ri,, ri,-ri,ri ,,rm,-rm,rm ,,rm,rm,rm ,, ri,ri,ri /) +nElems =(/ir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,ri,-ri,-ri ,, -ri,-ri,-ri,, -rm,-rm,rm ,,rm,-rm,rm ,,ri,-ri,ri ,, -ri,-ri,ri /) +nElems =(/i0,ir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-ri,ri,-ri ,,ri,ri,-ri ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,ri,ri ,,ri,ri,ri ,,rm,rm,rm ,, -rm,rm,rm /) +nElems =(/i0,ir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm,, -ri,-ri,-ri ,,ri,-ri,-ri ,,ri,ri,-ri ,, -ri,ri,-ri/) +nElems =(/i0,i0,ir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -ri,-ri,ri ,,ri,-ri,ri ,,ri,ri,ri ,, -ri,ri,ri,, -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm/) +nElems =(/i0,i0,ir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rm,-rm,-rm ,,-rm,rm,-rm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rm,-rm,rm ,,-rm,rm,rm ,, -r0,r0,r0 /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rm,-rm,-rm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rm,rm,-rm,, rm,-rm,rm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rm,rm,rm /) +nElems =(/jr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) !(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rm,-rm,-rm ,, -rm,-rm,-rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rm,-rm,rm ,, -rm,-rm,rm /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rm,rm,-rm ,,rm,rm,-rm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,rm,rm ,,rm,rm,rm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rm,-rm,-rm ,,rm,-rm,-rm ,,rm,rm,-rm ,, -rm,rm,-rm/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rm,-rm,rm ,,rm,-rm,rm ,,rm,rm,rm ,, -rm,rm,rm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/r0,-r0,-r0 ,,lx,-r0,-r0 ,,lx,r0,-r0 ,, r0,r0,-r0,, r0,-r0,r0 ,,lx,-r0,r0 ,,lx,r0,r0 ,, r0,r0,r0 /) +nElems =(/ix,i0,i0/) ! number of elements in each direction +BCIndex =(/5,3,2,4,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) - useCurveds =T - BoundaryOrder=5 +useCurveds =T +BoundaryOrder=5 !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_xplus ! BC index 2 ... - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yminus ! BC index 3 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_yplus ! BC index 4 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zminus ! BC index 5 - BoundaryType=(/2,0,0,0/) - BoundaryName=BC_zplus ! BC index 6 - BoundaryType=(/2,0,0,0/) +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) !================================================================================================================================= ! ! MESH POST DEFORM diff --git a/tutorials/1-10-postdeform-nozzle/parameter.ini b/tutorials/1-10-postdeform-nozzle/parameter.ini index 916d189..3d7de58 100644 --- a/tutorials/1-10-postdeform-nozzle/parameter.ini +++ b/tutorials/1-10-postdeform-nozzle/parameter.ini @@ -1,5 +1,5 @@ DEFVAR=(INT): i0 = 004 ! no. elems in inner square i0xi0 -DEFVAR=(INT): ir1 = 003 ! no. elems in r for first ring +DEFVAR=(INT): ir1 = 003 ! no. elems in r for first ring DEFVAR=(INT): ir2 = 004 ! no. elems in r for second ring DEFVAR=(INT): iz = 012 ! no. elems in z DEFVAR=(REAL): ri = 0.5 ! inner square dim @@ -13,86 +13,86 @@ DEFVAR=(REAL): f2 = 0.7 ! stretching factor in second ring !================================================================================================================================= ! ! OUTPUT !================================================================================================================================= ! - ProjectName = LAVAL_NOZZLE_Ngeo5_9zones ! Name of output files - Debugvisu = F ! Visualize mesh and boundary conditions (tecplot ascii) - checkElemJacobians=T - +ProjectName = LAVAL_NOZZLE_Ngeo5_9zones ! Name of output files +Debugvisu = F ! Visualize mesh and boundary conditions (tecplot ascii) +checkElemJacobians=T + !================================================================================================================================= ! ! MESH !================================================================================================================================= ! - Mode =1 ! Mode for Cartesian boxes - nZones =9 ! number of boxes - !center - Corner =(/-ri,-ri,0. ,,ri,-ri,0. ,,ri,ri,0. ,, -ri,ri,0.,, -ri,-ri,lz ,,ri,-ri,lz ,,ri,ri,lz ,, -ri,ri,lz /) - nElems =(/i0,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,1.,1./) ! stretching - !left inner - Corner =(/-rm,-rm,0. ,,-ri,-ri,0. ,,-ri,ri,0. ,, -rm,rm,0.,, -rm,-rm,lz ,,-ri,-ri,lz ,,-ri,ri,lz ,, -rm,rm,lz /) - nElems =(/ir1,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f1,1.,1./) ! stretching - !right inner - Corner =(/ri,-ri,0. ,,rm,-rm,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,-ri,lz ,,rm,-rm,lz ,,rm,rm,lz ,, ri,ri,lz /) - nElems =(/ir1,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/-f1,1.,1./) ! stretching - !upper inner - Corner =(/-ri,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, -rm,rm,0.,, -ri,ri,lz ,,ri,ri,lz ,,rm,rm,lz ,, -rm,rm,lz /) - nElems =(/i0,ir1,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f1,1./) ! stretching - !lower inner - Corner =(/-rm,-rm,0. ,,rm,-rm,0. ,,ri,-ri,0. ,, -ri,-ri,0.,, -rm,-rm,lz ,,rm,-rm,lz ,,ri,-ri,lz ,, -ri,-ri,lz /) - nElems =(/i0,ir1,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f1,1./) ! stretching - !left - Corner =(/-r0,-r0,0. ,,-rm,-rm,0. ,,-rm,rm,0. ,, -r0,r0,0.,, -r0,-r0,lz ,,-rm,-rm,lz ,,-rm,rm,lz ,, -r0,r0,lz /) - nElems =(/ir2,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,0,2,3/) ! Indices of Boundary Conditions - factor =(/-f2,1.,1./) ! stretching - elemtype =108 ! element type (108: Hexahedral) - !rmght - Corner =(/rm,-rm,0. ,,r0,-r0,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,-rm,lz ,,r0,-r0,lz ,,r0,r0,lz ,, rm,rm,lz /) - nElems =(/ir2,i0,iz/) ! number of elements in each direction - BCIndex =(/1,0,2,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/f2,1.,1./) ! stretching - !upper - Corner =(/-rm,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, -r0,r0,0.,, -rm,rm,lz ,,rm,rm,lz ,,r0,r0,lz ,, -r0,r0,lz /) - nElems =(/i0,ir2,iz/) ! number of elements in each direction - BCIndex =(/1,0,0,2,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,f2,1./) ! stretching - !lower - Corner =(/-r0,-r0,0. ,,r0,-r0,0. ,,rm,-rm,0. ,, -rm,-rm,0.,, -r0,-r0,lz ,,r0,-r0,lz ,,rm,-rm,lz ,, -rm,-rm,lz /) - nElems =(/i0,ir2,iz/) ! number of elements in each direction - BCIndex =(/1,2,0,0,0,3/) ! Indices of Boundary Conditions - elemtype =108 ! element type (108: Hexahedral) - factor =(/1.,-f2,1./) ! stretching +Mode =1 ! Mode for Cartesian boxes +nZones =9 ! number of boxes +!center +Corner =(/-ri,-ri,0. ,,ri,-ri,0. ,,ri,ri,0. ,, -ri,ri,0.,, -ri,-ri,lz ,,ri,-ri,lz ,,ri,ri,lz ,, -ri,ri,lz /) +nElems =(/i0,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,1.,1./) ! stretching +!left inner +Corner =(/-rm,-rm,0. ,,-ri,-ri,0. ,,-ri,ri,0. ,, -rm,rm,0.,, -rm,-rm,lz ,,-ri,-ri,lz ,,-ri,ri,lz ,, -rm,rm,lz /) +nElems =(/ir1,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f1,1.,1./) ! stretching +!right inner +Corner =(/ri,-ri,0. ,,rm,-rm,0. ,,rm,rm,0. ,, ri,ri,0.,, ri,-ri,lz ,,rm,-rm,lz ,,rm,rm,lz ,, ri,ri,lz /) +nElems =(/ir1,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/-f1,1.,1./) ! stretching +!upper inner +Corner =(/-ri,ri,0. ,,ri,ri,0. ,,rm,rm,0. ,, -rm,rm,0.,, -ri,ri,lz ,,ri,ri,lz ,,rm,rm,lz ,, -rm,rm,lz /) +nElems =(/i0,ir1,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f1,1./) ! stretching +!lower inner +Corner =(/-rm,-rm,0. ,,rm,-rm,0. ,,ri,-ri,0. ,, -ri,-ri,0.,, -rm,-rm,lz ,,rm,-rm,lz ,,ri,-ri,lz ,, -ri,-ri,lz /) +nElems =(/i0,ir1,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f1,1./) ! stretching +!left +Corner =(/-r0,-r0,0. ,,-rm,-rm,0. ,,-rm,rm,0. ,, -r0,r0,0.,, -r0,-r0,lz ,,-rm,-rm,lz ,,-rm,rm,lz ,, -r0,r0,lz /) +nElems =(/ir2,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,0,2,3/) ! Indices of Boundary Conditions +factor =(/-f2,1.,1./) ! stretching +elemtype =108 ! element type (108: Hexahedral) +!rmght +Corner =(/rm,-rm,0. ,,r0,-r0,0. ,,r0,r0,0. ,, rm,rm,0.,, rm,-rm,lz ,,r0,-r0,lz ,,r0,r0,lz ,, rm,rm,lz /) +nElems =(/ir2,i0,iz/) ! number of elements in each direction +BCIndex =(/1,0,2,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/f2,1.,1./) ! stretching +!upper +Corner =(/-rm,rm,0. ,,rm,rm,0. ,,r0,r0,0. ,, -r0,r0,0.,, -rm,rm,lz ,,rm,rm,lz ,,r0,r0,lz ,, -r0,r0,lz /) +nElems =(/i0,ir2,iz/) ! number of elements in each direction +BCIndex =(/1,0,0,2,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,f2,1./) ! stretching +!lower +Corner =(/-r0,-r0,0. ,,r0,-r0,0. ,,rm,-rm,0. ,, -rm,-rm,0.,, -r0,-r0,lz ,,r0,-r0,lz ,,rm,-rm,lz ,, -rm,-rm,lz /) +nElems =(/i0,ir2,iz/) ! number of elements in each direction +BCIndex =(/1,2,0,0,0,3/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +factor =(/1.,-f2,1./) ! stretching - useCurveds =T - BoundaryOrder=6 !choose boundary order freely +useCurveds =T +BoundaryOrder=6 !choose boundary order freely !================================================================================================================================= ! ! BOUNDARY CONDITIONS !================================================================================================================================= ! - BoundaryName=BC_inflow ! BC index 1 (from position in parameterfile) - BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) - BoundaryName=BC_wall ! BC index 2 - BoundaryType=(/9,1,0,0/) - BoundaryName=BC_outflow ! BC index 3 - BoundaryType=(/2,0,0,0/) +BoundaryName=BC_inflow ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_wall ! BC index 2 +BoundaryType=(/9,1,0,0/) +BoundaryName=BC_outflow ! BC index 3 +BoundaryType=(/2,0,0,0/) !================================================================================================================================= ! ! MESH POST DEFORM !================================================================================================================================= ! MeshPostDeform=21 ! deforms [-1,1]^2 x [0,lz] to a nozzle (hard coded polynomial profile r(z) -PostDeform_R0=s0 ! here domain is [-4,4]^2 mapped to a cylinder with radius 0.25*4 = 1 and +PostDeform_R0=s0 ! here domain is [-4,4]^2 mapped to a cylinder with radius 0.25*4 = 1 and ! then to the nozzle diff --git a/tutorials/1-13-postdeform_periodic_hill/parameter_hopr.ini b/tutorials/1-13-postdeform_periodic_hill/parameter_hopr.ini index e6ee3f6..9f3a9cd 100644 --- a/tutorials/1-13-postdeform_periodic_hill/parameter_hopr.ini +++ b/tutorials/1-13-postdeform_periodic_hill/parameter_hopr.ini @@ -1,5 +1,5 @@ -! Parameters for the Ercoftac periodic hill testcase +! Parameters for the Ercoftac periodic hill testcase ! http://www.kbwiki.ercoftac.org/w/index.php/Abstr:2D_Periodic_Hill_Flow ! For Re=700, a resolution of 16x16x8 elems with bell stretching and DXmaxToDXmin = (/1.5,10.,1./) ! yields approximately y+=0.8 and x+=z+=12 at the hill cusp and about half of that everywhere else. @@ -11,10 +11,10 @@ ProjectName = phill ! name of the project (used for filenam Debugvisu = F ! Write debug mesh to tecplot file DebugvisuLevel = 1 ! Level 0: visualization of linear mesh and BC - ! (default), Level 1: + curved surface - ! visualization (_SplineSurf.dat), if useCurveds +! (default), Level 1: + curved surface +! visualization (_SplineSurf.dat), if useCurveds NVisu = 4 ! number of visualization points per element edge, - ! if useCurved +! if useCurved checkElemJacobians = T ! checks the Jacobian and scaled Jacobian for each element !=============================================================================== ! @@ -26,8 +26,8 @@ nElems = (/16,16,8/) ! number of elements in each direction BCIndex = (/1,2,3,4,5,6/) ! Indices of UserDefinedBoundaries Meshtype = 1 ! Mesh Types: 1 - Cube (origin + dimensions) 2 - - ! Bilinear (8 points CGNS notation) 3 - Curved - ! (see Whichmapping) +! Bilinear (8 points CGNS notation) 3 - Curved +! (see Whichmapping) X0 = (/0.,0.,0./) DX = (/9.,3.035,4.5/) @@ -45,7 +45,7 @@ nCurvedBoundaryLayer= 1 ! BOUNDARY CONDITIONS !=============================================================================== ! nUserDefinedBoundaries = 6 ! number of bc's, order of bc's in cgns face order -BoundaryName=BC_periodicz- +BoundaryName=BC_periodicz- BoundaryType=(/1,0,0,2/) ! (/bc-type,curved index,bc state,displacement vector/) BoundaryName=BC_wall_lower BoundaryType=(/4,0,1,0/) ! (/bc-type,curved index,bc state,displacement vector/) @@ -58,5 +58,5 @@ BoundaryType=(/1,0,0,1/) ! (/bc-type,curved index,bc state,displ BoundaryName=BC_periodicz+ BoundaryType=(/1,0,0,-2/) ! (/bc-type,curved index,bc state,displacement vector/) nVV=2 ! number of displacement vectors for periodic bc's (=number bc's) -VV=(/9,0.,0./) ! displacement vector 1 for bc with (/?,?,?,+-1) -VV=(/0.,0.,4.5/) ! displacement vector 2 for bc with (/?,?,?,+-2) +VV=(/9,0.,0./) ! displacement vector 1 for bc with (/?,?,?,+-1) +VV=(/0.,0.,4.5/) ! displacement vector 2 for bc with (/?,?,?,+-2) diff --git a/tutorials/2-04-external_Specmesh_curved/parameter.ini b/tutorials/2-04-external_Specmesh_curved/parameter.ini index 212da4d..9e648ce 100644 --- a/tutorials/2-04-external_Specmesh_curved/parameter.ini +++ b/tutorials/2-04-external_Specmesh_curved/parameter.ini @@ -1,18 +1,18 @@ !=============================================================================== ! ! OUTPUT !=============================================================================== ! - projectname=SPECMESH_NACA ! name of the project (used for filenames) - Debugvisu =T ! Write debug mesh to tecplot file - outputFormat=0 - DebugvisuLevel=2 ! Level 0: visualization of linear mesh and BC (default), - ! Level 1: + curved surface visualization (_SplineSurf.*), if useCurveds - ! Level 2: + curved volume visualization (_SplineVol.*), if useCurveds +projectname=SPECMESH_NACA ! name of the project (used for filenames) +Debugvisu =T ! Write debug mesh to tecplot file +outputFormat=0 +DebugvisuLevel=2 ! Level 0: visualization of linear mesh and BC (default), + ! Level 1: + curved surface visualization (_SplineSurf.*), if useCurveds + ! Level 2: + curved volume visualization (_SplineVol.*), if useCurveds !=============================================================================== ! ! MESH !=============================================================================== ! Mode =6 ! 6 : specMesh2D - nZones =1 ! number of zones - filename=NACA0012.mesh ! name of specmesh file +nZones =1 ! number of zones +filename=NACA0012.mesh ! name of specmesh file meshscale=1.0 ! scales all input meshes by a factor spacequandt=1. ! tolerance for mesh connectivity (multiplicates with real tolerance) @@ -32,13 +32,13 @@ checkElemJacobians=T ! checks the Jacobian and scaled Jacobian for !=============================================================================== ! ! BOUNDARY CONDITIONS !=============================================================================== ! - BoundaryName=Airfoil ! the BC_Name must be defined in mesh file - BoundaryType=(/4,1,0,0/) - BoundaryName=Left ! the BC_Name must be defined in mesh file - BoundaryType=(/2,0,0,0/) - BoundaryName=Right - BoundaryType=(/2,0,0,0/) - BoundaryName=Bottom - BoundaryType=(/2,0,0,0/) - BoundaryName=Top - BoundaryType=(/2,0,0,0/) +BoundaryName=Airfoil ! the BC_Name must be defined in mesh file +BoundaryType=(/4,1,0,0/) +BoundaryName=Left ! the BC_Name must be defined in mesh file +BoundaryType=(/2,0,0,0/) +BoundaryName=Right +BoundaryType=(/2,0,0,0/) +BoundaryName=Bottom +BoundaryType=(/2,0,0,0/) +BoundaryName=Top +BoundaryType=(/2,0,0,0/) diff --git a/tutorials/2-06-external_mesh_Gmsh_v4_3D/hopr.ini b/tutorials/2-06-external_mesh_Gmsh_v4_3D/hopr.ini old mode 100755 new mode 100644 index c6c5db7..0e08f3d --- a/tutorials/2-06-external_mesh_Gmsh_v4_3D/hopr.ini +++ b/tutorials/2-06-external_mesh_Gmsh_v4_3D/hopr.ini @@ -7,8 +7,8 @@ Logging = F ! Write log files !=============================================================================== ! ! MESH !=============================================================================== ! -FileName = 70degCone_3D.msh ! name of mesh file -Mode = 5 ! 1 Cartesian 2 gambit file 3 CGNS +FileName = 70degCone_3D.msh ! name of mesh file +Mode = 5 ! 1 Cartesian 2 gambit file 3 CGNS meshscale = 0.001 SpaceQuandt = 1 !=============================================================================== ! diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_fullPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_fullPeriodic.ini new file mode 100644 index 0000000..65f3a88 --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_fullPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_FULLPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_noPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_noPeriodic.ini new file mode 100644 index 0000000..2486f6a --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_noPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_NOPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/3,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/4,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/5,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/6,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/7,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xPeriodic.ini new file mode 100644 index 0000000..4c7b5a4 --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_XPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/3,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/4,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/2,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xyPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xyPeriodic.ini new file mode 100644 index 0000000..46e29d9 --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xyPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_XYPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/2,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xzPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xzPeriodic.ini new file mode 100644 index 0000000..7b04e1a --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_xzPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_XZPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yPeriodic.ini new file mode 100644 index 0000000..5de898e --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_YPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/5,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/6,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/2,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yzPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yzPeriodic.ini new file mode 100644 index 0000000..3e9189b --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_yzPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_YZPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/2,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/2,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_zPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_zPeriodic.ini new file mode 100644 index 0000000..b92697f --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_01_01_01_zPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 001 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_ZPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/4,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/5,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/3,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_02_01_01_fullPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_02_01_01_fullPeriodic.ini new file mode 100644 index 0000000..e53401a --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_02_01_01_fullPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 002 +DEFVAR=(INT): nyy = 001 +DEFVAR=(INT): nzz = 001 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_FULLPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_fullPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_fullPeriodic.ini new file mode 100644 index 0000000..41cf18f --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_fullPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 002 +DEFVAR=(INT): nyy = 003 +DEFVAR=(INT): nzz = 004 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_FULLPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/1,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_noPeriodic.ini b/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_noPeriodic.ini new file mode 100644 index 0000000..e891d87 --- /dev/null +++ b/tutorials/4-01-testFEMconnect/parameter_elems_02_03_04_noPeriodic.ini @@ -0,0 +1,50 @@ +DEFVAR=(INT): nxx = 002 +DEFVAR=(INT): nyy = 003 +DEFVAR=(INT): nzz = 004 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = FEMCONNECT_NOPERIODIC_nxx_nyy_nzz ! Name of output files + +generateFEMconnectivity=T !build FEM connectivity and write to HDF5 file +Debugvisu = T ! Write files for Visualization of the mesh and boundary conditions (tecplot ascii) +DebugVisuLevel =2 +Nvisu = 10 + +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =1 ! number of boxes +Corner =(/-0.6,-0.8,-0.7 , 1.4,-0.8,-0.7 , 1.4,1.2,-0.7 , -0.6,1.2,-0.7 , & + -0.6,-0.8, 1.3 , 1.4,-0.8, 1.3 , 1.4,1.2, 1.3 , -0.6,1.2, 1.3 /) + ! Corner node positions: (/ x_1,y_1,z_1, x_2,y_2,z_2,..... , x_8,y_8,z_8/) +nElems =(/nxx,nyy,nzz/) ! number of elements in each direction +BCIndex =(/1,2,3,4,5,6/) ! Indices of Boundary Conditions for six Boundary Faces (z-,y-,x+,y+,x-,z+) +elemtype =108 ! Elementform (104: Tetrahedra, 105: pyramid, 106:prism, 108: Hexahedral) +useCurveds= T +BoundaryOrder=5 !=Ngeo+1 + +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_zminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,3/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/3,0,0,2/) +BoundaryName=BC_xplus ! BC index 6 +BoundaryType=(/4,0,0,-1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/5,0,0,-2/) ! (/ BCType=1: periodic, 0, 0, Index of second vector vv in parameter file /) +BoundaryName=BC_xminus ! BC index 5 +BoundaryType=(/6,0,0,1/) +BoundaryName=BC_zplus ! BC index 2 +BoundaryType=(/7,0,0,-3/) ! here the direction of the vector 1 is changed, because it is the opposite side +vv=(/2.,0.,0./) ! vector for periodic BC in z direction (zminus,zplus), index=1 +vv=(/0.,2.,0./) ! vector for periodic BC in y direction (yminus,yplus), index=2 +vv=(/0.,0.,2./) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=31 +!PostConnect=1 diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_nonperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_nonperiodic.ini new file mode 100644 index 0000000..4df1d37 --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_nonperiodic.ini @@ -0,0 +1,112 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_nonperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xperiodic.ini new file mode 100644 index 0000000..713b06d --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xperiodic.ini @@ -0,0 +1,113 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_xperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) +vv=(/8.0,0.0,0.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyperiodic.ini new file mode 100644 index 0000000..fe5e15f --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyperiodic.ini @@ -0,0 +1,114 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_xyperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) +vv=(/8.0,0.0,0.0/) +vv=(/0.0,8.0,0.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyzperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyzperiodic.ini new file mode 100644 index 0000000..ec9209e --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xyzperiodic.ini @@ -0,0 +1,115 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_xyzperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-2/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/1,0,0,3/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-3/) +vv=(/8.0,0.0,0.0/) +vv=(/0.0,8.0,0.0/) +vv=(/0.0,0.0,8.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xzperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xzperiodic.ini new file mode 100644 index 0000000..97d5701 --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_xzperiodic.ini @@ -0,0 +1,114 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_xzperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/1,0,0,1/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-2/) +vv=(/8.0,0.0,0.0/) +vv=(/0.0,0.0,8.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yperiodic.ini new file mode 100644 index 0000000..cb8f6f9 --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yperiodic.ini @@ -0,0 +1,113 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_yperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/2,0,0,0/) +vv=(/0.0,8.0,0.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yzperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yzperiodic.ini new file mode 100644 index 0000000..a2c0e02 --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_yzperiodic.ini @@ -0,0 +1,114 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_yzperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/1,0,0,-1/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/1,0,0,2/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-2/) +vv=(/0.0,8.0,0.0/) +vv=(/0.0,0.0,8.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 + diff --git a/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_zperiodic.ini b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_zperiodic.ini new file mode 100644 index 0000000..ad56487 --- /dev/null +++ b/tutorials/4-02-unstruct_curved_FEMconnect/parameter_sphereincubeFEM_zperiodic.ini @@ -0,0 +1,113 @@ +DEFVAR=(INT): i0 = 003 ! no. elems in inner cube i0xi0xi0 +DEFVAR=(INT): iir = 003 ! no. elems in r inside +DEFVAR=(INT): jjr = 002 ! no. elems in r outside +DEFVAR=(REAL): rri = 0.5 ! inner square dim +DEFVAR=(REAL): rrm = 1. ! middle square dim +DEFVAR=(REAL): r0 = 4. ! outer square dim + +DEFVAR=(INT): n0 =2 ! =Ngeo +DEFVAR=(INT): b0 =3 ! boundary order, =Ngeo+1 +!================================================================================================================================= ! +! OUTPUT +!================================================================================================================================= ! +ProjectName = SphereInCubeFEM_zperiodic_Ngeo_n0_i0_iir_jjr ! Name of output files +Debugvisu = T ! Visualize mesh and boundary conditions (tecplot ascii) +DebugVisuLevel=2 +checkElemJacobians=T + +generateFEMconnectivity=T + +useCurveds =T +BoundaryOrder=b0 +!================================================================================================================================= ! +! MESH +!================================================================================================================================= ! +Mode =1 ! Mode for Cartesian boxes +nZones =13 ! number of boxes +!center +Corner =(/-rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri,, -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri /) +nElems =(/i0,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left (-x) +Corner =(/-rrm,-rrm,-rrm ,,-rri,-rri,-rri ,,-rri,rri,-rri ,, -rrm,rrm,-rrm,, -rrm,-rrm,rrm ,,-rri,-rri,rri ,,-rri,rri,rri ,, -rrm,rrm,rrm /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right (+x) +Corner =(/rri,-rri,-rri ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, rri,rri,-rri,, rri,-rri,rri ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, rri,rri,rri /) +nElems =(/iir,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower (-y) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rri,-rri,-rri ,, -rri,-rri,-rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rri,-rri,rri ,, -rri,-rri,rri /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper (+y) +Corner =(/-rri,rri,-rri ,,rri,rri,-rri ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,rri,rri ,,rri,rri,rri ,,rrm,rrm,rrm ,, -rrm,rrm,rrm /) +nElems =(/i0,iir,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back (-z) +Corner =(/-rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm,, -rri,-rri,-rri ,,rri,-rri,-rri ,,rri,rri,-rri ,, -rri,rri,-rri/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front (+z) +Corner =(/ -rri,-rri,rri ,,rri,-rri,rri ,,rri,rri,rri ,, -rri,rri,rri,, -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm/) +nElems =(/i0,i0,iir/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!left outer (-x) +Corner =(/-r0,-r0,-r0 ,,-rrm,-rrm,-rrm ,,-rrm,rrm,-rrm ,, -r0,r0,-r0,, -r0,-r0,r0 ,,-rrm,-rrm,rrm ,,-rrm,rrm,rrm ,, -r0,r0,r0 /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,0,1,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!right outer (+x) +Corner =(/rrm,-rrm,-rrm ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, rrm,rrm,-rrm,, rrm,-rrm,rrm ,,r0,-r0,r0 ,,r0,r0,r0 ,, rrm,rrm,rrm /) +nElems =(/jjr,i0,i0/) ! number of elements in each direction +BCIndex =(/0,0,2,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!lower outer (-y) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,rrm,-rrm,-rrm ,, -rrm,-rrm,-rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,rrm,-rrm,rrm ,, -rrm,-rrm,rrm /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,3,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!upper outer (+y) +Corner =(/-rrm,rrm,-rrm ,,rrm,rrm,-rrm ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,rrm,rrm ,,rrm,rrm,rrm ,,r0,r0,r0 ,, -r0,r0,r0 /) +nElems =(/i0,jjr,i0/) ! number of elements in each direction +BCIndex =(/0,0,0,4,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!back outer (-z) +Corner =(/-r0,-r0,-r0 ,,r0,-r0,-r0 ,,r0,r0,-r0 ,, -r0,r0,-r0,, -rrm,-rrm,-rrm ,,rrm,-rrm,-rrm ,,rrm,rrm,-rrm ,, -rrm,rrm,-rrm/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/5,0,0,0,0,0/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!front outer (+z) +Corner =(/ -rrm,-rrm,rrm ,,rrm,-rrm,rrm ,,rrm,rrm,rrm ,, -rrm,rrm,rrm,, -r0,-r0,r0 ,,r0,-r0,r0 ,,r0,r0,r0 ,, -r0,r0,r0/) +nElems =(/i0,i0,jjr/) ! number of elements in each direction +BCIndex =(/0,0,0,0,0,6/) ! Indices of Boundary Conditions +elemtype =108 ! element type (108: Hexahedral) +!================================================================================================================================= ! +! BOUNDARY CONDITIONS +!================================================================================================================================= ! +BoundaryName=BC_xminus ! BC index 1 (from position in parameterfile) +BoundaryType=(/2,0,0,0/) ! (/ Type, curveIndex, State, alpha /) +BoundaryName=BC_xplus ! BC index 2 ... +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yminus ! BC index 3 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_yplus ! BC index 4 +BoundaryType=(/2,0,0,0/) +BoundaryName=BC_zminus ! BC index 5 +BoundaryType=(/1,0,0,1/) +BoundaryName=BC_zplus ! BC index 6 +BoundaryType=(/1,0,0,-1/) +vv=(/0.0,0.0,8.0/) +!================================================================================================================================= ! +! MESH POST DEFORM +!================================================================================================================================= ! +MeshPostDeform=4 +PostDeform_R0=0.5 +