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

Diverging velocities in gas phase with ultrasonic force in interFoam VOF simulation

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2025, 14:45
Default Diverging velocities in gas phase with ultrasonic force in interFoam VOF simulation
  #1
New Member
 
Mohammad Mesgar
Join Date: Jul 2021
Posts: 17
Rep Power: 6
Mohammadmz is on a distinguished road
Hi all,

I’m running an interFoam VOF simulation of laser melting with ultrasonic vibration applied as a coded momentum source. The setup works fine in the liquid metal region, but near the gas phase, the velocity blows up to e+9 – e+11 m/s, causing divergence immediately.

Solver: interFoam
VOF field: alpha.metal
Forcing: volumetric ultrasonic force applied in molten region.
loop:
forAll(C, cellI)
{
scalar y = C[cellI].y();


if (T[cellI] > 1673 && alpha[cellI] >= 0.8 && y >= 0.001 && y <= 0.004)
{
// ---- Smooth activation (tanh-type ramp) ----
scalar Tmid = 0.5 * (1673.0 + 1723.0); // midpoint
scalar dT = 0.25 * (1723.0 - 1673.0); // smoothness range

scalar Tfac = 0.5 * (1.0 + tanh((T[cellI] - Tmid)/dT)); // smooth 0→1


scalar weight = Tfac;

// Optional cutoff for negligible weight
if (weight < 1e-3) continue;


// if (weight <= smallValue) continue; // skip negligible contributions

// Local volumetric force (N/m3)

scalar alphaWeight = 0.5 * (1.0 + tanh((alpha[cellI] - 0.95)/0.02));
//scalar rhoRatio = rho0 / (rho1 + smallValue);
scalar fMix = (alphaWeight * Fmetal_t) + ((1.0 - alphaWeight) * Fgas_t);
scalar fLocal = fMix * weight ;
// scalar rhoLocal = (alpha[cellI]*Fmetal) + ((1.0-alpha[cellI])*Fgas);
vector fPerVol = vector(0,fLocal, 0);

// Convert to total force per cell (N)
vector fCell = fPerVol ;

// Add to equation source (eqn.source expects total force per cell)
eqn.source()[cellI] += fCell;

totalAppliedForce += fCell;
appliedCellCount += 1.0;
count++;
}
}

// -------------------- Info output -------------------- //
Info << "Ultrasonic Force at t = " << t << " s"
<< " : base fVol = " << fVol << " [N/m3]"
<< ", applied to " << count << " cells"
<< ", totalAppliedForce = " << totalAppliedForce << " N"
<< endl;

Any insight or suggestions to avoid unphysical velocities in the argon gas region would be greatly appreciated.

Thanks!
Mohammadmz is offline   Reply With Quote

Reply

Tags
interfoam, openfoam, ultrasonicforce

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
interFoam VOF is loosing fluid wersoe OpenFOAM Running, Solving & CFD 12 June 26, 2013 09:13
Gas dissolution from liquid phase with CFX Roger Young CFX 2 May 6, 2008 08:37
VOF simulation free surface caused by gas inject rensb FLUENT 4 July 20, 2006 05:45
Gas pressure question Dan Moskal Main CFD Forum 0 October 24, 2002 23:02
Moving mesh or VOF? Giovanni Main CFD Forum 16 September 24, 2001 09:25


All times are GMT -4. The time now is 05:59.