
[Sponsors] 
May 1, 2005, 07:38 
Code writing

#1 
Guest
Posts: n/a

Sponsored Links


Sponsored Links 
May 1, 2005, 20:51 
Re: Code writing

#2 
Guest
Posts: n/a

if u r seeing very arbit values such as in E+20s etc, then it is sometimes because you might be assuming that arrays are initialised to values of zero and instead they are initialised to garbaged values, check this aspect.


May 2, 2005, 05:09 
Re: Code writing

#3 
Guest
Posts: n/a

thanks for posting, but this is not my mistake. I'm sure I did the discretization wrong...


May 2, 2005, 05:15 
Re: Code writing

#4 
Guest
Posts: n/a

For a beginner, perhaps the best way is to start from 1D Euler code, test it against Riemann solutions. You may refer to textbooks and their codes.


May 2, 2005, 05:20 
Re: Code writing

#5 
Guest
Posts: n/a

is ur solver coupled or segreggated??


May 2, 2005, 10:11 
Re: Code writing

#6 
Guest
Posts: n/a

I don't know what "coupled" and "segreggated" means. I just take the integral 2D unsteady Euler equations for a polar coordinate system and discretize them in time with an explicit Euler scheme: dVALUE/dt = (VALUE(t+dt,x) VALUE(t,x))/dt This way the conservation of mass delivers me the density at the next timestep. With this information the conservation of impulse delivers me the velocity at the next timestep. With this information the conservation of energy delivers me the temperature and pressure (ideal gas equation) at the next timestep. You see, I use a "shooting"method that allowes me to compute the state at a point P at the next timelevel just by considering point P and its neighbourpoints at the current timelevel. Maybe I shouldn't use explicit Euler for time discretization, but I like it cause i am a beginner and it's the easiest way and I don't have to solve any equation system...


May 2, 2005, 11:24 
Re: Code writing

#7 
Guest
Posts: n/a

You are going to have to solve the entire system of equations at the same time step. That's what "coupled" means, and from what I can gather by your description that's not what you are doing. Firstorder Euler is fine for a simple algorithm as long as your timestep is very small, but you can't solve the equations in a step by step fashion unless you explicitly build in the equation segregation (i.e. a pressurebased scheme).


May 2, 2005, 12:41 
Re: Code writing

#8 
Guest
Posts: n/a

Ok thank you, so what would you recommend me to do? Should I use an implicit time discretization technique? Or is there also a fine explicit method, perhaps a RungeKutta technique?
And could you please explain the following sentence you wrote (I just understand the first part): "Firstorder Euler is fine for a simple algorithm as long as your timestep is very small, but you can't solve the equations in a step by step fashion unless you explicitly build in the equation segregation (i.e. a pressurebased scheme" 

May 2, 2005, 13:30 
Re: Code writing

#9 
Guest
Posts: n/a

It sounds from your description that you are solving the equations sequentially. This is typically done using a segregated solver, but segregated solvers usually utilize a pressurebased form of the equations and involve constructing an iterative process together with an equation to couple the velocity, pressure, and density fields (velocity and pressure only if the flow is incompressible). Assuming you are solving the compressible form of the equations in a densitybased form, you need to update all of the flow field quantities (density, velocity, and energy) at the same time, i.e. you don't get density at time level n+1 and then use that to get velocity at time n+1, and so on. That's what it sounds like you are doing from your description, and if that's what you are doing then that may be your problem.


May 2, 2005, 15:33 
Re: Code writing

#10 
Guest
Posts: n/a

Hey ag, thanks a lot for trying to help me with my problems. But I got problems with your answers as well... I have lots of literature on the topic (e.G. Ferziger and Peric, Anderson, Hirsch among others) but none of them tells me what a "segregated solver" or a "pressure" or a "density based form of the equations" is. I have never heard of these things. What books do you refer to?
You know, I try to solve the integral mass, momentum and energy equations for a 2D, unsteady, compressible, frictionless case. For example my equation of mass conservation is: d(roh*dV)/dt = roh*v*n*dS with  meaning an integral Symbol V Volume roh density dS incremental part of the element's surface v velocity vector n surface normal vector The other equations look similar. Those are called the integral Euler equations and I discretize them with a Finite Volume method (but maybe the wrong one). And I do not have any iterative processes in my code (I try to avoid these cause they're more difficult to implement). Hope you know what I mean... 

May 3, 2005, 09:02 
Re: Code writing

#11 
Guest
Posts: n/a

If you have the Ferziger and Peric book, try to get their codes (see the last pages). This will be a good start.


May 3, 2005, 15:42 
Re: Code writing

#12 
Guest
Posts: n/a

If you know how th use the Eullers explicit method you may want to try the Crank Nicolson method it is more stable than the Eullers explicit method. Here is a website that has some info on the crank Nicolson, you could aslo google it. http://math.fullerton.edu/mathews/n2...colsonMod.html


May 10, 2005, 15:32 
Re: Code writing

#13 
Guest
Posts: n/a

Hye guys. Can anyone help me with writing a code for particle image velocimetry.


May 10, 2005, 16:57 
Re: Code writing

#14 
Guest
Posts: n/a

Thanks to you for all your responses. I still haven't solved my problem but am working on it and because of your opinions I am now quite sure that my problem is that I am using an explicit solver. Books are not replaceable, but learning CFD just from them is a hard piece of work. Thanks for your responses!


May 10, 2005, 23:57 
Re: Code writing

#15 
Guest
Posts: n/a

There is no reason that an explicit scheme should not be stable as long as you remain within the stability limits. Going to an implicit scheme will not help you if you have a discretization problem. In fact, your problem will still be present, because the RHS of your system of equations will be the same as the discretized spatial terms from the explicit scheme. You need to get an explicit scheme working before moving to an implicit scheme.


May 19, 2005, 06:02 
Re: Code writing

#16 
Guest
Posts: n/a

HI!
You may try to do the FLIC or Large Cells methods for that. They work quiet well for Euler's equs. I'm working now with DNS/LES methods in FLICLarge Cells decartelization and they work quiet well, even for explicit procedures in finite difference representation. If you want i can sent you a scheme of the algorithm. Best Regards. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Writing a CFD code  Ernesto  FLUENT  2  March 27, 2007 17:38 
Design Integration with CFD?  John C. Chien  Main CFD Forum  19  May 17, 2001 15:56 
What is the Better Way to Do CFD?  John C. Chien  Main CFD Forum  54  April 23, 2001 08:10 
own Code vs. commercial code  Bernhard Mueck  Main CFD Forum  10  February 16, 2000 11:07 
public CFD Code development  Heinz Wilkening  Main CFD Forum  38  March 5, 1999 12:44 
Sponsored Links 