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

Moving Heat Source on a CV

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ahmmedshakil

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 2, 2013, 13:57
Default Moving Heat Source on a CV
  #1
New Member
 
Join Date: Jul 2013
Posts: 4
Rep Power: 13
Tomster0815 is on a distinguished road
Hello together,

I'm completely new in using OpenFoam and faced with a (I hope simple) problem I don't know how to continue.

My case is to simulate a simple heat conduction welding process where I want to simulate in a first step a moving heat source (Point source or circle) on the surface of a control volume (CV). I've chosen the laplacianFOAM solver because I don't want to consider any convective parts.
For that issue. I've implemented a source term q in the standard laplacianFOAM solver and boundaries.

But how is the approach for using this term as a moving source?
Do I need a moving "meshgrid" on the CV or maybe inside (Volume source) or can I solve this by boundary conditions?

Thanks a lot for answers.

Tomster
Tomster0815 is offline   Reply With Quote

Old   July 3, 2013, 15:21
Default Update: Maybe fvOptions as a solution?
  #2
New Member
 
Join Date: Jul 2013
Posts: 4
Rep Power: 13
Tomster0815 is on a distinguished road
Hello again,

after one more day of searching on a lot of sites I found an approach for my problem using the fvOptions framework.
I'll try it with the simpleScalarFOAM because the solver includes a fvOptions (T) - source-term.

Anyway - does anybody have a good conclusion or an idea where I can find a "manual" how I've to set der fvOptions dictionary file to create a moving heat source?

Thanks again for any reply.
Tomster0815 is offline   Reply With Quote

Old   July 3, 2013, 22:42
Default
  #3
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 15
ahmmedshakil is on a distinguished road
Hi Tomster,
It's easy to model the moving heat source. If your heat source is a surface heat source, then you can impose it as a boundary condition, then groovyBC [http://openfoamwiki.net/index.php/Contrib_groovyBC] will be more helpful for you. Just look at the groovyBC sites.
In case of volumetric heat source, you can easily use "expressionSource"- which comes with the swak4Foam [http://openfoamwiki.net/index.php/Contrib/swak4Foam].
So, what you need to construct the expression for moving source, then use the method that comply your need.
Cheers!
ahmmedshakil is offline   Reply With Quote

Old   July 8, 2013, 13:00
Default How to implement something from swak4Foam?
  #4
New Member
 
Join Date: Jul 2013
Posts: 4
Rep Power: 13
Tomster0815 is on a distinguished road
Hey Ahmmedshakil,

thanks a lot for you suggestion!
I'm completely new in OpenFoam and I have after a couple of days reading no idea how I have to implement this function I'm sorry, but the structure of OF is not easy to understand...

In the first step, I've downloaded and compiled swak4foam (with ./Allwmake). But where and how do I have to implement the Code? I want to use your suggested expressionSource.H for adding a moving volumetric heat source.

- Is the source itself (size, moving parameters) described in a library in the run/case-folder?
- Do I have to change something in the laplacianFoam.C?
- Should I add something in the ./Make/files oder options-file?
- What is to to in the case-folder?

Thank you for answering my noob-questions

Greetings, Tomster
Tomster0815 is offline   Reply With Quote

Old   July 9, 2013, 03:40
Default
  #5
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 15
ahmmedshakil is on a distinguished road
Hi Tomster,
For using expressionSource, there is a example done in swak4Foam-->Examples-->interFoamWithSources. And you can easily take help from this post: http://www.cfd-online.com/Forums/ope...urce-term.html.

Cheers!
ahmmedshakil is offline   Reply With Quote

Old   July 9, 2013, 10:10
Default How does it work?
  #6
New Member
 
Join Date: Jul 2013
Posts: 4
Rep Power: 13
Tomster0815 is on a distinguished road
Hello Ahmmedshakil,

thank you again for replying my post. Unfortunately it does not work
I'll now exactly describe what I've done from the beginning - maybe you find my mistake:

- I've downloaded the swak4Foam files (Version 0.2.3) from http://openfoamwiki.net/index.php/Contrib/swak4Foam as a *.tar-file and unpacked it in the $HOME/swak4foam directory (and stayed the files later here)

- As mentioned, I commented out the
#define FOAM_LOOKUPCLASS_NO_CONST
in the Libraries/swak4FoamParsers/include/swak.H file

- I compiled swak4Foam with ./Allwmake (It took around 10 Minutes!?)

- For my case, I followed the instructions from gschaider in this post: http://www.cfd-online.com/Forums/ope...urce-term.html

- Now these are my files:
createFields.H
Code:
Info<< "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
 
//----NEUE WAERMEQUELLE HINZUFUEGEN----
 expressionSource<scalar> heaterSource
 (
 IOdictionary 
 (
        IOobject
        (
            "heaterSourceDict",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
 )
        ),
        mesh
    );
//--------------------------------
    Info<< "Reading transportProperties\n" << endl;
    IOdictionary transportProperties
    (
        IOobject
        (
            "transportProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
 
    Info<< "Reading diffusivity DT\n" << endl;
    dimensionedScalar DT
    (
        transportProperties.lookup("DT")
    );
laplacianFoam.C
Code:
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
#include "expressionSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    simpleControl simple(mesh);
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    Info<< "\nCalculating temperature distribution\n" << endl;
    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;
        while (simple.correctNonOrthogonal())
        {
            solve
            (
  //Original: fvm::ddt(T) - fvm::laplacian(DT, T)
                  fvm::ddt(T) 
  - fvm::laplacian(DT, T)
  ==
  heaterSource()
            );
        }
        #include "write.H"
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
    Info<< "End\n" << endl;
    return 0;
}
and the ./Make/options
Code:
EXE_INC = \
          -I$(LIB_SRC)/finiteVolume/lnInclude \
          -I$HOME/swak4Foam/Libraries/swakSourceFields/InInclude
EXE_LIBS = \
    -lfiniteVolume \
           -L$FOAM_USER_LIBBIN
- I've tried to compile it with wmake but it didn't work (Error Message: expressionSource.H not found). Is my "link" in the options file incorrect written or where do I have to copy the EXE- and LIB-Files from swak4Foam?

Another Problem is that I can't run the suggested Example in ./interFoamWithSources. What do I have to do that it will work?

Thank you again very much - I hope my questions will help other noobs in understanding OpenFoam with swak4Foam
(Afer success I'll publish my code here).

Greetings
Tomster0815 is offline   Reply With Quote

Old   July 9, 2013, 22:25
Default
  #7
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 15
ahmmedshakil is on a distinguished road
Hi Tomster,
The error message Error Message: expressionSource.H not found)--- so you have problem in the linking file i.e.

EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$HOME/swak4Foam/Libraries/swakSourceFields/InInclude
(PLEASE CHECK HERE)
EXE_LIBS = \
-lfiniteVolume \
-L$FOAM_USER_LIBBIN

The same thing is true for the example running.... I'm sure now you can run the solver.
cheers!!
raj kumar saini likes this.
ahmmedshakil is offline   Reply With Quote

Old   November 3, 2013, 04:30
Default transient heat source
  #8
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 13
Kumudu is on a distinguished road
Hi,

Where u defined the heatSourceDict and how. I am new to OpenFoam and please tell me the step you follow to add the transient heat source into LaplacianFoam.

Kumudu









Quote:
Originally Posted by Tomster0815 View Post
Hello Ahmmedshakil,

thank you again for replying my post. Unfortunately it does not work
I'll now exactly describe what I've done from the beginning - maybe you find my mistake:

- I've downloaded the swak4Foam files (Version 0.2.3) from http://openfoamwiki.net/index.php/Contrib/swak4Foam as a *.tar-file and unpacked it in the $HOME/swak4foam directory (and stayed the files later here)

- As mentioned, I commented out the
#define FOAM_LOOKUPCLASS_NO_CONST
in the Libraries/swak4FoamParsers/include/swak.H file

- I compiled swak4Foam with ./Allwmake (It took around 10 Minutes!?)

- For my case, I followed the instructions from gschaider in this post: http://www.cfd-online.com/Forums/ope...urce-term.html

- Now these are my files:
createFields.H
Code:
Info<< "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
 
//----NEUE WAERMEQUELLE HINZUFUEGEN----
 expressionSource<scalar> heaterSource
 (
 IOdictionary 
 (
        IOobject
        (
            "heaterSourceDict",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
 )
        ),
        mesh
    );
//--------------------------------
    Info<< "Reading transportProperties\n" << endl;
    IOdictionary transportProperties
    (
        IOobject
        (
            "transportProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
 
    Info<< "Reading diffusivity DT\n" << endl;
    dimensionedScalar DT
    (
        transportProperties.lookup("DT")
    );
laplacianFoam.C
Code:
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
#include "expressionSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    simpleControl simple(mesh);
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    Info<< "\nCalculating temperature distribution\n" << endl;
    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;
        while (simple.correctNonOrthogonal())
        {
            solve
            (
  //Original: fvm::ddt(T) - fvm::laplacian(DT, T)
                  fvm::ddt(T) 
  - fvm::laplacian(DT, T)
  ==
  heaterSource()
            );
        }
        #include "write.H"
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
    Info<< "End\n" << endl;
    return 0;
}
and the ./Make/options
Code:
EXE_INC = \
          -I$(LIB_SRC)/finiteVolume/lnInclude \
          -I$HOME/swak4Foam/Libraries/swakSourceFields/InInclude
EXE_LIBS = \
    -lfiniteVolume \
           -L$FOAM_USER_LIBBIN
- I've tried to compile it with wmake but it didn't work (Error Message: expressionSource.H not found). Is my "link" in the options file incorrect written or where do I have to copy the EXE- and LIB-Files from swak4Foam?

Another Problem is that I can't run the suggested Example in ./interFoamWithSources. What do I have to do that it will work?

Thank you again very much - I hope my questions will help other noobs in understanding OpenFoam with swak4Foam
(Afer success I'll publish my code here).

Greetings
Kumudu is offline   Reply With Quote

Old   November 3, 2013, 05:10
Default Transient heat source
  #9
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 13
Kumudu is on a distinguished road
Hi Tomster0815,

I did exactly what you said. But I got this error. Please tell me how to fix this.

Kumudu

kumudu21688@kumudu21688-Inspiron-N5040:~/OpenFOAM/kumudu21688-2.1.1/run/myheatsource$ mylaplacianFoam
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.1-221db2718bbb
Exec : mylaplacianFoam
Date : Nov 03 2013
Time : 11:01:29
Host : "kumudu21688-Inspiron-N5040"
PID : 4536
Case : /home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/run/myheatsource
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field T

Reading transportProperties

Reading diffusivity DT


SIMPLE: no convergence criteria found. Calculations will run for 15 steps.


Calculating temperature distribution

swak4Foam: Allocating new repository for sampledSets


--> FOAM FATAL IO ERROR:
Attempt to return dictionary entry as a primitive

file: /home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/run/myheatsource/system/controlDict::functions::theSensor::setName from line 59 to line 63.

From function ITstream& primitiveEntry::stream() const
in file db/dictionary/dictionaryEntry/dictionaryEntry.C at line 82.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::IOerror::abort() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 Foam::dictionaryEntry::stream() const in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#3 Foam::SetsRepository::getSet(Foam::dictionary const&, Foam:olyMesh const&) in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswak4FoamParsers.so"
#4 Foam::createSampledSet::createSampledSet(Foam::wor d const&, Foam:bjectRegistry const&, Foam::dictionary const&, bool) in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswakFunctionObjects.so"
#5 Foam::OutputFilterFunctionObject<Foam::createSampl edSet>::allocateFilter() in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswakFunctionObjects.so"
#6 Foam::OutputFilterFunctionObject<Foam::createSampl edSet>::start() in "/home/kumudu21688/OpenFOAM/kumudu21688-2.1.1/platforms/linux64GccDPOpt/lib/libswakFunctionObjects.so"
#7 Foam::functionObjectList::read() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#8 Foam::Time::run() const in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#9 Foam::Time::loop() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#10 Foam::simpleControl::loop() in "/opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#11
in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/mylaplacianFoam"
#12 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13
in "/opt/openfoam211/platforms/linux64GccDPOpt/bin/mylaplacianFoam"
Aborted (core dumped)






Quote:
Originally Posted by Tomster0815 View Post
Hello Ahmmedshakil,

thank you again for replying my post. Unfortunately it does not work
I'll now exactly describe what I've done from the beginning - maybe you find my mistake:

- I've downloaded the swak4Foam files (Version 0.2.3) from http://openfoamwiki.net/index.php/Contrib/swak4Foam as a *.tar-file and unpacked it in the $HOME/swak4foam directory (and stayed the files later here)

- As mentioned, I commented out the
#define FOAM_LOOKUPCLASS_NO_CONST
in the Libraries/swak4FoamParsers/include/swak.H file

- I compiled swak4Foam with ./Allwmake (It took around 10 Minutes!?)

- For my case, I followed the instructions from gschaider in this post: http://www.cfd-online.com/Forums/ope...urce-term.html

- Now these are my files:
createFields.H
Code:
Info<< "Reading field T\n" << endl;
    volScalarField T
    (
        IOobject
        (
            "T",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );
 
//----NEUE WAERMEQUELLE HINZUFUEGEN----
 expressionSource<scalar> heaterSource
 (
 IOdictionary 
 (
        IOobject
        (
            "heaterSourceDict",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
 )
        ),
        mesh
    );
//--------------------------------
    Info<< "Reading transportProperties\n" << endl;
    IOdictionary transportProperties
    (
        IOobject
        (
            "transportProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );
 
    Info<< "Reading diffusivity DT\n" << endl;
    dimensionedScalar DT
    (
        transportProperties.lookup("DT")
    );
laplacianFoam.C
Code:
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "simpleControl.H"
#include "expressionSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    simpleControl simple(mesh);
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    Info<< "\nCalculating temperature distribution\n" << endl;
    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;
        while (simple.correctNonOrthogonal())
        {
            solve
            (
  //Original: fvm::ddt(T) - fvm::laplacian(DT, T)
                  fvm::ddt(T) 
  - fvm::laplacian(DT, T)
  ==
  heaterSource()
            );
        }
        #include "write.H"
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
    Info<< "End\n" << endl;
    return 0;
}
and the ./Make/options
Code:
EXE_INC = \
          -I$(LIB_SRC)/finiteVolume/lnInclude \
          -I$HOME/swak4Foam/Libraries/swakSourceFields/InInclude
EXE_LIBS = \
    -lfiniteVolume \
           -L$FOAM_USER_LIBBIN
- I've tried to compile it with wmake but it didn't work (Error Message: expressionSource.H not found). Is my "link" in the options file incorrect written or where do I have to copy the EXE- and LIB-Files from swak4Foam?

Another Problem is that I can't run the suggested Example in ./interFoamWithSources. What do I have to do that it will work?

Thank you again very much - I hope my questions will help other noobs in understanding OpenFoam with swak4Foam
(Afer success I'll publish my code here).

Greetings
Kumudu is offline   Reply With Quote

Reply


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
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 13:41
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
Moving workpiece instead of Heat source Problem ahmmedshakil OpenFOAM Programming & Development 1 April 21, 2013 00:17


All times are GMT -4. The time now is 19:55.