CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

functionObject to process field from scalarTransport, field not found

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

Like Tree2Likes
  • 1 Post By LuckyTran
  • 1 Post By LuckyTran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 28, 2020, 13:31
Default functionObject to process field from scalarTransport, field not found
  #1
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 5
Tom Lauriks is on a distinguished road
Hi foamers,


I'm using simpleFoam to calculate the flow. I added a scalar with the functionObject scalarTransport.

scalarTransport works correctly (thanks to help from this forum). But when I try to apply a function object - surfaceFieldValue - to the field generated by scalarTransport (sf6), I'm getting the error message: Requested field sf6 not found in database and not processed. surfaceFieldValue is defined in the functions dict in controlDIct.

Does anyone know what is causing this problem?

Tom Lauriks is offline   Reply With Quote

Old   April 28, 2020, 14:39
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,654
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Same problem as before and same solution as before. sf6 is not a registered field name, it's available only to the scalarTransport object.

Put your function object for surfaceFieldVaue inside the scalarTransport.

If you want to avoid these limitations in the future. You can build your own solver by copying all the simpleFoam stuff. Go into createFields.H and add your sf6 field to the database.
Tom Lauriks likes this.
LuckyTran is offline   Reply With Quote

Old   April 28, 2020, 17:15
Default
  #3
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 5
Tom Lauriks is on a distinguished road
Thanks again for your answer. Before I posted this thread, I was thinking that this is the problem and tried what you said. It didn't work. I must, however, mention that I first ran the solver and then tried to obtain surfaceFieldValue by: simpleFoam -postProcess. I, just now, also tried running the solver again for 1 more step that is written out with surfaceFieldValue activated in scalarTransport. But I'm not getting any surfaceFieldValue output. Can this problem be fixed?

Thanks also for the suggestion on building my own solver. That might come in handy.

I'll include my scalarTransport dict (the patch side_back indeed exists):
Quote:
sf6
{
type scalarTransport;
functionObjectLibs ("libsolverFunctionObjects.so");
enabled true;
writeControl outputTime;
log yes;
nCorr 1;
alphaD 0.62;
alphaDt 1.4286;
field sf6;
fvOptions
{
sf6
{
type scalarSemiImplicitSource;
active true;
scalarSemiImplicitSourceCoeffs
{
selectionMode cellSet;
cellSet source1;
volumeMode absolute;
injectionRateSuSp
{
sf6 (1e-2 0.0);
}
}
}
}
outletAverage
{
type surfaceFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
writeControl timeStep;
//writeControl outputTime;//Doesn't make a difference

writeInterval 1;
log true;
writeFields true;
regionType patch;
name side_back;
operation areaAverage;
fields
(
sf6
);
}
}
Tom Lauriks is offline   Reply With Quote

Old   April 29, 2020, 07:52
Default
  #4
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 5
Tom Lauriks is on a distinguished road
LuckyTran, I built the solver like you described. I then put the surfaceFieldValue dict outside the scalarTransport dict. It's super easy and works like a charm. That's a good enough solution for me.

For interested readers: in createFields.H, I copied and duplicated the code creating the p field and changed every p to the name of my field:
Info<< "Reading field sf6\n" << endl;
volScalarField sf6
(
IOobject
(
"sf6",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Tom Lauriks is offline   Reply With Quote

Old   April 29, 2020, 11:31
Default
  #5
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 5
Tom Lauriks is on a distinguished road
Maybe a small clarification: I was a bit reluctant to make my own solver, because I need to be able to run this case on our supercomputer. But compiling the new solver didn't cause any trouble. I just ran wclean and wmake in the map with the modified solver and the case ran without problems on our supercomputer.
Tom Lauriks is offline   Reply With Quote

Old   April 29, 2020, 11:42
Default
  #6
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,654
Rep Power: 65
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Good that you were able to build your custom solver.

Just FYI:
IOobject::MUST_READ means that OF will now throw a bitch fit if there isn't a sf6 file in your timedir (/0 or wherever). This is how you stop newbies from getting too far when they forget to provide file mandatory fields like p,U, etc.

For fields that are optional, you can choose to not make it required. The other options are READ_IF_PRESENT and NO_READ.

READ_IF_PRESENT means OF won't complain even if the file is not there (when you do not want to use your scalarTransport for example). Some fields are calculated as post processing fields only and never need to be read, in which case you can use NO_READ.
Tom Lauriks likes this.
LuckyTran is offline   Reply With Quote

Old   April 29, 2020, 12:25
Default
  #7
Member
 
Tom Lauriks
Join Date: Apr 2020
Posts: 34
Rep Power: 5
Tom Lauriks is on a distinguished road
Thanks again! This is very interesting info.
Tom Lauriks is offline   Reply With Quote

Reply

Tags
database, field, functionobject, scalartransport

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Problem of compilation OF 14Allwmake command not found erik_d OpenFOAM Bugs 13 September 13, 2008 22:45
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 05:26
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 02:44.