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

timeActivatedFileUpdate

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2020, 19:27
Default timeActivatedFileUpdate
  #1
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Hello, I try to use the functionObject "timeActivatedFileUpdate" to change stiffness of linearSpring (set in constant/dynamicMeshDict file) during the calculation.
For example, t<200, use dynamicMeshDict_1;
t>200, use dynamicMeshDict_2.
dynamicMeshDict_1 and dynamicMeshDict_2 are the same except the value of stiffness.

I checked the output log file and found that the calculation used dynamicMeshDict_1 from time = 0.005 to time = 200, and the dynamicMeshDict file has been replaced by dynamicMeshDict_2 at time = 200.005. But the results showed nothing different, which means the two different stiffnesses is in fact invalid during the calculation.

Another thing is that if I force the running to stop at time = 200 and reset the stiffness parameter and then continue the calculation, the results would be different.

I don't know why the timeActivatedFileUpdate is invalid. Could anyone can help me? Thanks!!! I have attached my controlDict file two dynamicMeshDict files.
Attached Files
File Type: zip files.zip (3.7 KB, 21 views)
WUYing is offline   Reply With Quote

Old   May 8, 2020, 23:34
Unhappy Hello all! Please help me!
  #2
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Hello all! Please help me!
WUYing is offline   Reply With Quote

Old   May 9, 2020, 19:36
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16
adhiraj is on a distinguished road
Perhaps you need to add this to the files dynamicMeshDict, dynamicMeshDict_1, and dynamicMeshDict_2?

Code:
runTimeModifiable true;
adhiraj is offline   Reply With Quote

Old   May 9, 2020, 20:10
Default
  #4
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

In addition to adhiraj's remarks.

>> I checked the output log file and found that the calculation used dynamicMeshDict_1 from time = 0.005 to time = 200, and the dynamicMeshDict file has been replaced by dynamicMeshDict_2 at time = 200.005.

- So, can we assume "timeActivatedFileUpdate" function object operates as instructed? I think, if there is a problem, the problem is not with this FO.

>> But the results showed nothing different, which means the two different stiffnesses is in fact invalid during the calculation.

- Could you please tell what results did you monitor? Were they the same elementwise? In which way the results in question should differ if we change "stiffness"? Would it be possible that changing "stiffness" value is not really effective on your simulation?

>> Another thing is that if I force the running to stop at time = 200 and reset the stiffness parameter and then continue the calculation, the results would be different.

- Oftentimes, perfect restart of a simulation is not possible, and tiny bits of numerical errors are introduced into the domain. But these almost always do not affect the statistical results of interest.
- Could you elaborate which results are different when you restart the simulation?
- I have checked whether "stiffness" entry is read when the dictionary is changed, and the answer is yes. So whenever, this entry is different in comparison to its previous state, it will use the new "stiffness" value: read() function in linearSpring.C.
HPE is offline   Reply With Quote

Old   May 10, 2020, 18:06
Default
  #5
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Quote:
Originally Posted by HPE View Post
Hi,

In addition to adhiraj's remarks.

>> I checked the output log file and found that the calculation used dynamicMeshDict_1 from time = 0.005 to time = 200, and the dynamicMeshDict file has been replaced by dynamicMeshDict_2 at time = 200.005.

- So, can we assume "timeActivatedFileUpdate" function object operates as instructed? I think, if there is a problem, the problem is not with this FO.

>> But the results showed nothing different, which means the two different stiffnesses is in fact invalid during the calculation.

- Could you please tell what results did you monitor? Were they the same elementwise? In which way the results in question should differ if we change "stiffness"? Would it be possible that changing "stiffness" value is not really effective on your simulation?

>> Another thing is that if I force the running to stop at time = 200 and reset the stiffness parameter and then continue the calculation, the results would be different.

- Oftentimes, perfect restart of a simulation is not possible, and tiny bits of numerical errors are introduced into the domain. But these almost always do not affect the statistical results of interest.
- Could you elaborate which results are different when you restart the simulation?
- I have checked whether "stiffness" entry is read when the dictionary is changed, and the answer is yes. So whenever, this entry is different in comparison to its previous state, it will use the new "stiffness" value: read() function in linearSpring.C.
Hi HPE,

Many thanks for your detailed reply! Sorry about the unclear description before, I would redescribed my problem according to your comments:
(1) according to the output, the "timeActivatedFileUpdate" functionObject operated as instructed, so I agree with you that the relevant settings about "timeActivatedFileUpdate" have no problems.
(2) My 2D case is the vortex induced vibration of a cylinder, so I monitor the vibration amplitude A of the cylinder, which changes with the spring stiffness. For example, if the stiffness changes at time = 200, A should first have a sudden change at that time and then gradually show a periodic trend.
(3) I can show you how the results can be changed by using the figure 1. The stiffness is changed at around time = 200 and time = 400 (two red circles), and the amplitude is suddenly changed and then shows a stable vibration. I obtained this figure by interrupting the running and manually adjusting only the stiffness (other parameters remain the same). As you can see, the amplitude curves are obviously different in different time period, which means the stiffness has an effect on A.
(4) If I use "timeActivatedFileUpdate" functionObject to let the code use different stiffnesses in different time period, the amplitude curves won't change once it reaches a stable vibration, although output file shows that the new stiffness has been used in the code.

Many people have said that "timeActivatedFileUpdate" functionObject can be used to realize different wirteInterval (using multiple controlDict files) during the calculation. But I failed in using this method to change parameters in dynamicMeshDict. I am very confused about that.

I found a thread having very similar problem with me (runTimeModifiable true; not working). Maybe it is the problem that the runTimeModifiable did not work?

Thanks!
Attached Images
File Type: jpg 1.jpg (112.7 KB, 9 views)
WUYing is offline   Reply With Quote

Old   May 10, 2020, 19:07
Default
  #6
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
Perhaps you need to add this to the files dynamicMeshDict, dynamicMeshDict_1, and dynamicMeshDict_2?

Code:
runTimeModifiable true;
Hi admiral,

Thanks for your reply! I thought the "runTimeModifiable true;" can only be included in controlDict. Can I just add this line to dynamicMeshDict files? If possible, could you give me an example?

And like I said, the code would use different dynamicMeshDict files in specified time points, but I found only the results corresponding to the last dynamicMeshDict file would be shown. In my case, although the code uses dynamicMeshDict_1 for time = 0-200 and dynamicMeshDict_2 for time = 200.005 - 400, but only the results for dynamicMeshDict_2 would be shown for time = 0-400.

Thanks!
Ying
WUYing is offline   Reply With Quote

Old   May 11, 2020, 18:57
Default
  #7
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Hi,

- Trying to write through my phone, so low quality answer for now.
- Could you please set a very stupid number (e.g. very high value) to the "stiffness" entry in the second dynamicMeshDict, to see if the result is not really affected? (I hope you have a small test case to try various settings quickly).
- I have never heard or seen an example in which you can use "runTimeModifiable" within dynamicMeshDict. I think `admiral` indicated the `controlDict` entry only, which makes sense. Yet `runtimeModifiable=true` there already.
HPE is offline   Reply With Quote

Old   May 12, 2020, 00:59
Default
  #8
Member
 
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6
WUYing is on a distinguished road
Quote:
Originally Posted by HPE View Post
Hi,

- Trying to write through my phone, so low quality answer for now.
- Could you please set a very stupid number (e.g. very high value) to the "stiffness" entry in the second dynamicMeshDict, to see if the result is not really affected? (I hope you have a small test case to try various settings quickly).
- I have never heard or seen an example in which you can use "runTimeModifiable" within dynamicMeshDict. I think `admiral` indicated the `controlDict` entry only, which makes sense. Yet `runtimeModifiable=true` there already.
Hi HPE,

Many thanks for your quick reply!

In fact, I have carried out test cases like you said by setting two very different stiffnesses (k1=10.0 for time<250, k2=4.4 for time>250).
I used three methods:
(1) run with k1 -> interrupt -> change stiffness to k2 at time=250 -> continue to run. From Fig.1, the stiffness has an effect on amplitude, with Amax=0.015 for k1 and Amax=0.6 for k2.
(2) run with k1 - change stiffness to k2 at time=250 (correct dynamicMeshDict when code is running). From Fig.2, only results corresponding to k1 are obtained, which means the code read dynamiceMeshDict before the time loop and won't read this file before every time step.
(3) use "timeActivatedFileUpdate" and do not make any corrections during the calculation. As shown in Fig.6, the code reads two dynamicMeshDict files before the calculation, copies dynamicMeshDict_1 to dynamicMeshDict for time<250 and copies dynamicMeshDict_2 to dynamicMeshDict at time=250.005. However, it seems that only vibration for k2 are shown (see Fig.3), but with a later onset of about time=130 comparing with the pure k2 case (time=0, see Fig.4). I don't understand why there is no k1 results for time<250 when using dynamiceMeshDict_1 in the code.

Did I make some wrong settings in functionObjects of controlDict:
fileUpdate
{
type timeActivatedFileUpdate;
libs ("libutilityFunctionObjects.so");
writeControl timeStep;
writeInterval 1;
fileToUpdate "constant/dynamicMeshDict";
timeVsFile
(
(-1 "constant/dynamicMeshDict_1")
(250 "constant/dynamicMeshDict_2")
);
}

Many many thanks for your help!

Ying
Attached Images
File Type: png Fig.1.png (64.1 KB, 3 views)
File Type: png Fig.2.png (120.2 KB, 1 views)
File Type: png Fig.3.png (151.9 KB, 2 views)
File Type: png Fig.4.png (180.2 KB, 1 views)
File Type: jpg Fig.6.jpg (177.1 KB, 6 views)

Last edited by WUYing; May 12, 2020 at 10:31.
WUYing is offline   Reply With Quote

Reply

Tags
controldict, dynamicmeshdict, timeactivatedfileupdate


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



All times are GMT -4. The time now is 08:24.