CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

swak4oam: swakSourceFields - SwakSetValue: How to use these?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 5, 2013, 07:21
Default swak4oam: swakSourceFields - SwakSetValue: How to use these?
  #1
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 152
Rep Power: 6
Anne Lincke is on a distinguished road
Dear Foamers,

I am using the library swak4foam for quite a while and I am really satisfied with it.
So far, I used it for evaluation of expressions which the solver produces, like pressure drop, velocity and so on.

Now I would like to know if it is possible to use a swak4foam function value which is defined in controlDict in the solver.
I found this document
http://openfoamwiki.net/images/e/e6/...oam_README.pdf

where is written that
Quote:
swakSourceFields
These classes allow to manipulate the solution. To use these the solver has to be modified.
SwakSetValue
sets values according to a mask or the mechanism provided by basicSource
SwakExplicitSource
Uses the calculated source term on the right hand side of the equation
SwakImplicitSource
Uses a calculated scalar-field to add an implicit source term (source is without the actual field)


I am really interested in using an expression, not as implicit or explicit source term but as an expression during run-time which is updated in each iteration.

So my questions are:
1. Is it possible to define swak4foam-functions, i.e. in the controlDict, and to use them during run-time?
2. How can I use them? Do I need to modify the solver?
3. Is there an example somewhere?

I am happy if there is given an example somewhere and am able to reproduce and transfer the example to my case.

Thank you very much for an answer in advance.

Kind Regards
Anne

Anne Lincke is offline   Reply With Quote

Old   November 8, 2013, 18:22
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Anne Lincke View Post
Dear Foamers,

I am using the library swak4foam for quite a while and I am really satisfied with it.
So far, I used it for evaluation of expressions which the solver produces, like pressure drop, velocity and so on.

Now I would like to know if it is possible to use a swak4foam function value which is defined in controlDict in the solver.
I found this document
http://openfoamwiki.net/images/e/e6/...oam_README.pdf

where is written that


I am really interested in using an expression, not as implicit or explicit source term but as an expression during run-time which is updated in each iteration.

So my questions are:
1. Is it possible to define swak4foam-functions, i.e. in the controlDict, and to use them during run-time?
2. How can I use them? Do I need to modify the solver?
3. Is there an example somewhere?

I am happy if there is given an example somewhere and am able to reproduce and transfer the example to my case.

Thank you very much for an answer in advance.

Kind Regards
Anne

There are examples for the use of these classes in Examples/BasicSourceSubclasses. For solvers that support BasicSource no modification is necessary. Not sure how things are with 2.2 which has with fvOptions an improved version of BasicSource
__________________
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   December 18, 2013, 13:35
Default
  #3
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 152
Rep Power: 6
Anne Lincke is on a distinguished road
Thank you very much for the answer, Bernhard.
It's been a while since I wrote the post above.
Finally I had a look at the examples of Examples/BasicSourceSubclasses.

I also installed a new swak-Version ( swak4Foam_2.x) using OpenFOAM-2.1.1

The installation was successful as the command
Code:
ls -l $FOAM_USER_LIBBIN
states

Code:
-rwxr-xr-x 1   682832 25. Feb 2013  libfieldFunctionObjectsCustom.so
-rwxr-xr-x 1  1525483 18. Dez 18:17 libgroovyBC.so
-rwxr-xr-x 1   636663 18. Dez 16:17 libgroovyStandardBCs.so
-rwxr-xr-x 1  2305375  8. Aug 09:40 libmyIncompressibleLESModels.so
-rwxr-xr-x 1  120288 24. Jul 10:40 libmy_octree.so
-rwxr-xr-x 1   107487  6. Aug 12:07 libRBFInterpolation.so
-rwxr-xr-x 1    81685  6. Aug 12:07 libShapeOptimisation.so
-rwxr-xr-x 1  1854204 18. Dez 18:24 libsimpleFunctionObjects.so
-rwxr-xr-x 1  1672657 18. Dez 18:26 libsimpleLagrangianFunctionObjects.so
-rwxr-xr-x 1   366774 18. Dez 18:27 libsimpleSearchableSurfaces.so
-rwxr-xr-x 1  451306 18. Dez 18:28 libsimpleSwakFunctionObjects.so
-rwxr-xr-x 1  7493071 18. Dez 18:16 libswak4FoamParsers.so
-rwxr-xr-x 1   215922 18. Dez 16:29 libswakChemistryModelFunctionPlugin.so
-rwxr-xr-x 1  1777552 18. Dez 18:20 libswakFunctionObjects.so
-rwxr-xr-x 1 1382461 18. Dez 16:22 libswakFvcSchemesFunctionPlugin.so
-rwxr-xr-x 1  399731 18. Dez 16:28 libswakLagrangianCloudSourcesFunctionPlugin.so
-rwxr-xr-x 1   204731 18. Dez 16:18 libswakLocalCalculationsFunctionPlugin.so
-rwxr-xr-x 1   230445 18. Dez 16:18 libswakMeshQualityFunctionPlugin.so
-rwxr-xr-x 1   197195 18. Dez 16:29 libswakRadiationModelFunctionPlugin.so
-rwxr-xr-x 1   150140 18. Dez 16:19 libswakRandomFunctionPlugin.so
-rwxr-xr-x 1   414849 18. Dez 16:17 libswakSourceFields.so
-rwxr-xr-x 1 1042878 18. Dez 16:27 libswakSurfacesAndSetsFunctionPlugin.so
-rwxr-xr-x 1   282569 18. Dez 16:22 libswakThermoTurbFunctionPlugin.so
-rwxr-xr-x 1    96182 18. Dez 16:16 libswakTopoSources.so
-rwxr-xr-x 1   213335 18. Dez 16:23 libswakTransportTurbFunctionPlugin.so
-rwxr-xr-x 1   239976 18. Dez 16:29 libswakVelocityFunctionPlugin.so
I also ran ./Allwmake and wmake libso.

But now I get an error message when running a solver (simpleFoam) in the Example swak4Foam/Examples/BasicSourceSubclasses/pitzDailyWithSwirl.

The solver does not "know" the swak-Expression vectorSwakSetValue

Code:
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.3;
}

Creating field source list from sourcesProperties

Selecting source model type vectorSwakSetValue


--> FOAM FATAL ERROR: 
Unknown Model type vectorSwakSetValue

Valid model types are:

13
(
actuationDiskSource
pressureGradientExplicitSource
radialActuationDiskSource
scalarExplicitSetValue
scalarExplicitSource
sphericalTensorExplicitSetValue
sphericalTensorExplicitSource
symmTensorExplicitSetValue
symmTensorExplicitSource
tensorExplicitSetValue
tensorExplicitSource
vectorExplicitSetValue
vectorExplicitSource
)


    From function basicSource::New(const name&, const dictionary&, const fvMesh&)
    in file cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C at line 240.

FOAM exiting
Can someone help me to solve the problem?

Thank you very much for an answer in advance.

Kind Regards
Anne
Anne Lincke is offline   Reply With Quote

Old   January 5, 2014, 18:39
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Anne Lincke View Post
Thank you very much for the answer, Bernhard.
It's been a while since I wrote the post above.
Finally I had a look at the examples of Examples/BasicSourceSubclasses.

I also installed a new swak-Version ( swak4Foam_2.x) using OpenFOAM-2.1.1

The installation was successful as the command
Code:
ls -l $FOAM_USER_LIBBIN
states

Code:
-rwxr-xr-x 1   682832 25. Feb 2013  libfieldFunctionObjectsCustom.so
-rwxr-xr-x 1  1525483 18. Dez 18:17 libgroovyBC.so
-rwxr-xr-x 1   636663 18. Dez 16:17 libgroovyStandardBCs.so
-rwxr-xr-x 1  2305375  8. Aug 09:40 libmyIncompressibleLESModels.so
-rwxr-xr-x 1  120288 24. Jul 10:40 libmy_octree.so
-rwxr-xr-x 1   107487  6. Aug 12:07 libRBFInterpolation.so
-rwxr-xr-x 1    81685  6. Aug 12:07 libShapeOptimisation.so
-rwxr-xr-x 1  1854204 18. Dez 18:24 libsimpleFunctionObjects.so
-rwxr-xr-x 1  1672657 18. Dez 18:26 libsimpleLagrangianFunctionObjects.so
-rwxr-xr-x 1   366774 18. Dez 18:27 libsimpleSearchableSurfaces.so
-rwxr-xr-x 1  451306 18. Dez 18:28 libsimpleSwakFunctionObjects.so
-rwxr-xr-x 1  7493071 18. Dez 18:16 libswak4FoamParsers.so
-rwxr-xr-x 1   215922 18. Dez 16:29 libswakChemistryModelFunctionPlugin.so
-rwxr-xr-x 1  1777552 18. Dez 18:20 libswakFunctionObjects.so
-rwxr-xr-x 1 1382461 18. Dez 16:22 libswakFvcSchemesFunctionPlugin.so
-rwxr-xr-x 1  399731 18. Dez 16:28 libswakLagrangianCloudSourcesFunctionPlugin.so
-rwxr-xr-x 1   204731 18. Dez 16:18 libswakLocalCalculationsFunctionPlugin.so
-rwxr-xr-x 1   230445 18. Dez 16:18 libswakMeshQualityFunctionPlugin.so
-rwxr-xr-x 1   197195 18. Dez 16:29 libswakRadiationModelFunctionPlugin.so
-rwxr-xr-x 1   150140 18. Dez 16:19 libswakRandomFunctionPlugin.so
-rwxr-xr-x 1   414849 18. Dez 16:17 libswakSourceFields.so
-rwxr-xr-x 1 1042878 18. Dez 16:27 libswakSurfacesAndSetsFunctionPlugin.so
-rwxr-xr-x 1   282569 18. Dez 16:22 libswakThermoTurbFunctionPlugin.so
-rwxr-xr-x 1    96182 18. Dez 16:16 libswakTopoSources.so
-rwxr-xr-x 1   213335 18. Dez 16:23 libswakTransportTurbFunctionPlugin.so
-rwxr-xr-x 1   239976 18. Dez 16:29 libswakVelocityFunctionPlugin.so
I also ran ./Allwmake and wmake libso.

But now I get an error message when running a solver (simpleFoam) in the Example swak4Foam/Examples/BasicSourceSubclasses/pitzDailyWithSwirl.

The solver does not "know" the swak-Expression vectorSwakSetValue

Code:
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
    Cmu             0.09;
    C1              1.44;
    C2              1.92;
    sigmaEps        1.3;
}

Creating field source list from sourcesProperties

Selecting source model type vectorSwakSetValue


--> FOAM FATAL ERROR: 
Unknown Model type vectorSwakSetValue

Valid model types are:

13
(
actuationDiskSource
pressureGradientExplicitSource
radialActuationDiskSource
scalarExplicitSetValue
scalarExplicitSource
sphericalTensorExplicitSetValue
sphericalTensorExplicitSource
symmTensorExplicitSetValue
symmTensorExplicitSource
tensorExplicitSetValue
tensorExplicitSource
vectorExplicitSetValue
vectorExplicitSource
)


    From function basicSource::New(const name&, const dictionary&, const fvMesh&)
    in file cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C at line 240.

FOAM exiting
Can someone help me to solve the problem?

Thank you very much for an answer in advance.

Kind Regards
Anne
The problem is that I inadvertently "disabled" the basicSources while adapting them for 2.2. I pushed a fix to the development repository. If you don't want to download that go to your copy of the sources and in Libraries/swakSourceFields/swakExplicitSources.C add
Code:
#include "swak.H"
before the first #ifdef. Also do so for swakImplicitSources.C and swakSetSources.C
__________________
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
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 On
Pingbacks are On
Refbacks are On



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