VM276 Input Listing


/COM,ANSYS MEDIA REL. 2024R2 (05/10/2024) REF. VERIF. MANUAL: REL. 2024R2
/verify,vm276
/title,vm276,Constant Diffusion Flux 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=2			            ! HALF SHEET THICKNESS, MM
H=50			        ! PLANE HEIGHT, MM
W=50			        ! PLANE WIDTH, MM
DX=4E-5			        ! DIFFUSIVITY, MM^2/S
F0=5E-14		        ! CONSTANT DIFFUSION FLUX, KG/MM^2/S
CSAT=3E-8		        ! SATURATED CONCENTRATION, KG/MM^3
CONC0=1E-10		        ! INITIAL CONCENTRATION, KG/MM^3
NORM_CONC0=CONC0/CSAT	! NORMALIZED INITIAL CONCENTRATION
T=36*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,DX             ! DIFFUSION COEFFICIENT
MP,CSAT,1,CSAT          ! SATURATED CONCENTRATION
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
SF,ALL,DFLUX,F0		! APPLY CONSTANT DIFFUSION FLUX AT X=-L AND X=L
NSEL,ALL
IC,ALL,CONC,NORM_CONC0	! SET INITIAL NORMALIZED CONCENTRATION
ALLS
FINISH

/SOLU
ANTYPE,TRANS
OUTRES,ALL,ALL
KBC,1			! STEPPED LOAD
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,TIME_II,ACTIVE,,SET,TIME
  CONCENTRATION_(II,0)=TIME_II			! TIME, S
  MASS_(II,0)=TIME_II

  NSEL,S,LOC,X,XLOC
  *GET,ND,NODE,,NUM,MIN
  *GET,ND_CONC,NODE,ND,CONC			! NORMALIZED CONCENTRATION
  CONCENTRATION_(II,1)=ND_CONC*CSAT		! CONCENTRATION, KG/MM^3

  ETABLE,CONC,SMISC,1
  ETABLE,VOLU,VOLU
  SMULT,WATR,CONC,VOLU
  SSUM
  *GET,MOISTURE,SSUM,,ITEM,WATR
  MASS_(II,1)=MOISTURE				! MOISTURE WEIGHT GAIN, KG

  C=CONC0+((F0*L/DX)*((DX*TIME_II/L**2)+((3*XLOC**2-L**2)/(6*L**2))))
  *DO,JJ,1,ITER
    C=C-((F0*L*2*((-1)**JJ)*EXP(-DX*JJ**2*PI**2*TIME_II/L**2)*COS(JJ*PI*XLOC/L))/(DX*PI**2*JJ**2))
  *ENDDO
  CONCENTRATION_(II,2)=C			! CRANK CONCENTRATION, KG/MM^3

  M=(2*L*H*W*CONC0)+(2*F0*TIME_II*H*W)
  MASS_(II,2)=M					! CRANK WEIGHT GAIN, KG
*ENDDO

/AXLAB,X,TIME (S)
/AXLAB,Y,CONCENTRATION (KG/MM^3)
/GCOL,1,MAPDL
/GCOL,2,REFERENCE
*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,vm276,vrt
/COM
/COM ----------------------- RESULTS COMPARISON ---------------------------
/COM
/COM
/COM   ***** CONCENTRATION (KG/MM^3) AT LOCATION X = %XLOC% MM *****
/COM
/COM       TIME (S)     |      TARGET      |     MECHANICAL APDL     |     RATIO
/COM
*VLEN,1
*VWRITE,CONCENTRATION_(35,0),CONCENTRATION_(35,2),CONCENTRATION_(35,1),CONC_RATIO(35,1)
(,F15.0,'       ',G14.5,'        ',G14.5,'          ',F8.3)
/COM
/COM
/COM
/COM   ***** MOISTURE WEIGHT GAIN (KG) *****
/COM
/COM       TIME (S)     |      TARGET      |     MECHANICAL APDL     |     RATIO
/COM
*VLEN,1
*VWRITE,MASS_(35,0),MASS_(35,2),MASS_(35,1),MASS_RATIO(35,1)
(,F15.0,'       ',G14.5,'        ',G14.5,'          ',F8.3)
/COM
/COM ------------------------------------------------------------------------
/OUT,
*list,vm276,vrt
FINISH