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

Tutorial/functional case for solidificationMeltingSource

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

Like Tree31Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 17, 2016, 09:55
Default Tutorial/functional case for solidificationMeltingSource
  #1
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Dear OpenFoamers,

I want to start simulating the melting of a solid wall bounding a flow. Ultimately the flow will be turbulent and transport heat towards the wall, which will result in the phase change. To get me started I have been looking for a tutorial case that uses the fvoption "solidificationMeltingSource" but so far I only found this thread:

http://www.cfd-online.com/Forums/ope...ingsource.html

which modifies the compressibleInterFoam solver to use the "solidificationMeltingSource".

If somebody has a working example case using "solidificationMeltingSource" that would be of great help to get me started. Else I guess I have to start by modifying the compressibleInterFoam case for myself, but I would prefer a working example to start with.

Thanks in advance

Alex
AnzarMark1 likes this.
alexj is offline   Reply With Quote

Old   February 18, 2016, 10:14
Default
  #2
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
@Baris:

I am new to using the "solidificationMeltingSource" within OpenFoam (not new to OpenFoam as such) and have asked recently in another part of the forum for a workable test case (http://www.cfd-online.com/Forums/ope...ingsource.html).

I was wondering if you would be interested in putting together some information on how to use that feature. So far I have the following list of questions which people like me ask when they get started:
  1. Is "compressibleInterFoam" the solver to start with or is there a better introduction solver to the melting concept? Obviously this depends on the application, but I guess a fairly generic assumption would be that people want to simulate solid/fluid mixture and phase changes therein.
  2. How is the solid phase represented. The source code of "solidificationMeltingSource" hints towards a porous solid in the fluid. Is this best done with topoSet? Where are examples for doing this?
Any help at this point would be highly appreciated as I have a hard time compiling information to get started.


Thanks in advance,
Alex

[Moderator note: Moved from here: http://www.cfd-online.com/Forums/ope...ingsource.html]

Last edited by wyldckat; February 21, 2016 at 14:50. Reason: see "Moderator note:"
alexj is offline   Reply With Quote

Old   February 20, 2016, 04:42
Default
  #3
Senior Member
 
Baris (Heewa)
Join Date: Jan 2013
Location: Japan
Posts: 130
Rep Power: 13
shipman is on a distinguished road
Hi Alex,

Truely speaking, when I decided to use this solidification fvOption, I have also searched a lot to find any previous application or example. However, I could not find. Then, what I did is that as you mentioned above I have modified the compressibleInterFoam and I thought that solid phase is included inside liquid alpha (I have defined one more volume fraction for solid) and when the Temp is lower/upper than melting point set to use this option for both melting/solidification among only solid and liquid phases. Since I used nitrogen as fluid, under some special conditions also there can be seen direct solidification from nitrogen gas to Nitrogen solid which was ignored in my case.

Hope these hints give you some idea.

BR.

Baris
shipman is offline   Reply With Quote

Old   February 22, 2016, 04:45
Default
  #4
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi Baris,

thanks for the answer, this helps along the way. I am currently working on implementing a demo case with a buoyantPimpleFoam solver. When I have a working demo case set up, I will post it here along with some info.

In the meantime, everybody is of course welcome and invited to contribute.

Best regards,
Alex
alexj is offline   Reply With Quote

Old   February 22, 2016, 10:12
Default
  #5
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi Baris,

would you mind posting the TEqn.H modification you did in compressibleInterFoam to get the fvOptions working? I also want to try your approach but struggle to get the modified compressibleInterFoam working.

Best regards,
Alex
alexj is offline   Reply With Quote

Old   February 23, 2016, 19:17
Default
  #6
Senior Member
 
Baris (Heewa)
Join Date: Jan 2013
Location: Japan
Posts: 130
Rep Power: 13
shipman is on a distinguished road
Hi Alex,

I checked the code of the buoyantPimpleFoam Solver of OF v3.0.x. Since it already has been using fvOptions for both U and T equations, you dont need to make any modificiation. You can use directly.

BR

Baris
shipman is offline   Reply With Quote

Old   February 24, 2016, 05:43
Default
  #7
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi Baris,

you are right, I can use the buoyantPimpleFoam Solver right away. I am still working on that example case. Thanks for the input.

I will report back as soon as I have a fully working example going.

BR
Alex
tom_flint2012 likes this.
alexj is offline   Reply With Quote

Old   February 25, 2016, 08:54
Smile functional Demo case done
  #8
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi phase-change Foamers,

I have completed a demo case for the solidificationMeltingSource function in OpenFOAM 3.0.x. Attached is the case file. I use the buoyantPimpleFoam solver and set up a case where gallium is melted, similar to this post:
http://www.cfd-online.com/Forums/ope...tml#post329995

You can also head over to vimeo and check a video of the simulation:


Hope this is useful for people starting on phase change models.

Best regards,
Alex
Attached Files
File Type: gz galliumMeltBuoyantPimpleFoam.tar.gz (4.0 KB, 788 views)
alexj is offline   Reply With Quote

Old   February 26, 2016, 14:12
Default
  #9
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 21
zfaraday will become famous soon enough
Hi Alex,

Many thanks for your contribution! I have been thinking of study this fvOption for a while but I haven't had the time nor the need by now... Now it will be easier to start thanks to your test case!

Btw, could you provide an Allrun script in order to ease and automate the process for the beginners? I say so because I saw your case needs to run setFields and it may cause some confusion...

Best regards and many thanks again,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   February 27, 2016, 09:46
Default
  #10
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi Alex,

Thanks for the hint on the Allrun script and glad to hear you find the test case useful.

I think it's always the easiest way to understand a setup when one can study a test case which works.

I am out of town the next few weeks and have no access to my computer, but when I return I will update the test case to include a fully functional "Allrun" and "Allclean" script.

Best regards
Alex
alexj is offline   Reply With Quote

Old   March 16, 2016, 08:47
Default
  #11
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Hi all,

I have added the 'Allrun' and 'Allclean' scripts to the gallium melting demo. Also I have removed the currently not needed 'decomposeParDict' and 'setFieldsDict' files. They were left overs from another attempt of setting up the demo.

This demo defines all BCs directly in the 0/ folder and does actually not require to run 'setFields'. However for convenience I have added the run and clean script to be certain people know instantly how to run the demo.

Cheers,
Alex
Attached Files
File Type: gz galliumMeltBuoyantPimpleFoam_v1.tar.gz (3.1 KB, 576 views)
alexj is offline   Reply With Quote

Old   August 11, 2016, 09:30
Default
  #12
New Member
 
Neil Sanut
Join Date: Mar 2011
Posts: 6
Rep Power: 15
neilpaulx is on a distinguished road
Hi Alex,

Many thanks for the sample.

I tried running your shared files as is in OF ver 3.x. It runs fine except that it won't generate aMS1_alpha1 in the succeeding time step results. Any idea what went wrong?

Thanks,
Neil
neilpaulx is offline   Reply With Quote

Old   September 14, 2016, 15:31
Default
  #13
Member
 
Alex Jarosch
Join Date: Dec 2015
Location: Austria
Posts: 32
Rep Power: 10
alexj is on a distinguished road
Quote:
Originally Posted by neilpaulx View Post
Hi Alex,

Many thanks for the sample.

I tried running your shared files as is in OF ver 3.x. It runs fine except that it won't generate aMS1_alpha1 in the succeeding time step results. Any idea what went wrong?

Thanks,
Neil
Hi Neil,

the demo has been tested on OF 3.0.0 and worked fine. It also works perfectly on OF 4.0.0, I just tested it.

Could you maybe give more info on what is wrong in your case. Do you get an error message?

Cheers,
Alex
alexj is offline   Reply With Quote

Old   November 22, 2016, 08:39
Default
  #14
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Dear Alexj,

Thanks for the case file.

I was interested to calculate global liquid fraction. sum(alpha1*vol)/sum(vol)
I tried to do it with adding a function to controldic
Quote:
functions
(
GFl
{
type swakExpression;
valueType cellZone;
zoneName solid; // or whatever is your zoneName
accumulations (
min
);
expression "sum(mag(alpha1)*vol())/sum(vol())";
verbose true;
}
);
As "alpha1" is not a IOobject for buoyantPimpleFoam (it is defined in src/....../solidificationMeltingSource....), the swak4Foam utility the function in controlDict gives error.

Any ideas for getting global fluid/solid fraction per time step.

please help
cfd@kgp is offline   Reply With Quote

Old   November 24, 2016, 07:18
Default solidification gallium
  #15
New Member
 
diwakar
Join Date: Sep 2016
Posts: 11
Rep Power: 9
janghel is on a distinguished road
Dear alex,
I am using your solver for metling of gallium but i am getting an error. i have copy pasted the error. can you give me some solutions.
Selecting finite volume options model type solidificationMeltingSource
Source: sMS1
- selecting cells using cellZone solid
- selected 7200 cell(s) with volume 7.2e-06

Starting time loop

Courant Number mean: 0 max: 0
deltaT = 1
Time = 1

PIMPLE: iteration 1


--> FOAM FATAL ERROR:

request for volScalarField Cp from objectRegistry region0 failed
available objects of type volScalarField are

3
(
nu
sMS1:alpha1
p
)


From function const Type& Foam:bjectRegistry::lookupObject(const Foam::word&) const [with Type = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]
in file /home/ubuntu/OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 193.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam:bjectRegistry::lookupObject<Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const at ??:?
#3 Foam::fv::solidificationMeltingSource::Cp() const at ??:?
#4 Foam::fv::solidificationMeltingSource::addSup(Foam ::fvMatrix<Foam::Vector<double> >&, int) at ??:?
#5 ? at ??:?
#6 ? at ??:?
#7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#8 ? at ??:?
Aborted (core dumped)
janghel is offline   Reply With Quote

Old   January 30, 2017, 08:48
Unhappy Modifying solidificationMeltingSource for Mushy problems
  #16
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Quote:
Originally Posted by alexj View Post
Hi phase-change Foamers,

I have completed a demo case for the solidificationMeltingSource function in OpenFOAM 3.0.x. Attached is the case file. I use the buoyantPimpleFoam solver and set up a case where gallium is melted, similar to this post:
http://www.cfd-online.com/Forums/ope...tml#post329995

You can also head over to vimeo and check a video of the simulation:


Hope this is useful for people starting on phase change models.

Best regards,
Alex
Hi Alex and all members on this Thread,

I was trying to modify the solidificationMeltingSource (Isothermal ohase change source) for the mushy ploblems.

I was successful till defining the liquid fraction using Tsolidus and Tliquidus.

But some how I am unable to get the "Phi field" in order to add the term " fvc::div(phi, alpha1_))" in solidificationMeltingSourceTemplates.C.

Code:
\*---------------------------------------------------------------------------*/

#include "fvMatrices.H"
#include "fvcDdt.H"
#include "fvcDiv.H"


// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //

template<class RhoFieldType>
void Foam::fv::mushysolidificationMeltingSource::apply
(

    const RhoFieldType& rho,
    fvMatrix<scalar>& eqn
)
{
    if (debug)
    {
        Info<< type() << ": applying source to " << eqn.psi().name() << endl;
    }

    const volScalarField Cp(this->Cp());

    update(Cp);

    dimensionedScalar L("L", dimEnergy/dimMass, L_);

    // contributions added to rhs of solver equation
    if (eqn.psi().dimensions() == dimTemperature)
    {
        // isothermal phase change - only include time derivative
         eqn -= L/Cp*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_)); //mushy phase change  
      //  eqn -= L/Cp*(fvc::ddt(rho, alpha1_));
    }
    else
    {
        // isothermal phase change - only include time derivative
         eqn -= L*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_)); //mushy phase change  
       // eqn -= L*(fvc::ddt(rho, alpha1_));
    }
}


// ************************************************************************* //
My compilation error is as given below,

Code:
In file included from sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSource.H:269:0,
                 from sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSource.C:26:
sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSourceTemplates.C: In member function ‘void Foam::fv::mushysolidificationMeltingSource::apply(const RhoFieldType&, Foam::fvMatrix<double>&)’:
sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSourceTemplates.C:56:57: error: ‘phi’ was not declared in this scope
          eqn -= L/Cp*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_)); //mushy phase change  
                                                         ^
sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSourceTemplates.C:62:54: error: ‘phi’ was not declared in this scope
          eqn -= L*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_)); //mushy phase change  
                                                      ^
sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSource.C: In member function ‘void Foam::fv::mushysolidificationMeltingSource::update(const volScalarField&)’:
sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSource.C:170:16: warning: unused variable ‘Cpc’ [-Wunused-variable]
         scalar Cpc = Cp[cellI];
                ^
make: *** [Make/linuxGccDPInt32Opt/sources/derived/mushysolidificationMeltingSource/mushysolidificationMeltingSource.o] Error 1
I have included the header file for the divergence term fvcDiv.H. should I include any other header file?

Thanks in advance.
kindly help
cfd@kgp is offline   Reply With Quote

Old   May 14, 2017, 12:16
Default do we have any reference for defination of fluid fraction-- Cpc*(Tc - Tmelt_)/L_?
  #17
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 11
cfd@kgp is on a distinguished road
Quote:
Originally Posted by alexj View Post
Hi all,

I have added the 'Allrun' and 'Allclean' scripts to the gallium melting demo. Also I have removed the currently not needed 'decomposeParDict' and 'setFieldsDict' files. They were left overs from another attempt of setting up the demo.

This demo defines all BCs directly in the 0/ folder and does actually not require to run 'setFields'. However for convenience I have added the run and clean script to be certain people know instantly how to run the demo.

Cheers,
Alex
Hi Alex and all phase-change foamers,

The solidification and melting sources (in OF 3.0 and 4.x ) gives accurate transient results. I have checked both the transient meltfront evolution and the time evolution of Nusselt numbers for melting.

However, the definition of fluid fraction do not seems to convince me, especially values of fluid fraction cannot be correlated with the temperature,
Quote:

forAll(cells_, i)
{
label cellI = cells_[i];

scalar Tc = T[cellI];
scalar Cpc = Cp[cellI];
scalar alpha1New = alpha1_[cellI] + relax_*Cpc*(Tc - Tmelt_)/L_;

alpha1_[cellI] = max(0, min(alpha1New, 1));
deltaT_[i] = Tc - Tmelt_;
}
can any body explain me the rationale of this fluid fraction defination---> Cpc*(Tc - Tmelt_)/L_;

Any Research paper with this definition?

Thanks in advance!
cfd@kgp is offline   Reply With Quote

Old   September 19, 2017, 15:19
Default Rationale
  #18
Member
 
Tarang
Join Date: Feb 2011
Location: Delhi, India
Posts: 47
Rep Power: 15
gtarang is on a distinguished road
Quote:
Originally Posted by cfd@kgp View Post
Hi Alex and all phase-change foamers,

The solidification and melting sources (in OF 3.0 and 4.x ) gives accurate transient results. I have checked both the transient meltfront evolution and the time evolution of Nusselt numbers for melting.

However, the definition of fluid fraction do not seems to convince me, especially values of fluid fraction cannot be correlated with the temperature,


can any body explain me the rationale of this fluid fraction defination---> Cpc*(Tc - Tmelt_)/L_;

Any Research paper with this definition?

Thanks in advance!
Hi,
I have answered your question melting problem: looking for appropriate solvers
-
Tarang
Zhiheng Wang likes this.
gtarang is offline   Reply With Quote

Old   September 19, 2017, 15:39
Default Using solidification/melting source in OF 4.1
  #19
Member
 
Tarang
Join Date: Feb 2011
Location: Delhi, India
Posts: 47
Rep Power: 15
gtarang is on a distinguished road
Hi,
I have been using solidificationMeltingSource as prescribed by you. Other than simple problems the solver fails and typically gives floating point exception error and runs for CFL no 0.1 or less for fine meshes.
I dug into the code and found that energy equation needs to be solved multiple times to actually correct the step function of liquid fraction as can be seen from the algorithm of Voller and Prakash (1987) http://dx.doi.org/10.1016/0017-9310(87)90317-6. I tried doing it by putting nEnergyCorrectors in PIMPLE dictionary and solving the energy equation n times. While I was debugging the code, I found this in solidificationMeltingSource.C line no 145.

Code:
if (curTimeIndex_ == mesh_.time().timeIndex())
    {
        return;
    }
Now according to my understanding, the above code ensures that the liquid fraction is updated only once and found it also. Can anyone suggest what can be the consequences of removing above bit of code.

Thanks
-
Tarang
Zhiheng Wang likes this.
gtarang is offline   Reply With Quote

Old   March 20, 2018, 07:05
Default alpha1 not printing in timesteps
  #20
New Member
 
bobby
Join Date: Jul 2017
Posts: 8
Rep Power: 8
rahul62 is on a distinguished road
Hi,
I am running the case (solidificationMeltingSource) in of4 but i am not getting alpha1 printed. Can anyone help me with this?
rahul62 is offline   Reply With Quote

Reply

Tags
melting, phase change

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
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 14:53
MRFSimpleFoam wind turbine case diverges ysh1227 OpenFOAM Running, Solving & CFD 2 May 7, 2015 10:13
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36
Transient case running with a super computer microfin FLUENT 0 March 31, 2009 11:20
Turbulent Flat Plate Validation Case Jonas Larsson Main CFD Forum 0 April 2, 2004 10:25


All times are GMT -4. The time now is 04:31.