|
[Sponsors] |
Trouble updating fields at regular time intervals |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 20, 2024, 06:53 |
Trouble updating fields at regular time intervals
|
#1 |
New Member
YF
Join Date: Sep 2016
Posts: 5
Rep Power: 10 |
I’ve been facing an issue for several weeks related to updating fields at regular time intervals, and I’m hoping for some help.
I am trying to create a droplet or bubble in a specific location at each time interval during a simulation. After researching different approaches, I found two possible solutions: 1. Using the coded function object in system/controlDict. 2. Using the systemCall function object to run a script that executes the setFields command. However, both methods have their challenges, and I have been unable to get either to work. For the coded function object approach, the issue is that while I can access field data (like alpha.water) using the lookupObject function, I’m unable to modify the field values. It seems that these fields are read-only within the coded function. For the systemCall approach, there are conflicts between the ongoing computation and the execution of setFields. Since the job is actively running when the systemCall function is triggered, modifying fields during the computation can lead to conflicts and cause the job to crash. Please could anyone help me? Many thanks in advance!
__________________
Yuan Fang |
|
October 15, 2024, 05:52 |
|
#2 |
New Member
YF
Join Date: Sep 2016
Posts: 5
Rep Power: 10 |
Problem resolved. By combing a bash script with 'timeActivatedFileUpdate' function, we are able to update fields at regular time intervals. Below is the script.
Code:
while (( (echo "$time_start < $time_end" | bc -l) )) do # Step 1: Run setFields in parallel mode mpirun -np $TOTAL_TASKS setFields -parallel > log.setFields_$time_start 2>&1 # Step 2: Run the case from time_start to time_start + time_step # ControlDict will be updated using timeActivatedFileUpdate function mpirun -np $TOTAL_TASKS icoFoam -parallel > log.icoFoam_$time_start 2>&1 # Increment time_start for the next interval time_start=$(echo "$time_start + $time_step" | bc) done
__________________
Yuan Fang |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" | bigphil | OpenFOAM CC Toolkits for Fluid-Structure Interaction | 686 | December 22, 2022 10:10 |
AMI speed performance | danny123 | OpenFOAM | 21 | October 24, 2020 05:13 |
Setting up Lid driven Cavity Benchmark with 1M cells for multiple cores | puneet336 | OpenFOAM Running, Solving & CFD | 11 | April 7, 2019 01:58 |
Floating point exception error | lpz_michele | OpenFOAM Running, Solving & CFD | 53 | October 19, 2015 03:50 |
same geometry,structured and unstructured mesh,different behaviour. | sharonyue | OpenFOAM Running, Solving & CFD | 13 | January 2, 2013 23:40 |