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

creating a new/derived field and writing at output time

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2016, 07:20
Smile creating a new/derived field and writing at output time
  #1
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Dear Foamers',

I want to create a new/derived field and write it at the output time.

lets visualize a new volScalarField of mag(U).

I found out there three ways to do it---

1. edit the application (I want to omit this option)

2. using Swak4foam with expressionField. I tried it by editing the controlDict

Quote:
velocityMagSquared
{
type expressionField;
//outputControl outputTime;
//outputInterval 1;
fieldName UMag2;
expression "U&U";
autowrite true;
}
I also get the output file written in the corresponding output/time directory.

But problem is paraview do not import thes new field, it do not have this information.

the last way is using coded function/dynamic code,

I tried this, by adding the following lines in controlDict

Quote:
compute_ptot
{
functionObjectLibs ( "libutilityFunctionObjects.so" );
type coded;
enabled true;
redirectType ptot;
// outputControl outputTime;
// outputInterval 1;
code
#{

const volVectorField& U = mesh().lookupObject<volVectorField>("U");
volScalarField ptot
(
IOobject
(
"ptot",
mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mag(U)
);


#};
}
I neither get any new file in the corresponding output/time directory nor any visualization..

Please give me some suggesions with option 2 or 3.

I am trying this in OF 3.x and using following libraries,
Quote:
libs (
"libOpenFOAM.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
"libgroovyBC.so"
"mylibfvOptions.so"

);
Thanks,

Last edited by cfd@kgp; December 10, 2016 at 04:52.
cfd@kgp is offline   Reply With Quote

Reply

Tags
coded functions, new field at runtime, swak4foam


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
[mesh manipulation] How to write cellSet for different regions in constant/polyMesh/sets Struggle_Achieve OpenFOAM Meshing & Mesh Conversion 3 June 17, 2019 09:29
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
Steady simulation does not iterate in Time=1 agustinvo OpenFOAM Running, Solving & CFD 3 November 19, 2015 04:57
Cht tutorial in 15 braennstroem OpenFOAM Running, Solving & CFD 197 June 10, 2015 03:02
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36


All times are GMT -4. The time now is 12:11.