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

combine 2 codes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2014, 11:33
Default combine 2 codes
  #1
New Member
 
farida rahmawati
Join Date: Sep 2014
Posts: 3
Rep Power: 11
farida is on a distinguished road
Dear foamers,

I would like solve conjugate heat transfer problem with cyclic boundary condition.
I have developed conjugate heat transfer code and cyclic flow and heat transfer (in one region not in multiple region). I want to combine both codes, could you help me please.
Both codes are in the following attachments.

I can't attached my file because it exceeds the limit, How can I upload?

Thank you very much,
Best regards,
Farida
farida is offline   Reply With Quote

Old   October 8, 2014, 04:22
Default Nusselt number in chtMultiRegion
  #2
New Member
 
farida rahmawati
Join Date: Sep 2014
Posts: 3
Rep Power: 11
farida is on a distinguished road
Dear Tushar,

I would like to discuss with you about conjugate heat transfer problem with periodic flow and heat transfer boundary condition in openfoam.

I have modified code for conjugate heat transfer for incompressible flow and my problem now I have to apply periodic BC in conjugate heat transfer code. I have modified code for periodic flow and heat transfer in a pipe not include conjugate heat transfer (in openfoam I modified solver incompressible / channelFoam). I want to combine both code (CHT + periodic BC in a pipe) and I have a lot of difficulty.

Do you have any suggestion?

Best regards,
Farida
farida is offline   Reply With Quote

Old   October 8, 2014, 06:33
Default
  #3
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by farida View Post
Dear Tushar,

I would like to discuss with you about conjugate heat transfer problem with periodic flow and heat transfer boundary condition in openfoam.

I have modified code for conjugate heat transfer for incompressible flow and my problem now I have to apply periodic BC in conjugate heat transfer code. I have modified code for periodic flow and heat transfer in a pipe not include conjugate heat transfer (in openfoam I modified solver incompressible / channelFoam). I want to combine both code (CHT + periodic BC in a pipe) and I have a lot of difficulty.

Do you have any suggestion?

Best regards,
Farida
Try "groovyBC" for periodic BC.

-
Best Luck!
Tushar@cfd is offline   Reply With Quote

Old   October 11, 2014, 13:21
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Farida: I hope you don't mind, I've merged your posts into a single thread, so that this can be discussed in a single thread of discussion...
In addition, I hope you don't mind I quote the private message you sent me, because it has relevant information for this line of discussion:
Quote:
Originally Posted by farida
Dear Bruno,

I would like to calculate Nusselt number in conjugate heat transfer. Actually I already have the code in following and the problem is I don't know how to write in conjugate heat transfer for incompressible flow?
If you have time please help me.

Thank you
Best regards
Farida

Code:
#include "fvCFD.H"
// modified from  wallHeatFlux
#include "singlePhaseTransportModel.H"
#include "turbulenceModel.H"
#include "wallFvPatch.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    timeSelector::addOptions();
    #include "setRootCase.H"
#   include "createTime.H"
    instantList timeDirs = timeSelector::select0(runTime, args);
#   include "createMesh.H"

    forAll(timeDirs, timeI)
    {
        runTime.setTime(timeDirs[timeI], timeI);
        Info<< "Time = " << runTime.timeName() << endl;
        mesh.readUpdate();

#       include "createFields.H"
#       include "readTransportProperties.H"

        // calculate effective diffusivity based on turbulent viscocity
        kappaEff=turbulence->nu()/Pr+turbulence->nut()/Prt;

        gradT=fvc::snGrad(T);

        surfaceScalarField heatFlux =fvc::interpolate(kappaEff*Cp0*rho0)*gradT;

        const surfaceScalarField::GeometricBoundaryField& patchGradT =
                 gradT.boundaryField();
          
        const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
                 heatFlux.boundaryField();
//
        Info<< "\nWall heat fluxes " << endl;
        forAll(patchHeatFlux, patchi)
        {
           if (typeid(mesh.boundary()[patchi]) == typeid(wallFvPatch))
            {
                Info<< mesh.boundary()[patchi].name()
                    << ": Total "
                    << sum
                       (
                           mesh.magSf().boundaryField()[patchi]
                          *patchHeatFlux[patchi]
                       )
                    << " [W] over "
                    << sum
                       (
                           mesh.magSf().boundaryField()[patchi]
                       )
                    << " [m2] ("
                    << sum
                       (
                           mesh.magSf().boundaryField()[patchi]
                          *patchHeatFlux[patchi]
                       )/
                       sum 
                       (
                           mesh.magSf().boundaryField()[patchi]
                       )
                    << " [W/m2])"
                    << endl;
            }
      }
      Info<< endl;

      
      volScalarField wallHeatFlux
        (
            IOobject
            (
                "wallHeatFlux",
                runTime.timeName(),
                mesh
            ),
            mesh,
            dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0)
        );

      volScalarField wallGradT
        (
            IOobject
            (
                "wallGradT",
                runTime.timeName(),
                mesh
            ),
            mesh,
            dimensionedScalar("wallGradT", gradT.dimensions(), 0.0)
        );
   
      forAll(wallHeatFlux.boundaryField(), patchi)
      {
         wallHeatFlux.boundaryField()[patchi] = patchHeatFlux[patchi];
      }

      forAll(wallGradT.boundaryField(), patchi)
      {
         wallGradT.boundaryField()[patchi] = patchGradT[patchi];
      }


      wallGradT.write();
      gradT.write();
      wallHeatFlux.write();
      kappaEff.write();

    volScalarField NusseltNumber
    (
        IOobject
        (
            "NusseltNumber",
            runTime.timeName(),
            mesh
        ),
        mesh,
        dimensionedScalar("NusseltNumber", heatFlux.dimensions(), 0.0)
    );
    forAll(NusseltNumber.boundaryField(), patchi)
    {
        NusseltNumber.boundaryField()[patchi] = length*
        patchHeatFlux[patchi]/((T_hot-T_initial)*k);
    }
    NusseltNumber.write();

    }

    Info<< "End" << endl;

    return 0;
}
As for the very first post on this thread, instructions on how to proceed to provide information in order to get help is indicated here: http://www.cfd-online.com/Forums/ope...-get-help.html - there it's stated this:
Quote:
Originally Posted by linnemann View Post
cfd-online does not provide large filesize uploads so registering a dropbox/box account and use a public link to the picture/file makes it a lot easier to share files/pics or the full case.

Now, as for your questions, I have to say I'm also having difficulty trying to understand where exactly are you going with this line of thinking. The source code you sent me only takes care of calculating post-processing data, namely the Nusselt number, the wall heat flux and wall GradT. It does not solve the flow itself... oh, wait, I re-read the PM you sent me and that's essentially what you asked about.

If I'm not mistaken, the solver chtMultiRegionFoam can be used with a single fluid region. You'll still need to set-up the case as if it was a multi-region case, but with only one region.
My advice is:
  1. To take a step back from what you're trying to achieve and first reconfigure the tutorial case provided here: http://openfoamwiki.net/index.php/Ge..._-_planeWall2D - so that it only has one region and is similar to the test case you're trying to perform.
  2. As Tushar indicated, groovyBC might be able to useful for setting up the periodic condition you want to define. Nonetheless, if you can be more specific about the case you want to create, it might be easier to tell you which is the best approach to preparing your case.
  3. Are you 100% certain you want to use a "conjugate heat transfer" solver? I ask this because (if I'm not mistaken) the "conjugate" part relates to how the heat is transferred between the fluid and the solid objects.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   October 27, 2014, 04:48
Default
  #5
New Member
 
farida rahmawati
Join Date: Sep 2014
Posts: 3
Rep Power: 11
farida is on a distinguished road
Dear Bruno,

Thank you for your reply, I already solve Nusselt number in conjugate heat transfer. My problem is how to apply periodic flow and heat transfer boundary condition n conjugate heat transfer case? and Tushar suggests me to use groovy boundary condition. Could you give me information about groovy boundary condition for periodic boundary condition?

Thank you for your help and I need that information about that.

Best regards,
farida

Last edited by wyldckat; January 25, 2015 at 11:46. Reason: removed bold formatting from the whole text, to make it easier to read
farida is offline   Reply With Quote

Old   January 25, 2015, 11:49
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Farida,

Sorry, only now was I able to come back to your question.
It's almost been 3 months since your last post... I don't know if you've solved your problem?

If not, can you please be more specific about what do you mean by "apply periodic flow"?

Best regards,
Bruno
__________________
wyldckat 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
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 09:01
Is it worth it? Jason Bardis Main CFD Forum 47 July 27, 2011 04:52
Comparison of CFD Codes Kerem Main CFD Forum 9 May 9, 2003 04:29
New List of Free CFD Codes Bert Laney Main CFD Forum 5 September 15, 1999 15:24
Anyone used Ansys/Flotran - cf. with other codes? S. Langsford Main CFD Forum 3 October 19, 1998 20:51


All times are GMT -4. The time now is 14:10.