TAGGED: ansys-apdl, ansys-mapdl, submodeling
-
-
November 21, 2024 at 3:59 pm
nils-erik.sanhen
SubscriberHello,
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 am
deepak.deepak
Ansys 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 am
nils-erik.sanhen
SubscriberHello,
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 pm
deepak.deepak
Ansys 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 pm
nils-erik.sanhen
SubscriberThank 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.
-
2979
-
970
-
857
-
755
-
599
© 2025 Copyright ANSYS, Inc. All rights reserved.