Issue with sudden 'nan' error
Hello everyone
As I stated in my previous question, I am having issues when running transient simulations. This is a basic code that shows the problem I go through when trying to simulate unsteady NS equations, with PSPG stabilization and no RANS model. It must be placed in the upper directory for import statements to work properly.
import cbc.cfd.icns as icns
from cbc.cfd.icns import solver_parameters
from NSProblem import *
class LidDrivenCavity
def __init__(self, parameters, mesh_size):
self.mesh = mesh = UnitSquare(
self.mf = FacetFunction(
#Set some constants
self.nu = self.prm[
self.U = 1.0 #Max. velocity
#Determine timestep size
if self.prm[
#Initialize u and p
self.q0 = Initdict({'p': '0', 'u': ('0', '0')})
#Create boundary conditions
#Define lid boundary function
def lid_func(self):
if self.prm[
#We set a large t. This will be changed if we choose to use smoothly
# and is not included here
func = {'u': Expression(
else:
func = {'u': Constant((1., 0.))}
return func
def create_
inlet = FlowSubDomain(
walls = FlowSubDomain(
return [inlet, walls]
def __info__(self):
return "Lid Driven Cavity"
#######
####problem_
#######
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
problem_
#######
####solver_
#######
#DICTIONARY UPDATE
solver_parameters = recursive_
dict(degree=
pdesubsyst
linear_
precond=
#SOLVER PARAMETERS SETUP
solver_
solver_
solver_
solver_
solver_
solver_
solver_
solver_
solver_
# solver_
solver_
# solver_
solver_
# solver_
solver_
solver_
# solver_
solver_
# solver_
# solver_
solver_
solver_
solver_
solver_
solver_
solver_
solver_
#######
# PROBLEM FORMULATION #
#######
problem= LidDrivenCavity
NS_solver = icns.NSCoupled(
problem.
Running this code yields a 'nan' error at time 0.2749, without showing any signs of divergence. It just keeps happening with different values of Re and different meshes.
I really think this is a bug, since changing slightly some parameters (like taking Re to be 500.00001 instead of 500., and other similar changes) makes the simulation run longer.
I hope someone can find what is going wrong here. If you have any clues or suggestions, please let me know.
Marcos
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- CBC.PDESys Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Marcos Samudio
- Solved:
- Last query:
- Last reply: