Reputation: 1
I am trying to do a transient thermal simulation in Ansys mechanical. To get a more appropriate simulation I want to "add" a source term. In special I want to add a reduction extent to my equation, which is temperature dependent.
I tried to do this with APDL commands but I am not very familiar with this programming language nor with the routines in Ansys.
Here is the "pseudo-code" I thought about so far:
! ############################################
! Getting values and material data
! ############################################
*GET, NumberOfMeshElements, VOLU, 0, COUNT, , Body 1, ! Number of Elements in Body 1
*GET, TimeStepSize, ACTIVE, 0, SOLU, DTIME
*SET, CeriaAmount, 1000 ! in mol
*SET, ReductionEnthalpy, 500 ! in kJ/mol O (
*SET, OxygenPartialPressure, 100 ! Setting oxygen partial pressure
*SET, Temperature, TEMP ! Setting Temperature as a variable
*SET, ReductionExtent, 0 ! previous reduction extent
! ############################################
! Calculation of Source Term
! ############################################
! Begin of Loop for each time step
*DO, t, 0, 10, TimeStepSize ! solve together with transient thermal analysis (convection, radiation, conduction)
ReductionExtent = 0.35 * EXP(Temperature) ! goal: storing of previous (t-1) value for later calculation of Rate of Change
! Begin of Loop for each element
*DO, i, 1, NumberOfMeshElements, 1 ! needed for each mesh element because each mesh element has a different temperature
*GET, MeshElementVolume, VOLU, i, VOLU, , Body 1,
ReductionExtentRateOfChange = ReductionExtent(t-1)- ReductionExtent(i) / TimeStepSize
S_reaction = - CeriaAmount / MeshElementVolume * ReductionEnthalpy * ReductionExtentRateOfChange ! usally a source term
Upvotes: 0
Views: 650
Reputation: 183
Apparently there is a way to generate heat depending on a nodal temperature:
https://forum.ansys.com/discussion/1695/heat-generation
If you need this method as APDL you can prototype your solution in the workbench and than lookup the APDL commands in the generated ds.dat.
APDL for the internal heat generation
You can either fit the Arrehnius equation to the polynom Property = C0 + C1(T) + C2(T)^2 + C3(T)^3 + C4(T)^4 and put that as your material model with
MP, QRATE, MATNUMBER, C0, C1, C2, C3, C4
or reference to a table name (C0 = %QRATETABLE%) created by
*DIM,QRATETABLE,TABLE,5,,,TEMP ! Define QRATE with TEMP
! primary variable
QRATETABLE(1,0)=0.,50.,100.,150.,200. ! Assign temperature values
QRATETABLE(1,1)=1,2,3,4,5 ! Assign heat generation values !!! I am using dummy values !!!!
MP,QRATE, MATNUMBER,%QRATETABLE% ! Input QRATE on the MP command
Upvotes: 0