Use a pressure BC with parallel and get a extremely large pressure value.

Asked by liu chin chi

Hi

    I'am trying to feed west and east boundary with pressure source in a short channel
with two piers in the center. The flml mainly follows the manual "8.16 Configuring
ocean simulations",and turns on "/mesh_adaptivity/mesh_movement/free_surface/move_whole_mesh"
and "adaptive_timestep".

    It blowed up at 178 secs, and a very large pressure exists at the northwest boundary
corner near surface. The adaptive mesh is also sharp around there. But after changing
nproc from 2 to 1 and running again. It performs very well. In another case with parallel
doesn't get this problem.

  Does it mean running in parallel may take risk with some meshs?

BC:
West/East: Pressure Source (use dirichlet read from file)
South/North side: no normal flow
Bottom: no normal flow and drag
Top: free surface
Pier:no slip

terrain:
Thannel:length 55m, width 45m and depth 5m (2 sigma layer)
pier: radius 2.1m

The geo and flml contents are below.

#------------ pier_tsu.geo ------------

// center coordinate
xc=0; yc=0; // model center
xp1=xc-6.6; yp1=yc; // south pier center 6.6
xp2=xc+6.6; yp2=yc; // north pier center 6.6
rad = 2.1; // pier radius rad = 2.1
d1w=5; // resolution at boumdary 50
d1e=5;
d2=2.5; // 5
d3=1; // resolution at pier
// boundary
wlen=27.5; //27.5
elen=27.5; //27.5
wid=45;
// 2345
// 1876
Point(1) = {xc-1*wlen, yc-0.5*wid, 0, d1w}; //sw
Point(2) = {xc-1*wlen, yc+0.5*wid, 0, d1w}; //nw
Point(3) = {xc-0.8*wlen, yc+0.5*wid, 0, d2};//nnw
Point(4) = {xc+0.8*elen, yc+0.5*wid, 0, d2};//nne
Point(5) = {xc+1*elen, yc+0.5*wid, 0, d1e}; //ne
Point(6) = {xc+1*elen, yc-0.5*wid, 0, d1e}; //sw
Point(7) = {xc+0.8*elen, yc-0.5*wid, 0, d2};//ssw
Point(8) = {xc-0.8*wlen, yc-0.5*wid, 0, d2};//sse

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 1};

// WEST PIER
Point(9) = {xp1, yp1, 0, d3};
Point(10) = {xp1-rad, yp1, 0, d3};
Point(11) = {xp1+rad, yp1, 0, d3};
Circle(9) = {10, 9, 11};
Circle(10) = {11, 9, 10};

// EAST PIER
Point(12) = {xp2, yp2, 0, d3};
Point(13) = {xp2-rad, yp2, 0, d3};
Point(14) = {xp2+rad, yp2, 0, d3};
Circle(11) = {13, 12, 14};
Circle(12) = {14, 12, 13};

Line Loop(11) = {1,2,3,4,5,6,7,8}; //BOUNDARY
Line Loop(12) = {9,10}; // SOUTH PIER
Line Loop(13) = {11,12}; // NORTH PIER

Plane Surface(14) = {11,12,13};

Physical Line(1) = {1}; //E
Physical Line(2) = {2,3,4}; //N
Physical Line(3) = {5}; //W
Physical Line(4) = {6,7,8}; //S
Physical Line(5) = {9,10,11,12}; // WEST EAST PIERS
Physical Surface(6) = {14};

#--------- pier_tsu.flml ---------
<?xml version='1.0' encoding='utf-8'?>
<fluidity_options>
  <simulation_name>
    <string_value lines="1">pier_tsu</string_value>
  </simulation_name>
  <problem_type>
    <string_value lines="1">fluids</string_value>
  </problem_type>
  <geometry>
    <dimension>
      <integer_value rank="0">3</integer_value>
    </dimension>
    <mesh name="CoordinateMesh">
      <from_mesh>
        <mesh name="InputMesh"/>
        <extrude>
          <regions name="WholeMesh">
            <bottom_depth>
              <constant>
                <real_value rank="0">5</real_value>
              </constant>
            </bottom_depth>
            <sizing_function>
              <sigma_layers>
                <standard>
                  <integer_value rank="0">2</integer_value>
                </standard>
              </sigma_layers>
            </sizing_function>
            <top_surface_id>
              <integer_value rank="0">101</integer_value>
            </top_surface_id>
            <bottom_surface_id>
              <integer_value rank="0">102</integer_value>
            </bottom_surface_id>
          </regions>
        </extrude>
        <stat>
          <include_in_stat/>
        </stat>
      </from_mesh>
    </mesh>
    <mesh name="VelocityMesh">
      <from_mesh>
        <mesh name="CoordinateMesh"/>
        <mesh_shape>
          <polynomial_degree>
            <integer_value rank="0">1</integer_value>
          </polynomial_degree>
        </mesh_shape>
        <mesh_continuity>
          <string_value>discontinuous</string_value>
        </mesh_continuity>
        <stat>
          <exclude_from_stat/>
        </stat>
      </from_mesh>
    </mesh>
    <mesh name="PressureMesh">
      <from_mesh>
        <mesh name="CoordinateMesh"/>
        <mesh_shape>
          <polynomial_degree>
            <integer_value rank="0">2</integer_value>
          </polynomial_degree>
        </mesh_shape>
        <stat>
          <exclude_from_stat/>
        </stat>
      </from_mesh>
    </mesh>
    <mesh name="InputMesh">
      <from_file file_name="pier_tsu">
        <format name="triangle"/>
        <stat>
          <exclude_from_stat/>
        </stat>
      </from_file>
    </mesh>
    <quadrature>
      <degree>
        <integer_value rank="0">8</integer_value>
        <comment>8</comment>
      </degree>
      <surface_degree>
        <integer_value rank="0">8</integer_value>
        <comment>8</comment>
      </surface_degree>
    </quadrature>
    <ocean_boundaries>
      <top_surface_ids>
        <integer_value shape="1" rank="1">101</integer_value>
      </top_surface_ids>
      <bottom_surface_ids>
        <integer_value shape="1" rank="1">102</integer_value>
      </bottom_surface_ids>
      <scalar_field name="DistanceToTop" rank="0">
        <diagnostic>
          <algorithm name="Internal" material_phase_support="multiple"/>
          <mesh name="CoordinateMesh"/>
          <output/>
          <stat/>
          <convergence>
            <include_in_convergence/>
          </convergence>
          <detectors>
            <include_in_detectors/>
          </detectors>
          <steady_state>
            <include_in_steady_state/>
          </steady_state>
        </diagnostic>
      </scalar_field>
      <scalar_field name="DistanceToBottom" rank="0">
        <diagnostic>
          <algorithm name="Internal" material_phase_support="multiple"/>
          <mesh name="CoordinateMesh"/>
          <output>
            <exclude_from_vtu/>
          </output>
          <stat/>
          <convergence>
            <include_in_convergence/>
          </convergence>
          <detectors>
            <include_in_detectors/>
          </detectors>
          <steady_state>
            <include_in_steady_state/>
          </steady_state>
        </diagnostic>
      </scalar_field>
    </ocean_boundaries>
  </geometry>
  <io>
    <dump_format>
      <string_value>vtk</string_value>
    </dump_format>
    <dump_period>
      <constant>
        <real_value rank="0">5</real_value>
      </constant>
    </dump_period>
    <output_mesh name="VelocityMesh"/>
    <stat/>
  </io>
  <timestepping>
    <current_time>
      <real_value rank="0">0.0</real_value>
      <time_units date="seconds since 1987-01-05 00:00.0"/>
    </current_time>
    <timestep>
      <real_value rank="0">1.0</real_value>
    </timestep>
    <finish_time>
      <real_value rank="0">870.0</real_value>
    </finish_time>
    <nonlinear_iterations>
      <integer_value rank="0">3</integer_value>
      <nonlinear_iterations_at_adapt>
        <integer_value rank="0">3</integer_value>
      </nonlinear_iterations_at_adapt>
    </nonlinear_iterations>
    <adaptive_timestep>
      <requested_cfl>
        <real_value rank="0">2</real_value>
      </requested_cfl>
      <courant_number name="CFLNumber">
        <mesh name="VelocityMesh"/>
      </courant_number>
      <minimum_timestep>
        <terminate_if_reached/>
        <real_value rank="0">1e-6</real_value>
      </minimum_timestep>
      <maximum_timestep>
        <real_value rank="0">1.0</real_value>
      </maximum_timestep>
      <increase_tolerance>
        <real_value rank="0">1.1</real_value>
      </increase_tolerance>
      <at_first_timestep/>
    </adaptive_timestep>
  </timestepping>
  <physical_parameters>
    <gravity>
      <magnitude>
        <real_value rank="0">9.81</real_value>
      </magnitude>
      <vector_field name="GravityDirection" rank="1">
        <prescribed>
          <mesh name="CoordinateMesh"/>
          <value name="gravity">
            <constant>
              <real_value shape="3" dim1="dim" rank="1">0 0 -1</real_value>
            </constant>
          </value>
          <output>
            <exclude_from_vtu/>
          </output>
          <stat>
            <include_in_stat/>
          </stat>
          <detectors>
            <exclude_from_detectors/>
          </detectors>
        </prescribed>
      </vector_field>
    </gravity>
  </physical_parameters>
  <material_phase name="Fields">
    <equation_of_state>
      <fluids>
        <linear>
          <reference_density>
            <real_value rank="0">1.0</real_value>
          </reference_density>
          <subtract_out_hydrostatic_level/>
        </linear>
      </fluids>
    </equation_of_state>
    <scalar_field name="Pressure" rank="0">
      <prognostic>
        <mesh name="PressureMesh"/>
        <spatial_discretisation>
          <continuous_galerkin>
            <remove_stabilisation_term/>
            <integrate_continuity_by_parts/>
          </continuous_galerkin>
        </spatial_discretisation>
        <scheme>
          <poisson_pressure_solution>
            <string_value lines="1">only first timestep</string_value>
          </poisson_pressure_solution>
          <use_projection_method/>
          <update_discretised_equation/>
        </scheme>
        <solver>
          <iterative_method name="cg"/>
          <preconditioner name="mg">
            <vertical_lumping/>
          </preconditioner>
          <relative_error>
            <real_value rank="0">1.0e-7</real_value>
          </relative_error>
          <absolute_error>
            <real_value rank="0">0.0</real_value>
          </absolute_error>
          <max_iterations>
            <integer_value rank="0">6000</integer_value>
          </max_iterations>
          <never_ignore_solver_failures/>
          <diagnostics>
            <monitors/>
          </diagnostics>
        </solver>
        <boundary_conditions name="W_input_from_txt">
          <surface_ids>
            <integer_value shape="1" rank="1">1</integer_value>
          </surface_ids>
          <type name="dirichlet">
            <python>
              <string_value lines="20" type="code" language="python">def val(X,t):
  import inputwave_w
  g=9.81
  return inputwave_w.val(X, t)*g</string_value>
              <comment>def val(X,t):
 g=9.81
 return -0.135*g*min(1,t)</comment>
            </python>
          </type>
        </boundary_conditions>
        <boundary_conditions name="E_input_from_txt">
          <surface_ids>
            <integer_value shape="1" rank="1">3</integer_value>
          </surface_ids>
          <type name="dirichlet">
            <python>
              <string_value lines="20" type="code" language="python">def val(X,t):
  import inputwave_e
  g=9.81
  return inputwave_e.val(X, t)*g</string_value>
              <comment>def val(X,t):
 g=9.81
 return -0.135*g*min(1,t)</comment>
            </python>
          </type>
        </boundary_conditions>
        <output/>
        <stat/>
        <convergence>
          <include_in_convergence/>
        </convergence>
        <detectors>
          <exclude_from_detectors/>
        </detectors>
        <steady_state>
          <exclude_from_steady_state/>
        </steady_state>
        <consistent_interpolation/>
      </prognostic>
    </scalar_field>
    <scalar_field name="Density" rank="0">
      <diagnostic>
        <algorithm name="Internal" material_phase_support="multiple"/>
        <mesh name="VelocityMesh"/>
        <output/>
        <stat/>
        <convergence>
          <include_in_convergence/>
        </convergence>
        <detectors>
          <include_in_detectors/>
        </detectors>
        <steady_state>
          <include_in_steady_state/>
        </steady_state>
      </diagnostic>
    </scalar_field>
    <vector_field name="Velocity" rank="1">
      <prognostic>
        <mesh name="VelocityMesh"/>
        <equation name="Boussinesq"/>
        <spatial_discretisation>
          <discontinuous_galerkin>
            <viscosity_scheme>
              <compact_discontinuous_galerkin/>
              <tensor_form/>
            </viscosity_scheme>
            <advection_scheme>
              <upwind/>
              <project_velocity_to_continuous>
                <mesh name="CoordinateMesh"/>
              </project_velocity_to_continuous>
              <integrate_advection_by_parts>
                <twice/>
              </integrate_advection_by_parts>
            </advection_scheme>
          </discontinuous_galerkin>
          <conservative_advection>
            <real_value rank="0">0.0</real_value>
          </conservative_advection>
        </spatial_discretisation>
        <temporal_discretisation>
          <theta>
            <real_value rank="0">1</real_value>
          </theta>
          <relaxation>
            <real_value rank="0">1</real_value>
          </relaxation>
          <discontinuous_galerkin>
            <maximum_courant_number_per_subcycle>
              <real_value rank="0">0.1</real_value>
            </maximum_courant_number_per_subcycle>
          </discontinuous_galerkin>
        </temporal_discretisation>
        <solver>
          <iterative_method name="gmres">
            <restart>
              <integer_value rank="0">45</integer_value>
            </restart>
          </iterative_method>
          <preconditioner name="sor"/>
          <relative_error>
            <real_value rank="0">1.0e-7</real_value>
          </relative_error>
          <absolute_error>
            <real_value rank="0">0</real_value>
          </absolute_error>
          <max_iterations>
            <integer_value rank="0">10000</integer_value>
          </max_iterations>
          <never_ignore_solver_failures/>
          <diagnostics>
            <monitors/>
          </diagnostics>
        </solver>
        <initial_condition name="WholeMesh">
          <constant>
            <real_value shape="3" dim1="dim" rank="1">0.0 0.0 0.0</real_value>
          </constant>
        </initial_condition>
        <boundary_conditions name="T_FreeSurface">
          <surface_ids>
            <integer_value shape="1" rank="1">101</integer_value>
          </surface_ids>
          <type name="free_surface"/>
        </boundary_conditions>
        <boundary_conditions name="N_S_B_NoNormalFlow">
          <surface_ids>
            <integer_value shape="3" rank="1">2 4 102</integer_value>
          </surface_ids>
          <type name="no_normal_flow"/>
        </boundary_conditions>
        <boundary_conditions name="P_NoSlip">
          <surface_ids>
            <integer_value shape="1" rank="1">5</integer_value>
          </surface_ids>
          <type name="dirichlet">
            <align_bc_with_cartesian>
              <x_component>
                <constant>
                  <real_value rank="0">0</real_value>
                </constant>
              </x_component>
              <y_component>
                <constant>
                  <real_value rank="0">0</real_value>
                </constant>
              </y_component>
              <z_component>
                <constant>
                  <real_value rank="0">0</real_value>
                </constant>
              </z_component>
            </align_bc_with_cartesian>
          </type>
        </boundary_conditions>
        <boundary_conditions name="B_Drag">
          <surface_ids>
            <integer_value shape="1" rank="1">102</integer_value>
          </surface_ids>
          <type name="drag">
            <constant>
              <real_value rank="0">2.5e-3</real_value>
            </constant>
            <quadratic_drag/>
          </type>
        </boundary_conditions>
        <tensor_field name="Viscosity" rank="2">
          <prescribed>
            <value name="WholeMesh">
              <isotropic>
                <constant>
                  <real_value rank="0">1e-6</real_value>
                </constant>
              </isotropic>
            </value>
            <output/>
          </prescribed>
        </tensor_field>
        <vertical_stabilization>
          <implicit_buoyancy/>
        </vertical_stabilization>
        <output/>
        <stat>
          <include_in_stat/>
          <previous_time_step>
            <exclude_from_stat/>
          </previous_time_step>
          <nonlinear_field>
            <exclude_from_stat/>
          </nonlinear_field>
        </stat>
        <convergence>
          <include_in_convergence/>
        </convergence>
        <detectors>
          <include_in_detectors/>
        </detectors>
        <steady_state>
          <include_in_steady_state/>
        </steady_state>
        <consistent_interpolation/>
      </prognostic>
    </vector_field>
    <scalar_field name="FreeSurface" rank="0">
      <diagnostic>
        <algorithm name="Internal" material_phase_support="multiple"/>
        <mesh name="PressureMesh"/>
        <output/>
        <stat/>
        <convergence>
          <include_in_convergence/>
        </convergence>
        <detectors>
          <include_in_detectors/>
        </detectors>
        <steady_state>
          <exclude_from_steady_state/>
        </steady_state>
      </diagnostic>
    </scalar_field>
    <scalar_field name="DG_CourantNumber" rank="0">
      <diagnostic>
        <algorithm name="Internal" material_phase_support="multiple"/>
        <mesh name="VelocityMesh"/>
        <output/>
        <stat/>
        <convergence>
          <include_in_convergence/>
        </convergence>
        <detectors>
          <include_in_detectors/>
        </detectors>
        <steady_state>
          <include_in_steady_state/>
        </steady_state>
      </diagnostic>
    </scalar_field>
    <vector_field name="BedShearStress" rank="1">
      <diagnostic>
        <algorithm name="Internal" material_phase_support="multiple"/>
        <mesh name="VelocityMesh"/>
        <density>
          <real_value rank="0">1000</real_value>
        </density>
        <calculation_method>
          <drag_coefficient>
            <real_value rank="0">2.5e-3</real_value>
          </drag_coefficient>
        </calculation_method>
        <output/>
        <stat>
          <include_in_stat/>
        </stat>
        <detectors>
          <include_in_detectors/>
        </detectors>
      </diagnostic>
    </vector_field>
  </material_phase>
  <mesh_adaptivity>
    <mesh_movement>
      <free_surface>
        <move_whole_mesh/>
      </free_surface>
      <vector_field name="GridVelocity" rank="1">
        <diagnostic>
          <algorithm name="Internal" material_phase_support="multiple"/>
          <mesh name="CoordinateMesh"/>
          <output/>
          <stat>
            <include_in_stat/>
          </stat>
          <convergence>
            <include_in_convergence/>
          </convergence>
          <detectors>
            <include_in_detectors/>
          </detectors>
          <steady_state>
            <include_in_steady_state/>
          </steady_state>
        </diagnostic>
      </vector_field>
    </mesh_movement>
  </mesh_adaptivity>
</fluidity_options>

Question information

Language:
English Edit question
Status:
Solved
For:
Fluidity Edit question
Assignee:
No assignee Edit question
Solved by:
Matthew Piggott
Solved:
Last query:
Last reply:
Revision history for this message
liu chin chi (caite8001) said :
#1

    Should I add a Dirichlet BC (let v=0, w=0) to the velicity of the west side?

Revision history for this message
Best Matthew Piggott (m-d-piggott) said :
#2

I would suggest you simplify your problem as much as possible until you're
happy that it runs robustly, in serial and parallel, and then slowly add the
complexity back in piece by piece.
Best wishes
Matt

On 7 March 2014 09:56, liu chin chi <email address hidden>wrote:

> Question #244867 on Fluidity changed:
> https://answers.launchpad.net/fluidity/+question/244867
>
> liu chin chi gave more information on the question:
> Should I add a Dirichlet BC (let v=0, w=0) to the velicity of the
> west side?
>
> --
> You received this question notification because you are a member of
> Fluidity Core Team, which is an answer contact for Fluidity.
>

Revision history for this message
liu chin chi (caite8001) said :
#3

Hi Matthew,

Thanks your advices.

I modified geo file and tested 3 cases below in parallel.
A.remove the pier.
B.changing the length from 55m to 60m.
C.changing the length from 55m to 70m.

Case A failed due to "PETSc did not converge for matrix solve of: DeltaU".
Case B and C passed without any error message.

Does it mean the design of mesh should be careful?

Liu

Revision history for this message
liu chin chi (caite8001) said :
#4

    I'll do more tests about BC sources with difference mesh sets later.

    Thanks

    Liu

Revision history for this message
liu chin chi (caite8001) said :
#5

Thanks Matthew Piggott, that solved my question.

Revision history for this message
Matthew Piggott (m-d-piggott) said :
#6

Yes you always need to be careful about matching your mesh to the
dynamics you are trying to simulate.

Once you have something working only make incremental changes, and
ensure you get sensible behaviour with each change you make.

Best wishes
Matt

On 8 March 2014 10:56, liu chin chi <email address hidden>wrote:

> Question #244867 on Fluidity changed:
> https://answers.launchpad.net/fluidity/+question/244867
>
> Status: Answered => Open
>
> liu chin chi is still having a problem:
> Hi Matthew,
>
> Thanks your advices.
>
> I modified geo file and tested 3 cases below in parallel.
> A.remove the pier.
> B.changing the length from 55m to 60m.
> C.changing the length from 55m to 70m.
>
> Case A failed due to "PETSc did not converge for matrix solve of: DeltaU".
> Case B and C passed without any error message.
>
> Does it mean the design of mesh should be careful?
>
> Liu
>
> --
> You received this question notification because you are a member of
> Fluidity Core Team, which is an answer contact for Fluidity.
>

Revision history for this message
Fangxin Fang (f-fang) said :
#7

Let us focus on either Liverpool or Denmark cases during the meeting. Talk to you soon.

Best wishes

Fangxin

----- Reply message -----
From: "Matthew Piggott" <email address hidden>
To: "Fang, Fangxin" <email address hidden>
Subject: [Question #244867]: Use a pressure BC with parallel and get a extremely large pressure value.
Date: Sun, Mar 9, 2014 09:36

Question #244867 on Fluidity changed:
https://answers.launchpad.net/fluidity/+question/244867

Matthew Piggott posted a new comment:
Yes you always need to be careful about matching your mesh to the
dynamics you are trying to simulate.

Once you have something working only make incremental changes, and
ensure you get sensible behaviour with each change you make.

Best wishes
Matt

On 8 March 2014 10:56, liu chin chi <email address hidden>wrote:

> Question #244867 on Fluidity changed:
> https://answers.launchpad.net/fluidity/+question/244867
>
> Status: Answered => Open
>
> liu chin chi is still having a problem:
> Hi Matthew,
>
> Thanks your advices.
>
> I modified geo file and tested 3 cases below in parallel.
> A.remove the pier.
> B.changing the length from 55m to 60m.
> C.changing the length from 55m to 70m.
>
> Case A failed due to "PETSc did not converge for matrix solve of: DeltaU".
> Case B and C passed without any error message.
>
> Does it mean the design of mesh should be careful?
>
> Liu
>
> --
> You received this question notification because you are a member of
> Fluidity Core Team, which is an answer contact for Fluidity.
>

--
You received this question notification because you are a member of
Fluidity Core Team, which is an answer contact for Fluidity.