VM150 Input Listing


/COM,ANSYS MEDIA REL. 2024R2 (05/10/2024) REF. VERIF. MANUAL: REL. 2024R2
/verify,vm150
/title,vm150,Diffusion in a Plane Sheet
/com,
/com,
/com, Reference: Crank,J. The Mathematics of Diffusion.
/com, 2nd printing, Bristol: Oxford University Press
/com, 1975, pg 47-48
/com,


/NOPR

! DEFINED PARAMETERS
L=2E-3			! SHEET THICKNESS, M
H=50E-3			! PLANE HEIGHT, M
W=50E-3			! PLANE WIDTH, M
D=1E-12			! DIFFUSIVITY, M^2/S
CONC0=0.01		! INITIAL CONCENTRATION, KG/M^3
CONC1=0.2		! APPLIED CONCENTRATION, KG/M^3
MSAT=CONC1*2*L*W*H	! MOISTURE WEIGHT GAIN AT SATURATION, KG
T=1600*3600		! TIME AT END OF LOAD STEP, S
PI=4*ATAN(1)	! VALUE OF PI COMPUTED
SUB=50			! NUMBER OF SUBSTEPS
ITER=5			! NUMBER OF ITERATIONS FOR CRANK EQUATION
XLOC=L/2		! LOCATION WITHIN PLATE FOR POSTPROCESSING

/PREP7
ET,1,SOLID239		! DIFFUSION SOLID
MP,DXX,1,D
BLOCK,-L,L,0,H,0,W
LESIZE,5,L/2
LESIZE,3,2*L
LESIZE,10,2*L
VMESH,ALL
ALLS

NSEL,S,LOC,X,-L
NSEL,A,LOC,X,L
D,ALL,CONC,CONC1	! APPLY CONC1 AT X=-L AND X=L
NSEL,INVE
IC,ALL,CONC,CONC0	! SET INITIAL CONCENTRATION CONC0
ALLS
FINISH

/SOLU
ANTYPE,TRANS
OUTRES,ALL,ALL
KBC,1
NSUB,SUB
TIME,T
AUTOTS,OFF
SOLVE
FINISH

/POST1
*DIM,CONCENTRATION_,TABLE,SUB,2
*DIM,MASS_,TABLE,SUB,2
*DO,II,1,SUB
  SET,1,II
  *GET,II_TIME,ACTIVE,,SET,TIME
  CONCENTRATION_(II,0)=II_TIME
  MASS_(II,0)=II_TIME

  NSEL,S,LOC,X,XLOC
  *GET,ND,NODE,,NUM,MIN
  *GET,ND_CONC,NODE,ND,CONC
  CONCENTRATION_(II,1)=ND_CONC
  ALLS

  ETABLE,CONC,CONC
  ETABLE,VOLU,VOLU
  SMULT,WATR,CONC,VOLU
  SSUM
  *GET,MOISTURE,SSUM,,ITEM,WATR
  MASS_(II,1)=MOISTURE

  C=CONC1
  M=MSAT
  *DO,JJ,0,ITER
    C=C-(((CONC1-CONC0)*4*((-1)**(JJ))*EXP((-D*II_TIME*((2*JJ+1)**2)*(PI**2))/(4*L**2))*COS(((2*JJ+1)*PI*XLOC)/(2*L)))/(PI*(2*JJ+1)))
    M=M-((MSAT*8*EXP((-D*II_TIME*((2*JJ+1)**2)*(PI**2))/(4*L**2)))/((PI*(2*JJ+1))**2))
  *ENDDO
  CONCENTRATION_(II,2)=C
  MASS_(II,2)=M
*ENDDO

/AXLAB,X,TIME (S)
/AXLAB,Y,CONCENTRATION (KG/M^3)
/GCOL,1,MAPDL
/GCOL,2,TARGET
*VPLOT,CONCENTRATION_(1,0),CONCENTRATION_(1,1),2
/AXLAB,Y,MOISTURE WEIGHT GAIN (KG)
*VPLOT,MASS_(1,0),MASS_(1,1),2

*DIM,CONC_RATIO,,SUB
*DIM,MASS_RATIO,,SUB
*VOPER,CONC_RATIO,CONCENTRATION_(1,1),DIV,CONCENTRATION_(1,2)
*VOPER,MASS_RATIO,MASS_(1,1),DIV,MASS_(1,2)
/OUT,vm150,vrt
/COM
/COM ----------------------- RESULTS COMPARISON ---------------------------
/COM
/COM
/COM   ***** CONCENTRATION (KG/M^3) AT LOCATION X = %XLOC% CM *****
/COM
/COM       TIME (S)     |      TARGET      |     MECHANICAL APDL     |     RATIO
/COM
*VLEN,1
*VWRITE,CONCENTRATION_(25,0),CONCENTRATION_(25,2),CONCENTRATION_(25,1),CONC_RATIO(25,1)
(,F15.0,'            ',F8.5,'             ',F8.5,'            ',F8.3)
/COM
/COM
/COM
/COM   ***** MOISTURE WEIGHT GAIN (KG) *****
/COM
/COM       TIME (S)     |       TARGET       |      MECHANICAL APDL      |     RATIO
/COM
*VLEN,1
*VWRITE,MASS_(25,0),MASS_(25,2),MASS_(25,1),MASS_RATIO(25,1)
(,F15.0,'         ',G14.5,'          ',G14.5,'          ',F8.3)
/COM
/COM ------------------------------------------------------------------------
/OUT,
*list,vm150,vrt
FINISH