TAGGED: ansys-apdl, ansys-mapdl, submodeling
-
-
November 21, 2024 at 3:59 pmnils-erik.sanhenSubscriber
Hello,
I created a small example to find out how I can use the shell-solid submodelling feature in apdl. Unfortunately I did not manage to write the d constraints in the .cbdo file.
I followed this related topic: https://innovationspace.ansys.com/knowledge/forums/topic/how-are-the-displacement-constraints-d-commands-in-cbdo-file-related-to-prnsol-displacements-at-the-cutboundary-nodes-if-the-nodes-are-coincident-at-cutboundary-in-the-coarse-and-the-submodel-i/
But I don't know how I have to update my code to generate the constraints, does someone has an idea for me?
Best greetings,
Nils
import os
import numpy as np
import pandas as pd
from ansys.mapdl import core as pymapdl
# Start MAPDL as a service
mapdl = pymapdl.launch_mapdl()
# print(mapdl)
### Basic settings
# Creates a jobname for the coarse model
mapdl.filname(fname = 'Shell_global')
# Enter the preprocessor
mapdl.prep7()
# Create a title for the coarse model
mapdl.title(title = 'Shell_global')
# Set analysis type to static
mapdl.antype(antype = 'static')
### Define variables and materials
# Define material
mapdl.mp(lab = 'ex', mat = 1, c0 = 30E6)
mapdl.mp(lab = 'NUXY', mat = 1, c0 = 0.3)
# Define Geometric parameters
l_plane = 3
l_detail = 1
h_detail = 1 # total height
### Setup model
# Define Keypoints
mapdl.k(npt = 1, x = 0, y = 0)
mapdl.k(npt = 2, x = l_plane, y = 0)
mapdl.k(npt = 3, x = l_plane, y = l_plane)
mapdl.k(npt = 4, x = 0, y = l_plane)
# Define lines
mapdl.l(p1 = 1, p2 = 2)
mapdl.l(p1 = 2, p2 = 3)
mapdl.l(p1 = 3, p2 = 4)
mapdl.l(p1 = 4, p2 = 1)
# Define area
mapdl.al(1,2,3,4)
mapdl.lesize(nl1 = 'all', ndiv = 3)
mapdl.sectype(secid = 1, type_ = 'SHELL')
mapdl.secdata(h_detail)
mapdl.et(1, "SHELL181", 2)
# Set to quads elements (key = 0)
mapdl.mshape(key = 0, dimension = '2D')
# Specifies whether free meshing or mapped meshing should be used to mesh - mapped meshing (key = 1)
mapdl.mshkey(key = 1)
mapdl.amesh('all')
### Create BC and forces/displacements
# Create fixed conditions
mapdl.nsel("s", "loc", "x", 0, 0)
mapdl.d(node="all", lab="ux", value=0.0)
mapdl.d(node="all", lab="uy", value=0.0)
mapdl.d(node="all", lab="uz", value=0.0)
#Apply displacements (1/20 of the Lenght of the cube)
mapdl.nsel("s", "loc", "x", l_plane, l_plane)
mapdl.d(node="all", lab="ux", value = l_plane * 1/20)
mapdl.allsel()
### Run model
mapdl.finish()
mapdl.run("/SOLU")
mapdl.outres("all", "all") # Save all result items for all nodes
mapdl.solve()
mapdl.finish()
# Save .db file --> name is as model fname: Cube_global_coarse.db
mapdl.save()
# Go in postprocessing --> should create the .rst file
mapdl.post1()
mapdl.set(1, 'LAST')
test = mapdl.prnsol('U')
print(test)
mapdl.clear("NOSTART") # CLEAR THE DATABASE
mapdl.filname("Solid_submodel") # DEFINE JOBNAME FOR THE SUBMODEL
mapdl.prep7()
# Create a title for the coarse model
mapdl.title(title = 'Solid_submodel')
mapdl.antype(antype = 'static')
# Define material
mapdl.mp(lab = 'ex', mat = 1, c0 = 30E6)
mapdl.mp(lab = 'NUXY', mat = 1, c0 = 0.3)
### Setup sub-model
# Define Keypoints
mapdl.k(npt = 10, x = l_detail, y = l_detail, z = 0.5*h_detail)
mapdl.k(npt = 11, x = 2*l_detail, y = l_detail, z = 0.5*h_detail)
mapdl.k(npt = 12, x = 2*l_detail, y = 2*l_detail, z = 0.5*h_detail)
mapdl.k(npt = 13, x = l_detail, y = 2*l_detail, z = 0.5*h_detail)
mapdl.k(npt = 14, x = l_detail, y = l_detail, z = -0.5*h_detail)
mapdl.k(npt = 15, x = 2*l_detail, y = l_detail, z = -0.5*h_detail)
mapdl.k(npt = 16, x = 2*l_detail, y = 2*l_detail, z = -0.5*h_detail)
mapdl.k(npt = 17, x = l_detail, y = 2*l_detail, z = -0.5*h_detail)
# Define volume
mapdl.v(10,11,12,13,14,15,16,17)
# Define element type
mapdl.et(itype = 1, ename = 'SOLID185')
# Define Mesh size
mapdl.esize(size = 0.25*h_detail)
# performing the meshing
mapdl.vmesh('all')
# Select node at cut boundary
mapdl.nsel("s", "loc", "x", l_detail, l_detail)
mapdl.nsel("a", "loc", "x", 2*l_detail, 2*l_detail)
mapdl.nsel("a", "loc", "y", l_detail, l_detail)
mapdl.nsel("a", "loc", "y", 2*l_detail, 2*l_detail)
# WRITE GEOMETRY TO Solid_submodel.node
mapdl.nwrite(fname="Solid_submodel", ext="node")
mapdl.allsel()
mapdl.finish()
# SAVE SUBMODEL DATA IN FILE Solid_submodel.db
mapdl.save()
mapdl.post1()
# Starts complete coarse model again
mapdl.resume("Shell_global", "db")
# Load result files from coarse model
mapdl.file("Shell_global", "rst")
mapdl.cbdof(fname1 = 'Solid_submodel', ext1 = 'node', fname2 = 'Solid_submodel', ext2 = 'cbdo', kpos = 0, kshs = 1)
### From this point on the submodel is investigated
mapdl.prep7()
# RESUME SUBMODEL FROM FILE Cube_submodel.db
mapdl.resume("Solid_submodel", "db")
# READ IN INTERPOLATED B.C.'S FROM Cube_submodel.cbdo
# :label — Begins reading from the first line beginning with the matching user-defined label :label
mapdl.input(fname = "Solid_submodel", ext = "cbdo")
mapdl.input(fname = "Solid_submodel", ext = "cbdo", Line = ":cb1")
mapdl.allsel()
# Enter the solution process
mapdl.slashsolu()
# Solve fine model
mapdl.solve()
mapdl.finish()
# Postprocessing
mapdl.post1()
mapdl.set(1, 1)
-
November 22, 2024 at 9:17 amdeepak.deepakAnsys Employee
Hi,
Please look into these two documents, which might help to build the shell-to-solid submodel.
Thanks,
Deepak
Ansys Help
Ansys Learning Forum (Rules & Guidelines) -
November 22, 2024 at 10:06 amnils-erik.sanhenSubscriber
Hello,
thank you for your reply.
In the modelling procedure I followed the manual. And I was able to create a solid-solid submodel. But in the follow up step, to create a shell-solid submodel, I was not able to generate a .CBDO consist out of an NMODIF block and and D block (dexcriped on page 148 of the document). My model consist soly on NMODIF commands. So I try to figure out what the cause of the problem is and how I can fix it.
If you have further ideas or examples I could take a look on, I would be happy.
Best greetings,
Nils Sanhen
-
November 22, 2024 at 2:36 pmdeepak.deepakAnsys Employee
Hi,
Please refer to this example, I was able to generate a .cbdo file, with NMODIF,DDELE, and D blocks.
!SHELL_MAIN_MODEL
/clear
/FILNAME,Mainmodel
/PREP7
!MATERIAL PROP
MP,EX,1,2E5, ! MPa
MP,NUXY,1,0.3,
! Shell Element
ET,1,181
sectype,1,shell
secdata,4
secoff,mid
!GEOMETRY
K,1,0,0,0
K,2,0,0,10
K,3,20,0,10
K,4,20,0,0
A,1,2,3,4
!MESHING
MSHAPE,0,2D
CM,_Y,AREA
ASEL, , , ,1
CM,_Y1,AREA
CHKMSH,’AREA’
CMSEL,S,_Y
AMESH,_Y1
!SUPPORTS
NSEL,S,LOC,X,0
D,ALL,ALL
ALLSEL,
NSEL,S,LOC,X,20,
F,ALL,FX,1E5
F,ALL,FY,0
F,ALL,FZ,0
ALLSEL
FINISH
/SOL
SOLVE,
FINISH
SAVE
!********************************
!****SHELL_TO_SOLID_SUB_MODEL****
!********************************
/CLEAR
/FILNAME,Submodel
/PREP7
ET,1,SOLID185
MP,EX,1,2E5, ! MPa
MP,NUXY,1,0.3,
!Sub_model GEOMETRY
BLOCK,0,10,-2,2,0,8,
MSHAPE,1,3D
MSHKEY,0
CM,_Y,VOLU
VSEL, , , ,1
CM,_Y1,VOLU
CHKMSH,’VOLU’
CMSEL,S,_Y
VSWEEP,_Y1
CMDELE,_Y
CMDELE,_Y1
CMDELE,_Y2
!NROTAT
NSEL,S,LOC,X,10
NSEL,A,LOC,Z,8
NROTAT,ALL,
ALLSEL,ALL
!NWRTIE
NSEL,S,LOC,X,10
NSEL,A,LOC,Z,8
NWRITE,
ALLSEL,ALL
FINISH
SAVE
!Resume of Mainmodel
RESUME,Mainmodel,DB
/POST1
FILE,’Mainmodel’,’rst’,’.’
SET,LAST
CBDOF,’Submodel’,’node’,’ ‘,,,,0, ,1,
FINISH,
!Resume back to Submodel
RESUME,Submodel,DB
/PREP7 ! The .cbdo file must be read in PREP7
/INPUT,,cbdo ! Reads Jobname.cbdo up to the /EOF command
/INPUT,,cbdo,,:cb1 ! Reads same file from the label :cb1
DCUM,ADD
!SUPPORTS
NSEL,S,LOC,X,0
D,ALL,ALL
ALLSEL,
FINISH
/SOLU
SOLVE
FINISH
/POST1
SET,LAST
PLNSOL,U,X,0,1.0Thanks,Deepak
-
-
November 22, 2024 at 4:02 pmnils-erik.sanhenSubscriber
Thank you very much, for your help!
It's working exactly as it should.
Best,
Nils
-
- You must be logged in to reply to this topic.
-
1116
-
468
-
445
-
225
-
201
© 2024 Copyright ANSYS, Inc. All rights reserved.