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

Error occurred when compiling new application based on chtMultiRegionSimpleFoam

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2013, 05:09
Default
  #1
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12
Kumudu is on a distinguished road
Hi,

I have changed the chtMultiRegionSimpleFoam, since I wanted to solve heat conduction equation for solid and scalar transport equation for fluid. These are the files that I changed,
1. createFluidFields.H
2.readFluidMultiRegionSimpleControl.H
3.setRegionFluidFields.H
4.solveFluid.H
5.chtMultiRegionSimpleFoam.C

Note:I changed .H files related to solid as well

As I wanted to have constant solid and water properties throughout the simulation, I defined rho, cp and K as constant dimensionedScalar for both solid and water. When I am compiling I got one error along with series of notes. I have attached all the .H files and error message.

Please someone can explain how to correct this error and what does these notes means?


Main error was :
make: *** [Make/linux64GccDPOpt/MultiRegionScalarTransportFoam.o] Error 1

---------------------

I have changed the chtMultiRegionSimpleFoam, and compile it as MultiRegionScalarTransportFoam. I got this error with series of notes.

Please some one tell me what is this error means. I am stuck in my thesis. I just want to know what is this error means.


Main error was :
make: *** [Make/linux64GccDPOpt/MultiRegionScalarTransportFoam.o] Error 1


Please someone can explain how to correct this error and what does these notes means? I am really stuck in my thesis. No one really helps me.

Kumudu
Attached Files
File Type: docx error_and_notes.docx (10.7 KB, 9 views)
File Type: zip MultiRegionScalarTransportFoam.zip (14.6 KB, 8 views)
File Type: docx error_and_notes.docx (10.2 KB, 5 views)

Last edited by wyldckat; December 26, 2013 at 12:06. Reason: So much information, have to collate it all into one post
Kumudu is offline   Reply With Quote

Old   December 26, 2013, 13:23
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 Kumudu,

You should have mentioned that you are using OpenFOAM 2.1.1

And I think you tried to do too many changes in a single step. I suggest that instead of trying to do so many modifications in a single go, and given that you want fixed properties for both solid and fluid, use the solver chtMultiRegionSimpleFoam as a base for your custom solver. I say this because this solver is designed for incompressible flow, which is apparently what you want.

Now, since you can use chtMultiRegionSimpleFoam as a basis for your solver, this means that you only need to add the scalar transport equation to the fluid side, which should be very similar (and easier) to the instructions given here: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Once you've done these steps, let me know if you still have problems compiling your customized solver!

By the way, before compressing the folder of the source code of your solver, run this command inside that folder:
Code:
wclean all
It will remove all non-essential object files and therefore keep only the necessary source code files!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 26, 2013, 13:52
Default
  #3
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12
Kumudu is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Kumudu,

1.given that you want fixed properties for both solid and fluid, use the solver chtMultiRegionSimpleFoam as a base for your custom solver. I say this because this solver is designed for incompressible flow, which is apparently what you want.

2.Now, since you can use chtMultiRegionSimpleFoam as a basis for your solver, this means that you only need to add the scalar transport equation to the fluid side, which should be very similar (and easier) to the instructions given here: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Best regards,
Bruno
Thank you very much again.
1.I used the chtMultiRegionSimpleFoam as the base case.But,I thought as I need to solve only the energy equation for both solid and liquid (Diffusion for solid, scalar transport for the water), I have to remove all the equations that related to the P, U,h. Thats why I created the solve.H for fluid as this.

Code:
 {
    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
            fvScalarMatrix TEqn
            (
                fvm::ddt(rho*Cp, T)
                  + fvm::div(rho*Cp*phi, T)
                 ==
                fvm::laplacian(K, T)
      
            );

            TEqn.relax();
            TEqn.solve();
    
    }

    Info<< "Min/max T:" << min(T).value << ' ' << max(T).value << endl;
}
And I defined fluid fields as this,
Code:
// Initialise fluid field pointer lists
    PtrList<volScalarField> TFluid(fluidRegions.size());
    PtrList<volVectorField> UFluid(fluidRegions.size());
    PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
    PtrList<dimensionedScalar> rho(fluidRegions.size());
    PtrList<dimensionedScalar> Cp(fluidRegions.size());
    PtrList<dimensionedScalar> K(fluidRegions.size());
   
    //******************************************************************
    Info<< "Reading field variables and transport properties\n" << endl;
    //*****************************************************************

   // **********************************************************************
   //  Fluid field variables
   // **********************************************************************
    Info<< "Reading Fluid field variables\n" << endl;
    forAll(fluidRegions, i)
    {

        Info<< "    Adding fluid Temperature to feild\n" << endl;
        TFluid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "T",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                fluidRegions[i]
            )
        );
    
        Info<< "    Adding fluid velocity field\n" << endl;
        UFluid.set
        (
            i,
            new volVectorField
            (
                IOobject
                (
                    "U",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                fluidRegions[i]
            )
        );


        Info<< "    Adding phi field to fluid through calculating fluid face flux field\n" << endl;
        phiFluid.set
        (
            i,
            new surfaceScalarField
            (
                IOobject
                (
                    "phi",
                    runTime.timeName(),
                    fluidRegions[i],
                    IOobject::READ_IF_PRESENT,
                    IOobject::AUTO_WRITE
                ),
                linearInterpolate(U) & mesh.Sf()

            )
        );
    
   // **********************************************************************
   //  Fluid transport properties
   // **********************************************************************

         Info<< "    Adding transport properties to  fluid field\n" << endl;

   
         IOdictionary transportProperties
         (
                
            IOobject
            (
                "transportProperties",
                runTime.constant(),
                 fluidRegions[i],
                 IOobject::MUST_READ,
                 IOobject::NO_WRITE
            ),
        fluidRegions[i]
        );

        Info<< "\tReading fluid density\n" << endl;
        rho.set
        (
            i,
            new dimensionedScalar 
            (
                fluidRegions[i].transportProperties.lookup("rho")
            )
        );


        Info<< "\tReading fluid specific heat\n" << endl;
        Cp.set
        (
        i, 
            new dimensionedScalar 
            (
                fluidRegions[i].transportProperties.lookup("Cp")
            )
        );

       Info<< "\tReading fluid thermal conductivity\n" << endl;
       K.set
       (
           i,
           new dimensionedScalar 
           (
            fluidRegions[i].transportProperties.lookup("K")
           )
       );
    }
2. I went through the link http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam.

Thats how I really learned to compile a new solver and add object as transport properties. Do you think what I did at the above is wrong?

Do you think if I keep the things same and just add the scalar transport to the solver, keep other PEqn.H,hEqn.H and UEqn.H?


Thanks again,
Kumudu

Last edited by wyldckat; December 26, 2013 at 14:54. Reason: Added [CODE][/CODE]
Kumudu is offline   Reply With Quote

Old   December 26, 2013, 14:59
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Quote:
Originally Posted by Kumudu View Post
But,I thought as I need to solve only the energy equation for both solid and liquid (Diffusion for solid, scalar transport for the water), I have to remove all the equations that related to the P, U,h.
OK, now I'm getting really confused here. What is the exact kind of simulation you are trying to perform? Namely, what are the specific details?

I ask this because it feels that you can simply define the water inside the pipe as if it were a solid as well!?
wyldckat is offline   Reply With Quote

Old   December 26, 2013, 17:21
Default
  #5
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12
Kumudu is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Kumudu,

You should have mentioned that you are using OpenFOAM 2.1.1

And I think you tried to do too many changes in a single step. I suggest that instead of trying to do so many modifications in a single go, and given that you want fixed properties for both solid and fluid, use the solver chtMultiRegionSimpleFoam as a base for your custom solver. I say this because this solver is designed for incompressible flow, which is apparently what you want.

Now, since you can use chtMultiRegionSimpleFoam as a basis for your solver, this means that you only need to add the scalar transport equation to the fluid side, which should be very similar (and easier) to the instructions given here: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Once you've done these steps, let me know if you still have problems compiling your customized solver!

By the way, before compressing the folder of the source code of your solver, run this command inside that folder:
Code:
wclean all
It will remove all non-essential object files and therefore keep only the necessary source code files!

Best regards,
Bruno
Quote:
Originally Posted by wyldckat View Post
OK, now I'm getting really confused here. What is the exact kind of simulation you are trying to perform? Namely, what are the specific details?

I ask this because it feels that you can simply define the water inside the pipe as if it were a solid as well!?

Thanks again. I have actually read MRConjugateHeatTransferFoam.C and chtMuitiRegionFoam.C. Because, I don't really need to solve pressure, and velosity. Just the temperature. And I need to keep constant solid and liquid thermo physical properties (K,Cp,rho). Thats why I create almost new cretaeFluidFields.H and cretaeSolidFields.H

I cannot really understand what is the wrong with the code I prepared. I prepared a new tutorial case for that. I am attaching it too. Then, you will realize what exactly I wanted to do. But, I think velocity, boundary conditions will be wrong in the tutorial I prepared. Because, as I said before, I still doesn't know after creating one fluid zone using topoSetDict, how to give boundary conditions defining inlet, outlet and wall boundaries for the liquid by merging blocks in the blockMeshDict. Thats why created three different regions for liquid and connected them through boundary conditions.

If you can tell me what is the wrong with code, I really appreciate it. But, I think I have bothered you so much.

Best,
Kumudu
Attached Files
File Type: zip GroundSourceHeatPump.zip (64.6 KB, 7 views)
Kumudu is offline   Reply With Quote

Old   December 28, 2013, 16:09
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 Kumudu,

If I understand you correctly, what you want is to create a multi-region solver that uses two basic solvers that OpenFOAM has got, namely:
The detail on those two solvers is that they are reaaaaaally basic. The fluid part would in fact take into account both solvers, but the original laplacian equation in laplacianFoam does not take into account convective heat transfer nor mass transport. It only does conduction.


The reason why I'm not able to simply state what the problem is with your solver, is because too many changes were made and it would take too long to diagnose all of the problems.

The best approach, from what I can figure out from your description, is either one of the following possibilities:
  1. We could go to the overly simplified multi-region solver, which would essentially require two development steps:
    1. To remove everything that doesn't matter from the chtMultiRegionSimpleFoam solver.
    2. Place in the solid part the equation solving loop from laplacianFoam.
    3. Place in the fluid part, the equation solving loop from potentialFoam and laplacianFoam.
    The problem with this implementation is that "Cp" is not defined explicitly in the solver
  2. On the other hand, you could leave the solver chtMultiRegionSimpleFoam unmodified and configure only the dictionary files for each region in the case, by using perfect fluid properties and constant isothermal characteristics for the solid part. This is the simplest implementation and possibly the most accurate one.
So, the big question here is: which approach do you need to use? Or is it something in between the two?

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 28, 2013, 17:43
Default
  #7
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12
Kumudu is on a distinguished road
Hi Bruno,

I really don't know how to thank you in words. But, I say many many thanks to you.


Quote:
Originally Posted by wyldckat View Post
Hi Kumudu,

If I understand you correctly, what you want is to create a multi-region solver that uses two basic solvers that OpenFOAM has got, namely:
  • potentialFoam
  • laplacianFoam

The best approach, from what I can figure out from your description, is either one of the following possibilities:
  1. We could go to the overly simplified multi-region solver, which would essentially require two development steps:
    1. To remove everything that doesn't matter from the chtMultiRegionSimpleFoam solver.
    2. Place in the solid part the equation solving loop from laplacianFoam.
    3. Place in the fluid part, the equation solving loop from potentialFoam and laplacianFoam.
    The problem with this implementation is that "Cp" is not defined explicitly in the solver
  2. On the other hand, you could leave the solver chtMultiRegionSimpleFoam unmodified and configure only the dictionary files for each region in the case, by using perfect fluid properties and constant isothermal characteristics for the solid part. This is the simplest implementation and possibly the most accurate one.
So, the big question here is: which approach do you need to use? Or is it something in between the two?
I would really like to go for the first choice. But, I think I should use ScalrTransportFoam for fluid. Because,

I just need to find out when the fluid (water) circulate through the pipe which is buried in the ground, what will be the fluid temperature at outlet of the pipe. So, my fluid( water) is an incompressible fluid and has constant Cp, rho and K. The mass flow rate of the pipe is constant.

Solid also has constant thermal properties.

The following are the equation that I should solve exactly,
for fluid,

ddt(rho_f*Cp_f, T_f)+ div(rho_f*Cp_f*phi, T_f)-laplacian(K_f, T_f)==Heat source_1

Heat source_1 = h*P(T_p - T_f)

where, h is the convection heat transfer coefficient
T_p = is the temperature at the inner surface of the pipe
T_f =fluid temperature
P=4/d_in
d_in= inner diameter of the pipe

I am writing the same in terms of PDE, if I made any thing wrong up there,
{
rho*Cp*∂T/∂t + rho*Cp*U*(∂T/∂z)-∂/∂x*(K*∂T/∂x)-∂/∂y*(K*∂T/∂y)-
∂/∂x*(K*∂T/∂x)= S_1
}

Assume that, I will know only rho, Cp, U, and temperature of water at the inlet. Inlet temperature at the heating mode will usually be low as 5 (0_C).

The ground will have maximum 20 (0_C)

For pipe,

ddt(rho_P*Cp_P, T_p) -laplacian(K_P, T_P)==Heat source_2

Heat source_2=h*(T_f - T_p)/ thickness_of_pipe

For soil,

ddt(rho_s*Cp_s, T_s) -laplacian(K_s, T_s)=0

These, all equations should be solved as considering the transient state.

I have to simulate the outlet temperature of the pipe and ground temperature at the same time. Also, need to calculate convective resistance inside the pipe, conduction resistance of the pipe and grout (lets say this is soil)

I also should be able to make the following changes ,

1. the flowrate of the fluid should be constant up to 12 hours (flow is circulating)
2. Then stops running the flow in the next 12 hours


No need to find pressure (actually, I wouldn't know the pressure conditions, and this is incompressible)

No need to solve U equation, The velocity is constant
Only field should be solved is the temperature.

So, solving unnecessary fields makes my thesis more complex. Thats why I thought to solve laplacianFoam for solid, scalar transport equations for fluid.

The heat sources are the boundary conditions at the interfaces, ı think so

So, thats why I create the solver so simple. So, what would you suggest? How to overcome the error in the code?

Thanks again.

Best regards,
Kumudu
Kumudu is offline   Reply With Quote

Old   December 30, 2013, 15:17
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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 Kumudu,

I honestly would like to create a simple basic multi-region solver, since it's a simple challenge and would get me a bit more understanding of how multi-region solvers work. But right now I apparently don't enough time to get to every single problem within this single vacation week

So my suggestion is this: take one step at a time. Don't try to implement everything in a single go.
I suggest that you first follow these steps:
  1. Try to do first only the basic changes to the chtMultiRegionSimpleFoam solver, by commenting out or simply removing the parts that don't matter for the simpler solver.
  2. Build the modified solver. It should not complain about anything at all.
  3. Run the modified solver with your test case. Barely nothing should happen, although it might do one or two steps in time...
  4. Then add the core loop from scalarTransportFoam into the fluid region of the modified solver.
  5. Build and test the case again. Configure the case in the fluid side.
  6. Now adapt the core loop of laplacianFoam in the solid region of the modified solver.
  7. Build and test the case again. Configure the case in the solid side.
  8. At this point, you should have a partially working solver, that should be able to perform some temperature transport. Honestly, you should prepare a simple test case, similar to the "plane2D" case, for which you can test if the result of the case is valid or not, when compared to the output of an analytical reference case.
Now, once you have finished step #8, you can now start adding the equations you need. But add only one or two at a time. Do not add them all at once, otherwise it's too complicated to try and solve the problem

In addition, always keep a safe copy of each step you do, so that you can trace back what you've done, as well as making it easier for others to help you, if they have access to the previous 1 or 2 steps, as well as the current step!

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 30, 2013, 16:38
Default
  #9
Member
 
Kumudu
Join Date: Oct 2013
Posts: 63
Rep Power: 12
Kumudu is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Kumudu,

I honestly would like to create a simple basic multi-region solver, since it's a simple challenge and would get me a bit more understanding of how multi-region solvers work. But right now I apparently don't enough time to get to every single problem within this single vacation week

So my suggestion is this: take one step at a time. Don't try to implement everything in a single go.
I suggest that you first follow these steps:
  1. Try to do first only the basic changes to the chtMultiRegionSimpleFoam solver, by commenting out or simply removing the parts that don't matter for the simpler solver.
  2. Build the modified solver. It should not complain about anything at all.
  3. Run the modified solver with your test case. Barely nothing should happen, although it might do one or two steps in time...
  4. Then add the core loop from scalarTransportFoam into the fluid region of the modified solver.
  5. Build and test the case again. Configure the case in the fluid side.
  6. Now adapt the core loop of laplacianFoam in the solid region of the modified solver.
  7. Build and test the case again. Configure the case in the solid side.
  8. At this point, you should have a partially working solver, that should be able to perform some temperature transport. Honestly, you should prepare a simple test case, similar to the "plane2D" case, for which you can test if the result of the case is valid or not, when compared to the output of an analytical reference case.
Now, once you have finished step #8, you can now start adding the equations you need. But add only one or two at a time. Do not add them all at once, otherwise it's too complicated to try and solve the problem

In addition, always keep a safe copy of each step you do, so that you can trace back what you've done, as well as making it easier for others to help you, if they have access to the previous 1 or 2 steps, as well as the current step!

Best regards,
Bruno
Thank you very much Bruno for the detailed explanation. Yes, I should check adding one step at a time which I didn't follow previously. I think what I really want is the extended version of blockCoupledSolver.
Because, in the blockCoupledScalarTransportFoam it was designed to used only one fluid and one solid region. But I need to have more regions in my case. If you have seen that the extended version which uses topoSet to define regions, please let me know. But, meanwhile I am using chtMultiRegionFoam and the similar case as multiRegionLiquidHeater.

What would you think if I use chtMultiRegionFoam to solve the same problem which is to simply solve the temperature field of a solid and water flow with constant mass flow rate with a forced convection. If anything that I have to change in the given tutorial case of multiRegionLiquidHeater, what would you suggest?

Thanks again. Happy new year and happy holiday!!!!!!!!!!

Best
Kumudu
Kumudu is offline   Reply With Quote

Old   December 30, 2013, 17:16
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Quote:
Originally Posted by Kumudu View Post
I think what I really want is the extended version of blockCoupledSolver.
Because, in the blockCoupledScalarTransportFoam it was designed to used only one fluid and one solid region. But I need to have more regions in my case. If you have seen that the extended version which uses topoSet to define regions, please let me know.
I have never looked at that solver with much attention, so I don't know how it works.

Quote:
Originally Posted by Kumudu View Post
What would you think if I use chtMultiRegionFoam to solve the same problem which is to simply solve the temperature field of a solid and water flow with constant mass flow rate with a forced convection. If anything that I have to change in the given tutorial case of multiRegionLiquidHeater, what would you suggest?
Have a look into this thread: http://www.cfd-online.com/Forums/ope...-openfoam.html

Honestly, it all really depends on the accuracy of the solution you are looking for and the time you are willing to let the solver run. The chtMultiRegion*Foam solvers are more than able to solve your simulations, as long as you properly configure the case. As I wrote above, have a look at that thread.

Quote:
Originally Posted by Kumudu View Post
Thanks again. Happy new year and happy holiday!!!!!!!!!!
2013 isn't over yet
But anyway: Happy holidays and have a good exit of 2013 and better entry in 2014
__________________
wyldckat is offline   Reply With Quote

Reply

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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 15:53
Compiling an application with OpenFOAM-1.6-ext ubuntu binaries ZKM OpenFOAM Running, Solving & CFD 4 March 24, 2014 07:05
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 19:56
incorrect temperature in pressure based solution Kian FLUENT 1 July 6, 2009 06:59


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