CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Automatic Mesh Motion solver (http://www.cfd-online.com/Forums/openfoam-solving/60476-automatic-mesh-motion-solver.html)

michele August 9, 2005 08:42

Hello, I'm working on naval
 
Hello,
I'm working on naval simulations. The first tests I've made with the free-surface solver rasInterFoam are very encouraging.

Now I would like to incorporate in the solver I'm using (rasInterFoam) the "Automatic mesh motion" technique. In this way it will be easy (I hope) to produce simulations with boat prescribed motions or n-DOF boat dynamic simulations.

I read that the interFoam has moving mesh capabilities. Are its moving mesh features similar to the icoFoamAutoMotion solver?
Is it possible to clone the interFoam moving mesh structures directly to the rasInterFoam?

I'm just starting to looking at these OpenFOAM features and I will be very grateful for every suggestion, paper reference, tutorial, experience you will give to me.

Best regards,
Michele.

henry August 9, 2005 08:54

Yes you can transfer the movin
 
Yes you can transfer the moving-mesh capability from interFoam into rasInterFoam but you may find it easier to transfer the RAS modelling from rasInterFoam into interFoam as this may entail fewer changes.

michele August 10, 2005 07:26

Thanks Henry for your suggesti
 
Thanks Henry for your suggestion.
I modified the files, obtaining a "rasInterFoamMotion" solver starting from the interFoam and adding RAS. I need some clarifications:
1. in "createFields.H" is it correct to replace the

autoPtr<transportmodel> phase1
(
transportModel::New(U, phi, "phase1")
);

autoPtr<transportmodel> phase2
(
transportModel::New(U, phi, "phase2")
);

with the

autoPtr<transportmodel> twoPhaseLaminar
(
transportModel::New(U, phi,"twoPhase")
);

model, that was in the rasInterFoam?

2. If so, is it sufficient to substitute in "rasInterFoamMotion.C" the

phase1->correct();
phase2->correct();

with

turbulence->correct();

after the mesh move procedure? It has the drawback that the turbulent equations will be calculated twice for each timestep: the first one just after the mesh motion and the second one after the PISO. Any workaround?
May I suppress one of the turbulence->correct() istances?

I obtain something like the following:

...
phi += mesh.phi();
mesh.move();
phi -= mesh.phi();

turbulence->correct();
// phase1->correct();
// phase2->correct();

# include "gammaEqnSubCycle.H"

# include "UEqn.H"

// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
# include "pEqn.H"


# include "movingMeshContinuityErrs.H"

turbulence->correct();

runTime.write();
...
}
3. Is it possible to obtain a test case of interFoam with the moving mesh? I
found the inkJet code, and I think I will need to start from it in order to specify boundary conditions for my ship.

Thanks
Michele.

henry August 10, 2005 07:36

1) Yes. 2) You can remove
 
1) Yes.

2) You can remove the first call to turbulence->correct()

3) Yes try the inkJet test case.

michele August 10, 2005 12:06

Thanks Henry. Unfortunatly I h
 
Thanks Henry. Unfortunatly I haven't found the inkJet complete case, in the distribution I have only the source files inside the interFoam directory. So I'm unable to run the case. Am I missing anything?

1) I tried to apply this solver to the damBreak case (with the interFoam solver), just to see what happens, so I changed the motionProperties file as following:

movingFvMesh movingInkJetFvMesh;
movingInkJetFvMeshCoeffs
{
amplitude 1.0;
frequency 0.5;
refPlaneX 0.0;
};

The interFoam runs but I obtain strange results: the polyMesh/points file seems to change only a little between time-write 0 and 0.05, and then it remains constant... Moreover the boundaries are not moved (should I specify somewhere motion boundary conditions?), the Courant number is not respected during the simulation (about 0.5 instead of the 0.2, but this may be due to excessive fast motions, but once again, I don't see motions apart the first step), the dam doesn't break, in 1 second it just reaches the obstacle...
Excuse for my stupid questions. I need some tips to understand how to manage simulations with the interFoam moving mesh capabilities.

2) Anyway, it seems that the inkJet has only analitically-specified mesh motion (that sometimes can be useful) but I was thinking adding the motion solver for computing the mesh updates. Is it possible to use the same strategy of the icoFoamAutoMotion?


Excuse for bothering you with these elementary questions...
Michele.

mattijs August 10, 2005 18:19

1. You best look at the source
 
1. You best look at the source for movingInkjetFvMesh in the interFoam solver. Just create your own movingFvMesh class which implements the behaviour you want.

2. Yes, but you have wrap it in your own class (see 1) and just make sure that the 'move()' member function does all the mesh motion solving.

wikstrom September 26, 2005 06:13

Hi, I'm trying to use the
 
Hi,

I'm trying to use the motionSolver for a turning rudder application, and it works fine in serial computations. However, running in parallel does not work with more than 2 processes involved. For a small test case I end up with the following fatal:


--> FOAM FATAL IO ERROR : wrong token type - expected int found on line 0 the scalar 40

file: IOstream at line 0.

From function operator>>(Istream&, int&)
in file primitives/int/intIO.C at line 74.

FOAM parallel run exiting


On a larger case, most of the processes "go to sleep", while the master load remains on 100%. Last output from OpenFOAM is
Selection motion diffusion: quadratic

Might there be a bug in the motion solver, or is it only me?

thank you
Niklas

hjasak September 26, 2005 06:29

It's you :-) The parallel m
 
It's you :-)

The parallel mesh motion test is a part of my standard test loop and it works fine (below).

Hrv

Quote:

coyote*157-> more parallelRunLog
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : moveMesh /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh cone -parallel
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : moveMesh /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh cone -parallel
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : moveMesh /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh cone -parallel
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : moveMesh /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh cone -parallel
[0] Date : Sep 26 2005
[0] Time : 11:23:54
[0] Host : coyote
[0] PID : 7919
[1] Date : Sep 26 2005
[1] Time : 11:23:54
[1] Host : coyote
[1] PID : 7920
[3] Date : Sep 26 2005
[3] Time : 11:23:54
[3] Host : coyote
[3] PID : 7922
[2] Date : Sep 26 2005
[2] Time : 11:23:54
[2] Host : coyote
[2] PID : 7921
[1] Root : /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh
[1] Case : cone
[1] Nprocs : 4
[3] Root : /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh
[3] Case : cone
[3] Nprocs : 4
[2] Root : /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh
[2] Case : cone
[2] Nprocs : 4
[0] Root : /home/coyote/hjasak/OpenFOAM/hjasak-1.2/run/testLoop-1.2/moveMesh
[0] Case : cone
[0] Nprocs : 4
[0] Slaves :
[0] 3
[0] (
[0] coyote.7920
[0] coyote.7921
[0] coyote.7922
[0] )
[0]
Create time

Create mesh for time = 0.000000e+00

Selecting motion solver: laplace
Selecting motion diffusion: patchEnhanced
Time = 3.000000e-04
ICCG: Solving for motionUx, Initial residual = 0.115706, Final residual = 0.000106514, No Iterations 94
ICCG: Solving for motionUx, Initial residual = 0.000108801, Final residual = 9.42306e-07, No Iterations 85
ICCG: Solving for motionUy, Initial residual = 0.870909, Final residual = 0.000857438, No Iterations 52
ICCG: Solving for motionUz, Initial residual = 0.953627, Final residual = 0.000823837, No Iterations 23
Correcting 2-D mesh motion ...done
ExecutionTime = 2.1 s

Time = 6.000000e-04
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000269225, Final residual = 9.54363e-07, No Iterations 69
ICCG: Solving for motionUy, Initial residual = 0.831505, Final residual = 0.000813695, No Iterations 50
ICCG: Solving for motionUz, Initial residual = 0.951659, Final residual = 0.000867936, No Iterations 23
Correcting 2-D mesh motion ...done
ExecutionTime = 3.23 s

Time = 9.000000e-04
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000184676, Final residual = 9.82099e-07, No Iterations 69
ICCG: Solving for motionUy, Initial residual = 0.324815, Final residual = 0.000323225, No Iterations 32
ICCG: Solving for motionUz, Initial residual = 0.992885, Final residual = 0.000823608, No Iterations 11
Correcting 2-D mesh motion ...done
ExecutionTime = 4.2 s

Time = 1.200000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000156449, Final residual = 9.44303e-07, No Iterations 76
ICCG: Solving for motionUy, Initial residual = 0.825296, Final residual = 0.000790422, No Iterations 39
ICCG: Solving for motionUz, Initial residual = 0.970803, Final residual = 0.000834042, No Iterations 11
Correcting 2-D mesh motion ...done
ExecutionTime = 5.23 s

Time = 1.500000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000144305, Final residual = 9.69579e-07, No Iterations 85
ICCG: Solving for motionUy, Initial residual = 0.295474, Final residual = 0.00027425, No Iterations 32
ICCG: Solving for motionUz, Initial residual = 0.999593, Final residual = 0.000749312, No Iterations 5
Correcting 2-D mesh motion ...done
ExecutionTime = 6.26 s

Time = 1.800000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000141547, Final residual = 9.62092e-07, No Iterations 95
ICCG: Solving for motionUy, Initial residual = 0.11109, Final residual = 0.00010915, No Iterations 32
ICCG: Solving for motionUz, Initial residual = 0.99898, Final residual = 0.000934639, No Iterations 7
Correcting 2-D mesh motion ...done
ExecutionTime = 7.44 s

Time = 2.100000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000149043, Final residual = 9.33683e-07, No Iterations 77
ICCG: Solving for motionUy, Initial residual = 0.0333692, Final residual = 3.07756e-05, No Iterations 27
ICCG: Solving for motionUz, Initial residual = 0.986584, Final residual = 0.000738477, No Iterations 11
Correcting 2-D mesh motion ...done
ExecutionTime = 8.41 s

Time = 2.400000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000172178, Final residual = 9.37101e-07, No Iterations 57
ICCG: Solving for motionUy, Initial residual = 0.0148666, Final residual = 1.4202e-05, No Iterations 26
ICCG: Solving for motionUz, Initial residual = 0.956194, Final residual = 0.000911522, No Iterations 18
Correcting 2-D mesh motion ...done
ExecutionTime = 9.34 s

Time = 2.700000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.000228139, Final residual = 9.31194e-07, No Iterations 80
ICCG: Solving for motionUy, Initial residual = 0.008711, Final residual = 8.46577e-06, No Iterations 19
ICCG: Solving for motionUz, Initial residual = 0.994211, Final residual = 0.000585608, No Iterations 7
Correcting 2-D mesh motion ...done
ExecutionTime = 10.29 s

Time = 3.000000e-03
Correct mesh motion diffusion field.
ICCG: Solving for motionUx, Initial residual = 0.00352386, Final residual = 3.41694e-06, No Iterations 53
ICCG: Solving for motionUy, Initial residual = 0.00489389, Final residual = 4.28818e-06, No Iterations 21
ICCG: Solving for motionUz, Initial residual = 0.986664, Final residual = 0.000758618, No Iterations 10
Correcting 2-D mesh motion ...done
ExecutionTime = 11.15 s

End

Finalising parallel run

wikstrom September 26, 2005 06:57

Certainly is, and as a perso
 
Certainly is,
and as a person I'm not evil :-)

Thank you for answering. Have to go through the case again, then. Happens on really simple cases, though. Eg on the offsetCylinder in the tut's.

Noticed now that (at least for that case) it depends on the decomposition (method simple):

(4 1 1) NOT OK.
(2 2 1) OK.
(1 4 1) NOT OK.

Wierd.

too bad we didn't meet in Gothenburg. We're just the guys working on the floor you know.

/Niklas

hjasak September 26, 2005 07:23

Hi Niklas, Don't get me wro
 
Hi Niklas,

Don't get me wrong, I've nothing against you personally and I am sorry we hadn't met in Gotherburg in person - unfortunately, I have to earn a living from time to time as well.

I am pretty certain my version is OK because I use it a lot. If things depend on the decomposition, this may be an indication of errors when the globally shared points and edges are determined - you will need to check this manually. I know Mattijs has been working on this and the test cases are OK, but I am not sure how much testing it has received.

Hrv

mattijs September 26, 2005 08:21

Hi Niklas, To find out wher
 
Hi Niklas,

To find out where it goes wrong:
lamwipe, switch on FOAM_ABORT, lamboot and use lamrun script (see board) to run the processes in separate windows.


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