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

[swak4Foam] outputTime in Swak function

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

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2013, 05:54
Default outputTime in Swak function
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I have written this SWAK function to write the expression at each outputTime(not each timeStep):
Code:
n1_totalTemperature
    {
        type swakExpression;
        valueType surface;
        surfaceName normalPlane_T0_1;
        verbose true;
        surface {
            type plane;
            basePoint       (0.01725 0.002 0);
            normalVector    (1 0 0);
            interpolate true;
        }
        expression "sum((T+0.000497517*magSqr(U))*rho*area())/sum(rho*area())";
        accumulations (
            average
        );
        outputControl outputTime;//outputTime;//
        outputInterval 1; // 5000
    }
bu it writes still the values in each time step:

Code:
nused output: areaAverage(right) for p = 303977.3946
Unused output: areaAverage(right) for U = (0 -78.27914269 0)
Unused output: areaAverage(right) for T = 440.0158214
Unused output: areaAverage(right) for rho = 2.406229408
Unused output: areaAverage(right) for h = 143969.4069
Unused output:
Unused output: Expression totalPressure_right :  average=311349.633
Unused output: Expression totalTemperature_right :  average=443.0644198
Unused output: Expression totalEnthalpy_right :  average=202609.9735
Unused output: Expression flowInlet :  sum=-0.000200896449
Unused output: faceSource Average_left output:
Unused output: areaAverage(left) for p = 328460.3658
Unused output: areaAverage(left) for U = (24.89352103 -84.5762301 0)
Unused output: areaAverage(left) for T = 496.1931543
Unused output: areaAverage(left) for rho = 2.355562913
Unused output: areaAverage(left) for h = 204658.9719
Unused output:
Unused output: Expression totalPressure_left :  average=344793.4867
Unused output: Expression totalTemperature_left :  average=494.9186351
Unused output: Expression n1_totalTemperature :  average=440
Unused output: Expression n1_totalPressure :  average=303975
Unused output: Expression n2_totalTemperature :  average=440
Unused output: Expression n2_totalPressure :  average=303975
Unused output: Expression n2_MaxU :  average=2.00358353e-13
Unused output: Expression n2_Maxp :  average=303975
Unused output: Expression n2_pressure_minMax :  min=303975 max=303975
Unused output: Expression n3_totalTemperature :  average=440
Unused output: Expression n3_totalPressure :  average=303975
Unused output: Expression h1_totalTemperature :  average=440.0002414
Unused output: Expression h1_totalPressure :  average=303975.5373
Unused output: Expression h2_totalTemperature :  average=440.0000913
Unused output: Expression h2_totalPressure :  average=303975.0635
Unused output: Expression h2_pressure_minMax :  min=303975 max=303978.1412
Unused output: Expression h3_totalTemperature :  average=440.5776045
Unused output: Expression h3_totalPressure :  average=305028.7895
Unused output: Mean and max Courant Numbers = 0.007692142019 0.09958988306
why?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; May 20, 2013 at 08:30.
immortality is offline   Reply With Quote

Old   May 19, 2013, 07:38
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

In this case, swak4Foam doesn't use "outputControl". It only uses "outputInterval". Which means that it you'll have to use something like this:
Code:
outputInterval 10;
Best regards,
Bruno
afshinb likes this.
__________________
wyldckat is offline   Reply With Quote

Old   May 19, 2013, 07:53
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi Bruno
1)what do you mean by "in this case"?
2)I have a variable timeStep.there isn't any other way to have outputs concurrent with folder writing times to save time?
I saw this,what does cloud mean?
Code:
createThrePointSet
    {
        type createSampledSet;
        outputControl timeStep;
        outputInterval 1;
        setName threePoints;
        set {
            type cloud;
            axis x;
            points (
                (0.1 0.14 0.0001)
                (0.0 0.02 0.0001)
                (-0.1 0.02 0.0001)
            );
        }
        writeSetOnConstruction true;
        autoWriteSet true;
        setFormat vtk;
    }
3)can use phi on patch in sampledSurfaces?
thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 19, 2013, 08:00
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

1) From what I can figure out, swak4Foam can use "outputControl" in some other function objects. But in this case, namely for "swakExpression", this doesn't work.

2)
Quote:
I have a variable timeStep.there isn't any other way to have outputs concurrent with folder writing times to save time?
It's necessary to change the source code of swak4Foam for this to be possible.

Quote:
I saw this,what does cloud mean?
I'm not familiar with this function object... but "cloud" is used for indicating multiple points for sampling.

3) As I said on the email a few minutes ago, "phi" cannot be used with the "sampledSurface" in OpenFOAM's function object, which is why "faceZone" has to be used instead.

Best regards,
Bruno
immortality likes this.
__________________
wyldckat is offline   Reply With Quote

Old   May 19, 2013, 17:47
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by wyldckat View Post
Hi Ehsan,

1) From what I can figure out, swak4Foam can use "outputControl" in some other function objects. But in this case, namely for "swakExpression", this doesn't work.
For historical reasons all function objects in swak that are based on the simpleFunctionObjects are not based on OutputFilterFunctionObject and therefor do not support outputControl (other function objects do). Incidentally my current development version already supports this.

Quote:
Originally Posted by wyldckat View Post
2) It's necessary to change the source code of swak4Foam for this to be possible.

Also writing at fixed time intervals is already supported
__________________
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   May 20, 2013, 04:53
Default
  #6
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi Bernhard
when does the new version will release?(current version i use is 0.2.3 is there a newer one?)
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 20, 2013, 06:43
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
Hi Bernhard
when does the new version will release?
When it is ready. Intermediate versions are found in the mercurial-repository. But they may contain bugs so use with care. New features are documented in the README

Quote:
Originally Posted by immortality View Post
(current version i use is 0.2.3 is there a newer one?)
No. That is the latest released one
__________________
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   June 24, 2015, 07:13
Default
  #8
Member
 
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12
manju819 is on a distinguished road
Hi Bernhard
I'm writing the variable on the patch using swakEpression

Code:
 Ttop {
                type    swakExpression;
                valueType       patch;
                patchName       top;
                outputControlMode timeStep;
                outputInterval  100;
                region          stratumCorneum;
                expression      "T";
                accumulations   (
                        average
                );
                verbose         true;
                autoInterpolate true;
        }
I added libraries also but it is showing the error


Code:
 --> FOAM FATAL ERROR: 
Unknown function type swakExpression

Valid functions are : 

71
(
CourantNo
DESModelRegions
Lambda2
Peclet
Q
addForeignMeshes
addGlobalVariable
calculateGlobalVariables
clearExpressionField
coded
correctThermo
createSampledSet
createSampledSurface
dsmcFields
dynamicFunctionObjectListProxy
executeIfEnvironmentVariable
executeIfExecutableFits
executeIfFunctionObjectPresent
executeIfObjectExists
executeIfOpenFOAMVersionBiggerEqual
executeIfParallelSerial
executeIfStartTime
expressionField
fieldDistribution
foreignMeshesFollowTime
functionObjectListProxy
initPotentialFlow
initSwakFunctionObject
listRegisteredObjects
loadCompressibleTurbulenceModel
loadIncompressibleTurbulenceModel
loadPsiThermoModel
loadRhoThermoModel
loadSLGThermoModel
manipulateField
manipulatePatchField
panicDump
patchAverage
patchFieldDistribution
patchFieldFlow
patchIntegrate
patchMassFlow
patchMassFlowAverage
patchProbes
pressureTools
probes
readAndUpdateFields
readGravitation
recalcPhi
recalcThermoHe
removeGlobalVariable
scalarTransport
setDeltaTByTimeline
setTimeStep
sets
solveLaplacianPDE
solveTransportPDE
solverPerformanceToGlobalVariables
surfaces
swakCoded
timeActivatedFileUpdate
trackDictionary
volumeAverage
volumeIntegrate
volumeMinMax
wallShearStress
writeAdditionalFields
writeAndEndFieldRange
writeFieldsOften
yPlusLES
yPlusRAS
)



    From function functionObject::New(const word& name, const Time&, const dictionary&)
    in file db/functionObjects/functionObject/functionObject.C at line 92.

FOAM exiting
why swakExpression function is not working? Please help me.

This is showing this error also


Code:
 --> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : /home/mechfoam/OpenFOAM/mechfoam-2.2.x/platforms/linux64GccDPOpt/lib/libsimpleSwakFunctionObjects.so: undefined symbol: _ZTIN4Foam36conditionDrivenWritingFunctionObjectE
--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libsimpleSwakFunctionObjects.so"

Last edited by wyldckat; June 28, 2015 at 16:20. Reason: merged posts that were a few minutes apart and added [CODE][/CODE]
manju819 is offline   Reply With Quote

Old   June 28, 2015, 16:25
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by manju819 View Post
why swakExpression function is not working?
Quick answer: Edit the "system/controlDict" and add the library "libsimpleFunctionObjects.so" in "libs" before "libsimpleSwakFunctionObjects.so", e.g.:
Code:
libs
(
"libsimpleFunctionObjects.so"
"libsimpleSwakFunctionObjects.so"
);
wyldckat is offline   Reply With Quote

Old   February 7, 2016, 03:02
Default
  #10
New Member
 
Afshin Bakhshi
Join Date: Mar 2014
Posts: 13
Rep Power: 12
afshinb is on a distinguished road
I'm using OF 3.0.1 and just installed swak4Foam 0.4.0 from here.
installation process seemed to went well. but now I'm getting this error.
Code:
-> FOAM FATAL ERROR: 
Unknown function type swakExpression

Valid functions are : 

4
(
patchProbes
probes
sets
surfaces
)



    From function functionObject::New(const word& name, const Time&, const dictionary&)
    in file db/functionObjects/functionObject/functionObject.C at line 92.

FOAM exiting
is it about the libraries location?
where should swak4Foam libraries be placed now?
afshinb is offline   Reply With Quote

Old   February 7, 2016, 11:07
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by afshinb View Post
is it about the libraries location?
where should swak4Foam libraries be placed now?
Quick requests:
  1. Please provide the "system/controlDict" file you're using in your case.
  2. Please provide the complete output from the solver.
  3. Please provide what the following command gives you:
    Code:
    ls -l $FOAM_USER_LIBBIN
__________________
wyldckat is offline   Reply With Quote

Old   February 7, 2016, 11:53
Default
  #12
New Member
 
Afshin Bakhshi
Join Date: Mar 2014
Posts: 13
Rep Power: 12
afshinb is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick requests:
  1. Please provide the "system/controlDict" file you're using in your case.
  2. Please provide the complete output from the solver.
  3. Please provide what the following command gives you:
    Code:
    ls -l $FOAM_USER_LIBBIN
1.
Code:
 libs (
"libsimpleSwakFunctionObjects.so" 
"libswakFunctionObjects.so" 
);
functions
{
liquid_COG //simpleFunctionObjects
{ 
type swakExpression;
valueType internalField;
setName liquidCog;
accumulations (sum);
expression "sum(pos()*alpha.water*vol())/(vol()*alpha.water)"; //works

/*# Time sum
0.01 (0.000309988 0.0903394 0.25)*/
verbose true;
outputControl outputTime;
}
2. I'm not sure what you want.

3. it gives me this:
Code:
ls: cannot access /home/afshin/OpenFOAM/afshin-3.0.1/platforms/linux64GccDPInt32Opt/lib: No such file or directory
are you looking for this directory?
Code:
/opt/openfoam30/platforms/linux64GccDPInt32Opt/lib
afshinb is offline   Reply With Quote

Old   February 7, 2016, 13:45
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Afshin,

Please keep in mind that OpenFOAM is very picky with every single detail Any missing detail can be the reason for it to not work as intended.

Quote:
Originally Posted by afshinb View Post
1.
Code:
 libs (
"libsimpleSwakFunctionObjects.so" 
"libswakFunctionObjects.so" 
);
functions
{
liquid_COG //simpleFunctionObjects
{ 
type swakExpression;
valueType internalField;
setName liquidCog;
accumulations (sum);
expression "sum(pos()*alpha.water*vol())/(vol()*alpha.water)"; //works

/*# Time sum
0.01 (0.000309988 0.0903394 0.25)*/
verbose true;
outputControl outputTime;
}
For this list, I hope the missing closing bracket is not missing from your complete "system/controlDict" file. In addition, I hope you only have a single "libs" entry. Beyond that, I don't see any specific problem.

Quote:
Originally Posted by afshinb View Post
2. I'm not sure what you want.
Remember what you posted in your previous post, namely post #10? Namely this:
Quote:
Originally Posted by afshinb View Post
Code:
-> FOAM FATAL ERROR: 
Unknown function type swakExpression

Valid functions are :
This is only a very small part of the output that the solver gave you on-screen. I need the complete output, so that I can confirm if there were any other diagnostics that OpenFOAM gave earlier or later.

Quote:
Originally Posted by afshinb View Post
3. it gives me this:
Code:
ls: cannot access /home/afshin/OpenFOAM/afshin-3.0.1/platforms/linux64GccDPInt32Opt/lib: No such file or directory
are you looking for this directory?
Code:
/opt/openfoam30/platforms/linux64GccDPInt32Opt/lib
If you didn't change anything from the conventional installation instructions for swak4Foam, then I was looking for the correct directory. And it doesn't exist, then that probably means that swak4Foam did not build at all

If this diagnosis is correct, then I need the log file "log.make" that results from this command:
Code:
./Allwmake > log.make 2>&1
You can compress the file with this command:
Code:
gzip < log.make > log.make.gz
Then please attach the file "log.make.gz" to your next post.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 7, 2016, 17:56
Default
  #14
New Member
 
Afshin Bakhshi
Join Date: Mar 2014
Posts: 13
Rep Power: 12
afshinb is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Afshin,

Please keep in mind that OpenFOAM is very picky with every single detail Any missing detail can be the reason for it to not work as intended.


For this list, I hope the missing closing bracket is not missing from your complete "system/controlDict" file. In addition, I hope you only have a single "libs" entry. Beyond that, I don't see any specific problem.


Remember what you posted in your previous post, namely post #10? Namely this:

This is only a very small part of the output that the solver gave you on-screen. I need the complete output, so that I can confirm if there were any other diagnostics that OpenFOAM gave earlier or later.


If you didn't change anything from the conventional installation instructions for swak4Foam, then I was looking for the correct directory. And it doesn't exist, then that probably means that swak4Foam did not build at all

If this diagnosis is correct, then I need the log file "log.make" that results from this command:
Code:
./Allwmake > log.make 2>&1
You can compress the file with this command:
Code:
gzip < log.make > log.make.gz
Then please attach the file "log.make.gz" to your next post.

Best regards,
Bruno
yes you are right, there was a missing closing bracket but fixing it didn't solve the problem.
is there a problem in having multiple libs entries ?

that's the complete output:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.1-119cac7e8750
Exec   : interFoam
Date   : Feb 08 2016
Time   : 02:11:19
Host   : "afshin-System"
PID    : 11058
Case   : /home/afshin/Desktop/damBreak
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

--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : libswakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libswakFunctionObjects.so"
--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : libgroovyBC.so: cannot open shared object file: No such file or directory
--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libgroovyBC.so"
--> FOAM Warning : 
    From function dlOpen(const fileName&, const bool)
    in file POSIX.C at line 1179
    dlopen error : libsimpleFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName&, const bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
    could not load "libsimpleFunctionObjects.so"
Create mesh for time = 0


PIMPLE: Operating solver in PISO mode

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

No finite volume options present

DICPCG:  Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Courant Number mean: 0 max: 0

Starting time loop



--> FOAM FATAL ERROR: 
Unknown function type swakExpression

Valid functions are : 

4
(
patchProbes
probes
sets
surfaces
)



    From function functionObject::New(const word& name, const Time&, const dictionary&)
    in file db/functionObjects/functionObject/functionObject.C at line 92.

FOAM exiting
thank you for your kind responses.

Regards,
Afshin.
Attached Files
File Type: gz make.log.gz (1.2 KB, 6 views)
afshinb is offline   Reply With Quote

Old   February 7, 2016, 18:24
Default
  #15
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: The log file told us the whole story!
The problem is that you built swak4Foam with root powers (probably using sudo), because it tells us that one of the installation folders was this:
Code:
/home/afshin/OpenFOAM/root-3.0.1/platforms/linux64GccDPInt32Opt/lib/
"root-3.0.1" is not "afshin-3.0.1", which is why the libraries are not being found.

OK, let's see if I don't make a mistake in the following code... please carefully run these commands:
Code:
cd ~/OpenFOAM
mkdir afshin-3.0.1
sudo mv root-3.0.1/* afshin-3.0.1/
sudo chown -R afshin:afshin afshin-3.0.1
And finally, check if the folder I asked about in a previous post exists as intended with the desired libraries:
Code:
ls -l $FOAM_USER_LIBBIN
If all went well, it should list the libraries we want, such as "libgroovyBC.so".

Quote:
Originally Posted by afshinb View Post
is there a problem in having multiple libs entries ?
For example, having the following two lines in "system/controlDict" is wrong:
Code:
libs ("libsimpleFunctionObjects.so");
libs ("libsimpleSwakFunctionObjects.so");
It's wrong, because OpenFOAM will only read the first one. Therefore, the correct way is something this:
Code:
libs ("libsimpleFunctionObjects.so" "libsimpleSwakFunctionObjects.so" );
afshinb likes this.
wyldckat is offline   Reply With Quote

Old   February 8, 2016, 08:16
Default
  #16
New Member
 
Afshin Bakhshi
Join Date: Mar 2014
Posts: 13
Rep Power: 12
afshinb is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: The log file told us the whole story!
The problem is that you built swak4Foam with root powers (probably using sudo), because it tells us that one of the installation folders was this:
Code:
/home/afshin/OpenFOAM/root-3.0.1/platforms/linux64GccDPInt32Opt/lib/
"root-3.0.1" is not "afshin-3.0.1", which is why the libraries are not being found.

OK, let's see if I don't make a mistake in the following code... please carefully run these commands:
Code:
cd ~/OpenFOAM
mkdir afshin-3.0.1
sudo mv root-3.0.1/* afshin-3.0.1/
sudo chown -R afshin:afshin afshin-3.0.1
And finally, check if the folder I asked about in a previous post exists as intended with the desired libraries:
Code:
ls -l $FOAM_USER_LIBBIN
If all went well, it should list the libraries we want, such as "libgroovyBC.so".


For example, having the following two lines in "system/controlDict" is wrong:
Code:
libs ("libsimpleFunctionObjects.so");
libs ("libsimpleSwakFunctionObjects.so");
It's wrong, because OpenFOAM will only read the first one. Therefore, the correct way is something this:
Code:
libs ("libsimpleFunctionObjects.so" "libsimpleSwakFunctionObjects.so" );
That did the job.
thank you for your kind help.
but I can't get my code to work:

Code:
functions
{
liquid_COG //simpleFunctionObjects
{ 
type swakExpression;
valueType internalField;
setName liquidCog;
accumulations (sum);
expression "sum(pos()*alpha.water*vol())/(vol()*alpha.water)"; 
verbose true;
outputControl outputTime;
}
}
do you have any idea about it?
Code:
Create time

Create mesh for time = 0


PIMPLE: Operating solver in PISO mode

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

No finite volume options present

DICPCG:  Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Courant Number mean: 0 max: 0

Starting time loop

--> FOAM Warning : 
    From function simpleFunctionObject::simpleFunctionObject
    in file simpleFunctionObject/simpleFunctionObject.C at line 109
    'outputControlMode' not found in liquid_COG
Assuming: timeStep
--> FOAM Warning : 
    From function simpleFunctionObject::simpleFunctionObject
    in file simpleFunctionObject/simpleFunctionObject.C at line 117
    'outputInterval' not found in liquid_COG
Assuming: 1
swak4Foam: Setting default mesh
Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.00119048
Time = 0.00119048

PIMPLE: iteration 1
smoothSolver:  Solving for alpha.water, Initial residual = 0, Final residual = 0, No Iterations 0
Phase-1 volume fraction = 0.130194  Min(alpha.water) = 0  Max(alpha.water) = 1
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.130194  Min(alpha.water) = 0  Max(alpha.water) = 1
DICPCG:  Solving for p_rgh, Initial residual = 1, Final residual = 0.00312205, No Iterations 1
time step continuity errors : sum local = 0.000863557, global = 1.26712e-12, cumulative = 1.26712e-12
DICPCG:  Solving for p_rgh, Initial residual = 0.00146358, Final residual = 6.1835e-05, No Iterations 13
time step continuity errors : sum local = 3.64891e-05, global = 1.00147e-05, cumulative = 1.00147e-05
DICPCG:  Solving for p_rgh, Initial residual = 5.08691e-05, Final residual = 8.19239e-08, No Iterations 48
time step continuity errors : sum local = 5.88452e-08, global = -1.01668e-08, cumulative = 1.00045e-05
ExecutionTime = 0.19 s  ClockTime = 1 s

Expression liquid_COG : swak4Foam: Allocating new repository for sampledMeshes
swak4Foam: Allocating new repository for sampledGlobalVariables
--> FOAM Warning : 
    From function ConcretePluginFunction<DriverType>::exists
    in file lnInclude/ConcretePluginFunction.C at line 121
    Constructor table of plugin functions for FieldValueExpressionDriver is not initialized


--> FOAM FATAL ERROR: 
 Parser Error for driver FieldValueExpressionDriver at "1.11-15" :"field alpha not existing or of wrong type"
"sum(pos()*alpha.water*vol())/(vol()*alpha.water)"
            ^^^^^
------------|    

Context of the error:


- From dictionary: /home/afshin/Desktop/damBreak/system/controlDict.functions.liquid_COG
  Evaluating expression "sum(pos()*alpha.water*vol())/(vol()*alpha.water)"


    From function parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 1204.

FOAM exiting
afshinb is offline   Reply With Quote

Old   February 14, 2016, 16:02
Default
  #17
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: "alpha.water" problem... that has to do with a problem that swak4Foam has with field names that have dots in their names. Googling... results:
  1. https://sourceforge.net/p/openfoam-e...swak4foam/210/
  2. http://xiaopingqiu.github.io/2015/11...m-alpha-water/
vsammartano and afshinb like this.
wyldckat is offline   Reply With Quote

Old   November 22, 2018, 21:08
Default
  #18
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
Hi,


I would like the output time step of swakExpression be written in 7 precisions. My current command is as following:


Code:
    interfaceTemp
    {
    ignore_unimplemented_simpleFunctionObject::updateMesh true;
        aliases {
        alpha1 alpha.water;
        }
    type swakExpression;
    valueType surface;
    surfaceName interface1;
    surface {
        type isoSurface;
        isoField alpha.water;
        isoValue 0.9;
        interpolate true;
                writePrecision 7;
    }
    verbose true;
    expression "T";
    accumulations (
        average
        min
        max
    );
        outputInterval 20;
        timePrecision 7;
    }

But it is still written in 4, although the processing time step precision is 7:



# Time average min max
31.8321 343.078 342.996 362.95
31.8321 343.065 341.481 362.862
31.8321 343.061 342.085 362.834




I will apprciate any help.


Cheers,


Elham
Elham is offline   Reply With Quote

Old   November 23, 2018, 08:53
Default
  #19
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Elham View Post
Hi,


I would like the output time step of swakExpression be written in 7 precisions. My current command is as following:


Code:
    interfaceTemp
    {
    ignore_unimplemented_simpleFunctionObject::updateMesh true;
        aliases {
        alpha1 alpha.water;
        }
    type swakExpression;
    valueType surface;
    surfaceName interface1;
    surface {
        type isoSurface;
        isoField alpha.water;
        isoValue 0.9;
        interpolate true;
                writePrecision 7;
    }
    verbose true;
    expression "T";
    accumulations (
        average
        min
        max
    );
        outputInterval 20;
        timePrecision 7;
    }
But it is still written in 4, although the processing time step precision is 7:



# Time average min max
31.8321 343.078 342.996 362.95
31.8321 343.065 341.481 362.862
31.8321 343.061 342.085 362.834




I will apprciate any help.


Cheers,


Elham

AFAIK (but I'd have to check the sources to be sure) swak makes no effort to change the write precision. So unless the underlying Foam-implementation doesn't support this on a functionObject-level (I'm not aware of this) your best chance is to set it in the controlDict for the whole run (everything will be written with 7 digits)
__________________
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   November 25, 2018, 05:40
Default
  #20
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
Quote:
Originally Posted by gschaider View Post
AFAIK (but I'd have to check the sources to be sure) swak makes no effort to change the write precision. So unless the underlying Foam-implementation doesn't support this on a functionObject-level (I'm not aware of this) your best chance is to set it in the controlDict for the whole run (everything will be written with 7 digits)
Ok. Thanks for your comment.
Elham 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
Error in compiling new drag model k.farnagh OpenFOAM Programming & Development 13 May 21, 2016 03:08
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 06:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


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