﻿ Sample Problems > Usage > Variable_Types > inactive_variables

# inactive_variables

Navigation:  Sample Problems > Usage > Variable_Types >

# inactive_variables   { INACTIVE_VARIABLES.PDE

This example demonstrates the use of variables absent in selected regions.

The problem is a modification of LOWVISC.PDE, in which the bottom half of the channel

has been filled with a solid.

The fluid equations are declared INACTIVE in the solid region, but a temperature

equation has been added that is active everywhere.

The bottom of the solid is held at temperature = 0, while the fluid has an incoming

temperature of 1.

We solve the equations in sequence: first the fluid equations, then the temperature.

}

title 'Variables inactive in regions'

variables

u(0.1)

v(0.01)

p(0.1)

temp(0.1)

definitions

Lx = 5       Ly = 1.5

Gx = 0       Gy = 0

u0 = 0                       { default initial u-velocity }

p0 = 0                       { default initial pressure }

pin=2                         { inlet pressure }

speed2 = u^2+v^2

speed = sqrt(speed2)

dens = 1

visc = 0.04

vxx = (p0/(2*visc*(2*Lx)))*y^2*(Ly-y)^2     { open-channel x-velocity }

k = 0.1                         { default thermal conductivity }

rball=0.5

cut = 0.1       { bevel the corners of the obstruction }

penalty = 100*visc/rball^2

Re = globalmax(speed)*(Ly/2)/(visc/dens)

initial values

u = u0   v = 0  p = p0

equations

u:  visc*div(grad(u)) - dx(p) = dens*(u*dx(u) + v*dy(u))

v:  visc*div(grad(v)) - dy(p) = dens*(u*dx(v) + v*dy(v))

then

temp:  div(k*grad(temp)) - u*dx(temp) - v*dy(temp) = 0

Boundaries

{ bound the entire region, placing temperature boundary conditions }

region 1

INACTIVE (u,v,p)       { Inactivate the fluid in this region }

start(-Lx,-Ly)

value(temp)=0       line to (Lx,-Ly)

natural(temp)=0     line to (Lx,0)

value(temp)=1       line to (Lx,Ly)   { inlet fluid temp = 1 }

natural(temp)=0     line to (-Lx,Ly)

natural(temp)=-k*dx(temp)   line to close { outlet diffusive temperature flux }

{ overlay the fluid region onto the total domain, including obstruction,

and place fluid boundary conditions }

region 2

u0 = 0.5*vxx  P0=pin*x/(2*Lx)     { initial values in fluid region }

K = 0.01                         { fluid thermal conductivity }

start(-Lx,0)

value(u)=0 value(v) = 0

line to (Lx/2-rball,0)

to (Lx/2-rball,rball) bevel(cut)

to (Lx/2+rball,rball) bevel(cut)

to (Lx/2+rball,0)

to (Lx,0)

load(u) = 0 value(v) = 0 value(p) = pin

line to (Lx,Ly)

value(u) = 0 value(v) = 0 load(p) = 0

line to (-Lx,Ly)

load(u) = 0 value(v) = 0 value(p) = 0

line to close

monitors

contour(speed)

contour(u) report(Re)

contour(v) report(Re)

contour(p) as "Pressure" painted

contour(temp)

plots

contour(u) report(Re)

contour(v) report(Re)

contour(p) as "Pressure" painted

contour(temp)

contour(speed) painted report(Re)

vector(u,v) as "flow"   report(Re)

contour(dx(u)+dy(v)) as "Continuity Error"

end