Changeset 27451


Ignore:
Timestamp:
12/03/22 20:02:23 (2 years ago)
Author:
jdquinn
Message:

CHG: Checkfield bug in Python API; cleanup

Location:
issm/trunk-jpl/src/m/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/stressbalance.m

    r27031 r27451  
    115115                                disp(sprintf('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n'));
    116116                        end
    117                         %CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
     117                        %CHECK THAT EACH LINE CONTAINS ONLY NAN VALUES OR NO NAN VALUES
    118118                        if any(sum(isnan(md.stressbalance.referential),2)~=0 & sum(isnan(md.stressbalance.referential),2)~=6),
    119119                                md = checkmessage(md,['Each line of stressbalance.referential should contain either only NaN values or no NaN values']);
  • issm/trunk-jpl/src/m/classes/stressbalance.py

    r27031 r27451  
    154154            md = checkfield(md, 'fieldname', 'stressbalance.vertex_pairing', '>', 0)
    155155        # Singular solution
    156         #        if ~any((~isnan(md.stressbalance.spcvx) + ~isnan(md.stressbalance.spcvy)) == 2),
    157156        if (not np.any(np.logical_or(np.logical_not(np.isnan(md.stressbalance.spcvx)), np.logical_not(np.isnan(md.stressbalance.spcvy))))) & (not np.any(md.mask.ocean_levelset>0)):
    158             print("\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n")
    159         # CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
    160         #        if any(sum(isnan(md.stressbalance.referential), 2)~=0 & sum(isnan(md.stressbalance.referential), 2)~=6),
     157            print('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n')
     158        # CHECK THAT EACH LINES CONTAIN ONLY NAN VALUES OR NO NAN VALUES
    161159        if np.any(np.logical_and(np.sum(np.isnan(md.stressbalance.referential), axis=1) != 0, np.sum(np.isnan(md.stressbalance.referential), axis=1) != 6)):
    162             md.checkmessage("Each line of stressbalance.referential should contain either only NaN values or no NaN values")
     160            md.checkmessage('Each line of stressbalance.referential should contain either only NaN values or no NaN values')
    163161        # CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
    164         #        if any(sum(isnan(md.stressbalance.referential), 2) == 0),
    165162        if np.any(np.sum(np.isnan(md.stressbalance.referential), axis=1) == 0):
    166163            pos = [i for i, item in enumerate(np.sum(np.isnan(md.stressbalance.referential), axis=1)) if item == 0]
    167         #            np.inner (and np.dot) calculate all the dot product permutations, resulting in a full matrix multiply
    168         #            if np.any(np.abs(np.inner(md.stressbalance.referential[pos, 0:2], md.stressbalance.referential[pos, 3:5]).diagonal()) > sys.float_info.epsilon):
    169         #                md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
    170164            for item in md.stressbalance.referential[pos, :]:
    171165                if np.abs(np.inner(item[0:2], item[3:5])) > sys.float_info.epsilon:
    172                     md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal")
     166                    md.checkmessage('Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal')
    173167        # CHECK THAT NO rotation specified for FS Grounded ice at base
    174168        if m.strcmp(md.mesh.domaintype(), '3D') and md.flowequation.isFS:
    175169            pos = np.nonzero(np.logical_and(md.mask.ocean_levelset, md.mesh.vertexonbase))
    176170            if np.any(np.logical_not(np.isnan(md.stressbalance.referential[pos, :]))):
    177                 md.checkmessage("no referential should be specified for basal vertices of grounded ice")
     171                md.checkmessage('no referential should be specified for basal vertices of grounded ice')
    178172        if md.flowequation.isMOLHO:
    179173            md = checkfield(md, 'fieldname', 'stressbalance.spcvx_base', 'Inf', 1, 'timeseries', 1)
Note: See TracChangeset for help on using the changeset viewer.