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

OpenFoam Unexpected file generation

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Andre1742
  • 1 Post By Andre1742

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2024, 06:03
Default OpenFoam Unexpected file generation
  #1
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
Hy everyone,

I am trying to run a simulatin of a car carrier truck. Everything seems to be pretty straightforward, but I am having an hard time in controlling file generations.

I started from the motorbike tut, and then I changed whatever I needed, including the addition of a force function. I cannot understand why I keep having my force and moment files generated in each processor folder, while it doesnt happen for the forcecoeffs, which are instead controlled my my control dict.
Here are my function and controldict:



/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 10; //almeno 5000 prima era 2000

deltaT 1;

writeControl timeStep;

writeInterval 300;

purgeWrite 2;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
// Include additional function objects if necessary
#include "streamLines"
#include "wallBoundedStreamLines"
#include "cuttingPlane"
#include "forceCoeffs"
#include "force"


yPlus
{
type yPlus;
libs (fieldFunctionObjects);
writeControl timeStep; // Changed to timeStep for consistency with writeInterval
writeInterval 200; // Make sure this matches with the frequency you want to write yPlus
purgeWrite 2;

patches
(
Bisarca
lowerWall
);
}



fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
writeControl writeTime;

fields
(
U
{
mean on;
prime2Mean on;
base time;
timeStart -2000; // Start averaging from the latest time
timeEnd -3000; // End averaging 1000 iterations ago
}

p
{
mean on;
prime2Mean on;
base time;
timeStart -2000; // Start averaging from the latest time
timeEnd -3000; // End averaging 1000 iterations ago
}
);
}


solverInfo
{
type solverInfo;
libs ("libutilityFunctionObjects.so");
fields (p U k omega);
writeResidualFields no;
writeControl timeStep;
writeInterval 200;
}
}


// ************************************************** ***********



/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

force1
{
type forces;

libs (forces);

writeControl timeStep;
timeInterval 1;

log yes;
patches (BisarcaGroup);
p p;
U U;
rho rho;
porosity no;
rho rhoInf; // Indicates incompressible
writeFields yes;
log true;
rhoInf 1; // Redundant for incompressible

CofR (0 0 0); // Rotation around centre line of propeller
pitchAxis (0 1 0);
}


// ************************************************** *********************** //





/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

forceCoeffs1
{
type forceCoeffs;

libs (forces);

writeControl timeStep;
timeInterval 1;

log yes;

patches (BisarcaGroup);
rho rhoInf; // Indicates incompressible
rhoInf 1; // Required when rho = rhoInf
liftDir (0 0 1);
dragDir (1 0 0);
CofR (0.72 0 0); // Axle midpoint on ground
pitchAxis (0 1 0);
magUInf 20;
lRef 1.42; // Wheelbase length
Aref 1; // mantengo Aref uguale per tutte le configurazioni,a=1 cda
}





// ************************************************** *********************** //




Thank you all!!!!
Andre1742 is offline   Reply With Quote

Old   July 18, 2024, 06:13
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,169
Rep Power: 27
Yann will become famous soon enough
Hello Andrea,

This is due to this line which writes the force and moment fields:
Code:
writeFields yes;
https://doc.openfoam.com/2306/tools/...forces/forces/

Cheers,
Yann
Yann is offline   Reply With Quote

Old   July 18, 2024, 07:09
Default
  #3
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
Thank you!
It worked.

Please, could you also take a look to my yPlus function? it does the same but there is no writeFields.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

yPlus1
{
type yPlus;

libs (fieldFunctionObjects);

writeControl timeStep;
timeInterval 1;


patches (Bisarca);

}


// ************************************************** *********************** //


Thank you again!!
Regards
Andre1742 is offline   Reply With Quote

Old   July 18, 2024, 07:50
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,169
Rep Power: 27
Yann will become famous soon enough
Adjust your writeControl in order to only write the fields each time your are writing the other variables:

Code:
writeControl writeTime;
writeInterval 1;
Yann
Yann is offline   Reply With Quote

Old   July 19, 2024, 09:27
Default
  #5
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
It works!

Thank you!!!
Yann likes this.
Andre1742 is offline   Reply With Quote

Old   August 13, 2024, 10:44
Default
  #6
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
Hy everybody,

I am facing a problem still related to my functons.

I would like to simulate a car-carrier truck. Especially, I think it would be really interesting to plot the cumulative Cd, in order to see which part of my model contributes more to the drag force.

I read that it is possible by slighting modify the forcecoeffs. That is what I did, I added the following part:
binData
{
nBin 50;
direction (1 0 0);
cumulative yes;
}

As a result, nothing changed compared to when I was not interested to the cumulative(output did not changed).

So this is my forcecoeffs:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

forceCoeffscum1
{
type forceCoeffs;

libs (forces);

writeControl timeStep;
timeInterval 1;

log yes;

patches (Motrice Trailer Macchina1 Macchina2 Macchina3 Macchina4 Macchina5 Macchina6 Macchina7 Ruota1 Ruota2 Ruota3 Ruota4 Ruota5 Ruota6 Ruota7 Ruota8);
rho rhoInf; // Indicates incompressible
rhoInf 1.225; // Required when rho = rhoInf
liftDir (0 0 1);
dragDir (1 0 0);
CofR (0.72 0 0); // Axle midpoint on ground
pitchAxis (0 1 0);
magUInf 20;
lRef 1.42; // Wheelbase length
Aref 8.418259; // mantengo Aref uguale per tutte le configurazioni,a=1 cda

binData
{
nBin 50;
direction (1 0 0);
cumulative yes;
}
}


// ************************************************** *********************** //


which gives me something like this as output:

# Force and moment coefficients
# dragDir : (1.000000e+00 0.000000e+00 0.000000e+00)
# sideDir : (0.000000e+00 1.000000e+00 0.000000e+00)
# liftDir : (0.000000e+00 0.000000e+00 1.000000e+00)
# rollAxis : (1.000000e+00 0.000000e+00 0.000000e+00)
# pitchAxis : (0.000000e+00 1.000000e+00 0.000000e+00)
# yawAxis : (0.000000e+00 0.000000e+00 1.000000e+00)
# magUInf : 2.000000e+01
# lRef : 1.420000e+00
# Aref : 8.418259e+00
# CofR : (7.200000e-01 0.000000e+00 0.000000e+00)
#
# Time Cd Cd(f) Cd(r) Cl Cl(f) Cl(r) CmPitch CmRoll CmYaw Cs Cs(f) Cs(r)
1 1.743486e+00 -2.461253e+00 4.204739e+00 -3.678612e-02 2.280931e+00 -2.317718e+00 2.299324e+00 -3.332996e+00 6.761764e+00 1.854698e+00 7.689113e+00 -5.834415e+00
2 1.379392e+00 -3.091395e+00 4.470787e+00 7.622977e-03 1.370568e+00 -1.362945e+00 1.366757e+00 -3.781091e+00 8.220369e+00 2.110245e+00 9.275492e+00 -7.165247e+00
3 1.128918e+00 -3.194860e+00 4.323778e+00 4.493676e-02 6.254805e-01 -5.805438e-01 6.030121e-01 -3.759319e+00 8.585122e+00 2.100171e+00 9.635208e+00 -7.535037e+00
4 1.046904e+00 -3.120372e+00 4.167277e+00 6.723828e-02 1.929156e-01 -1.256773e-01 1.592965e-01 -3.643825e+00 8.490653e+00 2.031377e+00 9.506342e+00 -7.474965e+00
5 1.045210e+00 -3.013119e+00 4.058329e+00 8.930964e-02 -9.387154e-02 1.831812e-01 -1.385264e-01 -3.535724e+00 8.261301e+00 1.967062e+00 9.244832e+00 -7.277770e+00
6 1.062146e+00 -2.883361e+00 3.945507e+00 1.103756e-01 -3.002359e-01 4.106115e-01 -3.554237e-01 -3.414434e+00 8.027046e+00 1.897840e+00 8.975966e+00 -7.078126e+00
7 1.083113e+00 -2.746025e+00 3.829138e+00 1.374777e-01 -4.808105e-01 6.182882e-01 -5.495494e-01 -3.287582e+00 7.779906e+00 1.827366e+00 8.693589e+00 -6.866223e+00
8 1.105770e+00 -2.620760e+00 3.726529e+00 1.601435e-01 -5.705205e-01 7.306640e-01 -6.505922e-01 -3.173644e+00 7.570221e+00 1.764757e+00 8.452599e+00 -6.687842e+00
9 1.108024e+00 -2.534941e+00 3.642965e+00 1.768012e-01 -6.133419e-01 7.901430e-01 -7.017425e-01 -3.088953e+00 7.412725e+00 1.718805e+00 8.272127e+00 -6.553322e+00



Instead, I was expecting something like cd related to the different part of my model along the x direction!

Am I doing something wrong?

Thanks to everybody!!!!
Andre1742 is offline   Reply With Quote

Old   August 13, 2024, 11:13
Default
  #7
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,169
Rep Power: 27
Yann will become famous soon enough
Hello,

In the OpenCFD branch (openfoam.com), binData feature has been deprecated and moved into a new function object in OpenFOAM-v2206. If you are using v2206 or newer, you should use the binField function instead:
https://www.openfoam.com/news/main-n...ssing#binfield

For people using the foundation branch (openfoam.org), the binData feature did not change and is still in use in OpenFOAM-12.

Cheers,
Yann
Yann is offline   Reply With Quote

Old   August 13, 2024, 12:28
Default
  #8
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
Thank you, your answer was really helpful.


Considering these as the patches I have defined:

Motrice{
level (5 6);
patchInfo{
type wall;
}
}
Trailer{
level (5 6);
patchInfo{
type wall;
}
}

Macchina1{
level (5 6);
patchInfo{
type wall;
}
}
Macchina2{
level (5 6);
patchInfo{
type wall;
}
}

Macchina3{
level (5 6);
patchInfo{
type wall;
}
}
Macchina4{
level (5 6);
patchInfo{
type wall;

}
}
Macchina5{
level (5 6);
patchInfo{
type wall;

}
}
Macchina6{
level (5 6);
patchInfo{
type wall;

}
}
Macchina7{
level (5 6);
patchInfo{
type wall;

}
}
Ruota1{
level (5 6);
patchInfo{
type wall;
}
}
Ruota2{
level (5 6);
patchInfo{
type wall;
}
}
Ruota3{
level (5 6);
patchInfo{
type wall;
}
}
Ruota4{
level (5 6);
patchInfo{
type wall;
}
}
Ruota5{
level (5 6);
patchInfo{
type wall;
}
}
Ruota6{
level (5 6);
patchInfo{
type wall;
}
}
Ruota7{
level (5 6);
patchInfo{
type wall;
}
}
Ruota8{
level (5 6);
patchInfo{
type wall;
}
}



do you think this function is well defined?

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

forceCoeffs1
{
type forceCoeffs;

libs (forces);

writeControl timeStep;
timeInterval 1;

log yes;

patches (Motrice Trailer Macchina1 Macchina2 Macchina3 Macchina4 Macchina5 Macchina6 Macchina7 Ruota5 Ruota6 Ruota7 Ruota8);
rho rhoInf; // Indicates incompressible
rhoInf 1.225; // Required when rho = rhoInf
liftDir (0 0 1);
dragDir (1 0 0);
CofR (0.72 0 0); // Axle midpoint on ground
pitchAxis (0 1 0);
magUInf 20;
lRef 1.42; // Wheelbase length
Aref 8.418259; // mantengo Aref uguale per tutte le configurazioni,a=1 cda
}

binField1
{
type binField;
libs (fieldFunctionObjects);
binModel singleDirectionUniformBin;
fields (forceCoeff);
patches (Motrice Trailer Macchina1 Macchina2 Macchina3 Macchina4 Macchina5 Macchina6 Macchina7 Ruota5 Ruota6 Ruota7 Ruota8);
decomposePatchValues yes;
CofR (0.72 0 0); // Axle midpoint on ground
//cellZones (porousZone);

binData
{
nBin 30; // output data into 20 bins
direction (1 0 0); // bin direction
cumulative yes;
}
writeControl writeTime;
}
// ************************************************** *********************** //

I just reported as patches the parts that are not cut out by the symmetry condition. I am not sure about the meaning of cellZones (porousZone); Do i need it?

Additionaly, the results it gaves me, in terms of x values, are related to my whole blockmesh domain or just my model?


Thank you for your answer again and for being so helpful!!!!!!
Andre1742 is offline   Reply With Quote

Old   August 15, 2024, 05:40
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,169
Rep Power: 27
Yann will become famous soon enough
Hi Andrea,

I don't think you need the cellZone entry.
The bins should be calculated based on your patches, so you will have 30 bins evenly distributed along the x axis based on the patch list you defined.
You can check the coordinates of the bins in the result file.

Yann
Yann is offline   Reply With Quote

Old   August 15, 2024, 05:41
Default
  #10
New Member
 
Andrea
Join Date: Apr 2024
Posts: 18
Rep Power: 2
Andre1742 is on a distinguished road
Thank you again Yann,
your answer are always really appreciated!
Yann likes this.
Andre1742 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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 06:42
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59


All times are GMT -4. The time now is 20:30.