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

Issue: setFields in Multi-World OpenFOAM Simulation

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2025, 16:13
Question Issue: setFields in Multi-World OpenFOAM Simulation
  #1
New Member
 
Matthias Lang
Join Date: Jun 2023
Location: Munich, Germany
Posts: 8
Rep Power: 3
Lang is on a distinguished road
Hi everyone,
I'm running a multi-region case in OpenFOAM using multi-world coupling to simulate a specialized casting process for a science project. My setup includes:
  • A custom solver for the physics of continuous metal casting.
  • laplacianFoam for the temperature field inside the mold.
I use setFields to:
  • Initialize the diffusivity field (DT) in the mold (to model different solid materials).
  • Properly initialize the casting process.
Issue:

When executing setFields and running both regions as a multi-world case, the initialized fields do not persist. So on t=0 the fields are not initialized as I specified. However, everything works as expected when running the regions separately. I'm unsure what I might be overlooking.


Has anyone encountered a similar issue before or found a better approach to initializing fields in multi-world cases? Any insights would be greatly appreciated!
I've attached my case files and log files for reference. Notably, log.setFieldsMould.txt indicates that the first selection is empty. This also happens without coupling, and I haven't been able to determine the cause. I suspect it's something simple, but it may not be related to the main issue.
Multi-World Documentation:

I set up the case by copying the tutorial:
/usr/lib/openfoam/openfoam2312/tutorials/basic/laplacianFoam/multiWorld1


Thanks in advance!
Attached Files
File Type: txt log.setFieldsStrand.txt (1.5 KB, 1 views)
File Type: txt log.setFieldsMould.txt (1.7 KB, 1 views)
File Type: zip 2DmultiWorld.zip (115.0 KB, 2 views)
Lang is offline   Reply With Quote

Old   March 18, 2025, 12:55
Default Solution
  #2
New Member
 
Matthias Lang
Join Date: Jun 2023
Location: Munich, Germany
Posts: 8
Rep Power: 3
Lang is on a distinguished road
In the top-level Allrun.pre script, restore0Dir is called after executing the bottom-level Allrun.pre script. This overwrites the setFields results.

Code:
  0 #!/bin/sh
  1 cd "${0%/*}" || exit                                # Run from this directory
  2 . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
  3 #------------------------------------------------------------------------------
  4 
  5 # Create meshes and initial fields
  6 for subcase in $(./list-worlds)
  7 do
  8 (
  9     cd "$subcase" || exit
 10     echo "case=$subcase"
 11     if [ -x ./Allrun.pre ]
 12     then
 13         ./Allrun.pre
 14     else
 15         runApplication blockMesh
 16     fi
 17 #    restore0Dir
 18     echo
 19 )
 20 done
 21 
 22 #------------------------------------------------------------------------------

Just in case anyone runs into the same issue when copying the tutorial files.
Lang is offline   Reply With Quote

Reply

Tags
multi domain, setfields

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
Issues running LES simulation on custom geometry in OpenFOAM v12 CarlosMH OpenFOAM Running, Solving & CFD 0 November 2, 2024 11:14
OpenFOAM v2312 - Compressible Steady case - rhoSimpleFoam issue CFD_SG_01 OpenFOAM Running, Solving & CFD 3 August 26, 2024 09:53
How to keep an initial field created by setFields during the simulation rafaelgabler OpenFOAM Programming & Development 6 February 21, 2024 13:13
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 15:24
OpenFoam Airfoil simulation - replacing Fluent with OpenFOAM shereez234 OpenFOAM Running, Solving & CFD 1 November 3, 2015 04:54


All times are GMT -4. The time now is 01:47.