CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Variable Courant number

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2022, 13:22
Default Variable Courant number
  #1
New Member
 
Andrea
Join Date: Aug 2014
Location: Italy
Posts: 2
Rep Power: 0
Dezzo is on a distinguished road
Dear all,
this is my first post on the forum, so please be patient if I made silly questions, and please be patient also if this is not the correct place…

Going to the topic, I’m using rhoPimpleFoam to solve a steady case and I would like to modify the Courant number (in order to reduce the computational time) automatically during the simulation, for example in a sinusoidal way, since I’m only interested on final values (p, T, U, rho).

I looked for something similar in the forum, I found the some this for example:
how to get current time as scalar?

So I tried to wrote something like:

[c]aMax 10; //amplitude
maxCo #eval "($aMax+0.5)-(($aMax)*(cos(2*3.14159*$runTime.value()/$endTime)))"; // sine wave with min value 0.5 at start and at endTime=0.005
[/c]

I got
[c]FOAM FATAL ERROR
Syntax error in expression at position:42
<<<<
(10.00000+1)-((10.00000)*(cos(2*3.14159*/0.005000)))
^^^^ near here[/c]

I also tried to add:

[c]scalar t=time().value()[/c]

instead of runTime.value()

I also tried many little modifications but I was not able to make it to work correctly.


Can someone show me the right way?
Many thanks!
Dezzo is offline   Reply With Quote

Old   April 1, 2022, 04:27
Default
  #2
New Member
 
Andrea
Join Date: Aug 2014
Location: Italy
Posts: 2
Rep Power: 0
Dezzo is on a distinguished road
I was able to manage the issue in a pragmatic way using the function object timeActivatedFileUpdate:

Code:
fileUpdate
    {
        type            timeActivatedFileUpdate;
        libs (utilityFunctionObjects);
        writeControl   timeStep;
        writeInterval  1;
        fileToUpdate    "$FOAM_CASE/system/controlDict";
        timeVsFile
        (
            (-1    "$FOAM_CASE/system/controlDict_1")
            (#eval "($endTime*0.02)"    "$FOAM_CASE/system/controlDict_2")
            (#eval "($endTime*0.05)"    "$FOAM_CASE/system/controlDict_5")
            (#eval "($endTime*0.95)"    "$FOAM_CASE/system/controlDict_2")
            (#eval "($endTime*0.98)"    "$FOAM_CASE/system/controlDict_1")
        );
    }
Varing the Courant number in each controlDict file.

But I’m still looking for something more elegant.

Thanks
Dezzo is offline   Reply With Quote

Reply


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
[snappyHexMesh] snappyHexMesh stuck when snap is turned on yukuns OpenFOAM Meshing & Mesh Conversion 3 February 2, 2021 14:05
SimpleFoam & Theater jipai OpenFOAM Running, Solving & CFD 3 June 18, 2019 11:11
GenerateVolumeMesh Error - Surface Wrapper Self Interacting (?) AndreP STAR-CCM+ 10 August 2, 2018 08:48
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 16:03
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01


All times are GMT -4. The time now is 10:19.