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

Run time calculating non-dimensional fields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 20, 2019, 17:40
Default Run time calculating non-dimensional fields
  #1
Member
 
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 8
ErenC is on a distinguished road
Greetings to all!

I am trying to calculate non-dimensional fields. Such as:

Tn
(
IOobject
(
"Tn",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
(T-Tc)/(Th-Tc)
);


Un
(
IOobject
(
"Un",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U/U0
);



of course, I defined Th and Tc, U0. This should actually work but it doesnt. It correctly calculates initial values but it doesn't calculate it for all iterations. In last iteration I still have same Tn values of the first iteration. I should be missing something.

Of course, I can calculate it in paraview but I am trying to gain some time.

Any help would be great,
Eren.
ErenC is offline   Reply With Quote

Old   September 21, 2019, 11:19
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
If you put those somewhere like createFields, they will just be initialized (not updated). To update them, you'll need to put

Code:
 Tn = (T - Tc)/(Th - Tc)
inside your run loop.

Caelan
clapointe is offline   Reply With Quote

Old   September 21, 2019, 15:22
Default
  #3
Member
 
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 8
ErenC is on a distinguished road
Quote:
Originally Posted by clapointe View Post
If you put those somewhere like createFields, they will just be initialized (not updated). To update them, you'll need to put

Code:
 Tn = (T - Tc)/(Th - Tc)
inside your run loop.

Caelan

Thank you sir! It is working. How about runtime calculation of gradients? I defined GUn in createFields and added following line to code:

Code:
GUn= con * fvc::grad(Un)
(where con is a constant to make dx,dy non dimensional)


But not working.
error: no match for 'operator='
ErenC is offline   Reply With Quote

Old   September 21, 2019, 20:02
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
Well it is hard to diagnose why it might not be working without seeing the code you've written or the corresponding error, but I'd guess that you haven't specified GUn as a volVectorField. Another option is to take the magnitude of the gradient to make it a scalar field.

Caelan
clapointe is offline   Reply With Quote

Old   September 21, 2019, 20:37
Default
  #5
Member
 
Join Date: Jun 2012
Posts: 76
Rep Power: 13
maHein is on a distinguished road
Is GUn of type volTensorField? Calculating the gradient of a vector (here: velocity) results in a tensor. Maybe that's the reason for the error.
maHein is offline   Reply With Quote

Old   September 22, 2019, 03:55
Default
  #6
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
Quote:
Originally Posted by maHein View Post
Is GUn of type volTensorField? Calculating the gradient of a vector (here: velocity) results in a tensor. Maybe that's the reason for the error.

yes, fvc::grad(volVectorField) is a volTensorField!
Daniel_Khazaei is offline   Reply With Quote

Old   September 22, 2019, 06:54
Default
  #7
Member
 
Eren
Join Date: Aug 2018
Posts: 86
Rep Power: 8
ErenC is on a distinguished road
And it quickly solves my error! I changed field and it compiled. Thank you all!
Hope this thread will help another fellas to gain some time too!
ErenC is offline   Reply With Quote

Old   September 22, 2019, 08:13
Default
  #8
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
OpenFOAM-Doxygen is your friend to deduce the types of objects, defined operators and so on in OpenFOAM software:

OpenFOAM-Doxygen
HPE 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
LES, Courant Number, Crash, Sudden Alhasan OpenFOAM Running, Solving & CFD 5 November 22, 2019 02:05
Inconsistencies in reading .dat file during run time in new injection model Scram_1 OpenFOAM 0 March 23, 2018 22:29
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 02:50
Transient run continues from last time (when startover is desired) bongbang CFX 2 March 22, 2015 23:05
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03


All times are GMT -4. The time now is 19:34.