Skip to content

Commit

Permalink
added Abaqus input support
Browse files Browse the repository at this point in the history
  • Loading branch information
JTHesse committed Jan 11, 2024
1 parent d55d476 commit ec40fd3
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ SPDX-License-Identifier: BSD-3-Clause

All notable changes to this project will be documented in this file.

## [1.1.0] -
## [1.0.4] -

### Added

- FEM Support
- Abaqus mesh input (.inp)

## [1.0.3] - 2024-01-08

Expand Down
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name = "PeriLab"
uuid = "2ecefcea-59f0-46dd-9cfd-1d2b8cc5f112"
authors = ["Christian Willberg <christian.willberg@dlr.de>", "Jan-Timo Hesse <jan-timo.hesse@dlr.de>"]
version = "1.1.0"
version = "1.0.4"

[deps]
AbaqusReader = "bc6b9049-e460-56d6-94b4-a597b2c0390d"
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Explore the comprehensive [documentation](https://dlr-perihub.gitlab.io/PeriLab.

- 📤📥 **Exodus Input/Output**: PeriLab uses the Exodus II data format for input and output, enabling easy transfer of data between simulation tools.

- 🧮 **Abaqus Input**: PeriLab supports Abaqus input files, allowing users to create custom Abaqus models for their simulations.

-**Bond filter**: The bond filter feature allows users to apply specific conditions to the bonds between particles in a simulation, influencing their behavior and interaction with other particles.

- 🔧 **User specified Input/Output**: PeriLab provides flexible options for users to specify custom input and output files, enabling easy data manipulation and analysis.
Expand Down
46 changes: 46 additions & 0 deletions src/IO/mesh_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using DataFrames
using MPI
using TimerOutputs
using LinearAlgebra
using AbaqusReader
using NearestNeighbors: BallTree
using NearestNeighbors: inrange
include("../Support/Parameters/parameter_handling.jl")
Expand Down Expand Up @@ -448,6 +449,51 @@ function read_mesh(filename::String, params::Dict)

return mesh_df

elseif params["Discretization"]["Type"] == "Abaqus"

mesh = abaqus_read_mesh(filename; verbose=false)

nodes = mesh["nodes"]
elements = mesh["elements"]
element_sets = mesh["element_sets"]

dof = size(nodes[1])[1]

mesh_df = ifelse(dof == 2,
DataFrame(x=[], y=[], volume=[], block_id=[]),
DataFrame(x=[], y=[], z=[], volume=[], block_id=[])
)

block_id = 1
element_written = []

for (key, values) in element_sets
for (i, element_id) in enumerate(values)
if element_id in element_written
continue
end
node_ids = elements[element_id]
vertices = [nodes[node_id] for node_id in node_ids]
center = sum(vertices) / size(vertices)[1]
if dof == 2
volume = area_of_polygon(vertices)
push!(mesh_df, (x=center[1], y=center[2], volume=volume, block_id=block_id))
else
volume = abs(dot(vertices[1] - vertices[4], cross(vertices[2] - vertices[4], vertices[3] - vertices[4]))) / 6.0
push!(mesh_df, (x=center[1], y=center[2], z=center[3], volume=volume, block_id=block_id))
end
push!(element_written, element_id)
end
block_id += 1
end

mesh = nothing
nodes = nothing
elements = nothing
element_sets = nothing

return mesh_df

elseif params["Discretization"]["Type"] == "Text File"
header_line, header = get_header(filename)
return CSV.read(filename, DataFrame; delim=" ", ignorerepeated=true, header=header, skipto=header_line + 1, comment="#")
Expand Down
2 changes: 1 addition & 1 deletion src/PeriLab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import .IO
import .Solver
# end

PERILAB_VERSION = "1.1.0"
PERILAB_VERSION = "1.0.4"

export main

Expand Down
19 changes: 19 additions & 0 deletions src/Support/Parameters/parameter_handling_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,25 @@ function get_node_sets(params::Dict, path::String)
close(exo)
return nsets
end
if type == "Abaqus"
mesh = abaqus_read_mesh(joinpath(path, get_mesh_name(params)); verbose=false)
element_sets = mesh["element_sets"]
element_written = []
id = 1
for (key, values) in element_sets
nodes::Vector{Int64} = []
for (i, element_id) in enumerate(values)
if element_id in element_written
continue
end
push!(element_written, element_id)
push!(nodes, id)
id += 1
end
nsets[key] = nodes
end
return nsets
end
if !haskey(params["Discretization"], "Node Sets")
return nsets
end
Expand Down

0 comments on commit ec40fd3

Please sign in to comment.