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

Inconsistencies in reading .dat file during run time in new injection model

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2018, 22:29
Default Inconsistencies in reading .dat file during run time in new injection model
  #1
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 10
Scram_1 is on a distinguished road
Hello everyone!
I'm trying to create a new injection model called myPatchInjection in OpenFOAM. Now, what this model should ideally do is read the time values from a .dat file and if this value matches with the current run time value, inject the corresponding number of particles (read from another column in the .dat file) from a predefined patch.
Now, my injection model is reading the values from the .dat file. The problem that I'm facing is that when I compare this value with the actual run time value, it shows some inconsistencies. Here's a small snippet of the output log file that I've generated.

Code:
/*---------------------------------------------------------------------------
Starting time loop

Courant Number mean: 2.9067e-09 max: 5.5993e-06
Time = 1e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 1, Final residual = 9.3372e-16, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 1, Final residual = 1.231e-15, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 1, Final residual = 1.4563e-15, No Iterations 1
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.083761, No Iterations 15
time step continuity errors : sum local = 4.8693e-10, global = 8.8325e-11, cumulative = 8.8325e-11
GAMG:  Solving for p, Initial residual = 0.14228, Final residual = 4.2989e-05, No Iterations 5
time step continuity errors : sum local = 4.2196e-10, global = -4.4371e-11, cumulative = 4.3954e-11
smoothSolver:  Solving for omega, Initial residual = 1.5186e-06, Final residual = 1.5186e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 5.4479e-06, Final residual = 5.6829e-12, No Iterations 1
bounding k, min: -3.3745e-11 max: 0.00437 average: 1.1794e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  1e-06	1e-06
times are = 1e-06	1e-06
injected!!!1
nParcels = 2

Cloud: kinematicCloud injector: model1
    Added 2 new parcels

Cloud: kinematicCloud
    Current number of parcels       = 2
    Current mass in system          = 3.5919e-13
    Linear momentum                 = (3.4697e-16 -8.3259e-18 -1.0058e-17)
   |Linear momentum|                = 3.4721e-16
    Linear kinetic energy           = 1.8075e-19
    Injector model1:
      - parcels added               = 2
      - mass introduced             = 3.5919e-13
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 12.31 s  ClockTime = 13 s

Courant Number mean: 4.9714e-06 max: 0.00020678
Time = 2e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.85068, Final residual = 9.7623e-13, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.33333, Final residual = 2.6761e-12, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.33333, Final residual = 2.7184e-12, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.031994, Final residual = 0.001481, No Iterations 4
time step continuity errors : sum local = 1.7484e-08, global = 2.2431e-09, cumulative = 2.287e-09
GAMG:  Solving for p, Initial residual = 0.31987, Final residual = 8.3962e-05, No Iterations 11
time step continuity errors : sum local = 3.1866e-10, global = -2.8136e-11, cumulative = 2.2589e-09
smoothSolver:  Solving for omega, Initial residual = 1.5038e-06, Final residual = 1.5038e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.1665e-06, Final residual = 6.8355e-12, No Iterations 1
bounding k, min: 9.6714e-16 max: 0.00437 average: 1.1794e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  2e-06	2e-06
times are = 2e-06	1e-06
times are = 2e-06	2e-06
injected!!!2
nParcels = 2

Cloud: kinematicCloud injector: model1
    Added 2 new parcels

Cloud: kinematicCloud
    Current number of parcels       = 4
    Current mass in system          = 7.1838e-13
    Linear momentum                 = (9.0704e-16 -1.5161e-17 -2.1691e-17)
   |Linear momentum|                = 9.0743e-16
    Linear kinetic energy           = 6.262e-19
    Injector model1:
      - parcels added               = 4
      - mass introduced             = 7.1838e-13
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 17.71 s  ClockTime = 18 s

Courant Number mean: 5.082e-06 max: 0.00029584
Time = 3e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.058207, Final residual = 5.7874e-13, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.079777, Final residual = 7.6951e-13, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.079944, Final residual = 7.3876e-13, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.54321, Final residual = 0.028242, No Iterations 1
time step continuity errors : sum local = 2.151e-08, global = 7.774e-11, cumulative = 2.3366e-09
GAMG:  Solving for p, Initial residual = 0.12556, Final residual = 7.9445e-05, No Iterations 12
time step continuity errors : sum local = 3.1715e-11, global = 4.8023e-12, cumulative = 2.3414e-09
smoothSolver:  Solving for omega, Initial residual = 1.4818e-06, Final residual = 1.4818e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.1876e-06, Final residual = 6.9469e-12, No Iterations 1
bounding k, min: 8.9151e-16 max: 0.00437 average: 1.1794e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  3e-06	3e-06
times are = 3e-06	1e-06
times are = 3e-06	2e-06
times are = 3e-06	3e-06
injected!!!3
nParcels = 2

Cloud: kinematicCloud injector: model1
    Added 2 new parcels

Cloud: kinematicCloud
    Current number of parcels       = 6
    Current mass in system          = 1.0776e-12
    Linear momentum                 = (1.7001e-15 -7.2062e-18 -2.2234e-17)
   |Linear momentum|                = 1.7002e-15
    Linear kinetic energy           = 1.4882e-18
    Injector model1:
      - parcels added               = 6
      - mass introduced             = 1.0776e-12
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 22.87 s  ClockTime = 23 s

Courant Number mean: 5.0722e-06 max: 0.00025577
Time = 4e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.023598, Final residual = 1.4736e-13, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.025595, Final residual = 2.1789e-13, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.025642, Final residual = 2.1164e-13, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.22671, Final residual = 0.012459, No Iterations 1
time step continuity errors : sum local = 3.7373e-09, global = -1.4419e-11, cumulative = 2.327e-09
GAMG:  Solving for p, Initial residual = 0.037161, Final residual = 5.1962e-05, No Iterations 7
time step continuity errors : sum local = 1.2622e-11, global = 1.3907e-12, cumulative = 2.3284e-09
smoothSolver:  Solving for omega, Initial residual = 1.4679e-06, Final residual = 1.4679e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.1997e-06, Final residual = 7.0183e-12, No Iterations 1
bounding k, min: 8.2828e-16 max: 0.00437 average: 1.1794e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  4e-06	4e-06
times are = 4e-06	1e-06
times are = 4e-06	2e-06
times are = 4e-06	3e-06
times are = 4e-06	4e-06
injected!!!4
nParcels = 2

Cloud: kinematicCloud injector: model1
    Added 2 new parcels

Cloud: kinematicCloud
    Current number of parcels       = 8
    Current mass in system          = 1.4368e-12
    Linear momentum                 = (2.7347e-15 -1.6502e-17 -2.4217e-17)
   |Linear momentum|                = 2.7348e-15
    Linear kinetic energy           = 2.9192e-18
    Injector model1:
      - parcels added               = 8
      - mass introduced             = 1.4368e-12
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 27.42 s  ClockTime = 28 s

Courant Number mean: 5.0666e-06 max: 0.00024399
Time = 5e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.014702, Final residual = 7.9554e-14, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.014753, Final residual = 1.1438e-13, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.014788, Final residual = 1.12e-13, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.1035, Final residual = 0.0058512, No Iterations 1
time step continuity errors : sum local = 1.1684e-09, global = -1.2116e-11, cumulative = 2.3163e-09
GAMG:  Solving for p, Initial residual = 0.015401, Final residual = 5.5016e-05, No Iterations 8
time step continuity errors : sum local = 9.8979e-12, global = -1.3963e-12, cumulative = 2.3149e-09
smoothSolver:  Solving for omega, Initial residual = 1.4582e-06, Final residual = 1.4582e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.2094e-06, Final residual = 7.0781e-12, No Iterations 1
bounding k, min: 7.6605e-16 max: 0.00437 average: 1.1795e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  5e-06	5e-06
times are = 5e-06	1e-06
times are = 5e-06	2e-06
times are = 5e-06	3e-06
times are = 5e-06	4e-06
times are = 5e-06	5e-06
times are = 5e-06	6e-06
times are = 5e-06	7e-06
times are = 5e-06	8e-06
times are = 5e-06	9e-06
times are = 5e-06	1e-05
times are = 5e-06	1.1e-05
times are = 5e-06	1.2e-05
times are = 5e-06	1.3e-05
times are = 5e-06	1.4e-05
times are = 5e-06	1.5e-05
times are = 5e-06	1.6e-05
times are = 5e-06	1.7e-05
times are = 5e-06	1.8e-05
Cloud: kinematicCloud
    Current number of parcels       = 8
    Current mass in system          = 1.4368e-12
    Linear momentum                 = (3.6177e-15 -1.9033e-17 -2.6665e-17)
   |Linear momentum|                = 3.6178e-15
    Linear kinetic energy           = 4.8511e-18
    Injector model1:
      - parcels added               = 8
      - mass introduced             = 1.4368e-12
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 31.97 s  ClockTime = 32 s

Courant Number mean: 5.0642e-06 max: 0.00023854
Time = 6e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.010394, Final residual = 5.9842e-14, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.010989, Final residual = 8.252e-14, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.011012, Final residual = 8.1308e-14, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.071461, Final residual = 0.003551, No Iterations 1
time step continuity errors : sum local = 5.5515e-10, global = -8.8436e-12, cumulative = 2.3061e-09
GAMG:  Solving for p, Initial residual = 0.0093249, Final residual = 7.7875e-05, No Iterations 6
time step continuity errors : sum local = 1.1344e-11, global = -1.7405e-12, cumulative = 2.3043e-09
smoothSolver:  Solving for omega, Initial residual = 1.4507e-06, Final residual = 1.4507e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.2175e-06, Final residual = 7.1293e-12, No Iterations 1
bounding k, min: 7.0476e-16 max: 0.00437 average: 1.1795e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  6e-06	6e-06
times are = 6e-06	1e-06
times are = 6e-06	2e-06
times are = 6e-06	3e-06
times are = 6e-06	4e-06
times are = 6e-06	5e-06
times are = 6e-06	6e-06
times are = 6e-06	7e-06
times are = 6e-06	8e-06
times are = 6e-06	9e-06
times are = 6e-06	1e-05
times are = 6e-06	1.1e-05
times are = 6e-06	1.2e-05
times are = 6e-06	1.3e-05
times are = 6e-06	1.4e-05
times are = 6e-06	1.5e-05
times are = 6e-06	1.6e-05
times are = 6e-06	1.7e-05
times are = 6e-06	1.8e-05
Cloud: kinematicCloud
    Current number of parcels       = 8
    Current mass in system          = 1.4368e-12
    Linear momentum                 = (4.496e-15 -2.1861e-17 -2.9104e-17)
   |Linear momentum|                = 4.4962e-15
    Linear kinetic energy           = 7.3152e-18
    Injector model1:
      - parcels added               = 8
      - mass introduced             = 1.4368e-12
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 36.36 s  ClockTime = 37 s

Courant Number mean: 5.0624e-06 max: 0.00023519
Time = 7e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.0082604, Final residual = 4.9367e-14, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.0090454, Final residual = 6.7029e-14, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.009053, Final residual = 6.6453e-14, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.057484, Final residual = 0.0027532, No Iterations 1
time step continuity errors : sum local = 3.6391e-10, global = -6.4179e-12, cumulative = 2.2979e-09
GAMG:  Solving for p, Initial residual = 0.0071272, Final residual = 6.3082e-05, No Iterations 6
time step continuity errors : sum local = 7.8532e-12, global = -1.2076e-12, cumulative = 2.2967e-09
smoothSolver:  Solving for omega, Initial residual = 1.4446e-06, Final residual = 1.4446e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.2244e-06, Final residual = 7.1739e-12, No Iterations 1
bounding k, min: 6.4428e-16 max: 0.00437 average: 1.1795e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  7e-06	7e-06
times are = 7e-06	1e-06
times are = 7e-06	2e-06
times are = 7e-06	3e-06
times are = 7e-06	4e-06
times are = 7e-06	5e-06
times are = 7e-06	6e-06
times are = 7e-06	7e-06
times are = 7e-06	8e-06
times are = 7e-06	9e-06
times are = 7e-06	1e-05
times are = 7e-06	1.1e-05
times are = 7e-06	1.2e-05
times are = 7e-06	1.3e-05
times are = 7e-06	1.4e-05
times are = 7e-06	1.5e-05
times are = 7e-06	1.6e-05
times are = 7e-06	1.7e-05
times are = 7e-06	1.8e-05
Cloud: kinematicCloud
    Current number of parcels       = 8
    Current mass in system          = 1.4368e-12
    Linear momentum                 = (5.3695e-15 -2.4933e-17 -3.1531e-17)
   |Linear momentum|                = 5.3696e-15
    Linear kinetic energy           = 1.0302e-17
    Injector model1:
      - parcels added               = 8
      - mass introduced             = 1.4368e-12
    Parcel fate: system (number, mass)
      - escape                      = 0, 0
    Parcel fate: patch INLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch PART_1 (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0
    Parcel fate: patch OUTLET (number, mass)
      - escape                      = 0, 0
      - stick                       = 0, 0

ExecutionTime = 40.65 s  ClockTime = 41 s

Courant Number mean: 5.0612e-06 max: 0.00023283
Time = 8e-06

PIMPLE: iteration 1
GAMG:  Solving for Ux, Initial residual = 0.0067451, Final residual = 4.2145e-14, No Iterations 1
GAMG:  Solving for Uy, Initial residual = 0.0077274, Final residual = 5.6852e-14, No Iterations 1
GAMG:  Solving for Uz, Initial residual = 0.0077286, Final residual = 5.6416e-14, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.049348, Final residual = 0.0022907, No Iterations 1
time step continuity errors : sum local = 2.6274e-10, global = -3.8918e-12, cumulative = 2.2928e-09
GAMG:  Solving for p, Initial residual = 0.0058192, Final residual = 9.2686e-05, No Iterations 4
time step continuity errors : sum local = 1.0111e-11, global = -1.5107e-12, cumulative = 2.2913e-09
smoothSolver:  Solving for omega, Initial residual = 1.4396e-06, Final residual = 1.4396e-06, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 6.2304e-06, Final residual = 7.2135e-12, No Iterations 1
bounding k, min: -7.831e-12 max: 0.00437 average: 1.1796e-06
Evolving kinematicCloud

Solving 3-D cloud kinematicCloud
inj_time:  8e-06	8e-06
times are = 8e-06	1e-06
times are = 8e-06	2e-06
times are = 8e-06	3e-06
times are = 8e-06	4e-06
times are = 8e-06	5e-06
times are = 8e-06	6e-06
times are = 8e-06	7e-06
times are = 8e-06	8e-06
injected!!!8
nParcels = 2
You can see that at 5e-6, 6e-6, 7e-6, it does not detect that the time in the .dat file is actually the same as the run time and continues to loop through the other rows of the .dat file till it reaches its end. I've also tried multiplying the time by 1e6 so that now I can compare integers. However, that also doesn't seem to work. I'm attaching the injection model, injection .dat file and an example case.
I think the problem lies in the if statement where I'm comparing the times. Possibly, it can also be a case of data type mismatch. This is proving a real roadblock in the work that I'm doing currently. Maybe, its an OpenFOAM bug. I don't know.. The testing.zip file contains the kinematic cloud properties file, the system folder and constant directory. It however does not contain the polyMesh folder or the .msh file due to size constraints that limits the size of the zip file. A simple mesh with boundary zones including INLET, OUTLET and PART_1 can be created to match the zone names that I had while running the case so that no changes to other files would be required. If you choose to run your own mesh, then please change the part names in all the files in the zero folder.
Any help is greatly appreciated. The model has been compiled on OpenFOAM v1706. There are slight changes in the header files that need to be made if you're using OF 3.0 or earlier.
Attached Files
File Type: zip myPatchInjection.zip (8.0 KB, 4 views)
File Type: zip Testing.zip (17.4 KB, 3 views)
Scram_1 is offline   Reply With Quote

Reply

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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 11:46


All times are GMT -4. The time now is 00:51.