diff --git a/geometry/3d_beam_nx/beam_3d.jl b/geometry/3d_beam_nx/beam_3d.jl new file mode 100644 index 0000000..c901acf --- /dev/null +++ b/geometry/3d_beam_nx/beam_3d.jl @@ -0,0 +1,90 @@ +using JuliaFEM +using JuliaFEM.Preprocess +using JuliaFEM.Postprocess +using JuliaFEM.Abaqus: create_surface_elements + +Logging.configure(level=Logging.DEBUG) + +function create_body(mesh, name, E, nu, rho) + body = Problem(mesh, Elasticity, name, 3) + update!(body, "youngs modulus", E) + update!(body, "poissons ratio", nu) + update!(body, "density", rho) + return body +end + +""" Create boundary condition from surface set. """ +function create_bc_from_surface_set(mesh, name, u1, u2, u3) + bc = Problem(Dirichlet, string(name), 3, "displacement") + bc.elements = create_surface_elements(mesh, name) + update!(bc, "displacement 1", u1) + update!(bc, "displacement 2", u2) + update!(bc, "displacement 3", u3) + return bc +end + +""" Create boundary condition from node set. """ +function create_bc_from_node_set(mesh, name, u1, u2, u3) + bc = Problem(Dirichlet, string(name), 3, "displacement") + bc.elements = [Element(Poi1, [nid]) for nid in mesh.node_sets[name]] + update!(bc, "geometry", mesh.nodes) + update!(bc, "displacement 1", u1) + update!(bc, "displacement 2", u2) + update!(bc, "displacement 3", u3) + return bc +end + +function create_bc(mesh, name, u1=0.0, u2=0.0, u3=0.0) + name = Symbol(name) + if haskey(mesh.surface_sets, name) + return create_bc_from_surface_set(mesh, name, u1, u2, u3) + elseif haskey(mesh.node_sets, name) + return create_bc_from_node_set(mesh, name, u1, u2, u3) + else + error("Mesh does not contain node or surface set $name") + end +end + +function create_interface(mesh, slave_surface::String, master_surface::String) + interface = Problem(Mortar, "interface between $slave_surface and $master_surface", 3, "displacement") + interface.properties.dual_basis = true + slave_elements = create_surface_elements(mesh, Symbol(slave_surface)) + master_elements = create_surface_elements(mesh, Symbol(master_surface)) + nslaves = length(slave_elements) + nmasters = length(master_elements) + info("$nslaves slaves, $nmasters masters") + update!(slave_elements, "master elements", master_elements) + interface.elements = [slave_elements; master_elements] + return interface +end + +function create_interface(mesh, slave::Problem, master::Problem) + slave_surface = slave.name * "_TO_" * master.name + master_surface = master.name * "_TO_" * slave.name + return create_interface(mesh, slave_surface, master_surface) +end + +# start of simulation +mesh = abaqus_read_mesh("beam_3d_2nd_order_tetra.inp") +info("element sets = ", collect(keys(mesh.element_sets))) +info("surface sets = ", collect(keys(mesh.surface_sets))) + +# parts +beam = create_body(mesh, "beam", 210.0e3, 0.3, 7.85e-9) + +# boundary conditions +bc1 = create_bc(mesh, "fixed") + +# load +load = Problem(Elasticity, "pressure load", 3) +load.elements = create_surface_elements(mesh, :load) +update!(load, "surface pressure", 20.0) + +# solution +isfile("results.h5") && rm("results.h5") +isfile("results.xmf") && rm("results.xmf") +solver = Solver(Linear, beam) +solver.xdmf = Xdmf("results") +solver() +close(get(solver.xdmf).hdf) + diff --git a/geometry/3d_beam_nx/beam_3d_2nd_order_tetra.inp b/geometry/3d_beam_nx/beam_3d_2nd_order_tetra.inp new file mode 100644 index 0000000..c544954 --- /dev/null +++ b/geometry/3d_beam_nx/beam_3d_2nd_order_tetra.inp @@ -0,0 +1,195 @@ +**% +*NODE, NSET=nset_csys0 + 1, 1.864581E+00,-3.819218E+00, 6.211303E+01 + 2,-2.538812E+00,-2.410175E+00, 2.521703E+02 + 3, 2.593229E+01, 2.309039E+01, 3.105652E+01 + 4, 2.593229E+01, 2.309039E+01, 8.105652E+01 + 5,-2.406771E+01, 2.309039E+01, 8.105652E+01 + 6, 2.593229E+01,-2.690961E+01, 3.105652E+01 + 7,-2.406771E+01,-1.909609E+00, 1.060565E+02 + 8,-2.406771E+01,-2.690961E+01, 8.105652E+01 + 9,-2.406771E+01, 2.309039E+01, 3.105652E+01 + 10, 2.593229E+01,-2.690961E+01, 8.105652E+01 + 11, 0.000000E+00, 2.500000E+01, 1.250000E+02 + 12, 2.373059E+01,-2.620509E+01, 2.760851E+02 + 13, 2.373059E+01,-2.620509E+01, 2.260851E+02 + 14,-2.626941E+01,-2.620509E+01, 2.260851E+02 + 15, 2.373059E+01, 2.379491E+01, 2.760851E+02 + 16,-2.406771E+01,-2.690961E+01, 3.105652E+01 + 17, 0.000000E+00,-2.500000E+01, 1.750000E+02 + 18,-3.552714E-15,-2.500000E+01, 1.250000E+02 + 19,-3.552714E-15, 5.190293E-15, 1.500000E+02 + 20, 2.373059E+01, 2.379491E+01, 2.260851E+02 + 21,-2.626941E+01, 2.379491E+01, 2.260851E+02 + 22, 0.000000E+00, 0.000000E+00, 2.000000E+02 + 23, 2.593229E+01,-1.909609E+00, 1.060565E+02 + 24,-2.626941E+01, 2.379491E+01, 2.760851E+02 + 25, 2.500000E+01, 2.500000E+01, 1.500000E+02 + 26,-2.500000E+01, 2.500000E+01, 1.500000E+02 + 27,-3.552714E-15, 2.500000E+01, 1.750000E+02 + 28,-2.626941E+01,-2.620509E+01, 2.760851E+02 + 29,-5.000000E+01, 1.199041E-14, 1.500000E+02 + 30,-5.000000E+01, 2.500000E+01, 1.250000E+02 + 31,-5.000000E+01, 2.500000E+01, 1.750000E+02 + 32,-5.000000E+01, 5.356826E-15, 2.000000E+02 + 33,-5.000000E+01,-2.500000E+01, 1.750000E+02 + 34,-5.000000E+01, 0.000000E+00, 2.500000E+02 + 35,-5.000000E+01,-2.500000E+01, 1.250000E+02 + 36,-5.000000E+01, 0.000000E+00, 1.000000E+02 + 37,-5.000000E+01,-4.440892E-16, 5.000000E+01 + 38, 1.332268E-15,-5.000000E+01, 5.000000E+01 + 39, 0.000000E+00,-5.000000E+01, 1.000000E+02 + 40,-1.332268E-15,-5.000000E+01, 1.500000E+02 + 41, 0.000000E+00,-5.000000E+01, 2.500000E+02 + 42, 0.000000E+00, 0.000000E+00, 0.000000E+00 + 43, 0.000000E+00, 0.000000E+00, 3.000000E+02 + 44, 0.000000E+00, 5.000000E+01, 1.500000E+02 + 45, 2.500000E+01, 5.000000E+01, 1.250000E+02 + 46, 2.500000E+01, 5.000000E+01, 1.750000E+02 + 47, 9.992007E-16, 5.000000E+01, 2.000000E+02 + 48,-2.500000E+01, 5.000000E+01, 1.750000E+02 + 49,-1.443290E-15, 5.000000E+01, 2.500000E+02 + 50,-2.500000E+01, 5.000000E+01, 1.250000E+02 + 51,-9.992007E-16, 5.000000E+01, 1.000000E+02 + 52, 1.443290E-15, 5.000000E+01, 5.000000E+01 + 53, 5.000000E+01,-1.609823E-15, 1.500000E+02 + 54, 5.000000E+01,-2.500000E+01, 1.250000E+02 + 55, 5.000000E+01,-2.500000E+01, 1.750000E+02 + 56, 5.000000E+01, 1.443290E-15, 2.000000E+02 + 57, 5.000000E+01, 2.500000E+01, 1.750000E+02 + 58, 5.000000E+01, 0.000000E+00, 2.500000E+02 + 59, 5.000000E+01, 2.500000E+01, 1.250000E+02 + 60, 5.000000E+01, 0.000000E+00, 1.000000E+02 + 61, 5.000000E+01, 1.332268E-15, 5.000000E+01 + 62,-5.000000E+01,-5.000000E+01, 1.000000E+02 + 63,-5.000000E+01,-5.000000E+01, 1.500000E+02 + 64,-5.000000E+01,-5.000000E+01, 5.000000E+01 + 65,-5.000000E+01,-5.000000E+01, 2.500000E+02 + 66,-5.000000E+01, 0.000000E+00, 0.000000E+00 + 67,-5.000000E+01, 0.000000E+00, 3.000000E+02 + 68,-5.000000E+01, 5.000000E+01, 2.000000E+02 + 69,-5.000000E+01, 5.000000E+01, 1.000000E+02 + 70,-5.000000E+01, 5.000000E+01, 1.500000E+02 + 71,-5.000000E+01, 5.000000E+01, 2.500000E+02 + 72,-5.000000E+01, 5.000000E+01, 5.000000E+01 + 73, 0.000000E+00,-5.000000E+01, 0.000000E+00 + 74, 0.000000E+00,-5.000000E+01, 2.000000E+02 + 75, 0.000000E+00,-5.000000E+01, 3.000000E+02 + 76, 0.000000E+00, 5.000000E+01, 0.000000E+00 + 77, 0.000000E+00, 5.000000E+01, 3.000000E+02 + 78, 5.000000E+01,-5.000000E+01, 1.000000E+02 + 79, 5.000000E+01,-5.000000E+01, 5.000000E+01 + 80, 5.000000E+01,-5.000000E+01, 1.500000E+02 + 81, 5.000000E+01,-5.000000E+01, 2.500000E+02 + 82, 5.000000E+01, 0.000000E+00, 0.000000E+00 + 83, 5.000000E+01, 0.000000E+00, 3.000000E+02 + 84, 5.000000E+01, 5.000000E+01, 2.000000E+02 + 85, 5.000000E+01, 5.000000E+01, 1.000000E+02 + 86, 5.000000E+01, 5.000000E+01, 1.500000E+02 + 87, 5.000000E+01, 5.000000E+01, 2.500000E+02 + 88, 5.000000E+01, 5.000000E+01, 5.000000E+01 + 89,-5.000000E+01,-5.000000E+01, 2.000000E+02 + 90,-5.000000E+01,-5.000000E+01, 0.000000E+00 + 91,-5.000000E+01,-5.000000E+01, 3.000000E+02 + 92,-5.000000E+01, 5.000000E+01, 0.000000E+00 + 93,-5.000000E+01, 5.000000E+01, 3.000000E+02 + 94, 5.000000E+01,-5.000000E+01, 0.000000E+00 + 95, 5.000000E+01,-5.000000E+01, 2.000000E+02 + 96, 5.000000E+01,-5.000000E+01, 3.000000E+02 + 97, 5.000000E+01, 5.000000E+01, 0.000000E+00 + 98, 5.000000E+01, 5.000000E+01, 3.000000E+02 +*NSET, NSET=NALL + nset_csys0, +*ELEMENT, TYPE=C3D10, ELSET=beam + 1, 85, 97, 1, 69, 88, 3, 4, + 51, 52, 5 + 2, 1, 85, 94, 97, 4, 61, 6, + 3, 88, 82 + 3, 29, 1, 62, 69, 7, 8, 35, + 30, 5, 36 + 4, 92, 1, 69, 62, 9, 5, 72, + 37, 8, 36 + 5, 62, 1, 78, 94, 8, 10, 39, + 38, 6, 79 + 6, 1, 69, 29, 85, 5, 30, 7, + 4, 51, 11 + 7, 95, 96, 2, 89, 81, 12, 13, + 74, 41, 14 + 8, 95, 96, 98, 2, 81, 83, 58, + 13, 12, 15 + 9, 94, 1, 90, 62, 6, 16, 73, + 38, 8, 64 + 10, 94, 78, 85, 1, 79, 60, 61, + 6, 10, 4 + 11, 95, 62, 29, 53, 40, 35, 17, + 55, 18, 19 + 12, 62, 78, 53, 95, 39, 54, 18, + 40, 80, 55 + 13, 68, 84, 2, 95, 47, 20, 21, + 22, 56, 13 + 14, 78, 85, 1, 53, 60, 4, 10, + 54, 59, 23 + 15, 68, 93, 2, 84, 71, 24, 21, + 47, 49, 20 + 16, 44, 85, 53, 29, 45, 59, 25, + 26, 11, 19 + 17, 44, 85, 84, 53, 45, 86, 46, + 25, 59, 57 + 18, 68, 95, 53, 84, 22, 55, 27, + 47, 56, 57 + 19, 97, 90, 1, 92, 42, 16, 3, + 76, 66, 9 + 20, 84, 68, 44, 53, 47, 48, 46, + 57, 27, 25 + 21, 53, 62, 29, 1, 18, 35, 19, + 23, 8, 7 + 22, 44, 69, 29, 68, 50, 30, 26, + 48, 70, 31 + 23, 95, 29, 62, 89, 17, 35, 40, + 74, 33, 63 + 24, 91, 89, 68, 2, 65, 32, 34, + 28, 14, 21 + 25, 89, 96, 2, 91, 41, 12, 14, + 65, 75, 28 + 26, 84, 93, 2, 98, 49, 24, 20, + 87, 77, 15 + 27, 2, 98, 95, 84, 15, 58, 13, + 20, 87, 56 + 28, 93, 2, 91, 68, 24, 28, 67, + 71, 21, 34 + 29, 2, 89, 68, 95, 14, 32, 21, + 13, 74, 22 + 30, 91, 96, 2, 93, 75, 12, 28, + 67, 43, 24 + 31, 93, 96, 2, 98, 43, 12, 24, + 77, 83, 15 + 32, 90, 1, 92, 62, 16, 9, 66, + 64, 8, 37 + 33, 53, 68, 44, 29, 27, 48, 25, + 19, 31, 26 + 34, 29, 85, 53, 1, 11, 59, 19, + 7, 4, 23 + 35, 85, 69, 29, 44, 51, 30, 11, + 45, 50, 26 + 36, 95, 89, 68, 29, 74, 32, 22, + 17, 33, 31 + 37, 1, 78, 53, 62, 10, 54, 23, + 8, 39, 18 + 38, 97, 94, 1, 90, 82, 6, 3, + 42, 73, 16 + 39, 29, 95, 53, 68, 17, 55, 19, + 31, 22, 27 + 40, 97, 92, 1, 69, 76, 9, 3, + 52, 72, 5 +*ELSET, ELSET=EALL + beam, +*SURFACE, TYPE=ELEMENT, NAME=load + 7, S2 + 25, S2 +*SURFACE, TYPE=ELEMENT, NAME=fixed + 19, S2 + 38, S2 +**% Initial Temperature +*INITIAL CONDITIONS, TYPE=TEMPERATURE +NALL, 2.000000E+01 +**%