THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#134 - reintroduce the physical-functions
User who did this - Philipp Nuske (PhilippNuske)

----------
I introduced some sort of physicalness for the mpnc model. 
So, just as an idea, this is what I do currently: call the physicalness after 
the fluidstate was updated. Check whatever I like. Print location and some more 
variables to the screen, if a criterion was violated. Throw numerical problem, 
i.e. proceed with smaller timestep. 

There is a precompiler macro around the call to the physicalness function. This 
way it is not called if I am explicitly not debugging. 

In the end the results with and without physicalness are comparable. Without 
physicalness function the matrix becomes singular and the timestep is reduced. 
With physicalness the timestep gets reduced and we proceed with a very small 
step. 

However, I am using this mainly for debugging. This way I can see, WHERE things 
go wrong. This was very helpful for me. 

Benefits: 
- more meanignful output: I see what goes wrong.
- more meanignful output: I see where sth goes wrong.
- simulation runs a little longer, because unphysical results are rejected from 
the start. 

in volume variables:
#ifndef NDEBUG
        const  GlobalPosition & globalPos =  
fvGeometry.subContVol[scvIdx].global ;
        physicalness(fluidState_, globalPos);
#endif

   const void physicalness(const FluidState & fs,
                               const GlobalPosition & globalPos) const
    {
        const Scalar eps = 1e-6 ;
        for(int phaseIdx=0; phaseIdx<numPhases; phaseIdx++){
            for (int compIdx=0; compIdx< numComponents; ++ compIdx){
                const Scalar xTest = fs.moleFraction(phaseIdx, compIdx);
                if (not std::isfinite(xTest)
                     or xTest < 0.-eps
                     or xTest > 1.+eps ){
                    std::stringstream positionString;
                    positionString << \"Here:\";
                                for(int i=0; i<dim; i++)
                                    positionString << \" x\"<< (i+1) << \"=\"  
<< globalPos[i] << \" \"   ;
                                positionString << \"\\n\";
                                std::stringstream message ;
                    message << \"Unphysical value found: x[\"<<phaseIdx<<\"][\" 
<<compIdx<<\"]=\"<< xTest <<\"\\n\" ;
                    message << positionString.str() ;
                    message << \"with \" ;
                    for(int phaseIdx=0; phaseIdx<numPhases; phaseIdx++)
                        for (int compIdx=0; compIdx< numComponents; ++ compIdx)
                            message << \" x\" 
<<\"_\"<<FluidSystem::phaseName(phaseIdx)
                                    
<<\"^\"<<FluidSystem::componentName(compIdx)<<\"=\"
                                    << fs.moleFraction(phaseIdx, compIdx) ;

                    for(int energyEqIdx=0; energyEqIdx<numEnergyEqs; 
energyEqIdx++)
                        message << \"T\" 
<<\"_\"<<FluidSystem::phaseName(energyEqIdx)<<\"=\"<< 
fs.temperature(energyEqIdx) ;
//                    Ts is only known in the energyVolVars

                    DUNE_THROW(NumericalProblem, message.str());
                }
            }
        }
    }
----------

More information can be found at the following URL:
http://www.dumux.org/flyspray/index.php?do=details&task_id=134#comment322

You are receiving this message because you have requested it from the Flyspray 
bugtracking system.  If you did not expect this message or don't want to 
receive mails in future, you can change your notification settings at the URL 
shown above.
_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to