CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD

creating a new/derived field and writing at output time

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

LinkBack Thread Tools Display Modes
Old   December 9, 2016, 08:20
Smile creating a new/derived field and writing at output time
Join Date: Oct 2014
Posts: 47
Rep Power: 5
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

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

functionObjectLibs ( "" );
type coded;
enabled true;
redirectType ptot;
// outputControl outputTime;
// outputInterval 1;

const volVectorField& U = mesh().lookupObject<volVectorField>("U");
volScalarField ptot

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,
libs (


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


coded functions, new field at runtime, swak4foam

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write cellSet for different regions in constant/polyMesh/sets Struggle_Achieve OpenFOAM Meshing & Mesh Conversion 2 March 9, 2017 03:46
Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
Steady simulation does not iterate in Time=1 agustinvo OpenFOAM Running, Solving & CFD 3 November 19, 2015 05: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 06:36

All times are GMT -4. The time now is 03:52.