CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Zeroes padding in scheme

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2023, 15:30
Default Zeroes padding in scheme
  #1
Member
 
Join Date: Aug 2021
Posts: 65
Rep Power: 6
cons013 is on a distinguished road
Hello,

I am trying to save an image sequence to then convert into an animation. I have something like this:

(let((i 0)) i
(do ((x 1 (- x 0.2))) ((< x -2))
(ti-menu-load-string (format #f "/display/objects/edit totalpressure-contour surfaces-list z=~a ()" x))
(ti-menu-load-string (format #f "/display/objects/display totalpressure-contour"))
(ti-menu-load-string (format #f "/display/save-picture ./pictures/totalpressure-contour-~a" i))
(set! i (+ i 1))
)
)

Here, it saves the images like this: totalpressure-contour 1 ,.., totalpressure-contour 12

However this mucks up the order when it gets to 10 for the image sequencing software I use. How can I add zeroes to get a format like 0001 0002 ,.., 0023 etc.?

Thanks!
cons013 is offline   Reply With Quote

Old   August 13, 2023, 19:29
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,841
Rep Power: 68
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Some examples to motivate your fmt
Code:
(format #t "~5,'*d" 12)   -| ***12
(format #t "~5,'0d" 12)   -| 00012
(format #t "~3d"    1234) -| 1234
LuckyTran is online now   Reply With Quote

Old   August 14, 2023, 00:57
Default
  #3
Member
 
Join Date: Aug 2021
Posts: 65
Rep Power: 6
cons013 is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Some examples to motivate your fmt
Code:
(format #t "~5,'*d" 12)   -| ***12
(format #t "~5,'0d" 12)   -| 00012
(format #t "~3d"    1234) -| 1234
Hi, thanks for the reply. I tried this but keep getting errors, I'm not sure how to actually implement this into a code. I get the message:

> (format #t "~5,'0d" 12)

Error: format: unassigned variable format (~,)
Error Object: #\,

I tried some similar commands yesterday that I found on various forums but couldn't get the hang of it. Any ideas?
cons013 is offline   Reply With Quote

Old   August 14, 2023, 07:09
Default
  #4
Member
 
Join Date: Aug 2021
Posts: 65
Rep Power: 6
cons013 is on a distinguished road
I got it to work:

(format #f "the string is ~04d" 1)

returns: the string is 0001

If anyone could explain the #f (I've seen it's boolean?) and what it means in scheme I'd be very grateful!
cons013 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Out of scheme heap space SSG_NJ FLUENT 4 April 24, 2025 07:24
Crank Nicolson scheme implemented wrong? rajibroy OpenFOAM Programming & Development 10 May 5, 2020 10:57
can you tell me best gradient, pressure & momentum order selection in fluent sanjiiv FLUENT 6 February 14, 2020 07:07
2nd order upwind scheme (Fluent and CFX) Far FLUENT 0 May 22, 2011 02:50
extrapolation in MUSCL scheme Chandra Main CFD Forum 6 February 14, 2007 12:21


All times are GMT -4. The time now is 04:26.