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

[swak4Foam] swakExpression not writing to log

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 13, 2020, 04:53
Default swakExpression not writing to log
  #1
New Member
 
Alex Fells
Join Date: Sep 2019
Posts: 4
Rep Power: 2
alexfells is on a distinguished road
Hello,

I have written a functionObject using a swakExpression to calculate the total volume of a phase in an interFoam simulation by multiplying the local volume coefficient alpha by the cell volume. I have produced it using the damBreak tutorial and then copied the functionObject to another simulation. Unfortunately, when running interFOAM -postProcess in the new simulation, the functionObject is not writing for timesteps other than the initial one.

I am running openFOAM 4.1.0 and swakVersion 0.4.2. My controlDict for the case that is not running correctly is included below.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     interFoam;

startFrom       latestTime; //startTime;

startTime       0;

stopAt          endTime;//writeNow;

endTime         60;

deltaT          1e-04;

writeControl    adjustableRunTime;

writeInterval   0.1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           1;

maxAlphaCo 	    1;

maxDeltaT 0.01;

minDeltaT 1e-15;

compute ALH  no;

writeOnCrash no;

libs
(
	"libsprghInterfaceTotalPressurePatchField.so"
	"libOpenFOAM.so"
	"libsimpleSwakFunctionObjects.so"
	"libswakFunctionObjects.so"
	"libgroovyBC.so"
);

functions
{
	dP
	{
		type			probes;
		functionObjectLibs	("libsampling.so");
		enabled			true;
		writeControl		writeTime;
		fields			(p);
		probeLocations
		(
		(0 0 0)
		(0 0 1.137)
		);
	}
	columnHoldUp
	{
		type		swakExpression;
		valueType	internalField;
		verbose		true;
		outputControlMode timeStep;
		outputInterval	1;
		writeStartTime	no;
		aliases
		{
			alpha alpha.HNO3;
		}
		expression	"vol() * alpha";
		accumulations (
			sum
		);
	}
}

// ************************************************************************* //
The following is the taken from my log file after running interFoam -postProcess. If you look you can see that swak4Foam sets the default mesh. I have also found that if I enable writeStartTime then the total volume fraction is written at this point. However, after the "MRF models present" line, there is no mention of swak. I have tried changing the outputControlMode to outputTime, deltaT, timeStep etc. with no luck.

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 4.1
Exec   : interFoam -postProcess
Date   : Mar 13 2020
Time   : 09:39:31
Host   : "login2.arc3.leeds.ac.uk"
PID    : 162027
Case   : /nobackup/pm11af/VOF_001
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PIMPLE: max iterations = 10
    field "(U|p_rgh)"   : relTol 0, tolerance 0.001
    field "(flm|fmm)"   : relTol 0, tolerance 0.0001

swak4Foam: Setting default mesh
Time = 0
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type LES
Selecting LES turbulence model dynamicLagrangian
Selecting LES delta type cubeRootVol
dynamicLagrangianCoeffs
{
    filter          simple;
    ce              1.048;
    theta           3;
    Ce              1.048;
}


Reading g

Reading hRef
Calculating field g.h

No MRF models present


Time = 0.1
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type LES
Selecting LES turbulence model dynamicLagrangian
Selecting LES delta type cubeRootVol
dynamicLagrangianCoeffs
{
    filter          simple;
    ce              1.048;
    theta           3;
    Ce              1.048;
}


Reading g

Reading hRef
Calculating field g.h

No MRF models present
Below is the controlDict from the damBreak tutorial where the functionObject works fine.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     interFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         1;

deltaT          0.001;

writeControl    adjustableRunTime;

writeInterval   0.1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           1;
maxAlphaCo      1;

maxDeltaT       1;

libs
(
	"libOpenFOAM.so"
	"libsimpleSwakFunctionObjects.so"
	"libswakFunctionObjects.so"
	"libgroovyBC.so"
);

functions
{
	dP
	{
		type			probes;
		functionObjectLibs	("libsampling.so");
		enabled			true;
		writeControl		writeTime;
		fields			(p);
		probeLocations
		(
		(0.292 0.292 0)
		(0.292 0.292 0.0146)
		);
	}
	columnHoldUp
	{
		type		swakExpression;
		valueType	internalField;
		verbose		true;
		outputControlMode	timeStep;
		outputInterval	1;
		writeStartTime	no;
		aliases
		{
			alpha alpha.water;
		}
		expression	"vol() * alpha";
		accumulations (
			sum
		);
	}
}

// ************************************************************************* //
Finally, I have also included the log file from the damBreak tutorial showing the functionObject calculating volumefraction.

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 4.1
Exec   : interFoam -postProcess
Date   : Mar 13 2020
Time   : 09:51:53
Host   : "login2.arc3.leeds.ac.uk"
PID    : 132270
Case   : /nobackup/pm11af/functionObjectSandbox
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


PIMPLE: Operating solver in PISO mode

swak4Foam: Setting default mesh
Time = 0
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp : swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
 sum=0.000646099

Time = 0.1
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000646099

Time = 0.2
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000646099

Time = 0.3
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000646098

Time = 0.4
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000640313

Time = 0.5
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.00063341

Time = 0.6
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000632398

Time = 0.7
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000632398

Time = 0.8
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000632397

Time = 0.9
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000632397

Time = 1
Reading field p_rgh

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar

Reading g

Reading hRef
Calculating field g.h

No MRF models present

Expression columnHoldUp :  sum=0.000632397

End
Hopefully this is enough information, please let me know if you need any more info from me.

Thanks,

Alex

Last edited by alexfells; March 16, 2020 at 09:17.
alexfells is offline   Reply With Quote

Old   March 15, 2020, 17:00
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,131
Rep Power: 46
gschaider will become famous soon enoughgschaider will become famous soon enough
To be honest: I haven't tested these things with the -postProcess option. I usually use funkyDoCalc when I want to evaluate some expressions after the run. So it is possible that this is just not working


I'll have a look whether this can be fixed. But don't hold your breath. The relevant code is a bit fragile because it has to accommodate 3 different OF-branches (OF-Foundation, OF-ESI, Foam-extend) with slightly different behaviour and API of the functionObjects (which is because the functionObjects were rewritten at least 3 times and different distros stayed at different version)


BTW: Please use CODE (that is the icon with the # in the edit toolbar) for your examples.


CODE is readable:

Code:
test {
    type test;
}
while quote is a "flat" unreadable mess

Quote:
test {
type test;
}
Thanks
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 16, 2020, 14:57
Default
  #3
New Member
 
Alex Fells
Join Date: Sep 2019
Posts: 4
Rep Power: 2
alexfells is on a distinguished road
Hi, thanks for the reply. I've updated to post to use QUOTE and will have a look at funkyDoCalc.

If I get round to it I'll have a go at incrementally changing my controlDict and try and identify what causes it to break and will post here incase it's useful.

Thanks,

Alex
alexfells is offline   Reply With Quote

Old   March 16, 2020, 18:19
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,131
Rep Power: 46
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by alexfells View Post
Hi, thanks for the reply. I've updated to post to use QUOTE and will have a look at funkyDoCalc.

If I get round to it I'll have a go at incrementally changing my controlDict and try and identify what causes it to break and will post here incase it's useful.

Thanks

Alex

CODE! Not QUOTE
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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/splitMeshRegion : region1 in zone "-1" GuiMagyar OpenFOAM Meshing & Mesh Conversion 1 September 10, 2019 09:59
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 32 February 7, 2018 08:26
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 1 May 19, 2017 10:13
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
[snappyHexMesh] crash sHM H25E OpenFOAM Meshing & Mesh Conversion 11 November 10, 2014 11:27


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