|
[Sponsors] | |||||
[swak4Foam] how can use Cp and Cv in Swak variables? |
11Likes
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 28 ![]() |
in below function if I want to use Cp/Cv instead of constant gamma that Cp and Cv can be calculated by the solver how I could do it?
Code:
totalPressure_left
{
type swakExpression;
valueType patch;
patchName left;
accumulations (
average
);
variables (
"gamma=1.4;"
"R=287.14;"
);
expression "sum(p*(pow(1+(gamma-1)/2*magSqr(U)/(gamma*R*T),(gamma/(gamma-1))))*rho*area())/sum(rho*area())";
verbose true;
outputControlMode outputTime;
outputInterval 1;
}
__________________
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. |
|
|
|
|
|
|
|
|
#2 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
Otherwise there are functions that get these fields in the swakThermophysicalFunctions-plugin
__________________
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 |
||
|
|
|
||
|
|
|
#3 |
|
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 28 ![]() |
Hi Bernhard
thanks for guidance. I managed to do that in Swak postProcessing functions with the help of dear Bruno through your advice. now I want to use Cp and Cv in groovyBC variables but it dowsn't know Cp and Cv opposite to postProcessing functions. this is the error I get: Code:
[3] --> FOAM FATAL ERROR:
[3]
[1]
[1] --> FOAM FATAL ERROR:
[1] Parser Error for driver PatchValueExpressionDriver at "1.1-2" :"field Cp not existing or of wrong type"
"Cp/Cv"
^^
--|
Context of the error:
- From dictionary: /home/ehsan/Desktop/WR_4/processor1/0.001019/U.boundaryField.right
Evaluating expression "Cp/Cv"
[1]
From function ConcretePluginFunction<DriverType>::exists
Parser Error for driver PatchValueExpressionDriver at "1.1-2" :"field Cp not existing or of wrong type"
"Cp/Cv"
^^
--|
Context of the error:
- From dictionary: /home/ehsan/Desktop/WR_4/processor3/0.001019/U.boundaryField.right
Evaluating expression "Cp/Cv"
[3]
[3]
[3] From function parsingValue
[3] in file lnInclude/CommonValueExpressionDriverI.H at line 1160[1]
[1] From function parsingValue
[1] in file lnInclude/CommonValueExpressionDriverI.H at line 1160..
[3]
FOAM parallel run exiting
[3]
[1]
FOAM parallel run exiting
[1]
[2]
[2] --> FOAM FATAL ERROR: --------------------------------------------------------------------------
MPI_ABORT was invoked on rank 3 in communicator MPI_COMM_WORLD
with errorcode 1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
[2] Parser Error for driver PatchValueExpressionDriver at "1.1-2" :"field Cp not existing or of wrong type"
"Cp/Cv"
^^
--|
Context of the error:
- From dictionary: /home/ehsan/Desktop/WR_4/processor2/0.001019/U.boundaryField.right
Evaluating expression "Cp/Cv"
[2]
[2]
[2] From function parsingValue
[2] in file lnInclude/CommonValueExpressionDriverI.H at line 1160.
[2]
FOAM parallel run exiting
[2]
in file lnInclude/ConcretePluginFunction.C at line 111
Constructor table of plugin functions for PatchValueExpressionDriver is not initialized
[0]
[0]
[0] --> FOAM FATAL ERROR:
[0] Parser Error for driver PatchValueExpressionDriver at "1.1-2" :"field Cp not existing or of wrong type"
"Cp/Cv"
^^
--|
Context of the error:
- From dictionary: /home/ehsan/Desktop/WR_4/processor0/0.001019/U.boundaryField.right
Evaluating expression "Cp/Cv"
[0]
[0]
[0] From function parsingValue
[0] in file lnInclude/CommonValueExpressionDriverI.H at line 1160.
[0]
FOAM parallel run exiting
[0]
--------------------------------------------------------------------------
mpirun has exited due to process rank 2 with PID 26488 on
node Ehsan-com exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[Ehsan-com:26483] 3 more processes have sent help message help-mpi-api.txt / mpi-abort
[Ehsan-com:26483] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
gnuplot> plot
gnuplot> plot
^
^
line 0: line 0: function to plot expected
function to plot expected
gnuplot> set terminal png small color
gnuplot> set terminal png small color
^
line 0: invalid color spec, must be xRRGGBB
^
line 0: invalid color spec, must be xRRGGBB
gnuplot> plot
gnuplot> plot
^
^
line 0: function to plot expected
line 0: function to plot expected
Warning: empty x range [0.00101902:0.00101902], adjusting to [0.00100883:0.00102921]
gnuplot> plot "/tmp/tmp2m8WmU.gnuplot/fifo" title "rhoUy" with lines, "/tmp/tmpDE20xb.gnuplot/fifo" title "rhoUx" with lines, "/tmp/tmp4mA5Zt.gnuplot/fifo" title "rho" with lines
^
line 0: all points y value undefined!
gnuplot> set terminal png small color
^
line 0: invalid color spec, must be xRRGGBB
Killing PID 26479
PyFoam WARNING on line 232 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py : Process 26479 was already dead
Warning: empty x range [0.00101902:0.00101902], adjusting to [0.00100883:0.00102921]
gnuplot> plot "/tmp/tmpkrENOz.gnuplot/fifo" title "rhoUy" with lines, "/tmp/tmpwHPZfe.gnuplot/fifo" title "rhoUx" with lines, "/tmp/tmpgEngiQ.gnuplot/fifo" title "rho" with lines
^
line 0: all points y value undefined!
Code:
loadThermo {
type loadPsiThermoModel;
correctModel true;//I think that if "correctModel" is set to "true", it will call "thermo.correct()" at the beginning of each time iteration.
// correctModel true;
allowReload false;//it's possibly for keeping track of the changes in "constant/thermo*"
failIfModelTypeExists false;
outputControlMode timeStep;
outputInterval 1;
}
CvField {
type expressionField;
autowrite true;//false;
outputControl timeStep;
outputInterval 1;
expression "thermo_Cv()";
fieldName Cv;
}
CpField {
type expressionField;
autowrite true;//false;
outputControl timeStep;
outputInterval 1;
expression "thermo_Cp()";
fieldName Cp;
}
in variables of groovyBC I wrote these terms in both patches for all variables(fields): Code:
"gamma2=Cp/Cv;"
"gamma4=Cp/Cv;"
"R=Cp-Cv;"
__________________
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. |
|
|
|
|
|
|
|
|
#4 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
The problem is probably that the expressionField is created AFTER it is needed by groovyBC. This situation is ugly to work around.
Anyway. Before you proceed try removing Cp/Cv temporarily from the groovyBC/functions and use the listRegisteredObjects-functionObject to see if a fitting field is there. Maybe under a different name 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 |
||
|
|
|
||
|
|
|
#5 |
|
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 130 ![]() ![]() ![]() ![]() ![]() ![]() |
Greetings to all!
@Bernhard: Ehsan forgot to update this thread. I had a look into this and answered him via email. The problem about "Cv" and "Cp" is that these fields are apparently also managed by some other class and they were unregistered at the end/beginning of the following time iteration. By renaming the field names to "CRRv" and "CRRp" in the function objects, it seemed to work just fine. I'll take the opportunity to consolidate the information I've been sending him over email. The following information was initially based on the example case "Examples/Lagrangian/hotStream" from swak4Foam:
Bruno
__________________
|
|
|
|
|
|
|
|
|
#6 |
|
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 28 ![]() |
Hi
whats the problem with reconstructPar about CRRv? Code:
Create time
Reconstructing fields for mesh region0
Time = 0.002216
Reconstructing FV fields
Reconstructing volScalarFields
ddt0(rho,k)
mut
rho
gas
k
gas_0
alphat
CRRv
--> FOAM FATAL IO ERROR:
error in IOstream "/home/ehsan/Desktop/WR_4/processor2/0.002216/CRRv" for operation operator>>(Istream&, List<T>&) : reading entry
file: /home/ehsan/Desktop/WR_4/processor2/0.002216/CRRv at line 4647.
From function IOstream::fatalCheck(const char*) const
in file db/IOstreams/IOstreams/IOstream.C at line 114.
FOAM exiting
__________________
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. |
|
|
|
|
|
|
|
|
#7 | |
|
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 130 ![]() ![]() ![]() ![]() ![]() ![]() |
There are a few possibilities:
Quote:
Or you can do it directly from the command line: Code:
sed '4647!d' processor2/0.002216/CRRv Code:
sed '4646,4648!d' processor2/0.002216/CRRv
__________________
|
||
|
|
|
||
|
|
|
#8 |
|
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 28 ![]() |
Hi Bruno
but there is not CRRv,maybe its because of using ctrl+c. ehsan@Ehsan-com:~/Desktop/WR_4$ sed '4647!d' processor2/0.002216/CRRv sed: can't read processor2/0.002216/CRRv: No such file or directory |
|
|
|
|
|
|
|
|
#9 | |
|
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 130 ![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
Let me see if I understand this correctly: instead of checking if the file actually existed or not and what contents it had, as the error message clearly stated that something was wrong with this file, you instead went here to the forum to ask something that only you could see on your computer... which is somewhat common... for beginners!!! You've been working with OpenFOAM for so long now, that these kinds of questions should no longer occur! Either way, why on Earth are you still using Ctrl+C? I sent you the other day via email the function object that helps to stop the solver, by simply creating a file named "stop". I'll remind you how it works:
|
||
|
|
|
||
|
|
|
#10 |
|
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 28 ![]() |
Hi Bruno
sorry,I had to leave and hadn't enough time to use touch stop and also was confused with various jobs should be done.CRRv file was there in fact,I saw that at the moment but was empty or incomplete because it couldn't be unzip and also CRRp didn't exist there.now I deleted four time folders and used previous time folder by reconstructPar -latestTime and worked fine. I'm glad and it seems it made an opportunity for others to use the command you provided with my troubles and mentioned here. thanks a lot. |
|
|
|
|
|
|
|
|
#11 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
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 |
||
|
|
|
||
|
|
|
#12 |
|
New Member
Join Date: Dec 2013
Posts: 4
Rep Power: 14 ![]() |
Hello I don't want to steal this thread but I think my Problem is quite similar to the problem of immortality. I hope this is okay.
I want to simulate a reactor. The upper part is heated from the outside and in the lower part where the flame is burning there should be like it is normal the heat transfer to the outside. I use of swak4Foam groovyBC to implement this heat transfer. If I try to run the simulation my error looks like this. Code:
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.2.2-9240f8b967db
Exec : reactingFoam
Date : Dec 05 2013
Time : 12:19:52
Host : "Martin"
PID : 2416
Case : /home/martin/OpenFOAM/martin-2.2.2/run/tutorials/combustion/reactingFoam/ras/Versuche_LVA/1_Versuch
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create mesh for time = 0
Reading g
Creating reaction model
Selecting combustion model PaSR<psiChemistryCombustion>
Selecting chemistry type
{
chemistrySolver ode;
chemistryThermo psi;
}
Selecting thermodynamics package
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy sensibleEnthalpy;
equationOfState perfectGas;
specie specie;
}
Selecting chemistryReader foamChemistryReader
chemistryModel: Number of species = 5 and reactions = 1
Selecting ODE solver SIBS
Reading field U
Reading/calculating face flux field phi
Creating turbulence model.
Selecting turbulence model type RASModel
Selecting RAS turbulence model realizableKE
realizableKECoeffs
{
Cmu 0.09;
A0 4;
C2 1.9;
alphak 1;
alphaEps 0.833333;
alphah 1;
sigmak 1;
sigmaEps 1.2;
Prt 1;
}
Creating field dpdt
Creating field kinetic energy K
No finite volume options present
Courant Number mean: 0.000425762 max: 2.81585
PIMPLE: Operating solver in PISO mode
Starting time loop
Courant Number mean: 3.02387e-05 max: 0.199989
deltaT = 7.10227e-05
Time = 7.10227e-05
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for O2, Initial residual = 1, Final residual = 6.25475e-07, No Iterations 20
DILUPBiCG: Solving for H2O, Initial residual = 1, Final residual = 6.18374e-07, No Iterations 22
DILUPBiCG: Solving for CH4, Initial residual = 1, Final residual = 6.24701e-07, No Iterations 23
DILUPBiCG: Solving for CO2, Initial residual = 1, Final residual = 6.70893e-07, No Iterations 23
swak4Foam: Setting default mesh
swak4Foam: Allocating new repository for sampledGlobalVariables
--> FOAM Warning :
From function ConcretePluginFunction<DriverType>::exists
in file lnInclude/ConcretePluginFunction.C at line 111
Constructor table of plugin functions for PatchValueExpressionDriver is not initialized
--> FOAM FATAL ERROR:
Parser Error for driver PatchValueExpressionDriver at "1.9-10" :"field Cp not existing or of wrong type"
"average(Cp)"
^^
----------|
Context of the error:
- Driver constructed from scratch
Evaluating expression "average(Cp)"
From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 1081.
FOAM exiting
I use OpenFoam 2.2.2 and the Version of swak4Foam which wyldcat posted (swak4Foam-master). I think this is the Version 0.2.4 but I am not sure. Thanks a lot for your time and help. Best regards Martin |
|
|
|
|
|
|
|
|
#13 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
Code:
aliases {
// thermo:cp myCp;
myCp thermo:cp;
}
__________________
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 Last edited by gschaider; December 8, 2016 at 17:12. Reason: Used dictionary wrong |
||
|
|
|
||
|
|
|
#14 |
|
New Member
Join Date: Dec 2013
Posts: 4
Rep Power: 14 ![]() |
Thanks a lot for your answer but now I have more questions.
How and where I can use the listRegisteredObjects-functionObject? I tried it in the terminal directly in the swak4Foam folder, but it want not work? Where I have to implement the aliases into the controlDict? Sorry for these question which maybe sounds to you trivial but I just started to use OpenFoam and therefore I am already not really familiar with some parts of it. Again thanks a lot for your time and help. Best regards Martin |
|
|
|
|
|
|
|
|
#15 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
Code:
grep -r listRegist Examples/* Either look it up in the reference guide or use the grep-trick again. Or have a look at the README (where it is described like every other new feature) You've got to understand my problem: I give you the name of the thing that helps you (listRegisteredObjects) and then expect you to do a minimum of research yourself. The reason is that every time I describe something in detail (especially if I described it several times before on the MessageBoard - You are aware that it has a search function) another paragraph of the documentation does NOT get written (I only have limited time for non-customer-support). The alternative would be that I stop answering redundant questions altogether and with the time saved in half a year there would be a complete reference guide for swak. That half year would be hard for some.
__________________
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 |
||
|
|
|
||
|
|
|
#16 |
|
New Member
Join Date: Dec 2013
Posts: 4
Rep Power: 14 ![]() |
Thanks a lot for your help. You're right I am sorry for my questions in the future I will do more research before I ask something.
Thank you very much! Best regards Martin |
|
|
|
|
|
|
|
|
#17 | ||
|
Member
a
Join Date: Oct 2014
Posts: 49
Rep Power: 13 ![]() |
Dear Bernhard,
I have similar issue with the variable defined in meltingandsolidification source in OF 3.0 and ahead. details are given in post #1 Quote:
Also I have tried to list the variables using following commands Quote:
But I am pretty sure about the name of the variable as I can operate with the variable in coded functions (banana trick works in coded functions but not with type writeRegisteredObject; ) please help, some how the variable "sMS1:alpha1" access with swakExpressions seem very necessary to me. Thanks and regards. Last edited by cfd@kgp; December 8, 2016 at 10:53. Reason: few more additions for clarity |
|||
|
|
|
|||
|
|
|
#18 | |
|
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
(looking down I saw that the confusion comes from one of my answers. But I put the disclaimer below the answer for a reason. I'll edit the answer)
__________________
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 |
||
|
|
|
||
|
|
|
#19 | |
|
Member
a
Join Date: Oct 2014
Posts: 49
Rep Power: 13 ![]() |
Quote:
|
||
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|