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

[swak4Foam] swak4oam: swakSourceFields - SwakSetValue: How to use these?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2013, 06:21
Default swak4oam: swakSourceFields - SwakSetValue: How to use these?
  #1
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 15
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, 17:22
Default
  #2
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 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, 12:35
Default
  #3
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 15
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, 17:39
Default
  #4
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 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
michu likes this.
__________________
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


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
[swak4Foam] swakSourceFields feature in order to fix the temperature in a certain cellZone samiam1000 OpenFOAM Community Contributions 1 June 20, 2012 09:41


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