|
[Sponsors] |
May 8, 2020, 19:27 |
timeActivatedFileUpdate
|
#1 |
Member
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6 |
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. |
|
May 8, 2020, 23:34 |
Hello all! Please help me!
|
#2 |
Member
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6 |
Hello all! Please help me!
|
|
May 9, 2020, 19:36 |
|
#3 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Perhaps you need to add this to the files dynamicMeshDict, dynamicMeshDict_1, and dynamicMeshDict_2?
Code:
runTimeModifiable true; |
|
May 9, 2020, 20:10 |
|
#4 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
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.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
May 10, 2020, 18:06 |
|
#5 | |
Member
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6 |
Quote:
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! |
||
May 10, 2020, 19:07 |
|
#6 | |
Member
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6 |
Quote:
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 |
||
May 11, 2020, 18:57 |
|
#7 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
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.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
May 12, 2020, 00:59 |
|
#8 | |
Member
WY
Join Date: Mar 2020
Posts: 36
Rep Power: 6 |
Quote:
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 Last edited by WUYing; May 12, 2020 at 10:31. |
||
Tags |
controldict, dynamicmeshdict, timeactivatedfileupdate |
|
|