{"id":157191,"date":"2022-06-06T08:33:04","date_gmt":"2022-06-06T08:33:04","guid":{"rendered":"\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/"},"modified":"2022-06-06T08:33:04","modified_gmt":"2022-06-06T08:33:04","slug":"how-can-i-set-up-a-repeating-cycle-of-timesteps-2","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/","title":{"rendered":"How can I set up a repeating cycle of timesteps?"},"content":{"rendered":"<p>In CFX Expression language, the procedure is as shown below, but the logic would apply in any code.  <br \/> LIBRARY:  <br \/>   CEL:  <br \/>     &#038;replace EXPRESSIONS: <br \/>         customtime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time)   <br \/>     cycleno = int(Time\/0.03 [s])+1  <br \/>  dt = if(cycletime <= 0.01[s] ,0.001[s], 0 [s])+ if(cycletime>0.01[s] &#038;&#038; cycletime <= 0.02[s], 0.002[s], 0[s]) + if(cycletime >0.02[s] &#038;&#038; <br \/>  cycletime<= 0.03[s], 0.003[s], 0.0[s])  <br \/>    END <br \/>   END <br \/>  END <br \/>  Since we have a repeating cycle of 0.03 [s], we need something to let us know what cycle we are in, so that we can make a custom time counter that will reset at the beginning of each cycle. This makes use of the int() function, which rounds UP to the closest integer.<br \/>    cycleno = int(Time\/0.03 [s])+1  <br \/>  Next we can make a time counter that goes from 0-0.03 [s][ repeatedly.  This makes use of the conditional if() function: <br \/>   cycletime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time) <br \/>   Now, we create a series of additive if() statements to cover each portion of the cycle. each one is only active inside its cycletime range  <br \/>      dt = if(cycletime <= 0.01[s] ,0.001[s], 0 [s])+ if(cycletime>0.01[s] &#038;&#038; cycletime <= 0.02[s], 0.002[s], 0[s]) + if(cycletime >0.02[s] &#038;&#038; cycletime<= 0.03[s], 0.003[s], 0.0[s])  <br \/>  If the list is very long, create a separate if expression for each portion and then add these expressions for a tidier timestep expression that is easier to debug.<\/p>\n","protected":false},"template":"","class_list":["post-157191","topic","type-topic","status-publish","hentry","topic-tag-ansys-cfx","topic-tag-expressions"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &amp;replace EXPRESSIONS: customtime = if(cycleno&gt;1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] &amp;&amp; cycletime 0.02[s] &amp;&amp; cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Ansys Knowledge | Ansys Innovation Space\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How can I set up a repeating cycle of timesteps? | Ansys Knowledge\" \/>\n\t\t<meta property=\"og:description\" content=\"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &amp;replace EXPRESSIONS: customtime = if(cycleno&gt;1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] &amp;&amp; cycletime 0.02[s] &amp;&amp; cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2022-06-06T08:33:04+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-06-06T08:33:04+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How can I set up a repeating cycle of timesteps? | Ansys Knowledge\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &amp;replace EXPRESSIONS: customtime = if(cycleno&gt;1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] &amp;&amp; cycletime 0.02[s] &amp;&amp; cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/ansys-cfx\\\/#listItem\",\"name\":\"ansys-cfx\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/ansys-cfx\\\/#listItem\",\"position\":3,\"name\":\"ansys-cfx\",\"item\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/ansys-cfx\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/#listItem\",\"name\":\"How can I set up a repeating cycle of timesteps?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/topics\\\/#listItem\",\"name\":\"Topics\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/#listItem\",\"position\":4,\"name\":\"How can I set up a repeating cycle of timesteps?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic-tag\\\/ansys-cfx\\\/#listItem\",\"name\":\"ansys-cfx\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#organization\",\"name\":\"Ansys Knowledge\",\"description\":\"Ansys Innovation Space\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/#webpage\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/\",\"name\":\"How can I set up a repeating cycle of timesteps? | Ansys Knowledge\",\"description\":\"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &replace EXPRESSIONS: customtime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\\\/0.03 [s])+1 dt = if(cycletime 0.01[s] && cycletime 0.02[s] && cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/forums\\\/topic\\\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\\\/#breadcrumblist\"},\"datePublished\":\"2022-06-06T08:33:04+00:00\",\"dateModified\":\"2022-06-06T08:33:04+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#website\",\"url\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/\",\"name\":\"Ansys Knowledge\",\"description\":\"Ansys Innovation Space\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/innovationspace.ansys.com\\\/knowledge\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How can I set up a repeating cycle of timesteps? | Ansys Knowledge","description":"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &replace EXPRESSIONS: customtime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] && cycletime 0.02[s] && cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each","canonical_url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge#listItem","position":1,"name":"Home","item":"https:\/\/innovationspace.ansys.com\/knowledge","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","position":2,"name":"Topics","item":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/#listItem","name":"ansys-cfx"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/#listItem","position":3,"name":"ansys-cfx","item":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/","nextItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/#listItem","name":"How can I set up a repeating cycle of timesteps?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/#listItem","name":"Topics"}},{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/#listItem","position":4,"name":"How can I set up a repeating cycle of timesteps?","previousItem":{"@type":"ListItem","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/#listItem","name":"ansys-cfx"}}]},{"@type":"Organization","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#organization","name":"Ansys Knowledge","description":"Ansys Innovation Space","url":"https:\/\/innovationspace.ansys.com\/knowledge\/"},{"@type":"WebPage","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/#webpage","url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/","name":"How can I set up a repeating cycle of timesteps? | Ansys Knowledge","description":"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &replace EXPRESSIONS: customtime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] && cycletime 0.02[s] && cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#website"},"breadcrumb":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/#breadcrumblist"},"datePublished":"2022-06-06T08:33:04+00:00","dateModified":"2022-06-06T08:33:04+00:00"},{"@type":"WebSite","@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#website","url":"https:\/\/innovationspace.ansys.com\/knowledge\/","name":"Ansys Knowledge","description":"Ansys Innovation Space","inLanguage":"en-US","publisher":{"@id":"https:\/\/innovationspace.ansys.com\/knowledge\/#organization"}}]},"og:locale":"en_US","og:site_name":"Ansys Knowledge | Ansys Innovation Space","og:type":"article","og:title":"How can I set up a repeating cycle of timesteps? | Ansys Knowledge","og:description":"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &amp;replace EXPRESSIONS: customtime = if(cycleno&gt;1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] &amp;&amp; cycletime 0.02[s] &amp;&amp; cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each","og:url":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/","article:published_time":"2022-06-06T08:33:04+00:00","article:modified_time":"2022-06-06T08:33:04+00:00","twitter:card":"summary_large_image","twitter:title":"How can I set up a repeating cycle of timesteps? | Ansys Knowledge","twitter:description":"In CFX Expression language, the procedure is as shown below, but the logic would apply in any code. LIBRARY: CEL: &amp;replace EXPRESSIONS: customtime = if(cycleno&gt;1,Time-0.03[s]*(cycleno-1),Time) cycleno = int(Time\/0.03 [s])+1 dt = if(cycletime 0.01[s] &amp;&amp; cycletime 0.02[s] &amp;&amp; cycletime1,Time-0.03[s]*(cycleno-1),Time) Now, we create a series of additive if() statements to cover each portion of the cycle. each"},"aioseo_meta_data":{"post_id":"157191","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2025-10-17 17:34:13","updated":"2026-07-29 02:54:35","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/\" title=\"Topics\">Topics<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/\" title=\"ansys-cfx\">ansys-cfx<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow can I set up a repeating cycle of timesteps?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/innovationspace.ansys.com\/knowledge"},{"label":"Topics","link":"https:\/\/innovationspace.ansys.com\/knowledge\/topics\/"},{"label":"ansys-cfx","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic-tag\/ansys-cfx\/"},{"label":"How can I set up a repeating cycle of timesteps?","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-set-up-a-repeating-cycle-of-timesteps-2\/"}],"acf":[],"custom_fields":[{"0":{"_wp_page_template":["default"],"_bbp_last_active_time":["06-06-2022 20:20"],"_bbp_forum_id":["27796"],"_btv_view_count":["987"],"_bbp_likes_count":["0"]},"test":"articlesansys-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/157191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/157191\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/media?parent=157191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}