|
[Sponsors] |
March 21, 2022, 13:22 |
Variable Courant number
|
#1 |
New Member
Andrea
Join Date: Aug 2014
Location: Italy
Posts: 2
Rep Power: 0 |
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! |
|
April 1, 2022, 04:27 |
|
#2 |
New Member
Andrea
Join Date: Aug 2014
Location: Italy
Posts: 2
Rep Power: 0 |
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") ); } But I’m still looking for something more elegant. Thanks |
|
|
|
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 |