|
[Sponsors] |
[swak4Foam] problems with averaging a new field |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 27, 2016, 08:22 |
problems with averaging a new field
|
#1 |
New Member
Francesco Garita
Join Date: Oct 2016
Location: Italy
Posts: 8
Rep Power: 10 |
Hi everybody,
I am finding some problems with Swak4Foam. In particular, the situation is the following: I want to create a new field (called epsilon) by using an expressionField, which calls for UMean, produced by a fieldAverage; then I want to average this new field epsilon, but I get an error if I write epsilon within the fieldAverage. What I managed to figure out is that the problem comes from the fact that OpenFOAM does not know how to initialize this new field (it only knows how to initialize UMean, pMean, etc.). The solutions I found are basically 2: 1) Do the following steps in sequence: - Make a check to see whether UMean is present; if it is, then ask Swak4Foam to create the field epsilon; - Let the solver run for some timestep (in order epsilon to be created); - Include epsilon within the fieldAverage. As you can see, this solution is very annoying because you have to wait that epsilon is created and then you have to include manually this new field within the fieldAverage. Furthermore, this will cause the total averaging time of epsilon to be shorter than the total averaging time of UMean, and this is definitely undesired. 2) Another option to solve the problem is the following: - Make a check to see whether UMean is present; if it is, then ask Swak4Foam to create the field epsilon; - Make a second check to see whether epsilon is present; if it is, then ask Swak4Foam to make a second fieldAverage where only epsilon is present. This solution works pretty well as epsilonMean is created for the first time when UMean is created for the first time, thus solving the problem of having two different total averaging times. Also, it does not require you to wait epsilon to be created in order to start averaging it. However, this solution has its own drawback represented by the fact that when a second fieldAverage is created, then the fieldAverageProperties file writes only the information related to the second field average. Somebody may think that if the information on UMean, pMean, etc. included in the fieldAverageProperties file are not present anymore, then the solver does not compute a correct average of UMean, pMean, etc. but I did make many checks and fortunately this seems not to be the case because, even though those information are not present anymore in the fieldAverageProperties file, OpenFOAM keeps those information in its registers anyway, therefore UMean, pMean, etc. should be calculated correctly in my opinion. The reasons why I am writing this post are 2: first I would like somebody to confirm that UMean, pMean are indeed calculated correctly, and second I would be grateful if you could suggest me some more efficient way to do what I need to do, without losing the information on UMean, pMean, etc. present in the fieldAverageProperties file. Thanks to anybody that will reply to this post. Francesco P.S. If you wish, you can go through the functions I included in my ControlDict in the second case: Code:
functions { fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl outputTime; fields ( U { mean on; prime2Mean on; base time; } p { mean on; prime2Mean on; base time; } ); } UMeanCheck { type executeIfObjectExists; objectName UMean; checkType true; objectType volVectorField; objectShouldExist true; readDuringConstruction false; functions { doCalc { type expressionField; fieldName "epsilon"; expression "nu*(grad(U) && grad(U))-2*nu*(grad(UMean) && grad(U))+nu*(grad(UMean) && grad(UMean))"; autowrite true; outputControlMode timeStep; outputInterval 1; } } } epsilonCheck { type executeIfObjectExists; objectName epsilon; checkType true; objectType volScalarField; objectShouldExist true; readDuringConstruction false; functions { doCalc{ type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled true; outputControl outputTime; fields ( epsilon { mean on; prime2Mean off; base time; } ); } } } } |
|
October 28, 2016, 04:27 |
|
#2 |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
I don't know the answer, but I have two quick suggestions that you might like to try:
Good luck! |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CyclicAMI: Problems with pressure field | Thoma | OpenFOAM Running, Solving & CFD | 13 | June 28, 2014 09:34 |
Averaging Field data over several Iterations | lin123 | STAR-CCM+ | 1 | April 14, 2010 04:32 |
averaging selected field - multiphase | RBJ | OpenFOAM Post-Processing | 1 | December 29, 2009 07:50 |
Field averaging in a certain time interval | misakagan | OpenFOAM Running, Solving & CFD | 1 | December 11, 2009 06:39 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |