# OpenFOAM function defaults to delete case directory

4 messages
Open this post in threaded view
|

## OpenFOAM function defaults to delete case directory

 Hello, I'm using the following function call to use the OpenFOAM solver. [fea.sol.u,~,fea.vars] = openfoam( fea, 'application', 'simpleFoam', 'ddtScheme', 'steadyState', 'deltaT', 0.1, 'endTime', 20, 'tolres', 1e-04, 'upwind', 'linearUpwind', 'bound', 2, 'turb', struct( 'model', 'kOmegaSST', 'inlet', [0.00322804,7.72379], 'wallfcn', 1 ),'control',true,'hax',axes(),'casedir',[pwd '\Run']); I'm looking for a steady state solution, but my residuals are pretty high 1e-3. I need to look at the max pressure and max sqrt(u^2+w^2) and see how they are changing with the number of iterations to see if they are stable and not changing to help me evaluate if the solution has converged, or is at least stable enough for my purposes. At the end of the day all I really need is the pressure drop. I know in OpenFOAM I can set it up to store solutions however often I want, so I can inspect them while the simulation is running, but after it stops then the whole casedir is deleted, so I can't plot inspect, etc after it completes. Is there some way to prevent the deletion of the casedir? I see that I'm supposed to be able to start from a previous solution, but I can't get that to work either, because none of the previous solutions are stored. As always thank you for your help, Matt
Open this post in threaded view
|

## Re: OpenFOAM function defaults to delete case directory

 Administrator This argument has not been documented but I think it sould be enough to set the "clean" argument to false, as  [...] = openfoam( fea, ..., 'clean' ,0 ); you can then either postprocess the solutions with an external tool, such as ParaView, or re-import into FEATool and Matlab by using the import mode as  [ u, tlist, vars ] = openfoam( fea, ..., 'mode', 'import', 'casedir', 'path_to_casedir_with_solution_files' ); 
 Administrator The openfoam( fea, ..., 'mode', 'import' ) call looks in the (given) case directory for solutions indicated by numeric sub-directories (So you can't give a solution directory as 'casedir' parameter). If you want to import all solutions (instead of only the last one), you have to specify a non-steady state (default) analysis type (which will work during import even if your simulation is of steadyState/localEuler type), for example:  [u,tlist,vars] = openfoam( fea, ... 'mode', 'import', ... 'ddtScheme', '', ... 'casedir', 'C:\temp\oftest', ... 'clean', 0 );