Hello Eelco,
I followed your thread above but as I am not a C++ programmer I have some problems to understand what you actually did. I need to set a time dependent BC for heatflux. What I did so far is to create a ramp over time. But if I want the ramp to become a constant value at a certain point in time I don't know how realize it. My idea was to define two expressions, from which one is true for the first part of the calculation, and the other one for the second part, controlling it with an if then else condition like: if time()<=t1 the use expression one, else use expression two. Is this somehow realizable? If so, how is the syntax? Thank you in advance Best, Tony |
Quote:
There is an example solver for swak-source-terms in the examples (basically you'll have to add the source-term to the equation and the source term has to be read) How you specify the zone is up to you: either by an expression or using a cellSet. cellSets can be created with the cellSet-utility. Either use one of the standard cellSet-methods or the one supplied by swak for that. There is a (simple) example for that too |
Failing to compile interfoamwithsources
Hi Bernhard,
I'm getting error compiling InterFoamWithSources: Code:
M/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude -I/home/fabioc/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed Make/linux64GccDPOpt/interFoamWithSources.o -L/home/fabioc/OpenFOAM/OpenFOAM-1.7.x/lib/linux64GccDPOpt \ Using OF-1.7.x... will try latter with OF-1.6-ext .. |
Not able to compile swak4foam
Hi,
When I try to do wmake in swak4FoamParsers I get following error SOURCE=FieldValueExpressionParser.yy ; rm -f Make/linux64GccDPOpt/FieldValueExpressionParser.C Make/linux64GccDPOpt/FieldValueExpressionParser.tab.hh; bison -ra -v -d $SOURCE ; mv *.tab.cc Make/linux64GccDPOpt/FieldValueExpressionParser.C ; sed -i.bak "s/position.hh/FieldValueExpressionParser_position.hh/" location.hh ; mv location.hh lnInclude/FieldValueExpressionParser_location.hh ; mv stack.hh lnInclude/FieldValueExpressionParser_stack.hh ; mv position.hh lnInclude/FieldValueExpressionParser_position.hh ; sed -i.bak "s/stack.hh/FieldValueExpressionParser_stack.hh/;s/location.hh/FieldValueExpressionParser_location.hh/" FieldValu[harshad@headhpccluster swak4FoamParsers]$ wmake SOURCE=FieldValueExpressionParser.yy ; rm -f Make/linux64GccDPOpt/FieldValueExpressionParser.C Make/linux64GccDPOpt/FieldValueExpressionParser.tab.hh; bison -ra -v -d $SOURCE ; mv *.tab.cc Make/linux64GccDPOpt/FieldValueExpressionParser.C ; sed -i.bak "s/position.hh/FieldValueExpressionParser_position.hh/" location.hh ; mv location.hh lnInclude/FieldValueExpressionParser_location.hh ; mv stack.hh lnInclude/FieldValueExpressionParser_stack.hh ; mv position.hh lnInclude/FieldValueExpressionParser_position.hh ; sed -i.bak "s/stack.hh/FieldValueExpressionParser_stack.hh/;s/location.hh/FieldValueExpressionParser_location.hh/" FieldValueExpressionParser.tab.hh ;mv *.hh lnInclude ; touch -r $SOURCE lnInclude/FieldValueExpressionParser*.hh ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -IMake/linux64GccDPOpt -I/home/harshad/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/harshad/OpenFOAM/OpenFOAM-1.6/src/meshTools/lnInclude -IlnInclude -I. -I/home/harshad/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/harshad/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c Make/linux64GccDPOpt/FieldValueExpressionParser.C -o Make/linux64GccDPOpt/FieldValueExpressionParser.o FieldValueExpressionParser.yy:40.1-15: invalid directive: `%initial-action' FieldValueExpressionParser.yy:41.1-44.1: syntax error, unexpected "{...}" mv: cannot stat `*.tab.cc': No such file or directory sed: can't read location.hh: No such file or directory mv: cannot stat `location.hh': No such file or directory mv: cannot stat `stack.hh': No such file or directory mv: cannot stat `position.hh': No such file or directory sed: can't read FieldValueExpressionParser.tab.hh: No such file or directory mv: cannot stat `*.hh': No such file or directory g++: Make/linux64GccDPOpt/FieldValueExpressionParser.C: No such file or directory g++: no input files make: *** [Make/linux64GccDPOpt/FieldValueExpressionParser.o] Error 1 Can anybody help me? |
Quote:
Try wclean. Have a look whether the regular interFoam compiles for you |
Quote:
|
bison version: 1.875c
Thanks |
Thanks for reply
I am using bison 1.875c Could not 'make' latest version so tried using existing version. |
Quote:
Bernhard |
Ok
I will try installing latest bison again Thanks for clarifications |
Hy Bernhard,
I've implemented now volume sources for momentum,mass and energy in reactingFoam and now I need to control the sources by an expression, which describes the source behavior over time. But as you can see below, in my source properties I can only specify a constant value instead of an expression. FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object massSourcesProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ( source1 { active true; timeStart 0.001; duration 0.05; selectionMode cellSet; volumeMode absolute; fieldData ( (H2O 1e-1) // kg/s (CO2 1e-1) (N2 1e-1) (O2 1e-1) ); cellSet heatSource; } ); Is this now a case that can be solved with swak4Foam? If so, could you point me to the right example or post where to add the expression and synthax of it. The source zone in the mesh is defined with cellSets. Thank you in advance Tony |
Quote:
To specify the source just in a cell set foo use this expression "set(foo) ? 1 : 0" instead of 1 use the expression you want to use Bernhard |
Hello Bernhard,
thanx for your quick reply. One difference is in the createFields.H file: expressionSource<vector> momentumSource ( IOdictionary ( IOobject ( "momentumSourceDict", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ), mesh ); In my case I need to add additionally energySources and massSources. EnergySources shouldn't be a problem, as the only changes to make are to set <vector> to <scalar> and to change momentumSource to energySource and so on. But what about massSources. I mean is it possible to control different species over a single massSourceDict? Or do I have to specify for each specie an own dict? One last question. Is this synthax right in the .C File? I just took the momentumSource synthax from interFoamWithSourcesFoam and adapted it to mass and energy... if (runTime.write()) { chemistry.dQ()().write(); volVectorField momSrc=momentumSource(); momSrc.rename("momSrc"); momSrc.write(); volVectorField enegSrc=energySource(); momSrc.rename("enegSrc"); momSrc.write(); volVectorField masSrc=massSource(); momSrc.rename("masSrc"); momSrc.write(); } Thank you very much, Tony |
oh I'm sorry... like this of course!!!!
if (runTime.write()) { chemistry.dQ()().write(); volVectorField momSrc=momentumSource(); momSrc.rename("momSrc"); momSrc.write(); volScalarField enegSrc=energySource(); enegSrc.rename("enegSrc"); enegSrc.write(); volScalarField masSrc=massSource(); masSrc.rename("masSrc"); masSrc.write(); } |
Quote:
BTW: I'm sure you've included the overall mass-source into the continuity equation Quote:
Bernhard |
Quote:
i am facing the same problem (ld returned 1 exit status). Is it possible that this is somehow related to where the *.o file is written... because i had to manually change the Make/files when compiling swak4Foam. I changed from ../Libraries/... to ../lib/.. and this fixed the "earlier" problem.. neewbie |
Hi Bernhard,
I've compiled swak4Foam for both 1.6-ext and 1.7.0. Everything seems okay except for the simpleSwakFunctionObjects library. It is mentioned on the wiki page but does not appear with the other libraries. Looking in the make log file the only reference to simpleFunctionObjects appears in this segment below: Code:
wmakeLnInclude: linking include files to ./lnInclude Thanks, Ziad |
Quote:
Let me quote from the README-file (sometimes I wonder why I write that stuff): Code:
** Requirements |
Right! I had simpleFunctionObjects, just not in $WM_PROJECT_USER_DIR/Libraries
Thanks for the "tip". |
Hello Bernhard,
two short questions: 1. what exactly do you mean with your comment: BTW: I'm sure you've included the overall mass-source into the continuity equation My Eqns look like this: UEqn: fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) == //rho*g rho.dimensionedInternalField()*g + momentumSource.Su() ); UEqn.relax(); if (momentumPredictor) { solve(UEqn == -fvc::grad(p)); } ...and YEqn: for (label i=0; i<Y.size(); i++) { if (Y[i].name() != inertSpecie) { volScalarField& Yi = Y[i]; solve ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == //kappa*chemistry.RR(i), kappa*chemistry.RR(i)().dimensionedInternalField() + massSource.Su(i), mesh.solver("Yi") ); Yi.max(0.0); Yt += Yi; Is there something wrong regarding the specie fractions or what else do you mean? 2. Do you know where to get the properties set for CO in the same "form" like other species used for reactingFoam? OpenFOAM support doesn't help unfortunately... Many thanx in advance, Tony |
All times are GMT -4. The time now is 09:49. |