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

Cannot compile solver help!

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 27, 2024, 16:42
Default Cannot compile solver help!
  #1
New Member
 
Sudin Bhuju Shrestha
Join Date: Jun 2024
Posts: 6
Rep Power: 2
sudin is on a distinguished road
Hello everyone,

I am a new user of OpenFOAM and have been learning it for about six months. I am a first-year PhD student, and my PI instructed me to learn OpenFOAM, specifically the fireFoam solver.

I am trying to compile a solver that can model soot movement. I have noticed that the sootModel class is declared as a subclass of the radiationModel. When I turn off the radiationModel, the solver does not solve the sootModel. My goal is to access the sootModel even when the radiationModel is off.

I apologize if my explanation is unclear or incorrect; I am new to the world of CFD, OpenFOAM, and C++.

Thank you for your understanding. If anyone can help, it would be greatly appreciated.

I have attached the source code based on OpenFOAM v2306.
Attached Files
File Type: zip myfireFoam.zip (50.0 KB, 1 views)
sudin is offline   Reply With Quote

Old   July 29, 2024, 04:21
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
In the file

constant/radiationProperties

set

radiation off;

sootModel <soot-model-of-choice>;
dlahaye is offline   Reply With Quote

Old   July 29, 2024, 10:00
Default
  #3
New Member
 
Sudin Bhuju Shrestha
Join Date: Jun 2024
Posts: 6
Rep Power: 2
sudin is on a distinguished road
Quote:
Originally Posted by dlahaye View Post
In the file

constant/radiationProperties

set

radiation off;

sootModel <soot-model-of-choice>;
Hello, thank you for the reply. I did try that first but, it doesn't work. When going through the source code, i found:

void Foam::radiation::radiationModel::initialise()
{
if (radiation_)
{
solverFreq_ = max(1, getOrDefault<label>("solverFreq", 1));

......
....

if (this->found("sootModel"))
{
soot_.reset(sootModel::New(*this, mesh_).ptr());
}
}
}

this means unless, the radiationmodel is initialized, the code doesn't acess the sootModel isn't it. So, i simply changed this part keeping the sootModel outside the radiationmodel loop, and tried to compile a custom library named myRadiationModel.

When i compile this custom library, it executes without an error.

where I do get my error is when, I try to acess this model with my custom solver. I get error is when the code reaches the #include"createRadiationModel.H" line inside the createField.H file.

In the original code for that file, i simply replaced "RadiationModel" to "myRadiationModel"
resulting the code to the one below:

autoPtr<radiation::myRadiationModel> radiation
(
radiation::myRadiationModel::New(thermo.T())
);

but when i try to compile I get the error below:
undefined reference to `typeinfo for Foam::radiation::myRadiationModel'
sudin is offline   Reply With Quote

Old   July 29, 2024, 10:58
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Makes sense.

I imagine that the class myRadiationModel is not defined, and therefore
myRadiationModel::New(thermo.T()) fails.

Question: what do you mean modeling "soot movement"? What are you trying to accomplish? Possibly changing the radiation model is not the best strategy.
dlahaye is offline   Reply With Quote

Old   July 29, 2024, 21:14
Default
  #5
New Member
 
Sudin Bhuju Shrestha
Join Date: Jun 2024
Posts: 6
Rep Power: 2
sudin is on a distinguished road
Well, my PI wants me to look into modeling particle movement in the atmosphere over buildings and land structures.
Specifically, he mentioned that since fireFoam can model fire, including how solid fuel breaks up into char/carbon particles and how these particles are carried away, he wants me to understand how this solver can model the movement of these final particles.
He is interested in various aspects, such as whether the movement is due to buoyant forces, changing air density, the wind effect caused by rising hot air, and even the effect of surrounding background wind effects. He wants me to explore how different researchers approximate this physics, whether the particles are dissipated and transported as a concentration field using the Eulerian-Eulerian approach or using the Eulerian-Lagrangian approach, where even the effect of gravity is considered.
He advised me to learn OpenFOAM (specifically mentioning fireFoam) and study the necessary physics and mathematical approximations related to this topic.
As I am new to graduate school and the CFD world, I began by learning OpenFOAM, running test cases, and understanding and modifying solver source codes. During this process, I encountered obstacles, which I mentioned above. Being an amateur in this field, I feel like I've hit a roadblock due to my limited knowledge and understanding of OpenFOAM. Heck, I don't even know where I should begin to learn.
Honestly, I would gladly accept any suggestions you could spare related to topics/papers I should look into or other solvers that align with what I just said.
Again, thank you very much for responding.
sudin is offline   Reply With Quote

Old   July 30, 2024, 03:07
Default
  #6
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Clear.

OpenFoam has both Euler-Lagrange (individual particles in fluid) and Euler-Euler (particles models as fluid with particular constitutive relations). Tutorials for the former and the latter are in tut/lagrangian and tut/multiphase, respectively.

From your description, MPPICFoam might (possibly) be a good entry point.

This \url{https://ep.liu.se/ecp/142/099/ecp17142099.pdf} might provide clues.

I am very happy to discuss further. Please give it a look and elaborate on your doubts.

Cheers, D.
dlahaye is offline   Reply With Quote

Old   July 30, 2024, 12:03
Default
  #7
New Member
 
Sudin Bhuju Shrestha
Join Date: Jun 2024
Posts: 6
Rep Power: 2
sudin is on a distinguished road
Thank you so much for your reply. Honestly, it means a lot to me. I'll definitely look into your suggestions.

I might have a naive question, but can you help me understand something? When I go through the source code, I see files named Ueqn, Peqn, and YEEqn/Eeqn that solve the momentum equation for the velocity field, pressure, and energy, respectively, which is common in all.

My question is, where can I find the equations being solved for the particles (in Lagrangian) or phases (in Eulerian)? Where is the source code for that? I'm trying to understand the mathematical models they are based on. I do know that they call specific headerfiles and models in the SRC folder, but all I find is, one class calling another class and so on. I tried searching for the mathematical models in the user guide, but I couldn't find them. Maybe I missed them somewhere else.

I'm sorry if my question is vague or poorly constructed.
sudin is offline   Reply With Quote

Old   July 30, 2024, 19:05
Default
  #8
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
You are asking good question.

Source code for MPPICFOAM, depending of version of OpenFoam used, https://github.com/OpenFOAM/OpenFOAM...am/MPPICFoam.C

Code refers to DPMFOAM that is at https://github.com/OpenFOAM/OpenFOAM...Foam/DPMFoam.C

Euler - Euler solvers are https://github.com/OpenFOAM/OpenFOAM...ers/multiphase

Possibly Dr. Google is a good friend.
https://help.sim-flow.com/solvers/mppic-foam

https://bugs.openfoam.org/file_downl...=1030&type=bug

https://www.sciencedirect.com/scienc...32591022007021

The above answers do require further elaborations.

Please keep posting your questions.
arch.mr likes this.
dlahaye is offline   Reply With Quote

Old   July 31, 2024, 18:31
Default
  #9
New Member
 
Sudin Bhuju Shrestha
Join Date: Jun 2024
Posts: 6
Rep Power: 2
sudin is on a distinguished road
Thank you for responding,

I did have a talk and suggested him about other solvers, but he is adamant about fireFoam, he want's me to show me the numerical model on which it is based and if it is not very useful to our puporse, he say we may move on to another. Since my PI is interested in how the particles broken down due to fire is transported across the domain, tried looking into the pyrolosis model that it is based on.

I've been looking into the pyrolysis model that fireFoam uses.


A paper commented on the pyrolysis model of fireFoam, stating:

"In FireFOAM, the pyrolysis modelling is based on the assumption of one-dimensional treatment, which is perpendicular to the exposed solid surface, of thermal degradation across a solid based on conservation statement for heat and mass. The corresponding global reaction for pyrolysis is as follows virgin solid -> volatiles + char. The pyrolysis reaction rate is based on Arrhenius-like degradation chemistry. It was complained that the model ignores the change of solid volume, the evaporation of free and bounded water, liquid phase melting and also the treatment of one-dimension avoids the difficulties of coupling gas-phase and solid-phase solvers".

"Lautenberger, C., & Fernandez-Pello, C. (2009). Generalized pyrolysis model for combustible solids. Fire Safety Journal, 44(6), 819-839. https://doi.org/10.1016/j.firesaf.2009.03.011"

— This paper, on which the pyrolysis model of fireFoam is based, mentions that the "condensed phase mass and phase species conservation equation" does not consider the convective term because it assumes that the condensed phase mass and species do not cross the cell boundaries. In the gas phase species conservation equation, both convective and diffusive transport across cell boundaries must be considered.

My question now is: since solving the pyrolysis model in fireFoam requires specifying a region of a mesh (say, zones A and B are specified in a mesh and zone A is the region for pyrolysis), does the gas species, which has convected/diffused out of this zone A, get transported into zone B??? I ask this question because when I go through the source code for the pyrolysis model, I see this patch of code, which I believe only deals with the zone A mesh because it constantly invokes regionMesh, not mesh (for the whole mesh).

In brief, my understanding is that the pyrolysis model solves the total mass of the solid, which decreases as pyrolysis continues. While the converted mass of solid into gas diffuses/convects into and out of the pyrolysis zone, the model solves only for the pyrolysis zone. Finally, this model is coupled to the overall solver by contributing to the heat equation later in the main solver.

Please correct me if my assumption about the gas species is false.

I'm sorry if I am being too wordy, I want to be as clear as possible.




phiGas_
(
IOobject
(
"phiGas",
time().timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
regionMesh(),
dimensionedScalar(dimMass/dimTime, Zero)
),

void reactingOneDim::updatePhiGas()
{
phiHsGas_ == dimensionedScalar(phiHsGas_.dimensions(), Zero);
phiGas_ == dimensionedScalar(phiGas_.dimensions(), Zero);

const speciesTable& gasTable = solidChemistry_->gasTable();

forAll(gasTable, gasI)
{
tmp<volScalarField> tHsiGas =
solidChemistry_->gasHs(solidThermo_->p(), solidThermo_->T(), gasI);

const volScalarField& HsiGas = tHsiGas();

const volScalarField::Internal& RRiGas = solidChemistry_->RRg(gasI);

surfaceScalarField::Boundary& phiGasBf = phiGas_.boundaryFieldRef();

label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i)
{
const label patchi = intCoupledPatchIDs_[i];

scalarField& phiGasp = phiGasBf[patchi];
const scalarField& cellVol = regionMesh().V();

forAll(phiGasp, facei)
{
const labelList& cells = boundaryFaceCells_[totalFaceId++];
scalar massInt = 0.0;
forAllReverse(cells, k)
{
const label celli = cells[k];
massInt += RRiGas[celli]*cellVol[celli];
phiHsGas_[celli] += massInt*HsiGas[celli];
}

phiGasp[facei] += massInt;

if (debug)
{
Info<< " Gas : " << gasTable[gasI]
<< " on patch : " << patchi
<< " mass produced at face(local) : "
<< facei
<< " is : " << massInt
<< " [kg/s] " << endl;
}
}
}
}
}
sudin is offline   Reply With Quote

Old   August 1, 2024, 05:08
Default
  #10
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Quote:
My question now is: since solving the pyrolysis model in fireFoam requires specifying a region of a mesh (say, zones A and B are specified in a mesh and zone A is the region for pyrolysis), does the gas species, which has convected/diffused out of this zone A, get transported into zone B??? I ask this question because when I go through the source code for the pyrolysis model, I see this patch of code, which I believe only deals with the zone A mesh because it constantly invokes regionMesh, not mesh (for the whole mesh).
Seems plausible. Can you run a tutorial example to verify this claim?

Cheers. D.
dlahaye is offline   Reply With Quote

Old   August 7, 2024, 04:49
Default
  #11
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Saw this: https://www.openfoam.com/trainings/c...fire-modelling
dlahaye is offline   Reply With Quote

Reply

Tags
firefoam, radiationmodel, sootmodel


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
Error: WorkBench Error: Could not handle event: SolutionStatusUpdate Kieyo Fluent Multiphase 0 November 10, 2022 00:58
Can't compile solver juanblanco OpenFOAM Programming & Development 9 March 19, 2019 03:09
How to compile openfoam solver without wmake silverbluep OpenFOAM Programming & Development 0 February 15, 2018 19:22
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
How to compile an unsteady solver based on solver of MRFSimpleFoam? renyun0511 OpenFOAM Running, Solving & CFD 0 April 27, 2010 12:16


All times are GMT -4. The time now is 11:07.