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

Adding equations to existing solvers

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2012, 09:46
Default Adding equations to existing solvers
  #1
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14
treima is on a distinguished road
Hello,

I want to add some equations to existing solvers, at the moment to rhoCentralFoam. The difficulties in this task is the dependency of factors from the calculated values in rhoCentralFoam.

I like to add this equation:
A, B matrices (4x4), L a vector (which should be calculated).

A * dL/dx + B * dL/dy = 0.

and the coefficents from A and B consists of

a11 = func(rhoE,rhoU.components(0),rhoU.components(1)).
a12 = func(rhoE,rhoU.components(0),rhoU.components(1)).
and so on, the same for B.

In Code it looks like

while(runtime.run())
{
... calculations rhoCentralFoam ...

// definition factors
<problem1> a11 = pow(rhoU.component(0),2) + pow(rhoU.component(1),2);
<problem1> a12 = rhoE;
and so on.

// building matrices
<problem2>

// solving equation
<problem3>
}

To my problems:

problem1:
the matrix coefficents are scalars, but which datatyp is the best one? I thought of volScalarField, because for example rhoE and the components of rhoU are volScalarField, too. I have to deal with the components of rhoU, because I couldnīt find a vectorial notation.

problem2:
How can I intialise the matrix? Taking the tensor-class seems not to be an option, because Iīve a 4x4 matrix and gives an error: "attempted to assign to a const reference to constant object" while performing the program.

problem3:
The last point is the equation. If to find a implementation for the partial derive of L to x and multiplicate this with a matrix. The same for y. For this step I havenīt tried very much things, because Iīve problems building my matrix. But one thing is, for solving in need fvc::ddt(L). This means Iīve to be careful with the dimensions.


Perhaps anybody can help me with some of my problems and my description is not to confusing . Maybe there is another, and better one, entrance to this problem. Iīm open for every suggestion.

Thanks!


Best regards

treima

Last edited by treima; July 10, 2012 at 02:23.
treima 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
Guide: Writing Equations in LaTeX on the CFD Online Forums pete Site Help, Feedback & Discussions 27 May 19, 2022 03:19
Adding porous zones to compressible multiphase solvers Hisham OpenFOAM Programming & Development 8 November 27, 2015 05:14
Help with chtMultiRegionFoam jbvw96 OpenFOAM Running, Solving & CFD 2 December 26, 2010 17:16
adding features to elements of an existing mesh? bunni OpenFOAM 1 November 4, 2010 13:03
Solver Equations Carola CFX 9 August 12, 2003 08:27


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