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

Problem in using new "fvOptions" called "solidificationMeltingSource"

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 9, 2019, 02:42
Default
  #21
New Member
 
S. Park
Join Date: Aug 2014
Posts: 3
Rep Power: 12
smfamily11 is on a distinguished road
Quote:
Originally Posted by farinha View Post
Hi all,

I've been trying to setup this source term for the buoyantBoussinesqPimple Foam solver.
I'm doing exactly what alexeym is saying here, but the fvOption stops the simulation due to the lack of a volScalarField for Cp.

I wonder if editing the createFields.H file to create a field for Cp would do the trick...

Does anyone know if this source term was coded solely for compressible? I mean, is there a way to set it up without editing the solver or the SMS.C file?

Thanks
Hi. Farinha.

So far, I figured it out the usage of the SMS.C with buoyantBoussinesqPimpleFoam that Cp field defined as 'volScalarField' in 'createFields.H' file, or modify SMS.C.
Perhaps, there is alternative way instead of these, but I couldn't find.
smfamily11 is offline   Reply With Quote

Old   May 17, 2021, 05:45
Default
  #22
Member
 
Join Date: Nov 2020
Posts: 53
Rep Power: 6
mikulo is on a distinguished road
Hey, the alternative is simple, just set

Cp CpRef;

not

CpName CpRef;

this works for OpenFOAM 7..
mikulo is offline   Reply With Quote

Old   June 27, 2024, 05:24
Default not implemented error
  #23
New Member
 
Arunkl
Join Date: Jun 2024
Posts: 7
Rep Power: 2
arunkl is on a distinguished road
I am trying to implement the degassing boundary condition in twophaseEulerFoam with the fvOptions but it gives me not implemented error

i here give the code for fv options please help me debug the code
Using dynamicCode for fvOption::degassingMassSource at line 31 in "/home/arunkl/openFoamFiles/bubbleColumn/constant/fvOptions/degassingMassSource/scalarCodedSourceCoeffs"
Selecting finite volume options type degassingMassSource
Source: degassingMassSource
- selecting all cells
- selected 1875 cell(s) with volume 0.015


--> FOAM FATAL ERROR: (openfoam-2312)
Not implemented

From virtual void Foam::fv::degassingMassSourceFvOptionscalarSource: :addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label)
in file /home/arunkl/openFoamFiles/bubbleColumn/constant/fvOptions/degassingMassSource/scalarCodedSourceCoeffs at line 109.

FOAM aborting

[stack trace]
=============
#1 Foam::error::simpleExit(int, bool) in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so
#2 ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libreactingMultiphaseSystem.so
#3 ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libreactingMultiphaseSystem.so
#4 Foam:haseSystem::correct() in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libreactingMultiphaseSystem.so
#5 ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/lib/libreactingTwoPhaseSystem.so
#6 ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/bin/reactingTwoPhaseEulerFoam
#7 ? in /lib/x86_64-linux-gnu/libc.so.6
#8 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#9 ? in /usr/lib/openfoam/openfoam2312/platforms/linux64GccDPInt32Opt/bin/reactingTwoPhaseEulerFoam
=============
Aborted



Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

degassingMassSource
{
type scalarCodedSource;
active yes;
selectionMode all;

name degassingMassSource;
patches (outlet);
rhoName thermo:rho.air;
alphaName alpha.air;

scalarCodedSourceCoeffs
{
selectionMode all;

fields (thermo:rho.air);

codeInclude
#{
#include "fvm.H"
#};

codeCorrect
#{

#};

codeAddSup
#{
// Get the names of the patches on which to apply the degassing forces
DynamicList<word, 1, 0> patches;
coeffs().lookup("patches") >> patches;

// Get the required fields
const word rhoName = coeffs().lookup("rhoName");
const volScalarField& rhoAir = mesh().lookupObject<volScalarField>(rhoName);
const word alphaName = coeffs().lookup("alphaName");
const volScalarField& alphaAir = mesh().lookupObject<volScalarField>(alphaName);

// Get the timestep
const scalar deltaT = mesh().time().deltaT().value();

// Create degassing mass source coefficient and initialize to zero
volScalarField degassingMassSourceCoeff
(
IOobject
(
"degassingMassSourceCoeff",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimensionedScalar("degassingMassSourceCoeff", dimless/dimTime, 0.0)
);

// Compute the degassing mass source coefficient for each cell adjacent to the selected patches
forAll(patches, iPatch)
{
// Get the boundary patch
const fvPatch& patch = mesh().boundary()[patches[iPatch]];

// Loop through each boundary face and compute degassing force coefficient in adjacent cell
forAll(patch, iFace)
{
label iCell = patch.faceCells()[iFace];
degassingMassSourceCoeff[iCell] = -alphaAir[iCell]/deltaT;
}
}

// Add the degassing force term
eqn += fvm::Sp(degassingMassSourceCoeff, rhoAir);
#};

codeSetValue
#{

#};

// Dummy entry. Make dependent on above to trigger recompilation
code
#{
$codeInclude
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
}

degassingForce
{
type vectorCodedSource;
active yes;
selectionMode all;

name degassingForce;
patches (outlet);
rhoName thermo:rho.air;
alphaName alpha.air;
UName U.air;

vectorCodedSourceCoeffs
{
selectionMode all;

fields (U.air);

codeInclude
#{
#include "fvm.H"
#};

codeCorrect
#{

#};

codeAddSup
#{
// Get the names of the patches on which to apply the degassing forces
DynamicList<word, 1, 0> patches;
coeffs().lookup("patches") >> patches;

// Get the required fields
const word rhoName = coeffs().lookup("rhoName");
const volScalarField& rhoAir = mesh().lookupObject<volScalarField>(rhoName);
const word alphaName = coeffs().lookup("alphaName");
const volScalarField& alphaAir = mesh().lookupObject<volScalarField>(alphaName);
const word UName = coeffs().lookup("UName");
const volVectorField& UAir = mesh().lookupObject<volVectorField>(UName);

// Get the timestep
const scalar deltaT = mesh().time().deltaT().value();

// Create degassing force coefficient and initialize to zero
volScalarField degassingForceCoeff
(
IOobject
(
"degassingForceCoeff",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimensionedScalar("degassingForceCoeff", dimDensity/dimTime, 0.0)
);

// Compute the degassing force coefficient for each cell adjacent to the selected patches
forAll(patches, iPatch)
{
// Get the boundary patch
const fvPatch& patch = mesh().boundary()[patches[iPatch]];

// Loop through each boundary face and compute degassing force coefficient in adjacent cell
forAll(patch, iFace)
{
label iCell = patch.faceCells()[iFace];
degassingForceCoeff[iCell] = -rhoAir[iCell]*alphaAir[iCell]/deltaT;
}
}

// Add the degassing force term
eqn += fvm::Sp(degassingForceCoeff, UAir);
#};

codeSetValue
#{

#};

// Dummy entry. Make dependent on above to trigger recompilation
code
#{
$codeInclude
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
}


// ************************************************** *********************** //
arunkl is offline   Reply With Quote

Old   September 6, 2024, 18:43
Default SolidificationMelting with Shrinkage void
  #24
New Member
 
JANGA RAKESH KUMAR
Join Date: Aug 2024
Posts: 14
Rep Power: 2
Rakesh_Kumar is on a distinguished road
Quote:
Originally Posted by alexj View Post
Hi Baris,

thanks for the hint. You are right, I have forgotten to edit the T.eqn. Darn my mistake. Now the solver runs. But of course as there is not really a thermo object in the compressibleInterFoam, similar to buoyantBoussinesqPimpleFoam, I have to set up my fvOptions to use the thermoMode "lookup" as you have been doing all along up in post #7 and which has been pointed out above in post #2 by Alexey as well.

Now my solver works. Here are the modifications for reference.

UEqn.H:
Code:
    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U)
      + fvm::div(rhoPhi, U)
      + turbulence->divDevRhoReff(U)
     ==
        fvOptions(rho, U)
    );

    UEqn.relax();

    fvOptions.constrain(UEqn);

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
         ==
            fvc::reconstruct
            (
                (
                    interface.surfaceTensionForce()
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                ) * mesh.magSf()
            )
        );

        fvOptions.correct(U);
    
        K = 0.5*magSqr(U);
    }
TEqn.H:
Code:
{
    fvScalarMatrix TEqn
    (
        fvm::ddt(rho, T)
      + fvm::div(rhoPhi, T)
      - fvm::laplacian(mixture.alphaEff(turbulence->mut()), T)
      + (
            fvc::div(fvc::absolute(phi, U), p)
          + fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
        )
       *(
           alpha1/mixture.thermo1().Cv()
         + alpha2/mixture.thermo2().Cv()
        )
      ==
        fvOptions(rho, T)
    );

    TEqn.relax();
    fvOptions.constrain(TEqn);
    TEqn.solve();

    mixture.correct();
    
    fvOptions.correct(T);

    Info<< "min(T) " << min(T).value() << endl;
}
Make/options:
Code:
EXE_INC = \
    -ItwoPhaseMixtureThermo \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/fvOptions/lnInclude

EXE_LIBS = \
    -ltwoPhaseMixtureThermo \
    -lcompressibleTransportModels \
    -lfluidThermophysicalModels \
    -lspecie \
    -ltwoPhaseMixture \
    -ltwoPhaseProperties \
    -linterfaceProperties \
    -lturbulenceModels \
    -lcompressibleTurbulenceModels \
    -lfiniteVolume \
    -lmeshTools \
    -lfvOptions
Make/files:
Code:
myCompressibleInterFoam.C

EXE = $(FOAM_USER_APPBIN)/myCompressibleInterFoam
as you can see I called my version creatively "myCompressibleInterFoam" and place it in the USER APPBIN.

Here is my working, but not physically very correct fvOptions file:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ice1
    {
        type            solidificationMeltingSource;
        active          yes;

        solidificationMeltingSourceCoeffs
        {
            selectionMode   cellZone;
            cellZone        ice;
            Tmelt           273.15;
            L               334000;
            thermoMode      lookup;
            beta            207e-6;
            rhoRef          913;
            Cu              1.0e+05;
            q               1.0e-06;
            CpName          CpRef;
            CpRef           4195.0;
        }
    }
}

// ************************************************************************* //
I hope that is useful for others who try to go along the same route. Now I will work on an example case and place it on the forum as well (http://www.cfd-online.com/Forums/ope...ingsource.html)

Again, thanks for your input Baris,

best regards,
Alex

Hello Alex and Foamers,
Currently, I working on solidification and need to capture the shrinkage using VoF method. I think, this CompressibleInterFoam coupled with this solidification melting fv option works well. Is anyone able to this problem?? If you have model solver with testcase, please share it here. It will be very helpful to me.


Thanks in advance.
-Rakesh

Last edited by Rakesh_Kumar; September 7, 2024 at 17:40. Reason: spelling error
Rakesh_Kumar is offline   Reply With Quote

Reply

Tags
fvoptions


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
[Other] engineFoam new mesh problem ayhan515 OpenFOAM Meshing & Mesh Conversion 5 August 10, 2015 09:45
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 05:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 06:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13


All times are GMT -4. The time now is 16:06.