-
-
May 14, 2024 at 2:31 pmmashettySubscriber
I am working on an transient thermal analysis using ansys workbench. I am using a commands(Apdl) to input some apdl commands in the workbench. I am trying to write an output file, for getting some values timevalues. My code is as follows,
TIMINT, ON
DDELE,ALL,TEMP
*DO,i,1,20,1Â Â !simulation time for 20 seconds
TIME,i
*CFOPEN,timeout,txt
*VWRITE,TIME
(F9.5)
*CFCLOSE
*ENDDO
Â
However, My output file only gives one value.Can you please let me know, how to write all the output vales in the file for each iteration.
-
May 15, 2024 at 1:22 pmdanielshawAnsys Employee
You are opening and closing the output file each time through the *DO loop. You could try opening it before the *DO and closing it after the *DO. You could also store time solution times in an array (one time stored each loop) and then use *VWRITE to write out that array after the *DO is finished.
Â
-
May 15, 2024 at 1:35 pmdloomanAnsys Employee
In your commands TIME isn't a parameter, it's a command. The commands should be something like below:
TIMINT, ON
DDELE,ALL,TEMP
time_val=0
*DO,i,1,20,1Â Â !simulation time for 20 seconds
time_val=time_val+0.1
TIME,time_val
*CFOPEN,timeout,txt,,APPENDÂ Â Â Â Â !!! need to APPEND output to file
*VWRITE,time_val
(F9.5)
*CFCLOSE
*ENDDO
-
May 15, 2024 at 8:13 pmmjmiddleAnsys Employee
I'm sorry, but none of this makes sense to me if you really want to use the TIME command, not the original commands, or Dave Looman's last comments. The TIME command sets the end time of the load step as a solution setting before running the solution:
https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v241/en/ans_cmd/Hlp_C_TIME.html
It does not make sense to keep resetting the load step end time, without issuing a SOLVE after each iteration. It's just going to use the last TIME command for the next SOLVE command.
What are you really trying to do? Do you just want to print out all the load step end times? Or maybe all the result set end times? Do the following in a command snippet under Solution:
/post1
*get,nrsets,active,0,set,nset   ! Only works when result file is present. Does not work when results are stored to database
*cfopen,timeout,txt
*do,rset,1,nrsets
set,,,,,,,rset
*get,Lstep,active,0,set,lstp
*get,Sbstep,active,0,set,sbst
*get,time,active,0,set,time
*vwrite,Lstep
Loadstep %4I
*vwrite,Sbstep
Substep %4I
*vwrite,rset
Cumulative Substep %5I
*vwrite,time
Time %13.5E
*enddo
*cfclosÂ
-
May 27, 2024 at 10:36 ammashettySubscriber
I am sorry for the late reply. Thanks for your suggestion, Dave. I have to write temperature values of a particular node for each time step to a text or csv file. So i was thinking to move forward from writing the time steps in an output file and extend the same code for writing the temperature results too. Â
  *CFOPEN,timeout,txt,,APPEND
  *VGET,my_TEMP,NODE,1,BFE,TEMP
  *vwrite,time_val,my_TEMP
  (F9.5,F9.5)
  *CFCLOSEI would like to have my output text file as mentioned below excel file. Please let me know, how to create an output text file for a particular node, which consists of time and temp value for each substep using apdl commands, so that i can run the simulation in batch mode and use the output file without opening the ansys.
1,00E-06 0 0,4625 0 0,555 0 8,88 1396,7 9,3425 928,18 9,435 902,65 9,8975 683,47 9,99 651,56 10,453 536,74 -
May 28, 2024 at 3:42 pmdloomanAnsys Employee
Â
After the thermal transient solution is complete you could use the commands below without any APDL complexity:
/post26
nsol,2,node_number,temp
/out,temp_solution,out
prvar,2
/outÂ
Â
-
May 31, 2024 at 8:19 ammashettySubscriber
I have tried as follows,Â
/post26
nsol,2,561,temp
/out,temp_solution,out
prvar,2
/outHowever, i am able to create a output file(temp_solution.out), but i am getting an error.
I have found online, i should use save MAPDL db file to yes and i have changed it to yes. Please let me know, what else can i do. I have one more question to, i would like to print the element results to an output file using ESOL(average of all the node values of the element, if only node results exists in the simulation),can you please help me with that too. Â
-
May 31, 2024 at 9:24 ammjmiddleAnsys Employee
For the error, I suspect you ran a post solve for a command snippet under the Solution branch after a solution was present. If the solution is cleared, it will run the command snippet as part of the solution and this error does not occur. To run as a post solve, you often need to set "Save MAPDL db" to yes in the Analysis Settings:
In the command snippet include the RESUME command near the top.
-
May 31, 2024 at 10:11 ammashettySubscriber
I have already done both of what you mentioned, still getting the same error. I have included RESUME before /post26(and after /post26 resume too ). I have also changed the status of the mapdl db - to yes. still getting the same error file in the output file.Â
-
May 31, 2024 at 10:07 pmmjmiddleAnsys Employee
When you set the "Save MAPDL db" to yes it requires running the solution again. It's not marking the solution out-of-date when you change this setting and that would help enforce the correct action. Right click to "Clear Generated Data" on the solution after changing this setting and run the soution again.
-
June 3, 2024 at 9:53 ammashettySubscriber
Thanks for your response. I have started the simulation from the beginning and now its working. I would like to write the result of an element to the output file, i have tried using this command
esol,2,10,,bfe,temp
(ansys documentation reference ESOL, NVAR, ELEM, NODE, Item, Comp, Name
Specifies element data to be stored from the results file.)
complete code isÂ
RESUME
/post26
!nsol,2,22,temp
esol,2,10,,bfe,temp
/out,temp_solution,out
prvar,2
/out
Â
However, this is not working and in the outfile, i can see the warning : PRVAR is ignored.
Can you please help me in writing the element temperature values w.r.t to the output file. If element values are not available, i would like to write the average of the temperature values of all nodes(for that particular element).
-
June 4, 2024 at 12:04 ammjmiddleAnsys Employee
I don't have much experience with the time history post processor /post26. Temperatures are from the nodal solution, not the element solution. Often when getting element results from nodes, the APDL commands do the averaging to the element centoid. But the documentation does not show anything in the items and comps that would get the temperature nodal solution. The BFE,TEMP is for applied temperature, not result temperatures that you want.
https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v241/en/ans_cmd/Hlp_C_ESOL.html
I would normally loop through the result sets using SET command with /post1 and *GET the temperatures on nodes. See my earlier post on looping through results sets. Use the *GET documentation to figure out a command to get temp on node(s). Maybe someone in this post knows how to so it simpler with /post26 processor?
-
June 5, 2024 at 2:32 pmdloomanAnsys Employee
BFE,TEMP is a "structural" temperature not a thermal analysis temperature. Normally the nodal temperatures are of interest so nsol,2,node number,temp is used. I don't see a way to plot the average element temperature in post26 so you for that you have to use post1 as Matt mentioned:
/post1Â
set,,,,,time
etable,e_temp,temp
pretab,e_temp
Â
-
- The topic ‘Write the parameter value to a text file’ is closed to new replies.
- Problem with access to session files
- Ayuda con Error: “Unable to access the source: EngineeringData”
- At least one body has been found to have only 1 element in at least 2 directions
- Error when opening saved Workbench project
- Geometric stiffness matrix for solid elements
- How to select the interface delamination surface of a laminate?
- How to apply Compression-only Support?
- Timestep range set for animation export
- SMART crack under fatigue conditions, different crack sizes can’t growth
- Image to file in Mechanical is bugged and does not show text
-
1191
-
513
-
488
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.