Top Banner
1 COMSOL Tutorial Bwaise III Original tutorial: Roger Thunvik (http://www.lwr.kth.se/Grundutbildning/1B1635/QH/CourseHome/index.htm) Updated by Emma Engström 26-Jan-10 This is a COMSOL Multiphysics tutorial adopted for the Bwaise III study case. It can be used to establish a preliminary model that can be further elaborated and improved. We will: first solve Richard’s (steady state) equation for variably saturated fluid flow, and then use this solution as an initial flow field in the computations for the contaminant transport. The idea with the first step is to create an appropriate steady-state flow field that we either can keep during the subsequent simulation of the contaminant transport, assuming that the fluid flow is constant, or else use as a basis before imposing time dependent inflow on the infiltration boundary (due to rainfall) and the lateral boundary. Later we will solve both these equations simultaneously, thus accounting for the transient fluid flow conditions. Modelling tips Notice: In this tutorial the font is italic when a word appears in the same way as in the Bwaise III Data Sheet, which is the file that contains all the relevant data (e.g. soil characteristics) needed for the model. In this tutorial the font is bold when a word appears in the same way as in the COMSOL graphical user interface. In COMSOL the name of a dependent variable is often the first letter of the corresponding physical quantity, e.g. the variable for pressure is called p and concentration c. In COMSOL, to denote the time derivative of a dependent variable, the variable gets the suffix t, e.g. the time derivative of pressure variable is called pt (and the x-derivative is px etc). In COMSOL, when a “physics”, such as Richard’s equation, is introduced, a so-called Application Mode Name will be associated with all predefined parameters for this physics, e.g. if you start using the Earth Science module and Richard’s equation the Application Mode Name is esvr and the moisture content is theta_esvr, the velocity components are u_esvr and v_esvr, the effective saturation is Se_esvr, etc. These parameters can then be used when coupling various equations to one another, or in the post-processing, to graphically display the results. For the Earth Science module and Solute Transport the application mode name is esst.
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: COMSOL Tutorial Bwaise III

1

COMSOL Tutorial Bwaise III

Original tutorial: Roger Thunvik

(http://www.lwr.kth.se/Grundutbildning/1B1635/QH/CourseHome/index.htm)

Updated by Emma Engström 26-Jan-10

This is a COMSOL Multiphysics tutorial adopted for the Bwaise III study case. It can be used to

establish a preliminary model that can be further elaborated and improved. We will:

first solve Richard’s (steady state) equation for variably saturated fluid flow, and then

use this solution as an initial flow field in the computations for the contaminant

transport.

The idea with the first step is to create an appropriate steady-state flow field that we either can

keep during the subsequent simulation of the contaminant transport, assuming that the fluid

flow is constant, or else use as a basis before imposing time dependent inflow on the

infiltration boundary (due to rainfall) and the lateral boundary. Later we will solve both these

equations simultaneously, thus accounting for the transient fluid flow conditions.

Modelling tips Notice:

In this tutorial the font is italic when a word appears in the same way as in the Bwaise III

Data Sheet, which is the file that contains all the relevant data (e.g. soil characteristics)

needed for the model.

In this tutorial the font is bold when a word appears in the same way as in the COMSOL

graphical user interface.

In COMSOL the name of a dependent variable is often the first letter of the

corresponding physical quantity, e.g. the variable for pressure is called p and

concentration c.

In COMSOL, to denote the time derivative of a dependent variable, the variable gets the

suffix t, e.g. the time derivative of pressure variable is called pt (and the x-derivative is

px etc).

In COMSOL, when a “physics”, such as Richard’s equation, is introduced, a so-called

Application Mode Name will be associated with all predefined parameters for this

physics, e.g. if you start using the Earth Science module and Richard’s equation the

Application Mode Name is esvr and the moisture content is theta_esvr, the velocity

components are u_esvr and v_esvr, the effective saturation is Se_esvr, etc. These

parameters can then be used when coupling various equations to one another, or in the

post-processing, to graphically display the results. For the Earth Science module and

Solute Transport the application mode name is esst.

Page 2: COMSOL Tutorial Bwaise III

2

There may be several versions of COMSOL (previously called FEMLAB) installed. Make

sure that you start version COMSOL 3.5 Multiphysics.

The default dimension in the Model Navigator is 2D (if we want to use 1D or 3D, then

that must be specified). In 2D the coordinates are x and y, regardless if the problem is a

vertical cross-section or a planar view.

Before you start, make sure that you:

Have reviewed the basic equation: Richard’s equation and its boundary conditions,

including those for variably saturated flow.

Have reviewed the concepts of retention curves, such as the Brooks and Corey and/or

Van Genuchten formulae. These relationships are more or less a standard today, but

you can also use your own curves in the modelling.

Have reviewed the material properties of the soils in consideration.

Between runs:

Make it a habit to make safety backups, e.g. if we solve the problem for steady-state

conditions it is a good idea to establish an initial setting, which can be used as a basis for

later work with, a transient problem of fluid flow and solute transport. In the COMSOL

graphical user interface, do this by selecting File→Save.

When you restart (transient solution):

Restart can be done in different ways and there are a few things to keep in mind: the

simulation time (i.e. not the CPU-time) is not being updated. This means that you, in

COMSOL, must modify the times under the Solver → Solver Parameters accordingly, to

stick to a specified time schedule, e.g. an irrigation scheme.

If your intention is to solve for steady state flow (to get an initial condition) then

uncheck the Global Equations option. If you have time dependent boundary conditions

then make sure that you remove the time dependency: switch from transient to

stationary solution.

Page 3: COMSOL Tutorial Bwaise III

3

Basic modelling steps I. Set the physical environment ......................................................................................................4

a. Define the physics ...................................................................................................................4

b. Specify the geometry ..............................................................................................................4

II. Assign material properties ..........................................................................................................5

a. Specify constants ....................................................................................................................5

b. Subdomain settings flow .........................................................................................................6

c. Subdomain settings solute transport .......................................................................................6

d. Specify initial conditions .........................................................................................................7

e. Set vertical 2D cross-section – account for gravity ....................................................................7

III. Boundary conditions ...............................................................................................................8

a. Split boundaries ......................................................................................................................8

b. Define boundary conditions ....................................................................................................8

c. (Advanced) adjust the upper infiltration boundary ..................................................................9

d. (Advanced) adjust the right lateral outflow boundary ............................................................ 10

IV. Generate Mesh ..................................................................................................................... 11

a. Initialize mesh ...................................................................................................................... 11

b. Specify alternative mesh elements ........................................................................................ 12

V. Solve the PDEs .......................................................................................................................... 13

a. Solve for fluid flow ................................................................................................................ 13

b. Solve for Solute Transport ..................................................................................................... 14

VI. Post-processing ..................................................................................................................... 16

a. Infiltration plot ..................................................................................................................... 16

b. Other 1D plots ...................................................................................................................... 16

VII. Alternative settings/tasks ..................................................................................................... 17

VIII. Group tasks .......................................................................................................................... 19

IX. Other resources .................................................................................................................... 20

Page 4: COMSOL Tutorial Bwaise III

4

Bwaise III COMSOL Tutorial (Courtesy of COMSOL)

I. Set the physical environment a. Define the physics

Open COMSOL 3.5:

- Go to: Start→All Programs→COMSOL 3.5→COMSOL Multiphysics 3.5

The Model Navigator will open.

- In the Space dimension list select 2D.

- Click the Multiphysics button.

For variably saturated flow Richard’s equation applies (find the details in the Bwaise III Data

Sheet):

- In the list of Application Modes, select (click on the +) Earth Science Module→Fluid

Flow→Richards’ Equation→Pressure analysis→Transient analysis.

- Click the Add button and leave the dialog box open.

To add the variably saturated solute transport equation (see the Bwaise III Data Sheet):

- Select Earth Science Module→Solute Transport→Variably Saturated Porous

Media→Transient analysis.

- Click the Add button and leave the dialog box open.

In order to put the advective term inside the divergence operator, switch from Non-

Conservative to Conservative (this enables adding fluid compressibility later on if we want to):

- Click on Application Mode Properties.

- Change from Non-conservative to Conservative, then click OK.

- Click OK to open the COMSOL graphical user interface.

We can later add more physics to the problem in the COMSOL window by clicking

Multiphysics→Model Navigator in the toolbar.

b. Specify the geometry We will now create a background grid that is sufficiently large to draw the features of interest in the flow domain:

- In the toolbar, go to: Options→Axes/Grid Settings. - Uncheck the Axis equal box. - Enter the following settings: x min: -1, x max: 15; y min: -1.5, y max: 0.5. - Click on the Grid tab and uncheck the Auto box. - Specify x spacing: 0.1 and y spacing: 0.05, then click OK.

The geometry of the flow domain will now be added according to the Conceptual model in the Bwaise III Data sheet (file name Bwaise III Data sheet.pdf):

- In the toolbar, go to: Draw→Specify Objects→Rectangle

Page 5: COMSOL Tutorial Bwaise III

5

Specify the subdomain settings for Width, Height and Position according to the Bwaise III Data sheet. After adding settings for each rectangle, click OK. You should now have four separate subdomains. We need to put the subdomains together, but we wish to keep the internal boundaries. We will create a single flow domain, but keep four subdomains that may be assigned different characteristics:

- Go to: Draw→Create Composite Object. - Make sure Object Type is set to Solid for all domains. - Select all the domains in Object selection, then click OK.

If you later need to modify subdomain data, go to: Draw→Object Properties.

The variables of these PDEs can be found in the Model Tree on the upper left part of the

screen:

- Below the Model Tree heading click on the central button (Detail).

- In the Model Tree select Geom1 and Richard’s Equation (click on the +).

- Select Subdomain Settings (click on the +) to read the names of the Dependent variable

(p).

- Select Groups (click on the +) and click on unnamed1 (for one subdomain).

- Read the list of names of the Richards Equation application mode variables. We will

refer to some of these variables later in the modelling, e.g. when integrating some

quantity over time.

- Select the Equation System below.

- Select the Subdomain Settings and Variables to read the list of variables in both

application modes (Richard’s Equation with suffix _esvr and Solute Transport with suffix

_esst). We will refer to some of these variables later in the modelling.

- Now select Solute Transport, Subdomain Settings, Groups and unnamed1.

- Read the long list of names of the Solute Transport application mode variables. We will

refer to some of these variables later in the modelling.

- Select the Equation System below.

- Select the Subdomain Settings and Variables to read the list of variables in both

application modes. We will refer to some of these variables later in the modelling.

II. Assign material properties

The material properties are to be found in the Bwaise III Data sheet.

a. Specify constants

We will specify some constants that we will use later on. This makes it possible to later on modify quantities, such as infiltration rates and permeabilities:

- Go to Multiphysics→Solute Transport

Page 6: COMSOL Tutorial Bwaise III

6

- Go to Options→Constants and add constants according to the Bwaise III Data sheet.

- Click OK.

You may define new constants whenever you’ll find it convenient during your work.

b. Subdomain settings flow

- Go to Multiphysics→Richard’s equation

- Go to Physics→Subdomains Settings

- Click in a domain to select it.

- In the drop down menu Constitutive relation, select Brooks & Corey.

- Select the Brooks & Corey tab

- According to the Bwaise III Data sheet, assign the Brooks and Corey material constants

for each domain:

Inverse of the air entry value

Pore size index (n = λ); and

Connectivity index (l). Make sure that all subdomains are assigned properties. Notice also that these parameters may be subject to changes.

- Select the Coefficients tab

- According to the Bwaise III Data sheet, assign the following material properties for each

domain:

Liquid fraction saturated, i.e. porosity ( s) and Liquid fraction residual ( r);

Storage term (S), select Specific storage, which implies that Compressibility of

the fluid ( f) and solid ( s) must be specified;

Saturated hydraulic conductivity (Ks); and

Density of the fluid (ρf), which is water (we assume that the fluid density is

constant, but we can put an expression for the relationship between

concentration and temperature if this would be important to the problem).

- Click OK.

c. Subdomain settings solute transport

Now the subdomain settings will be defined: - Go to Physics→Subdomain Settings

- Choose the Flow and Media tab and in the Subdomain selection select all domains

- For all domains, set the Time change in liquid volume fraction to Time change in

pressure head

- According to the Bwaise III Data sheet, specify:

o Time- scaling coefficient δts1

o Liquid volume fraction

o Pore volume fraction s

o x-velocity [m/s]

Page 7: COMSOL Tutorial Bwaise III

7

o y-velocity [m/s]

o Liquid source Qs [1/s]

o Specific Capacity C [1/m]

o Time change in pressure head δHp/δt *m/s+

- Choose the Liquid tab

- Set the Dispersivities according to the Bwaise III Data sheet

o Dispersivity, direction 1, transverse, α1 *m+

o Dispersivity, direction 2, longitudinal, α2 *m+

- Click OK.

The reason for defining tscale in Constants is that we now can apply it to Richard’s equation as

well. (Moreover, if we are using Particle tracing in the postprocessing then we will also have to

account for the time scale.)

- Go to Multiphysics → Richard’s equation

- Go to Physics → Subdomain settings

- Select all domains.

- Choose the Coefficients tab and set Time-scaling coefficient to tscale, click OK

- Go to Multiphysics → Solute Transport

- Go to Physics → Subdomain settings

- Choose the Flow and Media tab and set x-velocity and y-velocity to u_esvr/tscale and

v_esvr/tscale, respectively.

d. Specify initial conditions

In order for a solution to converge, reasonable initial conditions for pressure (the variable we solve for in Richard’s equation) need to be specified. Our assumption is that initially the bottom layer: Layer D is saturated and that the remaining part of the flow domain is unsaturated. For simplicity we assume that the initial pressure is hydrostatically distributed. As the water is assumed to be incompressible, the pressure hence depends linearly on the elevation. We guess that the pressure p(t0) = 0 at y = -1. Hence p(t0) = ρf * gravity * (y +1).

- Go to Multiphysics → Richard’s equation

- Go to Physics→Subdomains settings

- Click on the Init tab

- Select all domains

- Set the initial value (using the predefined quantities in COMSOL):

p(t0) = rhof_esvr*g_esvr*(y+1)

- Click OK.

e. Set vertical 2D cross-section – account for gravity

The flow domain considered is a vertical section, so we must account for gravity. This is done by

specifying the direction and quantity of gravity (9.82 m/s2).

Page 8: COMSOL Tutorial Bwaise III

8

- Go to Physics→Scalar variables

- Specify Name, Expression, Unit and Description according to:

D_esvr, y, m and Elevation/vertical axis;

g_esvr, 9.82, m/s2 and Gravity.

- Check the Synchronize equivalent variables box, then click OK.

III. Boundary conditions To facilitate boundary conditions settings:

- Go to Options →Visualization/Selection Settings. - Click on the options you wish to activate. - Click OK.

a. Split boundaries

The geometry that we have created has twelve boundaries (segments), of which three are

internal (between the layers). However, the conceptual sketch (see the Bwaise III Data sheet)

shows that we need to divide the upper boundary. One part will be subject to infiltration and

the other part will be considered impervious, due to roofs and other impervious surfaces.

To split the boundary we need to insert a new point:

- Go to Draw →Specify Objects→Point.

- Specify x: 3 and y: 0 to add a point at (3,0) and click OK.

We will add one point along the outlet boundary to facilitate convergence of the solution. The

time derivative of the present formulation of Richard’s equation contains a coefficient for the

specific moisture capacity: C = (which is multiplied with to obtain ). A problem with

this formulation is that C will be discontinuous if the flow domain is heterogeneous. The

discontinuity in the time derivative coefficients, such as C, may cause numerical problems if the

boundary conditions are changed at the same time as the material properties vary. Thus, to

allow us to modify the boundary conditions at part of the outlet boundary we will add an extra

point on here. It will be placed where we the estimate that the water table level will be, at y = -

0.6:

- Go to Draw →Specify Objects→Point.

- Specify x: 12 and y: -0.6 to add a point at (12,-0.6).

We may need to add more points on this boundary later, depending on what the solution, i.e.

the level of the water table, will be.

b. Define boundary conditions The boundary conditions on each of the segments will be specified, in the equations:

n represents the normal to the boundary;

po is a prescribed pressure;

No is a prescribed flux;

Page 9: COMSOL Tutorial Bwaise III

9

Rb represents the resistance to flow in a thin layer adjacent to the boundary;

pb is the pressure at the external edge of the resistive layer;

D is the water level elevation internal to the boundary; and

Db is the water level elevation external to the boundary. A negative sign indicates outward flux and a positive sign indicates inward flux. In general, if a boundary is expected to be unsaturated at all times No flux should be set. If the boundary might be a leaking one (seepage face), then Mixed boundary conditions should be set. To specify Fluid Flow Boundary Conditions:

- Go to Multiphysics→Richard’s equation. - Go to Physics →Boundary settings. - Click on one boundary at the time to define its settings according to the Bwaise III Data

sheet.

To specify Solute Transport Boundary Conditions: - Click on Multiphysics → Solute transport. - Go to Physics →Boundary settings. - Click on one boundary at a time to define its settings according to the Bwaise III Data

sheet. If you want a quick solution, then skip the following two sections (c and d).

c. (Advanced) adjust the upper infiltration boundary

The upper infiltration boundary demands some modifications. In the Bwaise III area the intensive rains often result in flooding and usually it takes some time (a couple of days) for the water to infiltrate into the soil; the time depends on the infiltration rate, which depends on the properties and conditions of the soil (e.g. saturation, hydraulic conductivity, the pF-curves, etc.). The time it takes for all water to infiltrated is calculated by integrating the infiltration flux over both space and time. In order to find the pond volume the initial pond height is integrated over the infiltration area and the inlet flux is found by integrating the flux over the infiltration area. We will use the COMSOL Integration Coupling Variables which give the value of an integral over a boundary:

- Go to Multiphysics→Richard’s equation. - Go to Options →Integration Coupling Variables→Boundary Variables - Click on the infiltration boundary (TL in the Bwaise III Data sheet sketch) - Specify Name pond_volume Expression pond_height - Specify Name inlet_flux Expression –flux_esvr (the normal is directed out of the

subdomain) - Click OK.

The total amount of water infiltrated into the ground, here called inb_flux, can be obtained by solving the differential equation:

Page 10: COMSOL Tutorial Bwaise III

10

= inlet_flux = the space integrated flux along the infiltration boundary.

In COMSOL the derivative is written as inb_fluxt. We can then rewrite the

differential equation as inlet_flux – inb_fluxt = 0. - Go to Physics →Global Equations. - Set Name to inb_flux.

- Set Equation to inlet_flux – inb_fluxt. - Set Init(u) to 0. - Set Init(ut) to 0, then click OK.

During the infiltration process, it is assumed that ponding conditions prevail at the boundary until all water has infiltrated. When all water has infiltrated, zero flux conditions will apply. Hence the boundary condition must be changed from head conditions (Dirichlet condition, specified p) to zero flux conditions (N0=0) and the other way around when the next irrigation phase begins. In order to obtain this double boundary condition one uses the technique of a so called stiff-spring, which is a high number and not a physical quantity; it has been earlier defined in Constants. The flux is set to the high stiff spring value multiplied with (-p + 0.001) to force the pressure p to remain close to zero and to allow the flux to vary almost freely.

To specify flux to occur at certain times only, COMSOL allows us to include logical functions, such as various time and flux conditions, together with the physical expression for the boundary condition. There may be a need for smoothing transients such as infiltration impact at a given time, which can be done by using the smoothened Heaviside function (equal to zero for a negative input argument and equal to one for a positive input argument), called flc2hs in COMSOL. Now adjust the boundary condition at the infiltration boundary:

- Go to Physics →Boundary settings - Click on the infiltration boundary (TL in the Bwaise III Data sheet sketch) - Set N0 equal to stiff_spring[m/(s*Pa)] * (-p +0.001) * flc2hs (t[1/s] - tstart [1/s],

deltime[1/s]) * flc2hs (pond_volume[1/m^3] - inb_flux[1/m^3], deltol[1/m^3]) * flc2hs (tfinal[1/s]-t[1/s], deltime[1/s])

where pond_volume is the the available amount if irrigation water; tstart and tfinal is the start and stop time of infiltration, respectively; t is time; inb_flux is the total amount of water infiltrated into the ground; and deltime and deltol are the transition intervals, the Heaviside smoothening parts.

d. (Advanced) adjust the right lateral outflow boundary The right hand boundary condition varies from no flow condition above the water table to flow

condition below the water table (sketched in the Bwaise III Data sheet). This is a complicated

Page 11: COMSOL Tutorial Bwaise III

11

boundary condition (a seepage face) to deal with numerically, especially for unsaturated flow

conditions. Some experimentation may be necessary to establish appropriate settings.

The term Rb, external conductance, will be modified with logical operators to create a flow

condition below the water table (Rb > 0) and a no flow condition above it (Rb <= 0). We decide

that flow (saturated conditions) exist either below the elevation y0 (=-1) at initial time (t ==0) or

where p > =0 at later times (t >0). Below the water table (where Rb > 0) the boundary condition

mimics a wall with thickness Tb and hydraulic conductivity K.

The elevation just inside the domain from the wall is D and the elevation just outside is Db.

Hence Db=D=y since the wall is vertical. The water pressure outside the wall Pb is set to zero

which implies that water is not ponding (there is air outside the wall).

The term Rb_new is the intrinsic value of Rb for the wall (i.e., without the logical operator

modifications) and it equals the hydraulic conductivity of the wall divided by the thickness and

the weight per unit volume of the fluid, Rb_new= KC/(rhof_esvr*g_esvr*Tb). Since the wall

does not exist we use the K for the corresponding layer and set the thickness to a very small

number (0.001 m), defined in Constants earlier. Now update the boundary conditions so that

flow occurs where y<-1 at start and where p>0 onwards:

- Go to Physics→Boundary Settings. - Select the right outflow boundary (RC2 in the Bwaise III Data sheet sketch) . - Adjust Rb to KC/(rhof_esvr*g_esvr*Tb) *((y<=y0 )*(t==0) + (p >= 0)*( t>0)) . - Set N0, Db to y and Pb to 0, then click OK.

IV. Generate Mesh a. Initialize mesh

- Click on Mesh →Initialize mesh. By default we will get an element mesh. However, this is usually too coarse to obtain the stipulated accuracy required for our calculations. Our solution will not converge. To adjust the Mesh:

- Click on Mesh → Free Mesh Parameters. - Select Predefined mesh sizes. - Select Extra fine and Remesh.

This results in a much finer mesh. It is very hard to beforehand exactly say how fine we must refine the mesh. This depends on many factors, e.g. the strength of the material contrasts and the sharpness of the contamination front. It is especially difficult to model sharp fronts and problems with high Peclet numbers. We can later easily compute the Peclet numbers to check which areas that might need being further refined. To refine the mesh further:

- Click on Mesh → Free Mesh Parameters. - Choose the Subdomain tab and set Maximum element size to

o 0.5 for the two top domains and

Page 12: COMSOL Tutorial Bwaise III

12

o 0.25 for the two bottom domains, both with Method Triangle. - Select the Boundary tab and set Maximum element size to

o 0.075 for the top Rightmost boundary (TR in the Bwaise III Data sheet) and o 0.05 for the other horizontal boundaries, then click OK.

b. Specify alternative mesh elements

By default we will get a mesh of triangular elements in 2D (or tetrahedral elements in 3D). In

some cases it is better (from a numerical point of view) to use a mesh of quadrilateral elements

instead of triangular elements (hexahedrons instead of tetrahedrons). Firstly, we will add two

extra points, which will create some new internal segments, which makes it possible refine the

mesh in their near vicinity:

- Go to Draw → Specify Objects→Point - Specify x: 3.0 and y: -0.5, click OK.

- Go to Draw → Specify Objects→Point - Specify x: 3.0 and y: -1, click OK.

To make a finer mesh:

- Go to Mesh → Mapped Mesh Parameters

- Select the Subdomain tab

- Set Predefined mesh sizes to Extra fine for all domains.

If you click on a subdomain its Edge groups will be displayed (group 1 is the bottom of the subdomain, group 2 the right side of the domain etc). The Group numbers usually come out directly as they should (so you won’t have to modify them, at least for our simple configuration).

- Click Remesh and OK. To create a mesh of quadrilateral elements:

- Click on Mesh → Free Mesh Parameters. - Choose the Subdomain tab, select all subdomains and set Method to Quad, then click

OK.

We can get an even finer mesh by defining the mesh for each boundary. This requires that we

are consistent with the number of elements in the two opposite boundaries (otherwise the

topology of the geometry will be invalid):

- Go to Mesh → Mapped Mesh Parameters

- Choose the Boundary tab

- For each boundary

o choose Constrained edge element distribution

o Set Element ratio to 0.5

o Set Number of edge elements so that the sum adds up to

9 in the vertical direction for each subdomain, and

100 in the horizontal direction for each subdomain.

Page 13: COMSOL Tutorial Bwaise III

13

- Click Remesh.

To see mesh data:

- Go to Mesh → Mesh statistics.

If you already have solved the equation system once, update: - Go to Solve → Update Model.

As you can see there are many options, but it is very hard beforehand to exactly say how fine the mesh must be for the solution to converge, as this depends on many factors, e.g. how strong the material contrasts are and how sharp the contamination front is. It is especially difficult to model sharp fronts and problems with high Peclet numbers. Sharp fronts give rise to what usually is referred to as numerical dispersion.

V. Solve the PDEs

a. Solve for fluid flow First remove all time-dependent settings:

- Go to Physics→Boundary Settings. - Select the right outflow boundary.

- Set the boundary conditions to Atmospheric

- Select the infiltration boundary.

- Set the boundary conditions to N0=N0, click OK.

We start by solving for steady state flow conditions. We use the coarse mesh:

- Go to Multiphysics→Richard’s Equation.

- Go to Solve → Solver Parameters.

- Choose the General tab and set Analysis types to Stationary.

- Choose the Stationary tab and set Linearity to Nonlinear and click OK.

Before trying to solve this equation system, we must make sure that we will only try to solve for the “physics” that we have assigned properties to:

- Go to Solve → Solver Manager and choose the tab Solve for

- Select only Richard’s Equation, hence de-select the other “physics”.

- Choose the tab Output.

- Select only Richard’s Equation, hence de-select the other “physics”.

- Click Solve and you should get an image of the Pressure field.

If you didn’t get a successful solution then you may first check the following things, i.e. that you

have:

Entered fluid density in SI-units (water density is typically around 1000 kg/m3).

Applied gravity forces Physics →Scalar variables → D_esvr →y (in 2D).

Refined the element mesh.

Go to Solve → Solver Parameters and choose the Stationary tab

Check Highly nonlinear problem

Page 14: COMSOL Tutorial Bwaise III

14

Increase the Maximum number of iterations from the default value to for example 35.

If this does not work you have to go through all settings again, or in the worst case your

problem is “simply” ill-posed or say formulated too difficult. It might be physically unsound. The

real world is full of such problems.

If you got a pressure field that looks reasonable then:

- Go to Postprocessing → Plot Parameters

- Choose the tab Surface and set Predefined quantities to Effective Saturation, click

Apply

- Choose the tab Contour and check the Contour plot.

- Set Predefined quantities to Pressure and set the Vector with isolevels to 0, then click

Apply.

To check your solution further:

- Choose the Arrow tab and check the Arrow plot.

- Select Velocity field as predefine quantity instead of Pressure gradient.

- Change arrow Color to white, click Apply, click OK.

b. Solve for Solute Transport

For a time-dependent solution, the default the setting is 0:0.1:1, which implies solving the

problem for 1 second, with intermediate storage of solutions at 0.1 seconds. We will modify

these values by setting: 0:600:36000, which means to store the solution values every 10

minutes until we have solved for one hour (36000 seconds); if time-scaling is used then (if

scaled to hours) Times should be set to 0:1/6:10:

- Go to Solve → Solver Parameters and select the General tab.

- Set Times to or 0:1/6:10, click OK.

The flow field above will be used as the initial conditions for time dependent simulation of solute transport. There are two alternatives to continue:

- If the infiltration rate during the transient solute transport is constant (the same as that of the steady solution) we can solve for solute transport only and keep the steady state fluid flow field constant, or

- If the infiltration rate during the transient solute transport is different than that at steady state, implying that the water table is varying with time we must solve simultaneously for the fluid flow and the solute transport.

For the first scenario (constant infiltration):

- Go to Multiphysics→Richard’s Equation.

- Go to Physics→Boundary Settings. - Select the right outflow boundary.

- Set the boundary conditions to Atmospheric.

Page 15: COMSOL Tutorial Bwaise III

15

- Select the infiltration boundary.

- Set the boundary conditions to N0=N0, click OK.

- Go to Solve → Solver Parameters, and choose the General tab.

- Set Analysis types Richard’s equation to Stationary.

- Set Analysis types Solute Transport to Transient.

- Set Solver to Time Dependent, click OK.

- Go to Solve → Solver Manager.

- Choose the Solve for tab and select Solute Transport.

- Choose the Output tab and select Solute Transport.

- Choose the Initial Value tab and select the Initial value expression evaluated using

current solution.

As for the flow field, the current solution (the Steady State previously obtained) will be used:

- Check the Current solution in Values of variables not solved for and linearization point,

click OK.

- Go to Solve → Restart.

To display the concentration:

- Go to Postprocessing → Plot Parameters.

- Choose the Surface tab and set Predefined quantities to Solute Transport→

Concentration. Check your solution further:

- Choose the Particle Tracing tab.

- Set Particle type to Massless, click OK.

- Go to Solve → Restart and repeat a couple of times to see the concentration moving.

For the second scenario (if the infiltration rate varies with time):

Make sure that the boundary conditions are transient (vary with time, see section III Advanced)

for flow:

- Go to Multiphysics→Richard’s Equation.

- Go to Physics→Boundary Settings. Then solve the PDEs:

- Go to Solve → Solver Parameters, and choose the General tab.

- Set Analysis types Richard’s equation to Transient.

- Set Analysis types Solute Transport to Transient.

- Set Solver to Time Dependent, click OK.

- Go to Solve → Solver Manager.

- Choose the Solve For tab and select ODE, Richard’s equation and Solute Transport.

- Choose the Output tab and select ODE, Richard’s equation and Solute Transport.

- Choose the Initial Value tab and check the Current solution in Initial value.

Page 16: COMSOL Tutorial Bwaise III

16

- Check the Use setting from Initial value frame in Values of variables not solved for and

linearization, click OK.

- Go to Solve → Restart.

VI. Post-processing

a. Infiltration plot To evaluate various mass balances we wish to define the subdomain and boundary quantities below. The idea is to display the results and check that the mass balances make sense. The variables are usually quantities obtained by integration of variables or expressions over boundaries or subdomains. We may also be interested in integrating some quantities over time, for example the total amount of infiltrated water or mass across a boundary in connection with irrigation. This requires that we either solve an ODE (Global Equation) or use a Weak Formulation. The most straightforward approach is that of the Global Equations.

Other integration variables apply to boundaries. To define quantities, such as total flow and

mass fluxes, to be integrated across the infiltration boundary:

- Go to Options → Integration Coupling Variables → Boundary Variables.

- Select the infiltration boundary and specify Name and Expressions according to the

Bwaise III Data sheet.

- Click OK. To plot the advection, dispersion and total mass flux through the infiltration boundary:

- Go to Postprocessing → Domain Plot Parameters.

- Choose the General tab and select all output times.

- Choose the Line/Extrusion tab and check Line/Extrusion plot.

- Specify y-axis data Expression to inlet_ndflux.

- Specify x-axis data to t (time).

- Click on Line Settings to adjust line format.

- Choose the General tab and check Line/Extrusion plot.

- Click Title/Axis to specify axis and titel, then click OK.

- When the figure is generated, display settings can be adjusted by clicking on the Palette.

b. Other 1D plots

To find the concentration by depth plot:

The concentration values may become unrealistic in certain areas due to numerical problems

typically occurring at certain spots, such as concentration fronts of the flow domain. These

problems are acceptable and we can choose to plot only the values up to cmax (e.g.

0.015kg/m3, defined in Constants). To plot the variation of pollutant concentration with depth:

- Go to Postprocessing → Domain Plot Parameters.

- Choose the Line/Extrusion tab.

- Select the vertical boundary segments on the left side.

- Specify the y-axis data Expression to c*(c<=cmax) + cmax*(c>cmax).

Page 17: COMSOL Tutorial Bwaise III

17

- Under x-axis data, click on Expression and specify (-y) , then click Apply.

To calculate the total lateral outflow over time:

- Go to Postprocessing → Boundary Integration.

- Select the lateral outflow boundary.

- Set Predefined quantities to Outward flux, click OK.

- Find the value of the total outward flux in the lowest part of the screen.

To calculate the pf-curve (the saturation variation with depth):

- Go to Postprocessing → Cross-section Plot Parameters.

- Choose the Line/Extrusion tab.

- In Predefined quantities select Geometry and mesh→y-coordinate.

- Under x-axis data, click on Expression and choose Predefined quantities: Effective

saturation.

- In the Cross-section line data specify: x0: 10, x1: 10 and y0: -1.5, y1: 0, click Apply.

VII. Alternative settings/tasks

To calculate the amount of mass advectively transported across the infiltration boundary,

which is equal to the concentration C0* rain infiltration N0* segment length, one can:

- Go to Options → Expressions → Boundary expressions

- Select the infiltration boundary.

- Specify Name incoming_mass and Expression C0* N0 * (tfinal-tstart)*leng, click OK. To plot the mass of infiltration:

- Go to Postprocessing → Global Variables Plot.

- Specify Expression to incoming_mass.

- Set x-axis data to t, then click Apply.

- After the figure is generated, click on the palette to adjust the plot.

To integrate variables over time:

- Go to Multiphysics → Weak form, point

- Go to Physics → Point Settings

- Select a point.

- Choose the Weak tab

- Specify weak to u_test*inlet_cflux

- Specify dweak to u_test*u_time

- Specify constr to 0

- Choose the Init tab and set u(t) to 0, click OK The Weak Form is only applicable for us for the transient solution, hence when solving for

steady state that the Weak Form must be unchecked in the solver manager. Keep in mind also

that if we are applying the Weak Form, Point (wp) equation, then we must ensure that only the

Page 18: COMSOL Tutorial Bwaise III

18

points that we have assigned equations to, such as the integration over time of some quantity,

be active. All other points must be unchecked; otherwise we are most likely to get an error

message about a singular matrix.

To change retention and permeability relationships (Van Genuchten, or user-defined

parameter values):

- Go to Multiphysics→Richard’s equation

- Go to Physics→Subdomains Settings

- Click in a domain to select it.

- In the drop down menu Constitutive relation, select Van Genuchten.

To add sorption type:

- Go to Multiphysics→Solute Transport.

- Physics→Subdomain settings.

- Choose the Solid tab and set Sorption Isotherms to Freundlich or Langmuir and specify

the Freundlich and Langmuir constants, respectively.

For integrals applying to subdomains (e.g. sorbed mass):

- Go to Options → Integration Coupling Variables → Subdomain Variables.

- Specify subdomain integration expressions, for both solute transport and flow according

to the Bwaise III Data sheet.

Note that any predefined quantity can be plotted with this option.

- Click OK. To plot the amount of adsorbed mass, solute and total mass in the subdomains:

- Go to Postprocessing → Domain Plot Parameters.

- Choose the General tab and select Line/Extrusion plot.

- Select all output times.

- Choose the Line/Extrusion tab and check Line plot.

- Specify y-axis data Expression to subdomain_sorbed.

- Specify x-axis data to t (time).

- Click on Line Settings to adjust line format.

- Click Title/Axis to specify axis and titel, then click OK.

- When the figure is generated, display settings can be adjusted by clicking on the Palette

- Repeat for subdomain_solute and subdomain_mass.

Modify Air entry value: The air entry value will increase width depth. We will now define a function that specifies the relation between depth and air entry value. Find the table for air entry in the Bwaise III Data sheet. A good interpolation method is cubic splines:

- Go to Options→Functions.

Page 19: COMSOL Tutorial Bwaise III

19

- Click on New.

- Specify Function name AirEntry.

- Choose Interpolation, choose Use data from Table in the drop down menu, and click

OK.

- Choose Interpolation method Cubic spline and Extrapolation method Constant.

- Set AirEntry value dependence on depth according to the Bwaise III Data sheet.

- Click OK

- Call this function by writing AirEntry(x).

Dispersivities

A task for one of the groups will be to check the sensitivity of the output results (for example

the spreading of the contamination plume) to the dispersivities.

The Boundary conditions can be modified according to the alternative settings in the Bwaise

III Data Sheet.

VIII. Group tasks

Suggested lab exercise tasks for the groups

Group 1 Investigate impact of the infiltration rate on the response time

for the water table to raise to the ground surface

Group 2 Investigate the impact of the lateral (base) flow rate on the

contamination transport

Group 3 Investigate the impact of the retention curves - A comparative

study of using the Brooks and Corey versus the Van Genuchten

analytic functions

Group 4 Investigate (general) impact of sorption on the movement on

the contamination plume

Group 5 Investigate the sensitivity to the dispersivity coefficients -

Diffusion?

Group 6 Investigate the impact of sorption - A comparative study of

Freundlich, Langmuir versus Linear Sorption

Group 7 Investigate the impact of having free drainage on the bottom

boundary - on the flow and on the contamination pattern

Put together a small report - 3-4 pages.

Page 20: COMSOL Tutorial Bwaise III

20

IX. Other resources

This file is based on the website (where more information can be found)

http://www.lwr.kth.se/Grundutbildning/1B1635/QH/CourseHome/index.htm

For COMSOL animations, see

http://www.comsol.se/showroom/animations/

For COMSOL tutorials, see

http://www.comsol.se/products/multiphysics/research/tutorials/