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

Write interval larger than 1 when using functions

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By JNSN
  • 2 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 23, 2023, 05:50
Default Write interval larger than 1 when using functions
  #1
New Member
 
Join Date: Nov 2023
Posts: 4
Rep Power: 3
boreal1 is on a distinguished road
Hi,

i want to calculate y+, Co and the wall shear stress and it works with the following controlDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
|                                                                             |
|                Generated by the CfdOF workbench for FreeCAD                 |
|                      https://github.com/jaheyns/CfdOF                       |
|                                                                             |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     pimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

deltaT          0.1;

endTime         4.0;

writeControl    timeStep;

writeInterval   1;

purgeWrite      0;

adjustTimeStep  yes;

maxCo           5.0;

writeFormat     ascii;

writePrecision  8;

runTimeModifiable true;

libs
(
    // Needed for availability of porous baffle boundary in potentialFoam
    #include "turbulenceLib"
);

functions
{yPlus
{
    type            	yPlus;
    libs            	(fieldFunctionObjects);
    writeControl        writeTime;
	writeInterval		1;
   
}
 Co1
    {
	type                CourantNo;
	libs                ("libfieldFunctionObjects.so");
	writeControl      	writeTime;
	writeInterval     	1;
    }
	
shearStress
{
	type 				wallShearStress;
	libs 				("libfieldFunctionObjects.so");
	writeControl 		writeTime;
	writeInterval 		1;
}
}

// ************************************************************************* //
The issue is that i want smaller time steps, because i need lower Courant numbers (btw, if you have any sources what Co for an LES should be, i would be glad, i'm finding contradicting information). Anyway, when I'm using the following script:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
|                                                                             |
|                Generated by the CfdOF workbench for FreeCAD                 |
|                      https://github.com/jaheyns/CfdOF                       |
|                                                                             |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     pimpleFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

deltaT          0.001;

endTime         4.0;

writeControl    timeStep;

writeInterval   0.01;

purgeWrite      0;

adjustTimeStep  yes;

maxCo           5.0;

writeFormat     ascii;

writePrecision  8;

runTimeModifiable true;

libs
(
    // Needed for availability of porous baffle boundary in potentialFoam
    #include "turbulenceLib"
);

functions
{yPlus
{
    type            	yPlus;
    libs            	(fieldFunctionObjects);
    writeControl        writeTime;
	writeInterval		0.01;
   
}
 Co1
    {
	type                CourantNo;
	libs                ("libfieldFunctionObjects.so");
	writeControl      	writeTime;
	writeInterval     	0.01;
    }
	
shearStress
{
	type 				wallShearStress;
	libs 				("libfieldFunctionObjects.so");
	writeControl 		writeTime;
	writeInterval 		0.01;
}
}

// ************************************************************************* //
I'm receiving the error:
Code:
--> FOAM FATAL IO ERROR: (openfoam-2206)
writeInterval < 1 for writeControl timeStep

file: system/controlDict at line 16 to 72.

    From virtual void Foam::Time::readDict()
    in file db/Time/TimeIO.C at line 279.
Do you have any idea how to solve this issue?
boreal1 is offline   Reply With Quote

Old   November 24, 2023, 05:04
Default
  #2
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 144
Rep Power: 20
JNSN is on a distinguished road
from the documentation:
writeControlControls the timing of write output to file.
  • timeStep: Writes data every writeInterval time steps.


thus in case of timeStep for writeControl the interval must be an integer >= 1
Yann likes this.
JNSN is offline   Reply With Quote

Old   November 24, 2023, 05:06
Default
  #3
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello,

You can choose different writeControl parameters. In your case, you chose timeStep. It means you will save data to disk every X time step. This interval is defined by the writeInterval parameter.

If you have writeControl timeStep and writeInterval 5, data will be saved to disk every 5 time steps.

Now, you chose writeInterval 0.1, but solver solves time steps, you cannot save data every 0.1 time step because this data does not exist.

If you want to save data every 0.1s of physical time, you should use runTime or adjustableRunTime as writeControl.

Check the user guide to know more about this: https://www.openfoam.com/documentati...output-control

Cheers,
Yann
JNSN and boreal1 like this.
Yann 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
The controlDict cannot control the write interval sy2516 OpenFOAM Programming & Development 13 March 6, 2017 15:53
[Helyx OS] Helyx-OS (GUI for SnappyHexMesh elvis OpenFOAM Community Contributions 210 January 30, 2017 19:57
Delta Functions within Ansys Mechanical Stephen Waite Structural Mechanics 2 July 29, 2013 09:56
Issue with write interval haze_1986 OpenFOAM 0 July 30, 2012 03:24
How to write DEFINE_UDS_FLUX functions?? Greg Perkins FLUENT 0 November 20, 2000 19:52


All times are GMT -4. The time now is 21:34.